From be30f131848c28d28a870423cc826a62fa7357c7 Mon Sep 17 00:00:00 2001 From: Marcus Overhagen Date: Mon, 24 Sep 2007 19:08:22 +0000 Subject: [PATCH] fixed wrong port definition git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22292 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../kernel/busses/scsi/ahci/ahci_defs.h | 35 ++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/src/add-ons/kernel/busses/scsi/ahci/ahci_defs.h b/src/add-ons/kernel/busses/scsi/ahci/ahci_defs.h index 908da7c4da..97e50d6bbe 100644 --- a/src/add-ons/kernel/busses/scsi/ahci/ahci_defs.h +++ b/src/add-ons/kernel/busses/scsi/ahci/ahci_defs.h @@ -87,7 +87,7 @@ typedef struct { uint32 sntf; // SNotification uint32 res2; // Reserved for FIS-based Switching Definition uint32 res[11]; // Reserved - uint32 vendor[2]; // Vendor Specific + uint32 vendor[4]; // Vendor Specific } _PACKED ahci_port; @@ -95,6 +95,7 @@ enum { PORT_CMD_ICC_ACTIVE = (1 << 28), // Interface Communication control PORT_CMD_ICC_SLUMBER = (6 << 28), // Interface Communication control PORT_CMD_ICC_MASK = (0xf<<28), // Interface Communication control + PORT_CMD_ATAPI = (1 << 24), // Device is ATAPI PORT_CMD_CR = (1 << 15), // Command List Running (DMA active) PORT_CMD_FR = (1 << 14), // FIS Receive Running PORT_CMD_FER = (1 << 4), // FIS Receive Enable @@ -130,6 +131,12 @@ enum { #define PORT_INT_MASK (PORT_INT_FATAL | PORT_INT_ERROR | PORT_INT_DP |\ PORT_INT_SDB | PORT_INT_DS | PORT_INT_PS | PORT_INT_DHR) +enum { + ATA_BUSY = 0x80, + ATA_DRQ = 0x08, + ATA_ERR = 0x01, +}; + typedef struct { uint32 cap; // Host Capabilities @@ -224,6 +231,32 @@ int count_bits_set(T value) return count; } +inline +status_t +wait_until_set(volatile uint32 *reg, uint32 bits, bigtime_t timeout) +{ + int trys = (timeout + 9999) / 10000; + while (trys--) { + if ((*reg & bits) == bits) + return B_OK; + snooze(10000); + } + return B_TIMED_OUT; +} + +inline +status_t +wait_until_clear(volatile uint32 *reg, uint32 bits, bigtime_t timeout) +{ + int trys = (timeout + 9999) / 10000; + while (trys--) { + if ((*reg & bits) == 0) + return B_OK; + snooze(10000); + } + return B_TIMED_OUT; +} + #endif /* __cplusplus */