438fa5cf9ef7cf707c0fe2a29e712c96038f147b
[lunaix-os.git] / lunaix-os / includes / hal / ahci.h
1 #ifndef __LUNAIX_AHCI_H
2 #define __LUNAIX_AHCI_H
3
4 /*
5  * Macro naming rule:
6  *      HBA_R[xxx]
7  *          HBA Register [xxx]
8  *          e.g. HBA_RPxCLB is Register PxCLB
9  *
10  * All registers offset are 0 based index of a DWORD array
11  */
12
13 #define HBA_RCAP 0
14 #define HBA_RGHC 1
15 #define HBA_RIS 2
16 #define HBA_RPI 3
17 #define HBA_RVER 4
18
19 #define HBA_RPBASE (0x40)
20 #define HBA_RPxCLB 0
21 #define HBA_RPxFB 2
22 #define HBA_RPxIS 4
23 #define HBA_RPxIE 5
24 #define HBA_RPxCMD 6
25 #define HBA_RPxTFD 8
26 #define HBA_RPxSIG 9
27 #define HBA_RPxSSTS 10
28 #define HBA_RPxSCTL 11
29 #define HBA_RPxSERR 12
30 #define HBA_RPxSACT 13
31 #define HBA_RPxCI 14
32 #define HBA_RPxSNTF 15
33 #define HBA_RPxFBS 16
34
35 typedef unsigned int hba_reg_t;
36
37 struct ahci_hba
38 {
39     volatile hba_reg_t* base;
40     unsigned int ports_num;
41     unsigned int port_map;
42     unsigned int version;
43     hba_reg_t* ports[32];
44 };
45
46 void
47 ahci_init();
48
49 #endif /* __LUNAIX_AHCI_H */