From 04fa82397e3a58a496e9d6883eb7495ef3ecea64 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Sun, 2 Jun 2024 23:08:43 -0400 Subject: kernel: ahci: Add SATA read/write support This commit introduces SATA read/write support and exposes SATA devices to userland as /dev/sdN files Signed-off-by: Ian Moffett --- sys/include/dev/ic/ahcivar.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'sys/include') diff --git a/sys/include/dev/ic/ahcivar.h b/sys/include/dev/ic/ahcivar.h index 0b945ae..edef4f6 100644 --- a/sys/include/dev/ic/ahcivar.h +++ b/sys/include/dev/ic/ahcivar.h @@ -33,6 +33,7 @@ #include #include #include +#include #include struct ata_identity { @@ -113,6 +114,13 @@ struct ahci_fis_h2d { uint8_t rsvd1[4]; }; +struct ahci_device { + struct ahci_hba *hba; + struct hba_port *port; + dev_t minor; + TAILQ_ENTRY(ahci_device) link; +}; + struct ahci_hba { struct hba_memspace *abar; struct ahci_cmd_hdr *cmdlist; @@ -121,8 +129,10 @@ struct ahci_hba { }; /* Commands */ -#define ATA_CMD_NOP 0x00 -#define ATA_CMD_IDENTIFY 0xEC +#define ATA_CMD_NOP 0x00 +#define ATA_CMD_IDENTIFY 0xEC +#define ATA_CMD_READ_DMA 0x25 +#define ATA_CMD_WRITE_DMA 0x35 /* FIS types */ #define FIS_TYPE_H2D 0x27 -- cgit v1.2.3