git://scm.lunaixsky.com
/
lunaix-os.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
refactor: make pci device driver loading passive, pci bus scanner will not load them...
[lunaix-os.git]
/
lunaix-os
/
includes
/
hal
/
ahci
/
hba.h
diff --git
a/lunaix-os/includes/hal/ahci/hba.h
b/lunaix-os/includes/hal/ahci/hba.h
index c60536d6d14b3707796ad76261c90c60bafc30ee..c3966281b6c919aaee943b5df3da8e7dd66e6516 100644
(file)
--- a/
lunaix-os/includes/hal/ahci/hba.h
+++ b/
lunaix-os/includes/hal/ahci/hba.h
@@
-35,12
+35,21
@@
#define HBA_PxINTR_DMA (1 << 2)
#define HBA_PxINTR_DHR (1)
#define HBA_PxINTR_DPS (1 << 5)
#define HBA_PxINTR_DMA (1 << 2)
#define HBA_PxINTR_DHR (1)
#define HBA_PxINTR_DPS (1 << 5)
-#define HBA_PxINTR_TFEE (1 << 30)
-#define HBA_PxINTR_IFE (1 << 27)
+#define HBA_PxINTR_TFE (1 << 30)
+#define HBA_PxINTR_HBF (1 << 29)
+#define HBA_PxINTR_HBD (1 << 28)
+#define HBA_PxINTR_IF (1 << 27)
+#define HBA_PxINTR_NIF (1 << 26)
+#define HBA_PxINTR_OF (1 << 24)
#define HBA_PxTFD_ERR (1)
#define HBA_PxTFD_BSY (1 << 7)
#define HBA_PxTFD_DRQ (1 << 3)
#define HBA_PxTFD_ERR (1)
#define HBA_PxTFD_BSY (1 << 7)
#define HBA_PxTFD_DRQ (1 << 3)
+#define HBA_FATAL \
+ (HBA_PxINTR_TFE | HBA_PxINTR_HBF | HBA_PxINTR_HBD | HBA_PxINTR_IF)
+
+#define HBA_NONFATAL (HBA_PxINTR_NIF | HBA_PxINTR_OF)
+
#define HBA_RGHC_ACHI_ENABLE (1 << 31)
#define HBA_RGHC_INTR_ENABLE (1 << 1)
#define HBA_RGHC_RESET 1
#define HBA_RGHC_ACHI_ENABLE (1 << 31)
#define HBA_RGHC_INTR_ENABLE (1 << 1)
#define HBA_RGHC_RESET 1
@@
-70,27
+79,27
@@
typedef unsigned int hba_reg_t;
struct hba_cmdh
{
struct hba_cmdh
{
- u
int
16_t options;
- u
int
16_t prdt_len;
- u
int
32_t transferred_size;
- u
int
32_t cmd_table_base;
- u
int
32_t reserved[5];
+ u16_t options;
+ u16_t prdt_len;
+ u32_t transferred_size;
+ u32_t cmd_table_base;
+ u32_t reserved[5];
} __HBA_PACKED__;
#define HBA_PRDTE_BYTE_CNT(cnt) ((cnt & 0x3FFFFF) | 0x1)
struct hba_prdte
{
} __HBA_PACKED__;
#define HBA_PRDTE_BYTE_CNT(cnt) ((cnt & 0x3FFFFF) | 0x1)
struct hba_prdte
{
- u
int
32_t data_base;
- u
int
32_t reserved[2];
- u
int
32_t byte_count;
+ u32_t data_base;
+ u32_t reserved[2];
+ u32_t byte_count;
} __HBA_PACKED__;
struct hba_cmdt
{
} __HBA_PACKED__;
struct hba_cmdt
{
- u
int
8_t command_fis[64];
- u
int
8_t atapi_cmd[16];
- u
int
8_t reserved[0x30];
+ u8_t command_fis[64];
+ u8_t atapi_cmd[16];
+ u8_t reserved[0x30];
struct hba_prdte entries[HBA_MAX_PRDTE];
} __HBA_PACKED__;
struct hba_prdte entries[HBA_MAX_PRDTE];
} __HBA_PACKED__;
@@
-98,27
+107,29
@@
struct hba_cmdt
#define HBA_DEV_FATAPI (1 << 1)
struct hba_port;
#define HBA_DEV_FATAPI (1 << 1)
struct hba_port;
+struct ahci_hba;
struct hba_device
{
char serial_num[20];
char model[40];
struct hba_device
{
char serial_num[20];
char model[40];
- u
int
32_t flags;
-
uint64
_t max_lba;
- u
int
32_t block_size;
- u
int
64_t wwn;
- u
int
8_t cbd_size;
+ u32_t flags;
+
lba
_t max_lba;
+ u32_t block_size;
+ u64_t wwn;
+ u8_t cbd_size;
struct
{
struct
{
- u
int
8_t sense_key;
- u
int
8_t error;
- u
int
8_t status;
- u
int
8_t reserve;
+ u8_t sense_key;
+ u8_t error;
+ u8_t status;
+ u8_t reserve;
} last_result;
} last_result;
- u
int
32_t alignment_offset;
- u
int
32_t block_per_sec;
- u
int
32_t capabilities;
+ u32_t alignment_offset;
+ u32_t block_per_sec;
+ u32_t capabilities;
struct hba_port* port;
struct hba_port* port;
+ struct ahci_hba* hba;
struct
{
struct
{
@@
-147,6
+158,7
@@
struct hba_port
struct hba_cmd_context cmdctx;
void* fis;
struct hba_device* device;
struct hba_cmd_context cmdctx;
void* fis;
struct hba_device* device;
+ struct ahci_hba* hba;
};
struct ahci_hba
};
struct ahci_hba