summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2006-12-11 13:17:58 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2006-12-11 13:17:58 +0000
commit6f5ab398cd028973a0564e09d624c5642902971c (patch)
tree60b737eca70b52b77f82ca0150bb8e68dbfa3842 /sys/dev
parent60d89b9be5048de909d51426f606d78a33f5bcfd (diff)
remove the argument to all the port registers that say which port you want
to address. instead make them simply offsets from the start of a ports register space, which is something we can easily set up with bus_space_subregion. this should make the code a lot easier to read later on.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/ahci.c35
1 files changed, 18 insertions, 17 deletions
diff --git a/sys/dev/pci/ahci.c b/sys/dev/pci/ahci.c
index 90ef6b0dfc1..c65371dad75 100644
--- a/sys/dev/pci/ahci.c
+++ b/sys/dev/pci/ahci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ahci.c,v 1.18 2006/12/11 13:08:11 dlg Exp $ */
+/* $OpenBSD: ahci.c,v 1.19 2006/12/11 13:17:57 dlg Exp $ */
/*
* Copyright (c) 2006 David Gwynne <dlg@openbsd.org>
@@ -89,22 +89,23 @@ int ahcidebug = AHCI_D_VERBOSE;
#define AHCI_REG_EM_LOC 0x01c /* Enclosure Mgmt Location */
#define AHCI_REG_EM_CTL 0x020 /* Enclosure Mgmt Control */
-#define _PO(_p) (0x100 + ((_p) * 0x80)) /* port offset */
-
-#define AHCI_PREG_CLB(_p) (_PO(_p)+0x00) /* Cmd List Base Addr */
-#define AHCI_PREG_CLBU(_p) (_PO(_p)+0x04) /* Cmd List Base Hi Addr */
-#define AHCI_PREG_FB(_p) (_PO(_p)+0x08) /* FIS Base Addr */
-#define AHCI_PREG_FBU(_p) (_PO(_p)+0x0c) /* FIS Base Hi Addr */
-#define AHCI_PREG_IS(_p) (_PO(_p)+0x10) /* Interrupt Status */
-#define AHCI_PREG_IE(_p) (_PO(_p)+0x14) /* Interrupt Enable */
-#define AHCI_PREG_CMD(_p) (_PO(_p)+0x18) /* Command and Status */
-#define AHCI_PREG_TFD(_p) (_PO(_p)+0x20) /* Task File Data*/
-#define AHCI_PREG_SIG(_p) (_PO(_p)+0x24) /* Signature */
-#define AHCI_PREG_Status(_p) (_PO(_p)+0x28) /* SATA Status */
-#define AHCI_PREG_Control(_p) (_PO(_p)+0x2c) /* SATA Control */
-#define AHCI_PREG_Error(_p) (_PO(_p)+0x30) /* SATA Error */
-#define AHCI_PREG_Active(_p) (_PO(_p)+0x34) /* SATA Active */
-#define AHCI_PREG_CI(_p) (_PO(_p)+0x38) /* Command Issue */
+#define AHCI_PORT_REGION(_p) (0x100 + ((_p) * 0x80))
+#define AHCI_PORT_SIZE 0x80
+
+#define AHCI_PREG_CLB 0x00 /* Cmd List Base Addr */
+#define AHCI_PREG_CLBU 0x04 /* Cmd List Base Hi Addr */
+#define AHCI_PREG_FB 0x08 /* FIS Base Addr */
+#define AHCI_PREG_FBU 0x0c /* FIS Base Hi Addr */
+#define AHCI_PREG_IS 0x10 /* Interrupt Status */
+#define AHCI_PREG_IE 0x14 /* Interrupt Enable */
+#define AHCI_PREG_CMD 0x18 /* Command and Status */
+#define AHCI_PREG_TFD 0x20 /* Task File Data*/
+#define AHCI_PREG_SIG 0x24 /* Signature */
+#define AHCI_PREG_Status 0x28 /* SATA Status */
+#define AHCI_PREG_Control 0x2c /* SATA Control */
+#define AHCI_PREG_Error 0x30 /* SATA Error */
+#define AHCI_PREG_Active 0x34 /* SATA Active */
+#define AHCI_PREG_CI 0x38 /* Command Issue */
struct ahci_cmd_list {
u_int16_t prdtl; /* sgl len */