refactor: send the command with retry and error detection
[lunaix-os.git] / lunaix-os / includes / hal / ahci / ahci.h
1 #ifndef __LUNAIX_AHCI_H
2 #define __LUNAIX_AHCI_H
3
4 #include "hba.h"
5
6 /*
7  * Macro naming rule:
8  *      HBA_R[xxx]
9  *          HBA Register [xxx]
10  *          e.g. HBA_RPxCLB is Register PxCLB
11  *
12  * All registers offset are 0 based index of a DWORD array
13  */
14
15 #define AHCI_HBA_CLASS 0x10601
16
17 /**
18  * @brief 初始化AHCI与HBA
19  *
20  */
21 void
22 ahci_init();
23
24 void
25 ahci_list_device();
26
27 unsigned int
28 ahci_get_port_usage();
29
30 struct hba_port*
31 ahci_get_port(unsigned int index);
32
33 void
34 ahci_parse_dev_info(struct hba_device* dev_info, uint16_t* data);
35
36 void
37 ahci_parsestr(char* str, uint16_t* reg_start, int size_word);
38
39 int
40 ahci_try_send(struct hba_port* port, int slot);
41
42 #endif /* __LUNAIX_AHCI_H */