Turnstone Operating System
|
ahci interface More...
#include <types.h>
#include <memory.h>
#include <list.h>
#include <cpu/sync.h>
#include <future.h>
#include <disk.h>
#include <pci.h>
Classes | |
struct | ahci_pci_capability_sata_s |
struct | ahci_ata_identify_data_t |
struct | ahci_ata_ncq_error_log_s |
struct | ahci_fis_reg_h2d_s |
struct | ahci_fis_reg_d2h_s |
struct | ahci_fis_reg_data_s |
struct | ahci_fis_dev_bits_s |
struct | ahci_fis_pio_setup_s |
struct | ahci_fis_dma_setup_s |
struct | ahci_hba_port_s |
struct | ahci_hba_mem_s |
struct | ahci_hba_fis_s |
struct | ahci_hba_cmd_header_s |
struct | ahci_hba_prdt_entry_s |
struct | ahci_hba_prdt_s |
union | ahci_ata_logging_u |
union | ahci_ata_smart_u |
struct | ahci_sata_disk_s |
struct | ahci_hba_s |
Macros | |
#define | ___DRIVER_AHCI_H 0 |
#define | AHCI_SATA_SIG_ATA 0x00000101 |
#define | AHCI_SATA_SIG_ATAPI 0xEB140101 |
#define | AHCI_SATA_SIG_SEMB 0xC33C0101 |
#define | AHCI_SATA_SIG_PM 0x96690101 |
#define | AHCI_HBA_PORT_IPM_ACTIVE 1 |
#define | AHCI_HBA_PORT_DET_PRESENT 3 |
#define | AHCI_HBA_PxCMD_ST 0x0001 |
#define | AHCI_HBA_PxCMD_FRE 0x0010 |
#define | AHCI_HBA_PxCMD_FR 0x4000 |
#define | AHCI_HBA_PxCMD_CR 0x8000 |
#define | AHCI_HBA_PxIS_TFES (1 << 30) |
#define | AHCI_ATA_CMD_READ_DMA_EXT 0x25 |
#define | AHCI_ATA_CMD_READ_LOG_EXT 0x2F |
#define | AHCI_ATA_CMD_WRITE_DMA_EXT 0x35 |
#define | AHCI_ATA_CMD_READ_LOG_DMA_EXT 0x47 |
#define | AHCI_ATA_CMD_READ_FPDMA_QUEUED 0x60 |
#define | AHCI_ATA_CMD_WRITE_FPDMA_QUEUED 0x61 |
#define | AHCI_ATA_CMD_FLUSH_EXT 0xEA |
#define | AHCI_ATA_CMD_IDENTIFY 0xEC |
#define | AHCI_ATA_DEV_BUSY 0x80 |
#define | AHCI_ATA_DEV_DRQ 0x08 |
#define | PCI_DEVICE_CAPABILITY_SATA 0x12 |
Typedefs | |
typedef struct ahci_pci_capability_sata_s | ahci_pci_capability_sata_t |
typedef struct ahci_ata_identify_data_t | ahci_ata_identify_data_t |
typedef struct ahci_ata_ncq_error_log_s | ahci_ata_ncq_error_log_t |
typedef enum ahci_fis_type_e | ahci_fis_type_t |
typedef enum ahci_device_type_e | ahci_device_type_t |
typedef union ahci_ata_logging_u | ahci_ata_logging_t |
typedef union ahci_ata_smart_u | ahci_ata_smart_t |
typedef struct ahci_sata_disk_s | ahci_sata_disk_t |
typedef struct ahci_hba_s | ahci_hba_t |
Enumerations | |
enum | ahci_fis_type_e { AHCI_FIS_TYPE_REG_H2D = 0x27 , AHCI_FIS_TYPE_REG_D2H = 0x34 , AHCI_FIS_TYPE_DMA_ACT = 0x39 , AHCI_FIS_TYPE_DMA_SETUP = 0x41 , AHCI_FIS_TYPE_DATA = 0x46 , AHCI_FIS_TYPE_BIST = 0x58 , AHCI_FIS_TYPE_PIO_SETUP = 0x5F , AHCI_FIS_TYPE_DEV_BITS = 0xA1 } |
enum | ahci_device_type_e { AHCI_DEVICE_NULL , AHCI_DEVICE_SATA , AHCI_DEVICE_SEMB , AHCI_DEVICE_PM , AHCI_DEVICE_SATAPI } |
Functions | |
struct ahci_fis_reg_h2d_s | __attribute ((packed)) ahci_fis_reg_h2d_t |
int8_t | ahci_init (memory_heap_t *heap, list_t *sata_pci_devices) |
int8_t | ahci_identify (uint64_t disk_id) |
future_t * | ahci_read (uint64_t disk_id, uint64_t lba, uint32_t size, uint8_t *buffer) |
future_t * | ahci_write (uint64_t disk_id, uint64_t lba, uint32_t size, uint8_t *buffer) |
future_t * | ahci_flush (uint64_t disk_id) |
const ahci_sata_disk_t * | ahci_get_disk_by_id (uint64_t disk_id) |
const ahci_sata_disk_t * | ahci_get_first_inserted_disk (void) |
disk_t * | ahci_disk_impl_open (ahci_sata_disk_t *sata_disk) |
Variables | |
ahci_fis_type_t | fis_type |
fis type | |
uint8_t | port_multiplier |
Port multiplier. More... | |
uint8_t | reserved0 |
Reserved. More... | |
uint8_t | control_or_command |
1: Command, 0: Control | |
uint8_t | command |
Command register. | |
uint8_t | featurel |
Feature register, 0:7. | |
uint64_t | lba0 |
LBA low register, 0:23. | |
uint8_t | device |
Device register. | |
uint64_t | lba1 |
LBA register, 24:48. | |
uint8_t | featureh |
Feature register, 15:8. | |
uint16_t | count |
Count register. | |
uint8_t | icc |
Isochronous command completion. | |
uint8_t | control |
Control register. | |
uint8_t | reserved1 [4] |
Reserved. More... | |
uint8_t | interrupt |
Interrupt Bit. More... | |
uint8_t | status |
Status. | |
uint8_t | error |
Error. | |
uint8_t | reserved2 |
Reserved. | |
uint8_t | reserved3 [6] |
Reserved. | |
uint32_t | data [1] |
data 1~N | |
uint8_t | notification |
Notification Bit. | |
uint8_t | direction |
0: host2device 1: device2host | |
uint8_t | new_status |
New Status. | |
uint16_t | transfer_count |
Transfer Count. More... | |
uint8_t | reserved4 [2] |
Reserved. | |
uint8_t | auto_active |
Auto-activate. Specifies if DMA Activate FIS is needed. | |
uint64_t | dma_buffer_id |
DMA Buffer Identifier. Used to Identify DMA buffer in host memory. SATA Spec says host specific and not in Spec. Trying AHCI spec might work. | |
uint32_t | dma_buffer_offset |
byte offset into buffer first 2 bits must be 0 | |
uint64_t | command_list_base_address |
0x00, command list base address, 1K-byte aligned | |
uint64_t | fis_base_address |
0x08, FIS base address, 256-byte aligned | |
uint32_t | interrupt_status |
0x10, interrupt status More... | |
uint32_t | interrupt_enable |
0x14, interrupt enable | |
uint32_t | command_and_status |
0x18, command and status | |
uint32_t | task_file_data |
0x20, task file data | |
uint32_t | signature |
0x24, signature | |
uint32_t | sata_status |
0x28, SATA status (SCR0:SStatus) | |
uint32_t | sata_control |
0x2C, SATA control (SCR2:SControl) | |
uint32_t | sata_error |
0x30, SATA error (SCR1:SError) | |
uint32_t | sata_active |
0x34, SATA active (SCR3:SActive) | |
uint32_t | command_issue |
0x38, command issue | |
uint32_t | sata_notification |
0x3C, SATA notification (SCR4:SNotification) | |
uint32_t | fis_based_switch_control |
0x40, FIS-based switch control | |
uint32_t | device_sleep |
0x44, device sleep | |
uint32_t | vendor [4] |
0x70 ~ 0x7F, vendor specific More... | |
uint32_t | host_capability |
0x00, Host capability | |
uint32_t | global_host_control |
0x04, Global host control | |
uint32_t | port_implemented |
0x0C, Port implemented | |
uint32_t | version |
0x10, Version | |
uint32_t | command_completion_coalescing_control |
0x14, Command completion coalescing control | |
uint32_t | command_completion_coalescing_ports |
0x18, Command completion coalescing ports | |
uint32_t | enclosure_management_location |
0x1C, Enclosure management location | |
uint32_t | enclosure_management_control |
0x20, Enclosure management control | |
uint32_t | host_capability_extended |
0x24, Host capabilities extended | |
uint32_t | bios_os_handoff_control_and_status |
0x28, BIOS/OS handoff control and status | |
uint8_t | reserved [0xA0 - 0x2C] |
reserved More... | |
ahci_hba_port_t | ports [0] |
1 ~ 32 | |
ahci_fis_dma_setup_t | dma_setup_fis |
DMA Setup FIS. | |
uint8_t | padding0 [4] |
padding | |
ahci_fis_pio_setup_t | pio_setup_fis |
PIO Setup FIS. | |
uint8_t | padding1 [12] |
padding | |
ahci_fis_reg_d2h_t | d2h_fis |
Register – Device to Host FIS. | |
uint8_t | padding2 [4] |
padding | |
ahci_fis_dev_bits_t | sdbs_fis |
Set Device Bit FIS. | |
uint8_t | ufis [64] |
unknown fis | |
uint8_t | command_fis_length |
Command FIS length in DWORDS, 2 ~ 16. | |
uint8_t | atapi |
ATAPI. | |
uint8_t | write_direction |
Write, 1: H2D, 0: D2H. | |
uint8_t | prefetchable |
Prefetchable. | |
uint8_t | reset |
Reset. | |
uint8_t | bist |
BIST. | |
uint8_t | clear_busy |
Clear busy upon R_OK. | |
uint16_t | prdt_length |
Physical region descriptor table length in entries. | |
volatile uint32_t | prd_transfer_count |
Physical region descriptor byte count transferred. | |
uint64_t | prdt_base_address |
Command table descriptor base address. | |
uint64_t | data_base_address |
Data base address. | |
uint32_t | data_byte_count |
Byte count, 4M max. | |
uint8_t | command_fis [64] |
Command FIS. | |
uint8_t | acmd [16] |
ATAPI command, 12 or 16 bytes. | |
ahci_hba_prdt_entry_t | prdt_entry [1] |
Physical region descriptor table entries, 0 ~ 65535. | |
uint8_t | gpl_supported |
uint8_t | gpl_enabled |
uint8_t | dma_ext_supported |
uint8_t | dma_ext_enabled |
uint8_t | dma_ext_is_log_ext |
uint8_t | supported |
uint8_t | enabled |
uint8_t | errlog_supported |
uint8_t | errlog_enabled |
uint8_t | selftest_supported |
uint8_t | selftest_enabled |
ahci interface
This work is licensed under TURNSTONE OS Public License. Please read and understand latest version of Licence.
#define ___DRIVER_AHCI_H 0 |
prevent duplicate header error macro
enum ahci_fis_type_e |
uint32_t interrupt |
Interrupt Bit.
Interrupt on completion.
uint32_t interrupt_status |
0x10, interrupt status
0x08, Interrupt status
uint8_t port_multiplier |
Port multiplier.
Port multiplier port.
uint8_t reserved |
reserved
Reserved.
uint32_t reserved0 |
Reserved.
reserved
0x1C, Reserved
uint32_t reserved1 |
Reserved.
0x48 ~ 0x6F, Reserved
uint32_t transfer_count |
Transfer Count.
Transfer Count bit 0 must 0.
uint8_t vendor |
0x70 ~ 0x7F, vendor specific
vendor defined