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
11 #include <exec/types.h>
14 #include <devices/scsidisk.h>
15 #include <exec/devices.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)
28 #define DEV_UNKNOWN 0x01
31 #define DEV_ATAPI 0x80
32 #define DEV_SATAPI 0x81
33 #define DEV_BROKEN 0xff
37 /* ahci.device base */
41 * Device structure - used to manage devices by Exec
43 struct Device ahci_Device
;
48 struct Task
*ahci_Daemon
;
50 /* Count of all hosts detected */
56 struct MinList ahci_Units
;
63 struct Library
*ahci_OOPBase
;
64 struct Library
*ahci_UtilityBase
;
66 /* Frequently used object offsets */
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
;
83 #if defined(__OOP_NOMETHODBASES__)
84 OOP_MethodID ahci_HiddPCIDeviceMethodBase
;
85 OOP_MethodID ahci_HiddPCIDriverMethodBase
;
86 OOP_MethodID ahci_HWMethodBase
;
88 struct List ahci_Controllers
;
91 #if defined(__OOP_NOATTRBASES__)
93 #define HWAttrBase (AHCIBase->ahci_HWAttrBase)
95 #define HiddBusAB (AHCIBase->ahci_BusAttrBase)
97 #define HiddAHCIBusAB (AHCIBase->ahci_AHCIBusAttrBase)
99 #define HiddAHCIUnitAB (AHCIBase->ahci_AHCIUnitAttrBase)
101 #define HiddAttrBase (AHCIBase->ahci_HiddAttrBase)
102 #undef HiddStorageUnitAB
103 #define HiddStorageUnitAB (AHCIBase->ahci_HiddStorageUnitAttrBase)
105 #if defined(__OOP_NOMETHODBASES__)
107 #define HWBase (AHCIBase->ahci_HWMethodBase)
109 #define OOPBase (AHCIBase->ahci_OOPBase)
110 #define UtilityBase (AHCIBase->ahci_UtilityBase)
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
;
119 const char *dev_revision
;
123 struct ahci_Controller
127 OOP_Object
*ac_Object
;
131 #include <exec/semaphores.h>
134 struct MinNode sim_Node
;
135 struct ahci_port
*sim_Port
;
138 struct SignalSemaphore sim_Lock
;
139 unsigned int sim_Timeout
;
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)
147 struct Task
*sim_Monitor
;
154 struct AHCIBase
*ab_Base
; /* device self */
155 struct ahci_port
*ab_Port
;
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 */
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 */