# FreeBSD 8 ahci(4) with amd740, SB700: timeouts when detecting devices at boot



## p5ycho (Dec 28, 2009)

Hi guys,

I'm running a NAS, FreeBSD 8-RELEASE with ZFSonRoot.
Trying ahci(4) didn't work out well. I receive timeouts when detecting the 2 SATA3G devices.


```
[B]Specs:[/B]
AMD 5050e CPU
Biostar a740G M2+ (SB700 southbridge, 1x ATA133 6x SATA3G)
4GB DDR2
2x 1TB WD Green HDD's

[B]Relevant BIOS settings:[/B]
OnChip SATA Channel: Enabled 
Options: Enabled (Default) / Disabled
OnChip SATA Type: AHCI
Options: Native IDE (Default) / RAID / AHCI / Legacy IDE / IDE->AHCI
SATA IDE Combined Mode: Enabled
Options: Enabled (Default) / Disabled 
SATA power management: Disabled
Options: Enabled / Disabled 

[B]pciconf -lv[/B]
atapci1@pci0:0:20:1:    class=0x01018a card=0x37001565 chip=0x439c1002 rev=0x00 hdr=0x00
    vendor     = 'ATI Technologies Inc. / Advanced Micro Devices, Inc.'
    device     = 'PATA 133 Controller (SB7xx)'
    class      = mass storage
    subclass   = ATA
atapci0@pci0:0:17:0:    class=0x010601 card=0x55021565 chip=0x43911002 rev=0x00 hdr=0x00
    vendor     = 'ATI Technologies Inc. / Advanced Micro Devices, Inc.'
    device     = 'SB700 SATA Controller [AHCI mode]'
    class      = mass storage
    subclass   = SATA
```

So, i figured i'd give the new ahci(4) driver a try. 
I rebooted, entered boot menu, pressed 6, 'load ahci', 'boot'.
The result is a timeout message on the ports the HDD's are connected to: 

```
ahcich0: Poll timeout on slot 0
(aprobe0:ahcich0:0:0:0): SIGNATURE: 0000
```
No HDD's are found at all because of this.
Only similar incident i found is here: 
http://www.mail-archive.com/freebsd-questions@freebsd.org/msg225581.html
The drives have worked fine for more than a year in AHCI mode with the ata(4) driver.
I messed around with the BIOS settings a bit, but no luck there. Current settings (above) should work though.

Is this a case of a unsupported controller, or is something else wrong here?
I am willing to do some testing and debugging to fix this, since the performance benefits of AHCI with NCQ are quite substantial.

Another small problem i ran into: how does one unload a single module on boot? Is this at all possible?
I ran into problems when i had ahci.ko loaded by /boot/loader.conf, and couldn't disable it at boot. The only way was unloading all, and adding things again except ahci.ko. Normally this works out fine, but i was not able to add the data in /boot/zfs/zpool.cache again. Quite the chicken and egg story .


----------



## mav@ (Dec 29, 2009)

ATI chips have some problems around device detection. Can you try to update to 8-STABLE? ahci(4) driver and CAM infrastructure were improved a lot since 8.0-RELEASE.


----------



## p5ycho (Dec 29, 2009)

updated to 8-STABLE today, unfortunately the result is thesame.
Error has changed to:

```
ahcich1: Timeout on slot 0
ahcich1: is 00000002 cs 00000000 ss 00000000 rs 00000001 tfd 50 serr 00000000
```
repeated for the 2nd disk.

any thoughts?


----------



## Tango48 (Jan 9, 2010)

I finally got a chance to have a closer look at the problem I was having, which was quoted by the original poster.

I tried 9.0 from a snapshot and it still has the same problem as 8.0-Release has, as a last resort I did a bios update on the motherboard and that solved the problem. The AHCI bios revision was 00070 initially after updating the system bios ACHI bios revision changed to 00078.

So you might want to take a look and see if you can get a bios update.

Regards


----------



## p5ycho (Jan 11, 2010)

Tango48, what motherboard did you use? Need to know so i can copy the latest revision option ROM from that bios.
I have AHCI option ROM version 74 in latest bios.

edit: i ripped a version 78 ahci bios from a gigabyte motherboard bios. Unfortunately the option ROM has a different size than version 74. This makes fixing the bios myself a bit too troublesome. Time to stop playing i guess.


----------



## Tango48 (Jan 13, 2010)

The board I am using is a gigabyte ga-m74-s2 IIRC. There was not a specific update for the AHCI bios, just an update for the BIOS on the board, in fact the read me just said it was an update for some newer cpu ID`s, there was no mention of other fixes or updates.

I would compare your current bios revision to what Biostar are currently offering.


----------



## p5ycho (Jan 13, 2010)

I did, latest bios is from november 2008.
Normally it's not that hard to replace the AHCI Option ROM (which is a part of the complete bios file) if you have the correct tools. Unfortunately the newer AHCI bios is of a different size, this screws up the internal linking in the bios file.

I think the ahci(4) driver should still be modified to fix this problem, there are plenty boards out there with this chipset/bios revision.


----------



## p5ycho (Aug 29, 2011)

For anyone who runs into this problem: the "hint.ahci.0.msi=0" loader tunable fixes things for me.


----------



## Beeblebrox (Nov 2, 2011)

Description of slightly similar problem: http://forums.freebsd.org/showthread.php?p=152920#post152920


----------

