chore: fix almost *ALL* warnings.
[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 struct ahci_driver
18 {
19     struct llist_header ahci_drvs;
20     struct ahci_hba hba;
21     int id;
22 };
23
24 /**
25  * @brief 初始化AHCI与HBA
26  *
27  */
28 void
29 ahci_init();
30
31 void
32 ahci_parse_dev_info(struct hba_device* dev_info, u16_t* data);
33
34 void
35 ahci_parsestr(char* str, u16_t* reg_start, int size_word);
36
37 /**
38  * @brief Issue a HBA command (synchronized)
39  *
40  * @param port
41  * @param slot
42  * @return int
43  */
44 int
45 ahci_try_send(struct hba_port* port, int slot);
46
47 /**
48  * @brief Issue a HBA command (asynchronized)
49  *
50  * @param port
51  * @param state
52  * @param slot
53  */
54 void
55 ahci_post(struct hba_port* port, struct hba_cmd_state* state, int slot);
56
57 #endif /* __LUNAIX_AHCI_H */