revert between 56095 -> 55830 in arch
[AROS.git] / rom / devs / ahci / ahci_intern.h
blobc065e7ad8ca6986050bd1df39f58153f1a25b0f5
1 /*
2 * Copyright (C) 2011-2018, The AROS Development Team. All rights reserved.
3 * Author: Jason S. McMullan <jason.mcmullan@gmail.com>
5 * Licensed under the AROS PUBLIC LICENSE (APL) Version 1.1
6 */
8 #ifndef AHCI_INTERN_H
9 #define AHCI_INTERN_H
11 #include <exec/types.h>
12 #include <asm/io.h>
14 #include <devices/scsidisk.h>
15 #include <exec/devices.h>
17 #include <oop/oop.h>
18 #include <utility/hooks.h>
20 #include <hardware/ahci.h>
21 #include <hidd/ahci.h>
23 #define Unit(io) ((struct ahci_Unit *)(io)->io_Unit)
24 #define IOStdReq(io) ((struct IOStdReq *)io)
26 /* Device types */
27 #define DEV_NONE 0x00
28 #define DEV_UNKNOWN 0x01
29 #define DEV_ATA 0x02
30 #define DEV_SATA 0x03
31 #define DEV_ATAPI 0x80
32 #define DEV_SATAPI 0x81
33 #define DEV_BROKEN 0xff
35 struct ahci_port;
37 /* ahci.device base */
38 struct AHCIBase
41 * Device structure - used to manage devices by Exec
43 struct Device ahci_Device;
46 * master task pointer
48 struct Task *ahci_Daemon;
50 /* Count of all hosts detected */
51 ULONG ahci_HostCount;
54 * List of all units
56 struct MinList ahci_Units;
59 * memory pool
61 APTR ahci_MemPool;
63 struct Library *ahci_OOPBase;
64 struct Library *ahci_UtilityBase;
66 /* Frequently used object offsets */
67 OOP_Class *ahciClass;
68 OOP_Class *busClass;
69 OOP_Class *unitClass;
71 OOP_Object *storageRoot;
73 #if defined(__OOP_NOATTRBASES__)
74 OOP_AttrBase ahci_HWAttrBase;
75 OOP_AttrBase ahci_HiddAttrBase;
76 OOP_AttrBase ahci_HiddPCIDeviceAttrBase;
77 OOP_AttrBase ahci_HiddStorageUnitAttrBase;
78 OOP_AttrBase ahci_AHCIAttrBase;
79 OOP_AttrBase ahci_BusAttrBase;
80 OOP_AttrBase ahci_AHCIBusAttrBase;
81 OOP_AttrBase ahci_AHCIUnitAttrBase;
82 #endif
83 #if defined(__OOP_NOMETHODBASES__)
84 OOP_MethodID ahci_HiddPCIDeviceMethodBase;
85 OOP_MethodID ahci_HiddPCIDriverMethodBase;
86 OOP_MethodID ahci_HWMethodBase;
87 #endif
88 struct List ahci_Controllers;
91 #if defined(__OOP_NOATTRBASES__)
92 #undef HWAttrBase
93 #define HWAttrBase (AHCIBase->ahci_HWAttrBase)
94 #undef HiddBusAB
95 #define HiddBusAB (AHCIBase->ahci_BusAttrBase)
96 #undef HiddAHCIBusAB
97 #define HiddAHCIBusAB (AHCIBase->ahci_AHCIBusAttrBase)
98 #undef HiddAHCIUnitAB
99 #define HiddAHCIUnitAB (AHCIBase->ahci_AHCIUnitAttrBase)
100 #undef HiddAttrBase
101 #define HiddAttrBase (AHCIBase->ahci_HiddAttrBase)
102 #undef HiddStorageUnitAB
103 #define HiddStorageUnitAB (AHCIBase->ahci_HiddStorageUnitAttrBase)
104 #endif
105 #if defined(__OOP_NOMETHODBASES__)
106 #undef HWBase
107 #define HWBase (AHCIBase->ahci_HWMethodBase)
108 #endif
109 #define OOPBase (AHCIBase->ahci_OOPBase)
110 #define UtilityBase (AHCIBase->ahci_UtilityBase)
112 typedef struct {
113 struct MinNode dev_Node;
114 struct AHCIBase *dev_AHCIBase;
115 OOP_Object *dev_Controller; /* AHCI HW Controller Object */
116 OOP_Object *dev_Object; /* PCI Device Object */
117 struct ahci_softc *dev_softc;
118 const char *dev_gen;
119 const char *dev_revision;
120 ULONG dev_HostID;
121 } *device_t;
123 struct ahci_Controller
125 struct Node ac_Node;
126 OOP_Class *ac_Class;
127 OOP_Object *ac_Object;
128 device_t ac_dev;
131 #include <exec/semaphores.h>
133 struct cam_sim {
134 struct MinNode sim_Node;
135 struct ahci_port *sim_Port;
136 ULONG sim_Unit;
137 ULONG sim_UseCount;
138 struct SignalSemaphore sim_Lock;
139 unsigned int sim_Timeout;
140 struct List sim_IOs;
141 ULONG sim_Flags;
142 #define SIMB_MediaPresent 0 /* Media is present */
143 #define SIMB_OffLine 1 /* No new IOs are permitted */
144 #define SIMF_MediaPresent (1 << SIMB_MediaPresent)
145 #define SIMF_OffLine (1 << SIMB_OffLine)
146 ULONG sim_ChangeNum;
147 struct Task *sim_Monitor;
150 struct ahci_Unit;
152 struct ahci_Bus
154 struct AHCIBase *ab_Base; /* device self */
155 struct ahci_port *ab_Port;
156 OOP_Object *ab_Unit;
159 struct ahci_Unit
161 struct Unit au_Unit; /* exec's unit */
162 struct ahci_Bus *au_Bus; /* Bus on which this unit is */
163 ULONG au_UnitNum; /* Unit number as coded by device */
164 UBYTE au_Model[41];
165 UBYTE au_FirmwareRev[9];
166 UBYTE au_SerialNumber[21];
169 /* Function prototypes */
171 BOOL Hidd_AHCIBus_Start(OOP_Object *, struct AHCIBase *);
172 AROS_UFP3(BOOL, Hidd_AHCIBus_Open,
173 AROS_UFPA(struct Hook *, h, A0),
174 AROS_UFPA(OOP_Object *, obj, A2),
175 AROS_UFPA(IPTR, reqUnit, A1));
177 #endif /* AHCI_INTERN_H */