Subject: kern/36899: First disk is always misrecognized on PC3000 controller
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <kab00m@labma.ru>
List: netbsd-bugs
Date: 09/04/2007 16:50:01
>Number:         36899
>Category:       kern
>Synopsis:       First disk is always misrecognized on PC3000 controller
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Sep 04 16:50:00 +0000 2007
>Originator:     Dima Veselov
>Release:        NetBSD 4.99.30
>Organization:
	Module Automation Lab
>Environment:
System: NetBSD avangard.labma.ru 4.99.30 NetBSD 4.99.30 (Adju) #2: Tue Sep 4 18:26:37 MSD 2007 kab00m@avangard.labma.ru:/usr/src/sys/arch/i386/compile/Adju i386
Architecture: i386
Machine: i386
>Description:

 First drive are always shown as ST506 with chs addressing, second is shown all-right. This is the most problem. I have checked BIOS parameters - they are fine and identical for both, RAID BIOS is never shown up since RAID mode is off. I swapped them - result is the same, I zeroed first sectors of the disk - same. Disk on atabus2 is always ST506 with strange geometry. Also, BIOS geometry, reported by fdisk is always correct. Besides, `atactl wd0 (wd1) identify` gives absolutely identical output. 

One more thing I've noticed. When box is booting up, after founding first port of ahcisata0 console is stalling for a little. After this pause it give two console outputs together making a little mess. Dmesg and fdisk output follows. Question I have - is this a bug and have this problem a possible workaround? 

Kernelized RAIDframe activated 
atapibus0 at atabus0: 2 targets 
cd0 at atapibus0 drive 1: <ASUS    DVD-E616A2, , 1.02> cdrom removable 
cd0: 32-bit data port 
cd0: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 5 (Ultra/100) 
cd0(piixide0:0:1): using PIO mode 4, Ultra-DMA mode 5 (Ultra/100) (using DMA) 
ahcisata0 port 0: device present, speed: 3.0Gb/s 

#### Here is a pause for 3-4 seconds.

wd0 at atabus2 drive 0ahcisata0 port 2: device present, speed: 3.0Gb/s 
: <ST506> 

#### ^^^^ This string got a mess of two. 

wd0: drive supports 1-sector PIO transfers, chs addressing 
wd0: 69632 KB, 1024 cyl, 8 head, 17 sec, 512 bytes/sect x 139264 sectors 
wd0: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 6 (Ultra/133) 
wd0(ahcisata0:0:0): using PIO mode 4, DMA mode 2, Ultra-DMA mode 6 (Ultra/133) (using DMA) 
wd1 at atabus4 drive 0: <WDC WD800JD-75MSA3> 
wd1: drive supports 16-sector PIO transfers, LBA48 addressing 
wd1: 76293 MB, 155009 cyl, 16 head, 63 sec, 512 bytes/sect x 156250000 sectors 
wd1: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 6 (Ultra/133) 
wd1(ahcisata0:2:0): using PIO mode 4, DMA mode 2, Ultra-DMA mode 6 (Ultra/133) (using DMA) 
boot device: bge1 

[root@free ~]$ fdisk wd0 
Disk: /dev/rwd0d 
NetBSD disklabel disk geometry: 
cylinders: 16383, heads: 16, sectors/track: 63 (1008 sectors/cylinder) 
total sectors: 139264 

BIOS disk geometry: 
cylinders: 1023, heads: 255, sectors/track: 63 (16065 sectors/cylinder) 
total sectors: 156250000 

[root@free ~]$ fdisk wd1 
fdisk: primary partition table invalid, no magic in sector 0 
Disk: /dev/rwd1d 
NetBSD disklabel disk geometry: 
cylinders: 155009, heads: 16, sectors/track: 63 (1008 sectors/cylinder) 
total sectors: 156250000 

BIOS disk geometry: 
cylinders: 1023, heads: 255, sectors/track: 63 (16065 sectors/cylinder) 
total sectors: 156250000

Dmesg is follow:

ahcisata0 at pci0 dev 31 function 2: Intel 82801GB/GR AHCI SATA Controller
ahcisata0: interrupting at ioapic0 pin 19 (irq 5)
ahcisata0: AHCI revision 1.1, 4 ports, 32 command slots, features 0xc720e000
atabus2 at ahcisata0 channel 0
atabus3 at ahcisata0 channel 1
atabus4 at ahcisata0 channel 2
atabus5 at ahcisata0 channel 3

>How-To-Repeat:
	Insert first disk in HS bay and look :)
>Fix:
	Don't know :(