diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2014-04-14 04:42:23 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2014-04-14 04:42:23 +0000 |
commit | c8992de2517b433c46df41ab03c6858d9f073e97 (patch) | |
tree | 975789c012fa0f928d3c801402e296b50c65dfb2 /sys | |
parent | 48857676578d53a992109c5e8b2abadd4310e0e1 (diff) |
move the hardware structures into ahcireg.h.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/armv7/imx/imxahci.c | 3 | ||||
-rw-r--r-- | sys/arch/armv7/sunxi/sxiahci.c | 2 | ||||
-rw-r--r-- | sys/dev/ic/ahci.c | 4 | ||||
-rw-r--r-- | sys/dev/ic/ahcireg.h | 54 | ||||
-rw-r--r-- | sys/dev/ic/ahcivar.h | 54 | ||||
-rw-r--r-- | sys/dev/pci/ahci_pci.c | 3 |
6 files changed, 61 insertions, 59 deletions
diff --git a/sys/arch/armv7/imx/imxahci.c b/sys/arch/armv7/imx/imxahci.c index 90e1042ae9d..33a9467b3c0 100644 --- a/sys/arch/armv7/imx/imxahci.c +++ b/sys/arch/armv7/imx/imxahci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: imxahci.c,v 1.2 2013/11/06 19:03:07 syl Exp $ */ +/* $OpenBSD: imxahci.c,v 1.3 2014/04/14 04:42:22 dlg Exp $ */ /* * Copyright (c) 2013 Patrick Wildt <patrick@blueri.se> * @@ -25,6 +25,7 @@ #include <machine/bus.h> +#include <dev/ic/ahcireg.h> #include <dev/ic/ahcivar.h> #include <armv7/armv7/armv7var.h> diff --git a/sys/arch/armv7/sunxi/sxiahci.c b/sys/arch/armv7/sunxi/sxiahci.c index cd7813e3321..f7dd6c12656 100644 --- a/sys/arch/armv7/sunxi/sxiahci.c +++ b/sys/arch/armv7/sunxi/sxiahci.c @@ -25,8 +25,8 @@ #include <machine/bus.h> -#include <dev/ic/ahcivar.h> #include <dev/ic/ahcireg.h> +#include <dev/ic/ahcivar.h> #include <armv7/armv7/armv7var.h> #include <armv7/sunxi/sunxireg.h> diff --git a/sys/dev/ic/ahci.c b/sys/dev/ic/ahci.c index 56f0836fcef..6b1433cb316 100644 --- a/sys/dev/ic/ahci.c +++ b/sys/dev/ic/ahci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ahci.c,v 1.12 2014/03/31 06:18:30 dlg Exp $ */ +/* $OpenBSD: ahci.c,v 1.13 2014/04/14 04:42:22 dlg Exp $ */ /* * Copyright (c) 2006 David Gwynne <dlg@openbsd.org> @@ -30,8 +30,8 @@ #include <machine/bus.h> -#include <dev/ic/ahcivar.h> #include <dev/ic/ahcireg.h> +#include <dev/ic/ahcivar.h> #ifdef AHCI_DEBUG #define DPRINTF(m, f...) do { if ((ahcidebug & (m)) == (m)) printf(f); } \ diff --git a/sys/dev/ic/ahcireg.h b/sys/dev/ic/ahcireg.h index 366da7e7a65..5e59d27a159 100644 --- a/sys/dev/ic/ahcireg.h +++ b/sys/dev/ic/ahcireg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ahcireg.h,v 1.2 2014/02/13 23:41:24 pelikan Exp $ */ +/* $OpenBSD: ahcireg.h,v 1.3 2014/04/14 04:42:22 dlg Exp $ */ /* * Copyright (c) 2006 David Gwynne <dlg@openbsd.org> @@ -227,3 +227,55 @@ #define AHCI_PREG_FBS_SDE (1<<2) /* Single Device Error */ #define AHCI_PREG_FBS_DEC (1<<1) /* Device Error Clear */ #define AHCI_PREG_FBS_EN (1<<0) /* Enable */ + +struct ahci_cmd_hdr { + u_int16_t flags; +#define AHCI_CMD_LIST_FLAG_CFL 0x001f /* Command FIS Length */ +#define AHCI_CMD_LIST_FLAG_A (1<<5) /* ATAPI */ +#define AHCI_CMD_LIST_FLAG_W (1<<6) /* Write */ +#define AHCI_CMD_LIST_FLAG_P (1<<7) /* Prefetchable */ +#define AHCI_CMD_LIST_FLAG_R (1<<8) /* Reset */ +#define AHCI_CMD_LIST_FLAG_B (1<<9) /* BIST */ +#define AHCI_CMD_LIST_FLAG_C (1<<10) /* Clear Busy upon R_OK */ +#define AHCI_CMD_LIST_FLAG_PMP 0xf000 /* Port Multiplier Port */ +#define AHCI_CMD_LIST_FLAG_PMP_SHIFT 12 + u_int16_t prdtl; /* sgl len */ + + u_int32_t prdbc; /* transferred byte count */ + + u_int64_t ctba; + + u_int32_t reserved[4]; +} __packed __aligned(8); + +struct ahci_rfis { + u_int8_t dsfis[28]; + u_int8_t reserved1[4]; + u_int8_t psfis[24]; + u_int8_t reserved2[8]; + u_int8_t rfis[24]; + u_int8_t reserved3[4]; + u_int8_t sdbfis[4]; + u_int8_t ufis[64]; + u_int8_t reserved4[96]; +} __packed; + +struct ahci_prdt { + u_int64_t dba; + u_int32_t reserved; + u_int32_t flags; +#define AHCI_PRDT_FLAG_INTR (1<<31) /* interrupt on completion */ +} __packed __aligned(8); + +/* this makes ahci_cmd_table 512 bytes, supporting 128-byte alignment */ +#define AHCI_MAX_PRDT 24 + +struct ahci_cmd_table { + u_int8_t cfis[64]; /* Command FIS */ + u_int8_t acmd[16]; /* ATAPI Command */ + u_int8_t reserved[48]; + + struct ahci_prdt prdt[AHCI_MAX_PRDT]; +} __packed __aligned(128); + +#define AHCI_MAX_PORTS 32 diff --git a/sys/dev/ic/ahcivar.h b/sys/dev/ic/ahcivar.h index ee3e2fa9692..c0209ddc7df 100644 --- a/sys/dev/ic/ahcivar.h +++ b/sys/dev/ic/ahcivar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ahcivar.h,v 1.7 2014/03/31 06:58:10 dlg Exp $ */ +/* $OpenBSD: ahcivar.h,v 1.8 2014/04/14 04:42:22 dlg Exp $ */ /* * Copyright (c) 2006 David Gwynne <dlg@openbsd.org> @@ -25,58 +25,6 @@ /* change to AHCI_DEBUG for dmesg spam */ #define NO_AHCI_DEBUG -struct ahci_cmd_hdr { - u_int16_t flags; -#define AHCI_CMD_LIST_FLAG_CFL 0x001f /* Command FIS Length */ -#define AHCI_CMD_LIST_FLAG_A (1<<5) /* ATAPI */ -#define AHCI_CMD_LIST_FLAG_W (1<<6) /* Write */ -#define AHCI_CMD_LIST_FLAG_P (1<<7) /* Prefetchable */ -#define AHCI_CMD_LIST_FLAG_R (1<<8) /* Reset */ -#define AHCI_CMD_LIST_FLAG_B (1<<9) /* BIST */ -#define AHCI_CMD_LIST_FLAG_C (1<<10) /* Clear Busy upon R_OK */ -#define AHCI_CMD_LIST_FLAG_PMP 0xf000 /* Port Multiplier Port */ -#define AHCI_CMD_LIST_FLAG_PMP_SHIFT 12 - u_int16_t prdtl; /* sgl len */ - - u_int32_t prdbc; /* transferred byte count */ - - u_int64_t ctba; - - u_int32_t reserved[4]; -} __packed __aligned(8); - -struct ahci_rfis { - u_int8_t dsfis[28]; - u_int8_t reserved1[4]; - u_int8_t psfis[24]; - u_int8_t reserved2[8]; - u_int8_t rfis[24]; - u_int8_t reserved3[4]; - u_int8_t sdbfis[4]; - u_int8_t ufis[64]; - u_int8_t reserved4[96]; -} __packed; - -struct ahci_prdt { - u_int64_t dba; - u_int32_t reserved; - u_int32_t flags; -#define AHCI_PRDT_FLAG_INTR (1<<31) /* interrupt on completion */ -} __packed __aligned(8); - -/* this makes ahci_cmd_table 512 bytes, supporting 128-byte alignment */ -#define AHCI_MAX_PRDT 24 - -struct ahci_cmd_table { - u_int8_t cfis[64]; /* Command FIS */ - u_int8_t acmd[16]; /* ATAPI Command */ - u_int8_t reserved[48]; - - struct ahci_prdt prdt[AHCI_MAX_PRDT]; -} __packed __aligned(128); - -#define AHCI_MAX_PORTS 32 - struct ahci_dmamem { bus_dmamap_t adm_map; bus_dma_segment_t adm_seg; diff --git a/sys/dev/pci/ahci_pci.c b/sys/dev/pci/ahci_pci.c index d26cd0a69c8..32f06066e68 100644 --- a/sys/dev/pci/ahci_pci.c +++ b/sys/dev/pci/ahci_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ahci_pci.c,v 1.4 2014/03/28 17:57:11 mpi Exp $ */ +/* $OpenBSD: ahci_pci.c,v 1.5 2014/04/14 04:42:22 dlg Exp $ */ /* * Copyright (c) 2006 David Gwynne <dlg@openbsd.org> @@ -38,6 +38,7 @@ #include <dev/ata/atascsi.h> #include <dev/ata/pmreg.h> +#include <dev/ic/ahcireg.h> #include <dev/ic/ahcivar.h> #define AHCI_PCI_BAR 0x24 |