Retro Rocket Kernel BASIC-Powered Operating System

Data Structures | Macros | Enumerations | Functions | Variables
ahci.h File Reference
`#include "kernel.h"`

## Data Structures
struct | ahci_fis_reg_h2d_t
struct | ahci_fis_reg_d2h_t
struct | ahci_fis_data_t
struct | ahci_fis_pio_setup_t
struct | ahci_fis_dma_setup_t
struct | ahci_hba_port_t
struct | ahci_hba_mem_t
struct | ahci_fis_dev_bits_t
struct | achi_hba_fis_t
struct | ahci_hba_cmd_header_t
struct | ahci_hba_prdt_entry_t
struct | achi_hba_cmd_tbl_t

## Macros
#define | ATA_IDENT_DEVICETYPE 0
#define | ATA_IDENT_CYLINDERS 2
#define | ATA_IDENT_HEADS 6
#define | ATA_IDENT_SECTORS 12
#define | ATA_IDENT_SERIAL 20
#define | ATA_IDENT_MODEL 54
#define | ATA_IDENT_CAPABILITIES 98
#define | ATA_IDENT_FIELDVALID 106
#define | ATA_IDENT_MAX_LBA 120
#define | ATA_IDENT_COMMANDSETS 164
#define | ATA_IDENT_MAX_LBA_EXT 200
#define | SATA_SIG_ATA 0x00000101
#define | SATA_SIG_ATAPI 0xEB140101
#define | SATA_SIG_SEMB 0xC33C0101
#define | SATA_SIG_PM 0x96690101
#define | AHCI_DEV_NULL 0
#define | AHCI_DEV_SATA 1
#define | AHCI_DEV_SEMB 2
#define | AHCI_DEV_PM 3
#define | AHCI_DEV_SATAPI 4
#define | HBA_PORT_IPM_ACTIVE 1
#define | HBA_PORT_DET_PRESENT 3
#define | HBA_PxCMD_ST 0x0001
#define | HBA_PxCMD_FRE 0x0010
#define | HBA_PxCMD_FR 0x4000
#define | HBA_PxCMD_CR 0x8000
#define | HBA_PxIS_TFES (1 << 30)
#define | ATA_CMD_READ_DMA_EX 0x25
#define | ATA_CMD_WRITE_DMA_EX 0x35
#define | ATA_DEV_BUSY 0x80
#define | ATA_DEV_DRQ 0x08

## Enumerations
enum | ahci_fis_type_t { FIS_TYPE_REG_H2D = 0x27 , FIS_TYPE_REG_D2H = 0x34 , FIS_TYPE_DMA_ACT = 0x39 , FIS_TYPE_DMA_SETUP = 0x41 , FIS_TYPE_DATA = 0x46 , FIS_TYPE_BIST = 0x58 , FIS_TYPE_PIO_SETUP = 0x5F , FIS_TYPE_DEV_BITS = 0xA1 }

## Functions
struct ahci_fis_reg_h2d_t | __attribute__ ((packed)) ahci_fis_reg_h2d_t
void | init_ahci ()

## Variables
uint8_t | fis_type
uint8_t | pmport
uint8_t | rsv0
uint8_t | c
uint8_t | command
uint8_t | featurel
uint8_t | lba0
uint8_t | lba1
uint8_t | lba2
uint8_t | device
uint8_t | lba3
uint8_t | lba4
uint8_t | lba5
uint8_t | featureh
uint8_t | countl
uint8_t | counth
uint8_t | icc
uint8_t | control
uint8_t | rsv1 [4]
uint8_t | i
uint8_t | status
uint8_t | error
uint8_t | rsv2
uint8_t | rsv3 [2]
uint8_t | rsv4 [4]
uint32_t | data []
uint8_t | d
uint8_t | e_status
uint16_t | tc
uint8_t | a
uint8_t | rsved [2]
uint64_t | DMAbufferID
uint32_t | rsvd
uint32_t | DMAbufOffset
uint32_t | TransferCount
uint32_t | resvd
uint32_t | clb
uint32_t | clbu
uint32_t | fb
uint32_t | fbu
uint32_t | is
uint32_t | ie
uint32_t | cmd
uint32_t | tfd
uint32_t | sig
uint32_t | ssts
uint32_t | sctl
uint32_t | serr
uint32_t | sact
uint32_t | ci
uint32_t | sntf
uint32_t | fbs
uint32_t | vendor [4]
uint32_t | cap
uint32_t | ghc
uint32_t | pi
uint32_t | vs
uint32_t | ccc_ctl
uint32_t | ccc_pts
uint32_t | em_loc
uint32_t | em_ctl
uint32_t | cap2
uint32_t | bohc
uint8_t | rsv [0xA0-0x2C]
ahci_hba_port_t | ports [1]
uint8_t | n
uint8_t | statusl
uint8_t | rsvd2
uint8_t | statush
uint8_t | rsvd3
ahci_fis_dma_setup_t | dsfis
uint8_t | pad0 [4]
ahci_fis_pio_setup_t | psfis
uint8_t | pad1 [12]
ahci_fis_reg_d2h_t | rfis
uint8_t | pad2 [4]
ahci_fis_dev_bits_t | sdbfis
uint8_t | ufis [64]
uint8_t | cfl
uint8_t | w
uint8_t | p
uint8_t | r
uint8_t | b
uint8_t | pmp
uint16_t | prdtl
volatile uint32_t | prdbc
uint32_t | ctba
uint32_t | ctbau
uint32_t | dba
uint32_t | dbau
uint32_t | dbc
uint8_t | cfis [64]
uint8_t | acmd [16]
ahci_hba_prdt_entry_t | prdt_entry [1]

## Detailed Description

Author
  Craig Edwards (craig.nosp@m.edwa.nosp@m.rds@b.nosp@m.rain.nosp@m.box.c.nosp@m.c)

Copyright
  Copyright (c) 2012-2023

## Macro Definition Documentation

## ◆ AHCI_DEV_NULL

#define AHCI_DEV_NULL 0

## ◆ AHCI_DEV_PM

#define AHCI_DEV_PM 3

## ◆ AHCI_DEV_SATA

#define AHCI_DEV_SATA 1

## ◆ AHCI_DEV_SATAPI

#define AHCI_DEV_SATAPI 4

## ◆ AHCI_DEV_SEMB

#define AHCI_DEV_SEMB 2

## ◆ ATA_CMD_READ_DMA_EX

#define ATA_CMD_READ_DMA_EX 0x25

## ◆ ATA_CMD_WRITE_DMA_EX

#define ATA_CMD_WRITE_DMA_EX 0x35

## ◆ ATA_DEV_BUSY

#define ATA_DEV_BUSY 0x80

## ◆ ATA_DEV_DRQ

#define ATA_DEV_DRQ 0x08

## ◆ ATA_IDENT_CAPABILITIES

#define ATA_IDENT_CAPABILITIES 98

## ◆ ATA_IDENT_COMMANDSETS

#define ATA_IDENT_COMMANDSETS 164

## ◆ ATA_IDENT_CYLINDERS

#define ATA_IDENT_CYLINDERS 2

## ◆ ATA_IDENT_DEVICETYPE

#define ATA_IDENT_DEVICETYPE 0

## ◆ ATA_IDENT_FIELDVALID

#define ATA_IDENT_FIELDVALID 106

## ◆ ATA_IDENT_HEADS

#define ATA_IDENT_HEADS 6

## ◆ ATA_IDENT_MAX_LBA

#define ATA_IDENT_MAX_LBA 120

## ◆ ATA_IDENT_MAX_LBA_EXT

#define ATA_IDENT_MAX_LBA_EXT 200

## ◆ ATA_IDENT_MODEL

#define ATA_IDENT_MODEL 54

## ◆ ATA_IDENT_SECTORS

#define ATA_IDENT_SECTORS 12

## ◆ ATA_IDENT_SERIAL

#define ATA_IDENT_SERIAL 20

## ◆ HBA_PORT_DET_PRESENT

#define HBA_PORT_DET_PRESENT 3

## ◆ HBA_PORT_IPM_ACTIVE

#define HBA_PORT_IPM_ACTIVE 1

## ◆ HBA_PxCMD_CR

#define HBA_PxCMD_CR 0x8000

## ◆ HBA_PxCMD_FR

#define HBA_PxCMD_FR 0x4000

## ◆ HBA_PxCMD_FRE

#define HBA_PxCMD_FRE 0x0010

## ◆ HBA_PxCMD_ST

#define HBA_PxCMD_ST 0x0001

## ◆ HBA_PxIS_TFES

#define HBA_PxIS_TFES (1 << 30)

## ◆ SATA_SIG_ATA

#define SATA_SIG_ATA 0x00000101

## ◆ SATA_SIG_ATAPI

#define SATA_SIG_ATAPI 0xEB140101

## ◆ SATA_SIG_PM

#define SATA_SIG_PM 0x96690101

## ◆ SATA_SIG_SEMB

#define SATA_SIG_SEMB 0xC33C0101

## Enumeration Type Documentation

## ◆ ahci_fis_type_t

enum ahci_fis_type_t

Enumerator
FIS_TYPE_REG_H2D |
FIS_TYPE_REG_D2H |
FIS_TYPE_DMA_ACT |
FIS_TYPE_DMA_SETUP |
FIS_TYPE_DATA |
FIS_TYPE_BIST |
FIS_TYPE_PIO_SETUP |
FIS_TYPE_DEV_BITS |

## Function Documentation

## ◆ __attribute__()

struct ahci_fis_reg_h2d_t __attribute__ | ( | (packed) |  | ) |

## ◆ init_ahci()

void init_ahci | ( |  | ) |

## Variable Documentation

## ◆ a

uint8_t a

## ◆ acmd

uint8_t acmd[16]

## ◆ b

uint8_t b

## ◆ bohc

uint32_t bohc

## ◆ c

uint8_t c

## ◆ cap

uint32_t cap

## ◆ cap2

uint32_t cap2

## ◆ ccc_ctl

uint32_t ccc_ctl

## ◆ ccc_pts

uint32_t ccc_pts

## ◆ cfis

uint8_t cfis[64]

## ◆ cfl

uint8_t cfl

## ◆ ci

uint32_t ci

## ◆ clb

uint32_t clb

## ◆ clbu

uint32_t clbu

## ◆ cmd

uint32_t cmd

## ◆ command

uint8_t command

## ◆ control

uint8_t control

## ◆ counth

uint8_t counth

## ◆ countl

uint8_t countl

## ◆ ctba

uint32_t ctba

## ◆ ctbau

uint32_t ctbau

## ◆ d

uint8_t d

## ◆ data

uint32_t data[]

## ◆ dba

uint32_t dba

## ◆ dbau

uint32_t dbau

## ◆ dbc

uint32_t dbc

## ◆ device

uint8_t device

## ◆ DMAbufferID

uint64_t DMAbufferID

## ◆ DMAbufOffset

uint32_t DMAbufOffset

## ◆ dsfis

ahci_fis_dma_setup_t dsfis

## ◆ e_status

uint8_t e_status

## ◆ em_ctl

uint32_t em_ctl

## ◆ em_loc

uint32_t em_loc

## ◆ error

uint8_t error

## ◆ fb

uint32_t fb

## ◆ fbs

uint32_t fbs

## ◆ fbu

uint32_t fbu

## ◆ featureh

uint8_t featureh

## ◆ featurel

uint8_t featurel

## ◆ fis_type

uint8_t fis_type

## ◆ ghc

uint32_t ghc

## ◆ i

uint32_t i

## ◆ icc

uint8_t icc

## ◆ ie

uint32_t ie

## ◆ is

uint32_t is

## ◆ lba0

uint8_t lba0

## ◆ lba1

uint8_t lba1

## ◆ lba2

uint8_t lba2

## ◆ lba3

uint8_t lba3

## ◆ lba4

uint8_t lba4

## ◆ lba5

uint8_t lba5

## ◆ n

uint8_t n

## ◆ p

uint8_t p

## ◆ pad0

uint8_t pad0[4]

## ◆ pad1

uint8_t pad1[12]

## ◆ pad2

uint8_t pad2[4]

## ◆ pi

uint32_t pi

## ◆ pmp

uint8_t pmp

## ◆ pmport

uint8_t pmport

## ◆ ports

ahci_hba_port_t ports[1]

## ◆ prdbc

volatile uint32_t prdbc

## ◆ prdt_entry

ahci_hba_prdt_entry_t prdt_entry[1]

## ◆ prdtl

uint16_t prdtl

## ◆ psfis

ahci_fis_pio_setup_t psfis

## ◆ r

uint8_t r

## ◆ resvd

uint32_t resvd

## ◆ rfis

ahci_fis_reg_d2h_t rfis

## ◆ rsv

uint8_t rsv

## ◆ rsv0

uint32_t rsv0

## ◆ rsv1

uint32_t rsv1

## ◆ rsv2

uint8_t rsv2

## ◆ rsv3

uint8_t rsv3

## ◆ rsv4

uint8_t rsv4

## ◆ rsvd

uint8_t rsvd

## ◆ rsvd2

uint8_t rsvd2

## ◆ rsvd3

uint8_t rsvd3

## ◆ rsved

uint8_t rsved[2]

## ◆ sact

uint32_t sact

## ◆ sctl

uint32_t sctl

## ◆ sdbfis

ahci_fis_dev_bits_t sdbfis

## ◆ serr

uint32_t serr

## ◆ sig

uint32_t sig

## ◆ sntf

uint32_t sntf

## ◆ ssts

uint32_t ssts

## ◆ status

volatile uint8_t status

## ◆ statush

uint8_t statush

## ◆ statusl

uint8_t statusl

## ◆ tc

uint16_t tc

## ◆ tfd

uint32_t tfd

## ◆ TransferCount

uint32_t TransferCount

## ◆ ufis

uint8_t ufis[64]

## ◆ vendor

uint8_t vendor

## ◆ vs

uint32_t vs

## ◆ w

uint8_t w