// This file is part of noxos and licensed under the MIT open source license #ifndef NOXOS_AHCI_H #define NOXOS_AHCI_H #include "utils/stdtypes.h" typedef enum { AHCI_FIS_REGISTER_HOST_TO_DEVICE = 0x27, // host --> device AHCI_FIS_REGISTER_DEVICE_TO_HOST = 0x34, // host <-- device AHCI_FIS_DMA_ACTIVATE = 0x39, // host <-- device AHCI_FIS_DMA_SETUP = 0x41, // host <--> device AHCI_FIS_DATA = 0x46, // host <--> device AHCI_FIS_BIST = 0x58, // host <--> device AHCI_FIS_PIO_SETUP = 0x5F, // host <-- device AHCI_FIS_DEVICE_BITS = 0xA1 // host <-- device } ahci_fis_type_E; typedef struct { uint8_t type; uint8_t port_multiplier:4; uint8_t reserved_0:3; uint8_t command_control_select:1; uint8_t command; uint8_t feature_0; uint8_t lba_0; uint8_t lba_1; uint8_t lba_2; uint8_t device; uint8_t lba_3; uint8_t lba_4; uint8_t lba_5; uint8_t feature_1; uint16_t count; uint8_t icc; uint8_t control; uint32_t reserved_1; } ahci_fis_register_host_to_device_T; typedef struct { uint8_t type; uint8_t port_multiplier:4; uint8_t reserved_0:2; uint8_t interrupt:1; uint8_t reserved_1:1; uint8_t status; uint8_t error; uint8_t lba_0; uint8_t lba_1; uint8_t lba_2; uint8_t device; uint8_t lba_3; uint8_t lba_4; uint8_t lba_5; uint8_t reserved_2; uint16_t count; uint16_t reserved_3; uint32_t reserved_4; } ahci_fis_register_device_to_host_T; typedef struct { uint8_t type; uint8_t port_multiplier:4; uint8_t reserved_0:4; uint16_t reserved_1; uint32_t data; // this can be followed by more data } ahci_fis_data_T; typedef struct { uint8_t type; uint8_t port_multiplier:4; uint8_t reserved_0:1; uint8_t transfer_direction:1; uint8_t interrupt:1; uint8_t reserved_1:1; uint8_t status; uint8_t error; uint8_t lba_0; uint8_t lba_1; uint8_t lba_2; uint8_t device; uint8_t lba_3; uint8_t lba_4; uint8_t lba_5; uint8_t reserved_2; uint16_t count; uint8_t reserved_3; uint8_t new_status; uint16_t transfer_count; uint16_t reserved_4; } ahci_fis_pio_setup_T; typedef struct { uint8_t type; uint8_t port_multiplier:4; uint8_t reserved_0:1; uint8_t transfer_direction:1; uint8_t interrupt:1; uint8_t auto_activate:1; uint16_t reserved_1; uint64_t dma_buffer_id; uint32_t reserved_2; uint32_t dma_buffer_offset; uint32_t transfer_count; uint32_t reserved_3; } ahci_fis_dma_setup_T; #endif //NOXOS_AHCI_H