Sie sind auf Seite 1von 34

AHCI

AHCI is a technical standard defined by intel.


AHCI is a standard interface used to
communicate with SATA devices.
AHCI gives software developers and hardware
designers a standard method for detecting ,
configuring and programming SATA/AHCI
adapters.
Features Supported by AHCI

Support for 32 ports


Hot Plug
Activity LED generation
64-bit addressing
PCI CONFIGURATION SPACE
PCI devices have a set of registers referred to
as Configuration Space and PCI Express
introduces Extended Configuration Space for
devices. Configuration space registers are
mapped to memory locations.
The size of pci configuration space is 256 bytes.
The size of pcie configuration space is 4096
bytes.
PCI Config Space Header
HBA MEMORY REGISTERS
AHCI registers are broken into two sections
global and port control registers.
Global apply to the entire HBA.
The port control registers are the same for all
ports, and there are as many register banks as
there are ports.
HBA GLOBAL REGISTER
Vendor Specific Registers

Registers at offset A0h to FFh are vendor


specific.
PORT REGISTERS
HBA Memory Space Usage
Port System Memory Structures
Received FIS Structure
Command List Structure
31 23 15 7 0
PRDTL PMP R C B R P WA CFL
PRDBC: PRD Byte Count
00h CTBA0: Command Table Base Address Reserved
CH0
Command CTBA_U0: Command Table Base Adr Upper 32-bits
0
Reserved

Command 1 20h - 3Fh

Command 2 40h - 7Fh

... Each command has the same


format as command 0

Command
3C0 - 3DFh
30

Command
3E0 - 3FFh
31
Command Table Structure
00h

CFIS: 31 23 15 7 0
Command FIS
DBA: Data Base Address 0
(up to 64 bytes)
DBAU: Data Base Addr Upper 32-bits
Item 0
Reserved
40h
ACMD: I Reserved DBC: Byte Count 1
ATAPI Command DBA: Data Base Address 0
(12 or 16 bytes) DBAU: Data Base Addr Upper 32-bits
50h Item 1
Reserved
Reserved I Reserved DBC: Byte Count 1

80h
PRDT: DBA: Data Base Address 0
Physical Region
DBAU: Data Base Addr Upper 32-bits
Descriptor Table Item CHz[PRDTL]-1
Reserved
I Reserved DBC: Byte Count 1

(up to 65,535
entries)
PIO Example
CFIS
Command 0
ACMD
Command 1
Operating
Command 2 Reserved
System
Command 3

PRD Table
OS presents new Command 31
command

HBA Port 0 HW
SATA
AHCI CI = 0000

Driver/BIOS
SATA
Device
PIO Example
CFIS
Command 0
ACMD
Command 1
Operating
Command 2 Reserved
System
Command 3

PRD Table
Command 31
Driver places in next available
slot (slot 0) filling out the PRD
table and CFIS fields

HBA Port 0 HW
SATA
AHCI CI = 0..000

Driver/BIOS
SATA
Device
PIO Example
CFIS
Command 0
ACMD
Command 1
Operating
Command 2 Reserved
System
Command 3

PRD Table
Command 31

HBA Port 0 HW
SATA
AHCI CI
CI==0..0100
0..000

Driver/BIOS
SATA
Device
Driver/BIOS updates CI bit to
indicate valid command
PIO Example
CFIS
Command 0
ACMD
Command 1
Operating
Command 2 Reserved
System
Command 3

PRD Table
Command 31

HBA Port 0 HW
SATA
AHCI CI = 0..0100

Driver/BIOS
SATA
Device
HBA fetches command, and
transmits CFIS to device
PIO Example
CFIS
Command 0
ACMD
Command 1
Operating
Command 2 Reserved
System
Command 3

PRD Table
Command 31

HBA Port 0 HW
SATA
AHCI CI = 0..0100

Driver/BIOS
SATA
Device
Device and HBA initiate transfer
through PRD table
PIO Example
CFIS
Command 0
ACMD
Command 1
Operating
Command 2 Reserved
System
Command 3

PRD Table
Command 31

HBA Port 0 HW
SATA
AHCI CI = 0..0000
0..0100

Driver/BIOS
SATA
Device
Transfer completes, HBA clears
CI bit to free command slot
Native Command Queuing
Example Command 0

Command 1
Operating
Command 2
System
Command 3


OS presents new Command 30
command Command 31

HBA Port 0 HW

SATA CI = 00..000

AHCI Driver SACT = 00..000

SATA
Queued
Device
Native Command Queuing
Example Driver places
command in Command 0
available slot (0)
Command 1
Operating
Command 2
System
Command 3


Command 30

Command 31

HBA Port 0 HW

SATA CI = 00..000

AHCI Driver SACT = 00..000

SATA
Queued
Device
Native Command Queuing
Example
Command 0

Command 1
Operating
Command 2
System
Command 3


OS presents 2 Command 30
new commands Command 31

HBA Port 0 HW

SATA CI = 00..001
00..000

AHCI Driver SACT


DSTS = 00..000
00..001

Driver updates SACT and CI to SATA


indicate valid command at slot Queued
0 Device
Native Command Queuing
Example Driver places
commands slots (2 Command 0
& 30)
Command 1
Operating
Command 2
System
Command 3


Command 30

Command 31

HBA Port 0 HW

SATA CI = 00..000
00..001

AHCI Driver SACT = 00..001

SATA
HBA sends command 0 to Queued
device, device accepts, HBA Device
clears CI bit
Native Command Queuing
Example
Command 0

Command 1
Operating
Command 2
System
Command 3


Command 30

Command 31

HBA Port 0 HW

SATA CI = 01..100
00..000

AHCI Driver SACT


DSTS = 00..001
01..101

SATA
Driver updates SACT and CI to Queued
indicate valid commands Device
Native Command Queuing
Example
Command 0

Command 1
Operating
Command 2
System
Command 3


Command 30

Command 31

HBA Port 0 HW

SATA CI = 00..000
01..100
01..000

AHCI Driver SACT = 01..101

SATA
HBA sends commands 2 & 30 to Queued
device, device accepts, HBA Device
clears CI bits
Native Command Queuing
Example
Command 0

Command 1
Operating
Command 2
System Active command
Command 3


Command 30

Command 31

HBA Port 0 HW

SATA CI = 00..000

AHCI Driver SACT = 01..101

SATA
Device sends DMA Setup FIS, Queued
indicating transfer ready for slot Device
2
Native Command Queuing
Example
Command 0

Command 1
Operating
Command 2
System Active command
Command 3


Command 30

Command 31

HBA Port 0 HW

SATA CI = 00..000

AHCI Driver SACT = 01..101

SATA
Queued
Data transfer occurs from PRD Device
table in slot 2
Native Command Queuing
Example
Command 0

Command 1
Operating Command Available
Command 2 (DSTS[2], CI[2]
System Activecleared)
command
Command 3


Command 30

Command 31

HBA Port 0 HW

SATA CI = 00..000

AHCI Driver SACT


DSTS = 01..101
01..001

SATA
Queued
SDB FIS sent by device at end Device
of transfer, clears DSTS[2]
Native Command Queuing
Example
Command 0

Command 1
Operating
Command 2
System
Command 3


Command 30 Active command
Command 31

HBA Port 0 HW

SATA CI = 00..000

AHCI Driver SACT = 01..001

SATA
Device sends DMA Setup FIS, Queued
indicating transfer ready for slot Device
30
Native Command Queuing
Example
Command 0

Command 1
Operating
Command 2
System
Command 3


Command 30 Active command
Command 31

HBA Port 0 HW

SATA CI = 00..000

AHCI Driver SACT = 01..001

SATA
Queued
Data transfer occurs from PRD Device
table in slot 30
Native Command Queuing
Example
Command 0

Command 1
Operating
Command 2
System
Command 3


Command 30 Command Available
Active command
(DSTS[30], CI[30]
Command 31 cleared)

HBA Port 0 HW

SATA CI = 00..000

AHCI Driver SACT


DSTS = 01..001
00..001

SATA
Queued
SDB FIS sent by device at end Device
of transfer, clears SACT[30]
Native Command Queuing
Example
Command 0 Active command
Command 1
Operating
Command 2
System
Command 3


Command 30

Command 31

HBA Port 0 HW

SATA CI = 00..000

AHCI Driver SACT = 00..001

SATA
Device sends DMA Setup FIS, Queued
indicating transfer ready for slot Device
0
Native Command Queuing
Example
Command 0 Active command
Command 1
Operating
Command 2
System
Command 3


Command 30

Command 31

HBA Port 0 HW

SATA CI = 00..000

AHCI Driver SACT = 00..001

SATA
Queued
Data transfer occurs from PRD Device
table in slot 0
Native Command Queuing
Example
Command 0 Command Available
Active command
(DSTS[0], CI[0]
Command 1
Operating cleared)
Command 2
System
Command 3


Command 30

Command 31

HBA Port 0 HW

SATA CI = 00..000

AHCI Driver SACT


DSTS = 00..001
00..000

SATA
Queued
SDB FIS sent by device at end Device
of transfer, clears SACT[0]

Das könnte Ihnen auch gefallen