Some answer to finding SATA ports
Posted: Sat Jun 26, 2010 9:01 am
In previous posts I attempted to find out how to determine the 9 standard ATA ports in I/O space for an AHCI-compliant SATA controller with included I/O ports, specifically the 9th one.
It's a very important thing because, among other things, it allows to wake up the devices from a SLEEP command since the Device Control register contains the SRST bit, etc. Without it there is no way of doing such things.
I found the answer, but I suspect that every SATA AHCI controller will put these things differently. The biggest problem is finding the Alternate Status/Device Control register. The first 8 are easy to find, at least in this case, because they are contiguous.
But the Device Control register in this case is in the middle of a 4-port I/O range (0 to 3) in register #2. This could make necessary to build some command tests to set the Status registers' values and compare them in such a way that makes certain to us that a port is the Alternate Status, as a "desperate" option to find this port in an "unknown" and "standard" SATA controller.
I have an ASRock N73V-S motherboard. It has an integrated SATA II AHCI with Vendor ID==10DEh (NVidia Corp.) and Device ID==07F0h.
The structure of the I/O registers in this controller is as follows (I hope every AHCI controller has this I/O structure but I don't know; otherwise at least we'll be left with a basic specification of a driver for this controller):
0F80h-0F87h == 8 Command Block Registers
0F00h-0F03h == Unknown except for 0F02h
0F02h == Alternate Status/Device Control register
0E80h-0E87h == 8 Command Block Registers
0E00h-0E03h == Unknown except for 0F02h
0E02h == Alternate Status/Device Control register
EB80h == Unknown
Here you can see the dump from the Craig Hart's PCI sniffer for this device:
It's a very important thing because, among other things, it allows to wake up the devices from a SLEEP command since the Device Control register contains the SRST bit, etc. Without it there is no way of doing such things.
I found the answer, but I suspect that every SATA AHCI controller will put these things differently. The biggest problem is finding the Alternate Status/Device Control register. The first 8 are easy to find, at least in this case, because they are contiguous.
But the Device Control register in this case is in the middle of a 4-port I/O range (0 to 3) in register #2. This could make necessary to build some command tests to set the Status registers' values and compare them in such a way that makes certain to us that a port is the Alternate Status, as a "desperate" option to find this port in an "unknown" and "standard" SATA controller.
I have an ASRock N73V-S motherboard. It has an integrated SATA II AHCI with Vendor ID==10DEh (NVidia Corp.) and Device ID==07F0h.
The structure of the I/O registers in this controller is as follows (I hope every AHCI controller has this I/O structure but I don't know; otherwise at least we'll be left with a basic specification of a driver for this controller):
0F80h-0F87h == 8 Command Block Registers
0F00h-0F03h == Unknown except for 0F02h
0F02h == Alternate Status/Device Control register
0E80h-0E87h == 8 Command Block Registers
0E00h-0E03h == Unknown except for 0F02h
0E02h == Alternate Status/Device Control register
EB80h == Unknown
Here you can see the dump from the Craig Hart's PCI sniffer for this device:
Code: Select all
Bus 0 (PCI Express), Device Number 14, Device Function 0
Vendor 10DEh Nvidia Corp
Device 07F0h Unknown
Command 0007h (I/O Access, Memory Access, BusMaster)
Status 00B0h (Has Capabilities List, Supports 66MHz, Supports Back-To-Back Trans., Fast Timing)
Revision A2h, Header Type 00h, Bus Latency Timer 00h
Minimum Bus Grant 03h, Maximum Bus Latency 01h
Self test 00h (Self test not supported)
PCI Class Storage, type IDE (ATA)
PCI EIDE Controller Features :
BusMaster EIDE is supported
Primary Channel is in native mode at Addresses 0 & 1
Secondary Channel is in native mode at Addresses 2 & 3
Subsystem ID 07F01849h Unknown
Subsystem Vendor 1849h ASRock Inc
Address 0 is an I/O Port : 00000F80h
Address 1 is an I/O Port : 00000F00h
Address 2 is an I/O Port : 00000E80h
Address 3 is an I/O Port : 00000E00h
Address 4 is an I/O Port : 0000EB80h
Address 5 is a Memory Address (anywhere in 0-4Gb) : FEB7C000h
System IRQ 21, INT# A
New Capabilities List Present:
Power Management Capability, Version 1.1
Does not support low power State D1 or D2
Does not support PME# signalling
Current Power State : D0 (Device operational, no power saving)
SATA HBA Optional Features Present
Message Signalled Interrupt Capability
MSI is disabled
MSI function can generate 64-bit addresses