The manual
ginnOS
The reference: libc, the libraries and the kernel
Loading...
Searching...
No Matches
ahci.h File Reference

SATA disks through an AHCI controller (PCI class 01:06:01). More...

Go to the source code of this file.

Data Structures

struct  ahci_disk_t

Macros

#define AHCI_MAX_DISKS   4

Functions

uint32_t ahci_init (void)
 find the AHCI controller (the first one) and its disks.
ahci_disk_t * ahci_disk (uint32_t index)
 a disk by index (0 to the number ahci_init returned).

Detailed Description

SATA disks through an AHCI controller (PCI class 01:06:01).

ahci_init finds the controller, maps its registers (BAR 5) and sets up each port that has a SATA disk. each disk is a block_device_t of 512-byte sectors. the transfers use DMA with 48-bit LBA commands. a process that waits for a command sleeps until the port interrupts; during boot, or without an interrupt, the driver polls the port.

Macro Definition Documentation

◆ AHCI_MAX_DISKS

#define AHCI_MAX_DISKS   4

Function Documentation

◆ ahci_init()

uint32_t ahci_init ( void )

find the AHCI controller (the first one) and its disks.

call after pci_init and mmio_init.

Returns
the number of disks found.

◆ ahci_disk()

ahci_disk_t * ahci_disk ( uint32_t index)

a disk by index (0 to the number ahci_init returned).

Returns
the disk, or NULL.