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: send the command with retry and error detection
[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 f65a93d460563202679337bf66d8706dda49eb69..8203ab5e6f902880961f7d3236fecfb99e394cb3 100644
(file)
--- a/
lunaix-os/includes/hal/ahci/hba.h
+++ b/
lunaix-os/includes/hal/ahci/hba.h
@@
-1,7
+1,7
@@
#ifndef __LUNAIX_HBA_H
#define __LUNAIX_HBA_H
#ifndef __LUNAIX_HBA_H
#define __LUNAIX_HBA_H
-#include <
stdint
.h>
+#include <
lunaix/types
.h>
#define HBA_RCAP 0
#define HBA_RGHC 1
#define HBA_RCAP 0
#define HBA_RGHC 1
@@
-31,8
+31,10
@@
#define HBA_PxCMD_FR (1 << 14)
#define HBA_PxCMD_ST (1)
#define HBA_PxINTR_DMA (1 << 2)
#define HBA_PxCMD_FR (1 << 14)
#define HBA_PxCMD_ST (1)
#define HBA_PxINTR_DMA (1 << 2)
-#define HBA_PxINTR_D
2
HR (1)
+#define HBA_PxINTR_DHR (1)
#define HBA_PxINTR_DPS (1 << 5)
#define HBA_PxINTR_DPS (1 << 5)
+#define HBA_PxINTR_TFEE (1 << 30)
+#define HBA_PxINTR_IFE (1 << 27)
#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)
@@
-45,6
+47,8
@@
#define HBA_RPxSSTS_IF(x) (((x) >> 4) & 0xf)
#define HBA_RPxSSTS_PHYSTATE(x) ((x)&0xf)
#define HBA_RPxSSTS_IF(x) (((x) >> 4) & 0xf)
#define HBA_RPxSSTS_PHYSTATE(x) ((x)&0xf)
+#define hba_clear_reg(reg) (reg) = -1
+
#define HBA_DEV_SIG_ATAPI 0xeb140101
#define HBA_DEV_SIG_ATA 0x00000101
#define HBA_DEV_SIG_ATAPI 0xeb140101
#define HBA_DEV_SIG_ATA 0x00000101
@@
-100,20
+104,26
@@
struct hba_device
uint32_t block_size;
uint64_t wwn;
uint8_t cbd_size;
uint32_t block_size;
uint64_t wwn;
uint8_t cbd_size;
- uint8_t last_error;
- uint8_t last_status;
+ struct
+ {
+ uint8_t sense_key;
+ uint8_t error;
+ uint8_t status;
+ uint8_t reserve;
+ } last_result;
uint32_t alignment_offset;
uint32_t block_per_sec;
uint32_t capabilities;
uint32_t alignment_offset;
uint32_t block_per_sec;
uint32_t capabilities;
+ struct hba_port* port;
struct
{
struct
{
- int (*identify)(struct hba_
port* port
);
- int (*read_buffer)(struct hba_
port* port
,
+ int (*identify)(struct hba_
device* dev
);
+ int (*read_buffer)(struct hba_
device* dev
,
uint64_t lba,
void* buffer,
uint32_t size);
uint64_t lba,
void* buffer,
uint32_t size);
- int (*write_buffer)(struct hba_
port* port
,
+ int (*write_buffer)(struct hba_
device* dev
,
uint64_t lba,
void* buffer,
uint32_t size);
uint64_t lba,
void* buffer,
uint32_t size);