As detailed in the following link I have to disable pciide and set my
BIOS to use SATA drives in 'compatible' mode in order to use my HP2133
netbook with the cheap 4GB SSD it came with:

http://www.nabble.com/Re%3A-Interrupt-problems-with-recent-snapshot-p20160942.html

I looked into the problem and discovered that my drive only supports
Ultra-DMA mode 4.  The pciide/wdc code forces various PIO/DMA settings
(including UDMA5) when it detects a SATA drive in 'native' mode and
dispenses with any autodetection.  The following patch just removes
the forced settings and lets the autodetection run.  My drive is
detected properly with my BIOS set to use native SATA and runs at a
more acceptable speed.  Presumably someone added that code because
some drives don't work with autodetection so I doubt this patch can be
applied to 4.6-beta without more widespread testing.

Daniel


Index: wdc.c
===================================================================
RCS file: /cvs/src/sys/dev/ic/wdc.c,v
retrieving revision 1.102
diff -u wdc.c
--- wdc.c       7 Feb 2009 08:07:28 -0000       1.102
+++ wdc.c       4 Jul 2009 00:41:43 -0000
@@ -1245,21 +1245,6 @@
       int i, valid_mode_found;
       int cf_flags = drvp->cf_flags;

-       if ((wdc->cap & WDC_CAPABILITY_SATA) != 0 &&
-           (params->atap_sata_caps != 0x0000 &&
-           params->atap_sata_caps != 0xffff)) {
-               WDCDEBUG_PRINT(("%s: atap_sata_caps=0x%x\n", __func__,
-                   params->atap_sata_caps), DEBUG_PROBE);
-
-               /* Skip ATA modes detection for native SATA drives */
-               drvp->PIO_mode = drvp->PIO_cap = 4;
-               drvp->DMA_mode = drvp->DMA_cap = 2;
-               drvp->UDMA_mode = drvp->UDMA_cap = 5;
-               drvp->drive_flags |= DRIVE_SATA | DRIVE_MODE | DRIVE_UDMA;
-               drvp->ata_vers = 4;
-               return;
-       }
-
       if ((wdc->cap & (WDC_CAPABILITY_DATA16 | WDC_CAPABILITY_DATA32)) ==
           (WDC_CAPABILITY_DATA16 | WDC_CAPABILITY_DATA32)) {
               struct ataparams params2;


diff of dmesg before patch (with SATA in compatible mode) and after
(with SATA in native mode):

--- dmesg.before        Fri Jul  3 17:16:14 2009
+++ dmesg.after Fri Jul  3 17:19:11 2009
@@ -1,112 +1,106 @@
-OpenBSD 4.6-beta (GENERIC) #37: Tue Jun 30 11:13:06 MDT 2009
-    dera...@i386.openbsd.org:/usr/src/sys/arch/i386/compile/GENERIC
+OpenBSD 4.6 (build) #1: Fri Jul  3 17:05:05 PDT 2009
+    u...@host.example.com:/home/user/work/wdc/build
 cpu0: VIA C7-M Processor 1000MHz ("CentaurHauls" 686-class) 1 GHz
 cpu0: 
FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,CMOV,PAT,CFLUSH,ACPI,MMX,FXSR,SSE,SSE2,TM,SBF,SSE3,EST,TM2,xTPR
 real mem  = 1877241856 (1790MB)
 avail mem = 1805881344 (1722MB)
-User Kernel Config
-UKC> disable pciide
-105 pciide* disabled
-106 pciide* disabled
-UKC> quit
-Continuing...
 mainbus0 at root
 bios0 at mainbus0: AT/286+ BIOS, date 11/11/08, BIOS32 rev. 0 @
0xf0010, SMBIOS rev. 2.5 @ 0xfc590 (19 entries)
 bios0: vendor Hewlett-Packard version "68VGU Ver. F.06" date 11/11/2008
 bios0: Hewlett-Packard HP 2133
 acpi0 at bios0: rev 2
 acpi0: tables DSDT FACP APIC MCFG SLIC WDRT OEMB HPET SSDT
 acpi0: wakeup devices BLAN(S0) SLPB(S4)
 acpitimer0 at acpi0: 3579545 Hz, 24 bits
 acpimadt0 at acpi0 addr 0xfee00000: PC-AT compat
 cpu0 at mainbus0: apid 0 (boot processor)
 cpu0: RNG AES AES-CTR SHA1 SHA256 RSA
 cpu0: apic clock running at 99MHz
 ioapic0 at mainbus0: apid 1 pa 0xfec00000, version 3, 24 pins
 ioapic1 at mainbus0: apid 2 pa 0xfecc0000, version 3, 24 pins
 acpihpet0 at acpi0: 14318179 Hz
 acpiprt0 at acpi0: bus 0 (PCI0)
 acpiprt1 at acpi0: bus 1 (P0P1)
 acpiprt2 at acpi0: bus 2 (NBPG)
 acpiprt3 at acpi0: bus 0 (P0P9)
 acpiprt4 at acpi0: bus 7 (P0PA)
 acpiprt5 at acpi0: bus 5 (NBP0)
 acpiprt6 at acpi0: bus 128 (PCI1)
 acpiec0 at acpi0
 acpicpu0 at acpi0: C3, C2, PSS
 acpipwrres0 at acpi0: APMF
 acpitz0 at acpi0: critical temperature 105 degC
 acpiac0 at acpi0: AC unit online
 acpibat0 at acpi0: BAT1 model "Primary" serial 100000 type LiOn oem
"Hewlett-Packard"
 acpibtn0 at acpi0: LID_
 acpibtn1 at acpi0: SLPB
 acpibtn2 at acpi0: PWRB
 acpivideo0 at acpi0: VGA_
 acpivout0 at acpivideo0: LCD_
 acpivout1 at acpivideo0: CRT_
 bios0: ROM list: 0xc0000/0xcc00
 cpu0: Enhanced SpeedStep 998 MHz: speeds: 1000, 800, 600, 400 MHz
 pci0 at mainbus0 bus 0: configuration mode 1 (bios)
 pchb0 at pci0 dev 0 function 0 "VIA P4M900 Host" rev 0x00
 viaagp0 at pchb0: v3
 agp0 at viaagp0: aperture at 0xf0000000, size 0x10000000
 pchb1 at pci0 dev 0 function 1 "VIA P4M900 Host" rev 0x00
 pchb2 at pci0 dev 0 function 2 "VIA P4M900 Host" rev 0x00
 pchb3 at pci0 dev 0 function 3 "VIA P4M900 Host" rev 0x00
 pchb4 at pci0 dev 0 function 4 "VIA P4M900 Host" rev 0x00
 "VIA P4M900 IOAPIC" rev 0x00 at pci0 dev 0 function 5 not configured
 pchb5 at pci0 dev 0 function 6 "VIA P4M900 Security" rev 0x00
 pchb6 at pci0 dev 0 function 7 "VIA P4M900 Host" rev 0x00
 ppb0 at pci0 dev 1 function 0 "VIA VT8377 AGP" rev 0x00
 pci1 at ppb0 bus 1
 vga1 at pci1 dev 0 function 0 "VIA Chrome9 HC IGP" rev 0x01
 wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation)
 wsdisplay0: screen 1-5 added (80x25, vt100 emulation)
 ppb1 at pci0 dev 2 function 0 "VIA P4M900 PCI-PCI" rev 0x80: apic 2
int 3 (irq 10)
 pci2 at ppb1 bus 2
 "Broadcom BCM4315" rev 0x01 at pci2 dev 0 function 0 not configured
 ppb2 at pci0 dev 3 function 0 "VIA P4M900 PCI-PCI" rev 0x80: apic 2
int 7 (irq 10)
 pci3 at ppb2 bus 5
-"VIA VT8237S SATA" rev 0x00 at pci0 dev 15 function 0 not configured
+pciide0 at pci0 dev 15 function 0 "VIA VT8237S SATA" rev 0x00: DMA
+pciide0: using apic 1 int 21 (irq 5) for native-PCI interrupt
+wd0 at pciide0 channel 0 drive 0: <SMI MODEL>
+wd0: 1-sector PIO, LBA, 3823MB, 7831152 sectors
+wd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 4
 uhci0 at pci0 dev 16 function 0 "VIA VT83C572 USB" rev 0xb0: apic 1
int 20 (irq 11)
-uhci1 at pci0 dev 16 function 2 "VIA VT83C572 USB" rev 0xb0: apic 1
int 21 (irq 5)
-uhci2 at pci0 dev 16 function 3 "VIA VT83C572 USB" rev 0xb0: apic 1
int 23 (irq 3)
-ehci0 at pci0 dev 16 function 4 "VIA VT6202 USB" rev 0x90: apic 1 int
21 (irq 5)
+uhci1 at pci0 dev 16 function 2 "VIA VT83C572 USB" rev 0xb0: apic 1
int 21 (irq 3)
+uhci2 at pci0 dev 16 function 3 "VIA VT83C572 USB" rev 0xb0: apic 1
int 23 (irq 7)
+ehci0 at pci0 dev 16 function 4 "VIA VT6202 USB" rev 0x90: apic 1 int
21 (irq 3)
 usb0 at ehci0: USB revision 2.0
 uhub0 at usb0 "VIA EHCI root hub" rev 2.00/1.00 addr 1
 viapm0 at pci0 dev 17 function 0 "VIA VT8237S ISA" rev 0x00
 iic0 at viapm0
-iic0: addr 0x1d 0f=3b 10=97 11=9f 12=8b 13=11 14=13 15=05 16=11 17=82
18=1b 19=d1 1a=0e 1b=51 20=47 21=0a 22=01 27=ff 29=fe 2b=fe 2d=3c
30=95 31=25 32=14 33=02 34=2a 35=15 36=12 37=02 8f=3b 90=97 91=9f
92=8b 93=11 94=13 95=05 96=11 97=82 98=1b 99=d1 9a=0e 9b=51 a0=47
a1=0a a2=01 a7=ff a9=fd ab=03 ad=3a b0=95 b1=25 b2=14 b3=02 b4=2a
b5=15 b6=12 b7=02 words 00=0000 01=0000 02=0000 03=0000 04=0000
05=0000 06=0000 07=0000
+iic0: addr 0x1d 0f=3b 10=97 11=9f 12=8b 13=11 14=13 15=05 16=11 17=82
18=1b 19=d1 1a=0e 1b=51 20=47 21=0a 22=01 27=ff 29=fc 2d=40 30=95
31=25 32=14 33=02 34=2a 35=15 36=12 37=02 8f=3b 90=97 91=9f 92=8b
93=11 94=13 95=05 96=11 97=82 98=1b 99=d1 9a=0e 9b=51 a0=47 a1=0a
a2=01 a7=ff a9=fd ab=fe ad=39 b0=95 b1=25 b2=14 b3=02 b4=2a b5=15
b6=12 b7=02 words 00=0000 01=0000 02=0000 03=0000 04=0000 05=0000
06=0000 07=0000
 spdmem0 at iic0 addr 0x50: 2GB DDR2 SDRAM non-parity PC2-5300CL5 SO-DIMM
 pchb7 at pci0 dev 17 function 7 "VIA VT8251 VLINK" rev 0x00
 pchb8 at pci0 dev 19 function 0 "VIA VT8237A PCI-PCI" rev 0x00
 ppb3 at pci0 dev 19 function 1 "VIA VT8237A PCI-PCI" rev 0x00
 pci4 at ppb3 bus 7
 bge0 at pci4 dev 3 function 0 "Broadcom BCM5788" rev 0x03, BCM5705 A3
(0x3003): apic 1 int 16 (irq 11), address 00:1f:29:7f:44:7f
 brgphy0 at bge0 phy 1: BCM5705 10/100/1000baseT PHY, rev. 2
 usb1 at uhci0: USB revision 1.0
 uhub1 at usb1 "VIA UHCI root hub" rev 1.00/1.00 addr 1
 usb2 at uhci1: USB revision 1.0
 uhub2 at usb2 "VIA UHCI root hub" rev 1.00/1.00 addr 1
 usb3 at uhci2: USB revision 1.0
 uhub3 at usb3 "VIA UHCI root hub" rev 1.00/1.00 addr 1
 isa0 at mainbus0
 isadma0 at isa0
 pckbc0 at isa0 port 0x60/5
 pckbd0 at pckbc0 (kbd slot)
 pckbc0: using irq 1 for kbd slot
 wskbd0 at pckbd0: console keyboard, using wsdisplay0
 pms0 at pckbc0 (aux slot)
 pckbc0: using irq 12 for aux slot
 wsmouse0 at pms0 mux 0
-wdc0 at isa0 port 0x1f0/8 irq 14
-wd0 at wdc0 channel 0 drive 0: <SMI MODEL>
-wd0: 1-sector PIO, LBA, 3823MB, 7831152 sectors
-wd0(wdc0:0:0): using BIOS timings
 pcppi0 at isa0 port 0x61
 midi0 at pcppi0: <PC speaker>
 spkr0 at pcppi0
 npx0 at isa0 port 0xf0/16: reported by CPUID; using exception 16
 mtrr: Pentium Pro MTRR support
 softraid0 at root
 root on wd0a swap on wd0b dump on wd0b

Reply via email to