7052b3d8a0ca239d4d66a7f54fde5d6a4df3557c
[tpg/acess2.git] / KernelLand / Modules / Storage / AHCI / ahci.h
1 /*
2  * Acess2 Kernel - AHCI Driver
3  * - By John Hodge (thePowersGang)
4  *
5  * ahci.h
6  * - Driver header
7  */
8 #ifndef _AHCI__AHCI_H_
9 #define _AHCI__AHCI_H_
10
11 #include "ahci_hw.h"
12 #include <Storage/LVM/include/lvm.h>
13 #include <stdbool.h>
14 #include <mutex.h>
15 #include <semaphore.h>
16 #include <events.h>
17
18 typedef struct sAHCI_Ctrlr      tAHCI_Ctrlr;
19 typedef struct sAHCI_Port       tAHCI_Port;
20
21 struct sAHCI_Ctrlr
22 {
23          int    IRQ;
24         tPAddr  PMemBase;
25         tAHCI_MemSpace  *MMIO;
26         
27         bool    Supports64Bit;
28
29          int    NCS;
30         
31          int    PortCount;
32         tAHCI_Port      *Ports;
33 };
34
35 struct sAHCI_Port
36 {
37          int    Idx;    // Hardware index
38         tAHCI_Ctrlr     *Ctrlr;
39         volatile struct s_port  *MMIO;
40
41         tMutex  lCommandSlots;
42         Uint32  IssuedCommands;
43         volatile struct sAHCI_CmdHdr    *CmdList;
44         struct sAHCI_CmdTable   *CommandTables[32];
45         tThread *CommandThreads[32];
46         volatile struct sAHCI_RcvdFIS   *RcvdFIS;
47
48         tSemaphore      InterruptSem;
49         Uint32  LastIS;
50
51         bool    bHotplug;
52         bool    bPresent;
53         bool    bATAPI;
54
55         void    *LVMHandle;
56 };
57
58 #endif
59

UCC git Repository :: git.ucc.asn.au