Please try the attached diff.
On 22 September 2017 at 20:45, Andrew Daugherity <
[email protected]> wrote:
>
> >Synopsis: panic on boot during probe of wdc0 at isa0
> >Category: kernel
> >Environment:
> System : OpenBSD 6.2
> Details : OpenBSD 6.2-beta (GENERIC) #132: Fri Sep 15 22:31:00
> MDT 2017
> [email protected]:/usr/src/sys/arch/i386/compile/GENERIC
>
> Architecture: OpenBSD.i386
> Machine : i386
> >Description:
> It seems that this commit broke wdc(4), or at least wdc0 at isa0:
> ========
> CVSROOT: /cvs
> Module name: src
> Changes by: [email protected] 2017/07/12 07:40:59
>
> Modified files:
> sys/dev/ic : wdc.c wdcvar.h
> sys/dev/pci : pciide.c
>
> Log message:
> Introduce two quirks to prevent attaching ATA and ATAPI devices
> [...]
> ========
>
>
> The kernel panics when trying to probe wdc:
>
> >> OpenBSD/i386 BOOT 3.31
> boot> hd0a:/bsd.62
> cannot open hd0a:/etc/random.seed: No such file or directory
> booting hd0a:/bsd.62: 8157496+2278404+161312+0+1093632
> [672972+82+489424+501185]=0xcbe478
> entry point at 0x2000d4
>
> [ using 1664120 bytes of bsd ELF symbol table ]
> Copyright (c) 1982, 1986, 1989, 1991, 1993
> The Regents of the University of California. All rights reserved.
> Copyright (c) 1995-2017 OpenBSD. All rights reserved.
> https://www.OpenBSD.org
>
> OpenBSD 6.2-beta (GENERIC) #132: Fri Sep 15 22:31:00 MDT 2017
> [email protected]:/usr/src/sys/arch/i386/compile/GENERIC
> cpu0: Intel 486DX (486-class)
> real mem = 16138240 (15MB)
> avail mem = 1863680 (1MB)
> warning: no entropy supplied by boot loader
> mpath0 at root
> scsibus0 at mpath0: 256 targets
> mainbus0 at root
> bios0 at mainbus0: date 03/31/93
> pcibios at bios0 function 0x1a not configured
> bios0: ROM list: 0xc8000/0x1000 0xc9000/0x1000 0xca000/0x2000
> cpu0 at mainbus0: (uniprocessor)
> isa0 at mainbus0
> isadma0 at isa0
> fdc0 at isa0 port 0x3f0/6 irq 6 drq 2
> com0 at isa0 port 0x3f8/8 irq 4: ns16450, no fifo
> com0: console
> pckbc0 at isa0 port 0x60/5 irq 1 irq 12
> pckbd0 at pckbc0 (kbd slot)
> wskbd0 at pckbd0: console keyboard
> pms0 at pckbc0 (aux slot)
> wsmouse0 at pms0 mux 0
> vga0 at isa0 port 0x3b0/48 iomem 0xa0000/131072
> wsdisplay0 at vga0 mux 1: console (80x25, vt100 emulation), using wskbd0
> wsdisplay0: screen 1-5 added (80x25, vt100 emulation)
> uvm_fault(0xd0d06da4, 0x0, 0, 1) -> e
> kernel: page fault trap, code=0
> Stopped at wdcprobe+0x110: movzwl 0x40(%eax),%eax
> ddb> trace
> wdcprobe(d0ec1348) at wdcprobe+0x110
> wdc_isa_probe(d0fd2000,d0fd3800,d0ec1b18) at wdc_isa_probe+0x95
> isascan(d0fd2000,d0fd3800) at isascan+0x266
> config_scan(d0855a10,d0fd2000) at config_scan+0x86
> isaattach(d0fd10c0,d0fd2000,d0ec1eb8) at isaattach+0xcc
> config_attach(d0fd10c0,d0c11554,d0ec1eb8,d034af50) at config_attach+0x184
> config_found_sm(d0fd10c0,d0ec1eb8,d034af50,0) at config_found_sm+0x29
> mainbus_attach(0,d0fd10c0,0) at mainbus_attach+0x339
> config_attach(0,d0c0faf4,0,0) at config_attach+0x184
> config_rootfound(d0a13a74,0) at config_rootfound+0xc0
> cpu_configure(0,ebf000,ece000,0,d02004ce) at cpu_configure+0x29
> main(0,0,0,0,0) at main+0x478
> ddb> ps
> PID TID PPID UID S FLAGS WAIT COMMAND
> * 0 0 -1 0 7 0x10200 swapper
> ddb>
> ========
>
>
> >How-To-Repeat:
> Boot latest snapshot on hardware with an ISA-bus IDE controller,
or
> with pciide disabled in UKC
> >Fix:
> Workaround: reverting sys/dev/ic/wdc.c to r1.131 restores
operation:
>
> boot> hd0a:/bsd62.rd.test
> cannot open hd0a:/etc/random.seed: No such file or directory
> booting hd0a:/bsd62.rd.test: 3271740+1344512+3346032+0+454656
> [370634+82+283040+276713]=0x8eb470
> entry point at 0x2000d4
>
> Copyright (c) 1982, 1986, 1989, 1991, 1993
> The Regents of the University of California. All rights reserved.
> Copyright (c) 1995-2017 OpenBSD. All rights reserved.
> https://www.OpenBSD.org
>
> OpenBSD 6.2-beta (RAMDISK_CD) #2: Tue Sep 19 17:14:33 CDT 2017
> [email protected]:/usr/src/sys/arch/i386/compile/RAMDISK_CD
> cpu0: Intel 486DX (486-class)
> real mem = 16183296 (15MB)
> avail mem = 6762496 (6MB)
> mainbus0 at root
> bios0 at mainbus0: date 03/31/93
> pcibios at bios0 function 0x1a not configured
> bios0: ROM list: 0xc8000/0x1000 0xc9000/0x1000 0xca000/0x2000
> cpu0 at mainbus0: (uniprocessor)
> isa0 at mainbus0
> isadma0 at isa0
> fdc0 at isa0 port 0x3f0/6 irq 6 drq 2
> com0 at isa0 port 0x3f8/8 irq 4: ns16450, no fifo
> com0: console
> pckbc0 at isa0 port 0x60/5 irq 1 irq 12
> pckbd0 at pckbc0 (kbd slot)
> wskbd0 at pckbd0: console keyboard
> vga0 at isa0 port 0x3b0/48 iomem 0xa0000/131072
> wsdisplay0 at vga0 mux 1: console (80x25, vt100 emulation), using wskbd0
> wdc0 at isa0 port 0x1f0/8 irq 14
> wd0 at wdc0 channel 0 drive 0: <IBM-DARA-206000>
> wd0: 16-sector PIO, LBA, 5729MB, 11733120 sectors
> wd0(wdc0:0:0): using BIOS timings
> npx0 at isa0 port 0xf0/16 irq 13
> pcic0 at isa0 port 0x3e0/2 iomem 0xd0000/16384
> pcic0 controller 0: <Intel 82365SL rev 1> has sockets A and B
> pcic0 controller 1: <Intel 82365SL rev 1> has sockets A and B
> pcmcia0 at pcic0 controller 0 socket 0
> pcmcia1 at pcic0 controller 0 socket 1
> pcmcia2 at pcic0 controller 1 socket 0
> ep1 at pcmcia2 function 0 "3Com, 3C574-TX Fast EtherLink PC Card, A" port
> 0x340/32, irq 3: address 00:10:4b:5f:20:c0
> tqphy0 at ep1 phy 0: 78Q2120 10/100 PHY, rev. 3
> pcmcia3 at pcic0 controller 1 socket 1
> ep2 at pcmcia3 function 0 "3Com, 3C574-TX Fast EtherLink PC Card, A" port
> 0x300/32, irq 9: address 00:60:08:93:80:48
> tqphy1 at ep2 phy 0: 78Q2120 10/100 PHY, rev. 3
> pcic0: irq 5, polling enabled
> softraid0 at root
> scsibus0 at softraid0: 256 targets
> root on rd0a swap on rd0b dump on rd0b
> fd0 at fdc0 drive 0: 1.44MB 80 cyl, 2 head, 18 sec
> erase ^?, werase ^W, kill ^U, intr ^C, status ^T
>
> Welcome to the OpenBSD/i386 6.2 installation program.
> (I)nstall, (U)pgrade, (A)utoinstall or (S)hell?
> ========
>
>
>
> You don't need ISA hardware to reproduce this -- if you have onboard
> pciide(4), disabling it with UKC will let wdc(4) take over:
>
> >> OpenBSD/i386 CDBOOT 3.28
> boot> boot /6.2/i386/bsd -c
> cannot open cd0a:/etc/random.seed: No such file or directory
> booting cd0a:/6.2/i386/bsd: 8228740+2282500+164096+0+1093632
> [675840+82+491200+502901]=0xcd2d50
> entry point at 0x2000d4
>
> [ using 1670480 bytes of bsd ELF symbol table ]
> Copyright (c) 1982, 1986, 1989, 1991, 1993
> The Regents of the University of California. All rights reserved.
> Copyright (c) 1995-2017 OpenBSD. All rights reserved.
> https://www.OpenBSD.org
>
> OpenBSD 6.2-beta (GENERIC.MP) #138: Sat Sep 16 23:41:33 MDT 2017
> [email protected]:/usr/src/sys/arch/i386/compile/GENERIC.MP
> cpu0: VIA C3 Ezra ("CentaurHauls" 686-class) 1 GHz
> cpu0: FPU,DE,TSC,MSR,MTRR,PGE,MMX,3DNOW
> real mem = 502747136 (479MB)
> avail mem = 479006720 (456MB)
> User Kernel Config
> UKC> disable pciide
> 110 pciide* disabled
> 111 pciide* disabled
> UKC> quit
> Continuing...
> mpath0 at root
> scsibus0 at mpath0: 256 targets
> mainbus0 at root
> bios0 at mainbus0: date 05/19/04, BIOS32 rev. 0 @ 0xfb210, SMBIOS rev. 2.2
> @ 0xf0800 (26 entries)
> bios0: vendor Award Software International, Inc. version "6.00 PG" date
> 05/19/2004
> bios0: VIA Technologies, Inc. VT8623-8235
> acpi0 at bios0: rev 0
> acpi0: sleep states S0 S1 S3 S4 S5
> acpi0: tables DSDT FACP
> acpi0: wakeup devices PCI0(S5) USB0(S5) USB1(S5) USB2(S5) USB3(S3)
USB4(S3)
> USB5(S3) USB6(S3) LAN0(S5) AC97(S5) MC97(S5) UAR1(S5)
> acpitimer0 at acpi0: 3579545 Hz, 24 bits
> acpiprt0 at acpi0: bus 0 (PCI0)
> acpicpu0 at acpi0: !C3(@900 io@0x415), !C2(@90 io@0x414), C1(@1 halt!)
> acpibtn0 at acpi0: PWRB
> "PNP0700" at acpi0 not configured
> "PNP0400" at acpi0 not configured
> bios0: ROM list: 0xc0000/0xec00 0xd0000/0x8000!
> cpu0 at mainbus0: (uniprocessor)
> mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges
> pci0 at mainbus0 bus 0: configuration mode 1 (bios)
> pchb0 at pci0 dev 0 function 0 "VIA VT8623 PCI" rev 0x00
> viaagp0 at pchb0: v2
> agp0 at viaagp0: aperture at 0xd0000000, size 0x10000000
> ppb0 at pci0 dev 1 function 0 "VIA VT8633 AGP" rev 0x00
> pci1 at ppb0 bus 1
> vga1 at pci1 dev 0 function 0 "VIA CLE266" rev 0x03
> wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation)
> wsdisplay0: screen 1-5 added (80x25, vt100 emulation)
> "VIA VT6306 FireWire" rev 0x80 at pci0 dev 13 function 0 not configured
> uhci0 at pci0 dev 16 function 0 "VIA VT83C572 USB" rev 0x80: irq 11
> uhci1 at pci0 dev 16 function 1 "VIA VT83C572 USB" rev 0x80: irq 12
> uhci2 at pci0 dev 16 function 2 "VIA VT83C572 USB" rev 0x80: irq 10
> ehci0 at pci0 dev 16 function 3 "VIA VT6202 USB" rev 0x82: irq 5
> usb0 at ehci0: USB revision 2.0
> uhub0 at usb0 configuration 1 interface 0 "VIA EHCI root hub" rev
2.00/1.00
> addr 1
> viapm0 at pci0 dev 17 function 0 "VIA VT8235 ISA" rev 0x00: SMI
> iic0 at viapm0
> spdmem0 at iic0 addr 0x50: 512MB DDR SDRAM non-parity PC2100CL2.5
> "VIA VT82C571 IDE" rev 0x06 at pci0 dev 17 function 1 not configured
> auvia0 at pci0 dev 17 function 5 "VIA VT8233 AC97" rev 0x50: irq 10
> ac97: codec id 0x49434552 (ICEnsemble VIA VT1616i)
> ac97: codec features headphone, 18 bit DAC, 18 bit ADC, KS Waves 3D
> audio0 at auvia0
> vr0 at pci0 dev 18 function 0 "VIA RhineII-2" rev 0x74: irq 11, address
> 00:40:63:c5:ee:69
> ukphy0 at vr0 phy 1: Generic IEEE 802.3u media interface, rev. 5: OUI
> 0x004063, model 0x0032
> usb1 at uhci0: USB revision 1.0
> uhub1 at usb1 configuration 1 interface 0 "VIA UHCI root hub" rev
1.00/1.00
> addr 1
> usb2 at uhci1: USB revision 1.0
> uhub2 at usb2 configuration 1 interface 0 "VIA UHCI root hub" rev
1.00/1.00
> addr 1
> usb3 at uhci2: USB revision 1.0
> uhub3 at usb3 configuration 1 interface 0 "VIA UHCI root hub" rev
1.00/1.00
> addr 1
> isa0 at mainbus0
> isadma0 at isa0
> fdc0 at isa0 port 0x3f0/6 irq 6 drq 2
> com0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo
> com0: console
> com1 at isa0 port 0x2f8/8 irq 3: ns16550a, 16 byte fifo
> pckbc0 at isa0 port 0x60/5 irq 1 irq 12
> pckbc0: unable to establish interrupt for irq 12
> pckbd0 at pckbc0 (kbd slot)
> wskbd0 at pckbd0: console keyboard, using wsdisplay0
> uvm_fault(0xd0c7e2a4, 0x0, 0, 1) -> e
> kernel: page fault trap, code=0
> Stopped at wdcprobe+0x110: movzwl 0x40(%eax),%eax
> ddb{0}> trace
> wdcprobe(d0ed5348) at wdcprobe+0x110
> wdc_isa_probe(d220e100,d2222000,d0ed5b18) at wdc_isa_probe+0x95
> isascan(d220e100,d2222000) at isascan+0x266
> config_scan(d05a64c0,d220e100) at config_scan+0x86
> isaattach(d21c0100,d220e100,d0ed5eb8) at isaattach+0xcc
> config_attach(d21c0100,d0c0ef1c,d0ed5eb8,d09af960) at config_attach+0x194
> config_found_sm(d21c0100,d0ed5eb8,d09af960,0) at config_found_sm+0x29
> mainbus_attach(0,d21c0100,0) at mainbus_attach+0x33e
> config_attach(0,d0c0d4bc,0,0) at config_attach+0x194
> config_rootfound(d0b39437,0) at config_rootfound+0xc0
> cpu_configure(aa8aabc4,ed3000,ee2000,0,d02004ce) at cpu_configure+0x51
> main(0,0,0,0,0) at main+0x4a7
> ddb{0}>
> ========
>
>
> Also reproducible on amd64, if you both enable wdc and disable pciide:
> ========
> boot> hd0a:/bsd.62.amd64 -c
> booting hd0a:/bsd.62.amd64: 8450428+2544648+243008+0+671744
> [658996+82+699360+482912]=0xd1fb90
> entry point at 0x1000158
> [ using 1842064 bytes of bsd ELF symbol table ]
> Copyright (c) 1982, 1986, 1989, 1991, 1993
> The Regents of the University of California. All rights reserved.
> Copyright (c) 1995-2017 OpenBSD. All rights reserved.
> https://www.OpenBSD.org
>
> OpenBSD 6.2-beta (GENERIC) #103: Mon Sep 18 23:27:20 MDT 2017
> [email protected]:/usr/src/sys/arch/amd64/compile/GENERIC
> real mem = 1056899072 (1007MB)
> avail mem = 1017982976 (970MB)
> User Kernel Config
> UKC> enable wdc
> 234 wdc* already enabled
> 252 wdc0 enabled
> 253 wdc1 enabled
> UKC> disable pciide
> 109 pciide* disabled
> 110 pciide* disabled
> UKC> quit
> Continuing...
> mpath0 at root
> scsibus0 at mpath0: 256 targets
> mainbus0 at root
> bios0 at mainbus0: SMBIOS rev. 2.5 @ 0xe1000 (10 entries)
> bios0: vendor innotek GmbH version "VirtualBox" date 12/01/2006
> bios0: innotek GmbH VirtualBox
> acpi0 at bios0: rev 2
> acpi0: sleep states S0 S5
> acpi0: tables DSDT FACP APIC HPET MCFG SSDT
> acpi0: wakeup devices
> acpitimer0 at acpi0: 3579545 Hz, 32 bits
> acpimadt0 at acpi0 addr 0xfee00000: PC-AT compat
> cpu0 at mainbus0: apid 0 (boot processor)
> cpu0: Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz, 4008.52 MHz
> cpu0:
>
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,HTT,SSE3,PCLMUL,SSSE3,CX16,SSE4.1,SSE4.2,MOVBE,POPCNT,AES,XSAVE,AVX,RDRAND,NXE,RDTSCP,LONG,LAHF,ABM,3DNOWP,ITSC,RDSEED,CLFLUSHOPT
> cpu0: 256KB 64b/line 8-way L2 cache
> cpu0: TSC frequency 4008518750 Hz
> cpu0: smt 0, core 0, package 0
> mtrr: CPU supports MTRRs but not enabled by BIOS
> cpu0: apic clock running at 999MHz
> cpu at mainbus0: not configured
> ioapic0 at mainbus0: apid 2 pa 0xfec00000, version 20, 24 pins
> , remapped to apid 2
> acpihpet0 at acpi0: 14318179 Hz
> acpimcfg0 at acpi0 addr 0xdc000000, bus 0-63
> acpiprt0 at acpi0: bus 0 (PCI0)
> acpicpu0 at acpi0: C1(@1 halt!)
> "PNP0F03" at acpi0 not configured
> acpiac0 at acpi0: AC unit online
> acpivideo0 at acpi0: GFX0
> pci0 at mainbus0 bus 0
> vga1 at pci0 dev 2 function 0 "InnoTek VirtualBox Graphics Adapter" rev
0x00
> wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation)
> wsdisplay0: screen 1-5 added (80x25, vt100 emulation)
> virtio0 at pci0 dev 3 function 0 "Qumranet Virtio Network" rev 0x00
> vio0 at virtio0: address 08:00:27:ba:11:77
> virtio0: apic 2 int 19
> "InnoTek VirtualBox Guest Service" rev 0x00 at pci0 dev 4 function 0 not
> configured
> auich0 at pci0 dev 5 function 0 "Intel 82801AA AC97" rev 0x01: apic 2 int
> 21, ICH
> ac97: codec id 0x83847600 (SigmaTel STAC9700)
> audio0 at auich0
> piixpm0 at pci0 dev 7 function 0 "Intel 82371AB Power" rev 0x08: apic 2
int
> 23
> iic0 at piixpm0
> ppb0 at pci0 dev 24 function 0 "Intel 82801BAM Hub-to-PCI" rev 0xf2
> pci1 at ppb0 bus 1
> ppb1 at pci0 dev 25 function 0 "Intel 82801BAM Hub-to-PCI" rev 0xf2
> pci2 at ppb1 bus 2
> pcib0 at pci0 dev 31 function 0 "Intel 82801GBM LPC" rev 0x02
> "Intel 82371AB IDE" rev 0x01 at pci0 dev 31 function 1 not configured
> ohci0 at pci0 dev 31 function 4 "Apple Intrepid USB" rev 0x00: apic 2 int
> 23, version 1.0
> ehci0 at pci0 dev 31 function 5 "Intel 82801FB USB" rev 0x00: apic 2 int
23
> usb0 at ehci0: USB revision 2.0
> uhub0 at usb0 configuration 1 interface 0 "Intel EHCI root hub" rev
> 2.00/1.00 addr 1
> isa0 at pcib0
> isadma0 at isa0
> com0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo
> com0: console
> pckbc0 at isa0 port 0x60/5 irq 1 irq 12
> pckbd0 at pckbc0 (kbd slot)
> wskbd0 at pckbd0: console keyboard, using wsdisplay0
> pms0 at pckbc0 (aux slot)
> wsmouse0 at pms0 mux 0
> uvm_fault(0xffffffff81b16038, 0x60, 0, 1) -> e
> kernel: page fault trap, code=0
> Stopped at wdcprobe+0x13e: movzwl 0x60(%rax),%eax
> ddb> trace
> wdcprobe(ffffffff81a85530,0,ffffffff81d268a0,0,10,ffffffff81d25fe0) at
> wdcprobe+0x13e
>
wdc_isa_probe(ffffffff81a85530,ffff8000000fe800,ffff8000000fb400,ee487fc7fc5a75c,0,0)
> at wdc_isa_probe+0xb0
>
isascan(ffff8000000fb400,ffffffff813a6400,ffffffff81a81960,ffffffff81aa2201,ffffffff81a85530,ee487fc7fc5a75c)
> at isascan+0x288
>
config_scan(ffff800000080b80,ffffffff81d26ca0,ffff8000000fb424,ffffffff81aa22a8,ffff8000000fb400,ffff8000000fb448)
> at config_scan+0xb1
>
config_attach(ffff80000001a3e0,ffff800000014e00,ffff800000014e24,ffffffff81b36da0,ffff80000001a3a0,ffffffff811edea0)
> at config_attach+0x1d8
>
pcib_callback(ee487fc7fc5a75c,0,ffffffff81ab7420,ffffffff81957678,ffffffff81957548,ffffffff8191db81)
> at pcib_callback+0x4e
>
config_process_deferred_children(ffff80000001b100,ffffffff81d26d88,ffffffff81a914c0,ffff800000014e00,ffffffff81535122,ffffffff81d26d00)
> at config_process_deferred_children+0x72
>
config_attach(0,ffff80000001b100,ffff80000001b124,ffffffff81a8eca8,ffffffff81d26d88,ffffffff810c7da0)
> at config_attach+0x1e0
> mainbus_attach(0,ffff80000001b100,ee487fc7fc5a75c,0,0,0) at
> mainbus_attach+0x247
> config_attach(ffffffff81d26e78,0,b28,ffffffff818338a0,ffffffff81a87c9a,0)
> at config_attach+0x1d8
> config_rootfound(0,0,0,0,ffffffff81d20008,ee487fc7fc5a75c) at
> config_rootfound+0xe1
> cpu_configure(0,ffffffff81d20008,ffffffff814c575a,ffffffff81d26ef0,0,0) at
> cpu_configure+0x1a
> main(0,ffffffff81d20008,0,0,ffffffff810c4e72,ffffffff81d26f20) at
main+0x472
> end trace frame: 0x0, count: -13
> ddb>
> ========
>
> Reverting wdc.c makes wdc0 at isa0 function properly in these "disable
> pciide" test cases as well.
diff --git sys/dev/ic/wdc.c sys/dev/ic/wdc.c
index 55871544eba..e5598ed224f 100644
--- sys/dev/ic/wdc.c
+++ sys/dev/ic/wdc.c
@@ -644,11 +644,11 @@ wdcprobe(struct channel_softc *chp)
ret_value), DEBUG_PROBE);
if (ret_value == 0)
return 0;
- if (chp->wdc->quirks & WDC_QUIRK_NOATAPI)
+ if (chp->wdc && (chp->wdc->quirks & WDC_QUIRK_NOATAPI))
goto noatapi;
/*
* Use signatures to find potential ATAPI drives
*/
@@ -678,11 +678,11 @@ wdcprobe(struct channel_softc *chp)
if (cl == 0x14 && ch == 0xeb)
chp->ch_drive[drive].drive_flags |= DRIVE_ATAPI;
}
noatapi:
- if (chp->wdc->quirks & WDC_QUIRK_NOATA)
+ if (chp->wdc && (chp->wdc->quirks & WDC_QUIRK_NOATA))
goto noata;
/*
* Detect ATA drives by poking around the registers
*/