summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2006-12-11 13:06:34 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2006-12-11 13:06:34 +0000
commit768cd38eb63f24405aad63217c1db7cae1851134 (patch)
treea804ee683c312c0f751b0ee2039eb26e32df24ab /sys
parent08765a3fee55f06ca8aec8747b96711b73465cce (diff)
define the command structs used by the ports.
this stuff isnt endearing me to ata at all, and apparently ahci is a good ata controller. the command path looks way more complicated than it needs to be (or maybe i am used to really good scsi controllers, i dont know). a lot of the terminology seems annoyingly different just for the sake of being different. i mean, what is the advantage of calling a scatter gather lement a "physical region descriptor table"? noone else calls it that. there's a lot of weird stuff in here. blah.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pci/ahci.c52
1 files changed, 49 insertions, 3 deletions
diff --git a/sys/dev/pci/ahci.c b/sys/dev/pci/ahci.c
index 510005e9678..ce05b33733c 100644
--- a/sys/dev/pci/ahci.c
+++ b/sys/dev/pci/ahci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ahci.c,v 1.16 2006/12/11 12:54:00 dlg Exp $ */
+/* $OpenBSD: ahci.c,v 1.17 2006/12/11 13:06:33 dlg Exp $ */
/*
* Copyright (c) 2006 David Gwynne <dlg@openbsd.org>
@@ -106,6 +106,52 @@ int ahcidebug = AHCI_D_VERBOSE;
#define AHCI_PREG_Active(_p) (_PO(_p)+0x34) /* SATA Active */
#define AHCI_PREG_CI(_p) (_PO(_p)+0x38) /* Command Issue */
+struct ahci_cmd_list {
+ u_int16_t prdtl; /* sgl len */
+ u_int16_t flags;
+
+ u_int32_t prdbc; /* datalen */
+
+ u_int32_t ctba_lo;
+ u_int32_t ctba_hi;
+
+ u_int32_t reserved[4];
+} __packed;
+
+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_cmd_table {
+ u_int8_t cfis[64];
+ u_int8_t acmd[16];
+ u_int8_t reserved[48];
+} __packed;
+
+struct ahci_prdt {
+ u_int32_t dba_lo;
+ u_int32_t dba_hi;
+ u_int32_t reserved;
+ u_int32_t flags;
+} __packed;
+
+#define AHCI_MAX_PRDT 24
+
+struct ahci_cmd {
+ struct ahci_cmd_table table;
+ struct ahci_prdt prdt[AHCI_MAX_PRDT];
+} __packed;
+
+#define AHCI_MAX_PORTS 32
+
static const struct pci_matchid ahci_devices[] = {
{ PCI_VENDOR_JMICRON, PCI_PRODUCT_JMICRON_JMB361 }
};
@@ -405,7 +451,7 @@ ahci_write(struct ahci_softc *sc, bus_size_t r, u_int32_t v)
int
ahci_wait_eq(struct ahci_softc *sc, bus_size_t r, u_int32_t mask,
u_int32_t target)
-{
+{
int i;
for (i = 0; i < 1000; i++) {
@@ -420,7 +466,7 @@ ahci_wait_eq(struct ahci_softc *sc, bus_size_t r, u_int32_t mask,
int
ahci_wait_ne(struct ahci_softc *sc, bus_size_t r, u_int32_t mask,
u_int32_t target)
-{
+{
int i;
for (i = 0; i < 1000; i++) {