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
Merge branch 'iso-9660' into block-io
[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 d836a78a423967ecd7349ec9360b805d71b9061b..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,7
+31,13
@@
#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_D2HR (1)
+#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_PxTFD_ERR (1)
+#define HBA_PxTFD_BSY (1 << 7)
+#define HBA_PxTFD_DRQ (1 << 3)
#define HBA_RGHC_ACHI_ENABLE (1 << 31)
#define HBA_RGHC_INTR_ENABLE (1 << 1)
#define HBA_RGHC_ACHI_ENABLE (1 << 31)
#define HBA_RGHC_INTR_ENABLE (1 << 1)
@@
-41,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
@@
-82,15
+90,44
@@
struct hba_cmdt
struct hba_prdte entries[3];
} __HBA_PACKED__;
struct hba_prdte entries[3];
} __HBA_PACKED__;
+#define HBA_DEV_FEXTLBA 1
+#define HBA_DEV_FATAPI (1 << 1)
+
+struct hba_port;
+
struct hba_device
{
char serial_num[20];
char model[40];
struct hba_device
{
char serial_num[20];
char model[40];
- uint32_t
signature
;
- uint
32
_t max_lba;
+ uint32_t
flags
;
+ uint
64
_t max_lba;
uint32_t block_size;
uint32_t block_size;
- uint
8_t wwn[8]
;
+ uint
64_t wwn
;
uint8_t cbd_size;
uint8_t cbd_size;
+ 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;
+ struct hba_port* port;
+
+ struct
+ {
+ int (*identify)(struct hba_device* dev);
+ int (*read_buffer)(struct hba_device* dev,
+ uint64_t lba,
+ void* buffer,
+ uint32_t size);
+ int (*write_buffer)(struct hba_device* dev,
+ uint64_t lba,
+ void* buffer,
+ uint32_t size);
+ } ops;
};
struct hba_port
};
struct hba_port
@@
-98,7
+135,7
@@
struct hba_port
volatile hba_reg_t* regs;
unsigned int ssts;
struct hba_cmdh* cmdlst;
volatile hba_reg_t* regs;
unsigned int ssts;
struct hba_cmdh* cmdlst;
-
struct sata_fis_hea
d* fis;
+
voi
d* fis;
struct hba_device* device;
};
struct hba_device* device;
};
@@
-106,15
+143,17
@@
struct ahci_hba
{
volatile hba_reg_t* base;
unsigned int ports_num;
{
volatile hba_reg_t* base;
unsigned int ports_num;
+ unsigned int ports_bmp;
unsigned int cmd_slots;
unsigned int version;
struct hba_port* ports[32];
};
int
unsigned int cmd_slots;
unsigned int version;
struct hba_port* ports[32];
};
int
-hba_alloc_slot(struct hba_port* port,
- struct hba_cmdt** cmdt,
- struct hba_cmdh** cmdh,
- uint16_t header_options);
+hba_prepare_cmd(struct hba_port* port,
+ struct hba_cmdt** cmdt,
+ struct hba_cmdh** cmdh,
+ void* buffer,
+ unsigned int size);
#endif /* __LUNAIX_HBA_H */
#endif /* __LUNAIX_HBA_H */