>Number:         6531
>Category:       kernel
>Synopsis:       wd(4) LBA48 hard disk problem and fix on Apple Macintosh 
>MacBook Pro
>Confidential:   yes
>Severity:       serious
>Priority:       medium
>Responsible:    bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   unknown
>Arrival-Date:   Tue Dec 28 14:30:02 GMT 2010
>Closed-Date:
>Last-Modified:
>Originator:     
>Release:        
>Organization:
>Environment:
        System      : OpenBSD 4.8
        Details     : OpenBSD 4.8 (GENERIC.MP) #359: Mon Aug 16 09:16:26 MDT 
2010
                         
[email protected]:/usr/src/sys/arch/i386/compile/GENERIC.MP

        Architecture: OpenBSD.i386
        Machine     : i386
>Description:
        Raw copying disk blocks with /bin/dd of an original Macintosh 500GB HD
        on a MacBook Pro 13" laptop gives an input/output error at the
        LBA48_THRESHOLD (0xfffffff or 128GB).

        This is not related to a hard disk failure, but (suspected) to the
        way Macintosh EFI Bios and Apple HDD Firmware interacts with the wd(4)
        hard disk driver.

        This problem shows up only with the Hitachi HTS54505050B9SA02
        hard disk furnished by Apple, and OpenBSD installed from scratch, or
        with the 4.8 OpenBSD i386 install CD starting up single user at the
        shell.
        This Hitachi hard disk label reads: Apple HDD Firmware 2009 500GB
        2.5inch AT 9.5mm P/N:0A78255 MLC:DA3350
        This Hitachi hard disk was not wiped or zeroed before installing
        OpenBSD.

        When using a 1TB Western Digital Scorpio Blue WD10TPVT SATA disk
        in place, the problem could not be reproduced on the MacBook Pro.

        On a "normal" PC (ASUS Motherboard, no EFI or Apple firmware) and
        a LBA48 wd(4) SATA disk, the problem could not be reproduced.
        The fix below is also used on this "normal" productive server, without
        regression.

>How-To-Repeat:
        dd if=/dev/rwd0c of=/dev/null bs=8192
        dd: /dev/rwd0c: Input/output error
        1677215+0 record in
        1677215+0 record out
        137438945280 bytes transferred in 16371.361 secs (8395083 bytes/sec)

        Here the related kernel messages:       
Dec 21 01:20:22 foo /bsd: wd0c: id not found reading fsbn 268435440 of 
268435440-268435455 (wd0 bn 268435440; cn 16709 tn 85 sn 0), retrying
Dec 21 01:20:26 foo /bsd: wd0c: id not found reading fsbn 268435440 of 
268435440-268435455 (wd0 bn 268435440; cn 16709 tn 85 sn 0), retrying
Dec 21 01:20:26 foo /bsd: wd0c: id not found reading fsbn 268435440 of 
268435440-268435455 (wd0 bn 268435440; cn 16709 tn 85 sn 0), retrying
Dec 21 01:20:26 foo /bsd: wd0c: id not found reading fsbn 268435440 of 
268435440-268435455 (wd0 bn 268435440; cn 16709 tn 85 sn 0), retrying
Dec 21 01:20:26 foo /bsd: wd0c: id not found reading fsbn 268435455 of 
268435440-268435455 (wd0 bn 268435455; cn 16709 tn 85 sn 15), retrying
Dec 21 01:20:26 foo /bsd: wd0c: id not found reading fsbn 268435455 of 
268435440-268435455 (wd0 bn 268435455; cn 16709 tn 85 sn 15)

>Fix:
        Removing the optimizations of the wd.c code wich where inserted between
        revisions 1.23 and 1.24,
        revisions 1.31 and 1.32,
        revisions 1.40 and 1.41
        fixes the problem

Index: wd.c
===================================================================
RCS file: /home/cvs/src/sys/dev/ata/wd.c,v
retrieving revision 1.88
diff -u -r1.88 wd.c
--- wd.c        23 Jul 2010 07:47:13 -0000      1.88
+++ wd.c        7 Oct 2010 13:25:35 -0000
@@ -91,8 +91,6 @@
 #include "locators.h"
 #endif
 
-#define        LBA48_THRESHOLD         (0xfffffff)     /* 128GB / DEV_BSIZE */
-
 #define        WDIORETRIES_SINGLE 4    /* number of retries before 
single-sector */
 #define        WDIORETRIES     5       /* number of retries before giving up */
 #define        RECOVERYTIME hz/2       /* time to wait before retrying a cmd */
@@ -540,8 +538,6 @@
 void
 __wdstart(struct wd_softc *wd, struct buf *bp)
 {
-       daddr64_t nblks;
-
        wd->sc_wdc_bio.blkno = bp->b_blkno +
            
DL_GETPOFFSET(&wd->sc_dk.dk_label->d_partitions[DISKPART(bp->b_dev)]);
        wd->sc_wdc_bio.blkno /= (wd->sc_dk.dk_label->d_secsize / DEV_BSIZE);
@@ -556,11 +552,7 @@
                wd->sc_wdc_bio.flags = ATA_SINGLE;
        else
                wd->sc_wdc_bio.flags = 0;
-       nblks = bp->b_bcount / wd->sc_dk.dk_label->d_secsize;
-       if ((wd->sc_flags & WDF_LBA48) &&
-           /* use LBA48 only if really need */
-           ((wd->sc_wdc_bio.blkno + nblks - 1 > LBA48_THRESHOLD) ||
-            (nblks > 0xff)))
+       if (wd->sc_flags & WDF_LBA48)
                wd->sc_wdc_bio.flags |= ATA_LBA48;
        if (wd->sc_flags & WDF_LBA)
                wd->sc_wdc_bio.flags |= ATA_LBA;

dmesg:
OpenBSD 4.8 (GENERIC.MP) #359: Mon Aug 16 09:16:26 MDT 2010
    [email protected]:/usr/src/sys/arch/i386/compile/GENERIC.MP
RTC BIOS diagnostic error 
f7<clock_battery,ROM_cksum,config_unit,memory_size,invalid_time>
cpu0: Intel(R) Core(TM)2 Duo CPU P8600 @ 2.40GHz ("GenuineIntel" 686-class) 
2.39 GHz
cpu0: 
FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,SBF,SSE3,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,SSE4.1,XSAVE
real mem  = 2942984192 (2806MB)
avail mem = 2884861952 (2751MB)
mainbus0 at root
bios0 at mainbus0: AT/286+ BIOS, date 07/29/05, SMBIOS rev. 2.4 @ 0xe0000 (44 
entries)
bios0: vendor Apple Inc. version "MBP71.88Z.####.###.##########" date 03/25/10
bios0: Apple Inc. MacBookPro7,1
acpi0 at bios0: rev 2
acpi0: sleep states S0 S3 S4 S5
acpi0: tables DSDT FACP HPET APIC APIC ASF! SBST ECDT SSDT SSDT MCFG SSDT SSDT
acpi0: wakeup devices ADP1(S3) LID0(S3) EC__(S3) OHC1(S3) EHC1(S3) OHC2(S3) 
EHC2(S3) ARPT(S5) GIGE(S5)
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpihpet0 at acpi0: 25000000 Hz
acpimadt0 at acpi0 addr 0xfee00000: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: apic clock running at 265MHz
cpu1 at mainbus0: apid 1 (application processor)
cpu1: Intel(R) Core(TM)2 Duo CPU P8600 @ 2.40GHz ("GenuineIntel" 686-class) 
2.39 GHz
cpu1: 
FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,SBF,SSE3,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,SSE4.1,XSAVE
ioapic0 at mainbus0: apid 1 pa 0xfec00000, version 11, 24 pins
ioapic0: misconfigured as apic 0, remapped to apid 1
acpiec0 at acpi0
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus 4 (IXVE)
acpicpu0 at acpi0: C3, C2, C1, PSS
acpicpu1 at acpi0: C3, C2, C1, PSS
acpiac0 at acpi0: AC unit online
acpibtn0 at acpi0: LID0
acpibtn1 at acpi0: PWRB
acpibtn2 at acpi0: SLPB
acpibat0 at acpi0: BAT0 model "###################" type ################### 
oem "###################"
bios0: ROM list: 0xc0000/0xe400!
cpu0: Enhanced SpeedStep 2390 MHz: speeds: 2394, 2128, 1862, 1596, 798 MHz
memory map conflict 0xffc00000/0x400000
pci0 at mainbus0 bus 0: configuration mode 1 (bios)
mem address conflict 0xd3400000/0x80000
pchb0 at pci0 dev 0 function 0 vendor "NVIDIA", unknown product 0x0d60 rev 0xa1
vendor "NVIDIA", unknown product 0x0d68 (class memory subclass RAM, rev 0xa1) 
at pci0 dev 0 function 1 not configured
vendor "NVIDIA", unknown product 0x0d6d (class memory subclass RAM, rev 0xa1) 
at pci0 dev 1 function 0 not configured
vendor "NVIDIA", unknown product 0x0d6e (class memory subclass RAM, rev 0xa1) 
at pci0 dev 1 function 1 not configured
vendor "NVIDIA", unknown product 0x0d6f (class memory subclass RAM, rev 0xa1) 
at pci0 dev 1 function 2 not configured
vendor "NVIDIA", unknown product 0x0d70 (class memory subclass RAM, rev 0xa1) 
at pci0 dev 1 function 3 not configured
vendor "NVIDIA", unknown product 0x0d71 (class memory subclass RAM, rev 0xa1) 
at pci0 dev 2 function 0 not configured
vendor "NVIDIA", unknown product 0x0d72 (class memory subclass RAM, rev 0xa1) 
at pci0 dev 2 function 1 not configured
pcib0 at pci0 dev 3 function 0 vendor "NVIDIA", unknown product 0x0d80 rev 0xa2
vendor "NVIDIA", unknown product 0x0d7b (class memory subclass RAM, rev 0xa1) 
at pci0 dev 3 function 1 not configured
vendor "NVIDIA", unknown product 0x0d79 (class serial bus subclass SMBus, rev 
0xa1) at pci0 dev 3 function 2 not configured
vendor "NVIDIA", unknown product 0x0d69 (class memory subclass RAM, rev 0xa1) 
at pci0 dev 3 function 3 not configured
vendor "NVIDIA", unknown product 0x0d7a (class processor subclass Co-processor, 
rev 0xa1) at pci0 dev 3 function 4 not configured
ohci0 at pci0 dev 4 function 0 vendor "NVIDIA", unknown product 0x0d9c rev 
0xa1: apic 1 int 11 (irq 11), version 1.0, legacy support
ehci0 at pci0 dev 4 function 1 vendor "NVIDIA", unknown product 0x0d9d rev 
0xa2: apic 1 int 10 (irq 10)
usb0 at ehci0: USB revision 2.0
uhub0 at usb0 "NVIDIA EHCI root hub" rev 2.00/1.00 addr 1
ohci1 at pci0 dev 6 function 0 vendor "NVIDIA", unknown product 0x0d9c rev 
0xa1: apic 1 int 7 (irq 7), version 1.0, legacy support
ehci1 at pci0 dev 6 function 1 vendor "NVIDIA", unknown product 0x0d9d rev 
0xa2: apic 1 int 5 (irq 5)
usb1 at ehci1: USB revision 2.0
uhub1 at usb1 "NVIDIA EHCI root hub" rev 2.00/1.00 addr 1
azalia0 at pci0 dev 8 function 0 "NVIDIA MCP89 HD Audio" rev 0xa2: apic 1 int 
15 (irq 15)
azalia0: codecs: Cirrus Logic/0x4206, NVIDIA/0x000c, NVIDIA/0x000c, 
NVIDIA/0x000c, using Cirrus Logic/0x4206
audio0 at azalia0
pciide0 at pci0 dev 10 function 0 "NVIDIA MCP89 AHCI" rev 0xa2: DMA 
(unsupported), channel 0 wired to native-PCI, channel 1 wired to native-PCI
pciide0: using apic 1 int 11 (irq 11) for native-PCI interrupt
wd0 at pciide0 channel 0 drive 0: <Hitachi HTS545050B9SA02>
wd0: 16-sector PIO, LBA48, 476940MB, 976773168 sectors
atapiscsi0 at pciide0 channel 1 drive 0
scsibus0 at atapiscsi0: 2 targets
cd0 at scsibus0 targ 0 lun 0: <MATSHITA, DVD-R UJ-898, HC10> ATAPI 5/cdrom 
removable
vendor "NVIDIA", unknown product 0x0d75 (class memory subclass RAM, rev 0xa1) 
at pci0 dev 11 function 0 not configured
ppb0 at pci0 dev 14 function 0 vendor "NVIDIA", unknown product 0x0d9a rev 
0xa1: apic 1 int 16 (irq 255)
pci1 at ppb0 bus 1
"AT&T/Lucent FW643 1394" rev 0x08 at pci1 dev 0 function 0 not configured
ppb1 at pci0 dev 21 function 0 vendor "NVIDIA", unknown product 0x0d9b rev 
0xa1: apic 1 int 16 (irq 255)
pci2 at ppb1 bus 2
"Broadcom BCM4322" rev 0x01 at pci2 dev 0 function 0 not configured
ppb2 at pci0 dev 22 function 0 vendor "NVIDIA", unknown product 0x0d9b rev 
0xa1: apic 1 int 11 (irq 255)
pci3 at ppb2 bus 3
bge0 at pci3 dev 0 function 0 "Broadcom BCM5764" rev 0x10, BCM5784 A1 
(0x5784100): apic 1 int 11 (irq 10), address ##:##:##:##:##:##
brgphy0 at bge0 phy 1: BCM5784 10/100/1000baseT PHY, rev. 4
ppb3 at pci0 dev 23 function 0 vendor "NVIDIA", unknown product 0x0d76 rev 0xa1
pci4 at ppb3 bus 4
vga1 at pci4 dev 0 function 0 vendor "NVIDIA", unknown product 0x08a0 rev 0xa2
wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation)
wsdisplay0: screen 1-5 added (80x25, vt100 emulation)
isa0 at pcib0
isadma0 at isa0
pcppi0 at isa0 port 0x61
spkr0 at pcppi0
npx0 at isa0 port 0xf0/16: reported by CPUID; using exception 16
usb2 at ohci0: USB revision 1.0
uhub2 at usb2 "NVIDIA OHCI root hub" rev 1.00/1.00 addr 1
usb3 at ohci1: USB revision 1.0
uhub3 at usb3 "NVIDIA OHCI root hub" rev 1.00/1.00 addr 1
mtrr: Pentium Pro MTRR support
umass0 at uhub1 port 1 configuration 1 interface 0 "Apple Card Reader" rev 
2.00/98.33 addr 2
umass0: using SCSI over Bulk-Only
scsibus1 at umass0: 2 targets, initiator 0
sd0 at scsibus1 targ 1 lun 0: <APPLE, SD Card Reader, 1.00> SCSI0 0/direct 
removable
sd0: drive offline
uvideo0 at uhub0 port 6 configuration 1 interface 0 "Apple Inc. Built-in 
iSight" rev 2.00/4.35 addr 2
video0 at uvideo0
uhidev0 at uhub3 port 3 configuration 1 interface 0 "Apple Inc. Apple Internal 
Keyboard / Trackpad" rev 2.00/0.90 addr 2
uhidev0: iclass 3/1, 9 report ids
ukbd0 at uhidev0 reportid 1: 8 modifier keys, 6 key codes, country code 13
wskbd0 at ukbd0: console keyboard, using wsdisplay0
uhid0 at uhidev0 reportid 9: input=0, output=0, feature=3
uhidev1 at uhub3 port 3 configuration 1 interface 1 "Apple Inc. Apple Internal 
Keyboard / Trackpad" rev 2.00/0.90 addr 2
uhidev1: iclass 3/0, 68 report ids
uhid1 at uhidev1 reportid 68: input=511, output=0, feature=0
uhidev2 at uhub3 port 3 configuration 1 interface 2 "Apple Inc. Apple Internal 
Keyboard / Trackpad" rev 2.00/0.90 addr 2
uhidev2: iclass 3/1, 2 report ids
ums0 at uhidev2 reportid 2: 3 buttons
wsmouse0 at ums0 mux 0
uhidev3 at uhub3 port 5 configuration 1 interface 0 "Apple Computer, Inc. IR 
Receiver" rev 2.00/0.16 addr 3
uhidev3: iclass 3/0, 38 report ids
uhid2 at uhidev3 reportid 36: input=4, output=0, feature=0
uhid3 at uhidev3 reportid 37: input=4, output=0, feature=0
uhid4 at uhidev3 reportid 38: input=4, output=0, feature=0
uhub4 at uhub3 port 6 "Apple Inc. BRCM2046 Hub" rev 2.00/1.00 addr 4
ugen0 at uhub4 port 1 "Apple Inc. Bluetooth USB Host Controller" rev 2.00/1.86 
addr 5
uhidev4 at uhub4 port 2 configuration 1 interface 0 "Apple Computer product 
0x820a" rev 2.00/1.00 addr 6
uhidev4: iclass 3/1, 1 report id
ukbd1 at uhidev4 reportid 1: 8 modifier keys, 6 key codes
wskbd1 at ukbd1 mux 1
wskbd1: connecting to wsdisplay0
uhidev5 at uhub4 port 3 configuration 1 interface 0 "Apple Computer product 
0x820b" rev 2.00/1.00 addr 7
uhidev5: iclass 3/1, 2 report ids
ums1 at uhidev5 reportid 2: 3 buttons
wsmouse1 at ums1 mux 0
softraid0 at root
root on wd0a swap on wd0b dump on wd0b


>Release-Note:
>Audit-Trail:
>Unformatted:

Reply via email to