2 Copyright (C) 2018, The AROS Development Team. All rights reserved.
6 #include <aros/debug.h>
8 /* We want all other bases obtained from our base */
11 #include <hidd/storage.h>
12 #include <hidd/ahci.h>
13 #include <hidd/hidd.h>
15 #include <utility/tagitem.h>
16 #include <proto/utility.h>
20 extern int ahci_attach(device_t dev
);
21 extern void ahci_release(device_t dev
);
23 OOP_Object
*AHCI__Root__New(OOP_Class
*cl
, OOP_Object
*o
, struct pRoot_New
*msg
)
25 struct AHCIBase
*AHCIBase
= (struct AHCIBase
*)cl
->UserData
;
27 device_t dev
= (device_t
)GetTagData(aHidd_DriverData
, 0, msg
->attrList
);
29 OOP_Object
*ahciController
= (OOP_Object
*)OOP_DoSuperMethod(cl
, o
, (OOP_Msg
)msg
);
32 struct ahci_Controller
*data
= OOP_INST_DATA(cl
, ahciController
);
33 // D(bug ("[AHCI:Controller] Root__New: New '%s' Controller Obj @ %p\n", new_tags[0].ti_Data, ahciController);)
35 /*register the controller in ahci.device */
36 D(bug ("[AHCI:Controller] Root__New: Controller Entry @ %p\n", data
);)
37 D(bug ("[AHCI:Controller] Root__New: Controller Data @ %p\n", dev
);)
40 data
->ac_Object
= ahciController
;
41 if ((data
->ac_dev
= dev
) != NULL
)
42 dev
->dev_Controller
= ahciController
;
44 AddTail(&AHCIBase
->ahci_Controllers
, &data
->ac_Node
);
46 return ahciController
;
49 VOID
AHCI__Root__Dispose(OOP_Class
*cl
, OOP_Object
*o
, OOP_Msg msg
)
51 struct AHCIBase
*AHCIBase
= cl
->UserData
;
52 struct ahci_Controller
*ahciNode
, *tmpNode
;
53 D(bug ("[AHCI:Controller] Root__Dispose(%p)\n", o
);)
54 ForeachNodeSafe (&AHCIBase
->ahci_Controllers
, ahciNode
, tmpNode
)
56 if (ahciNode
->ac_Object
== o
)
58 D(bug ("[AHCI:Controller] Root__Dispose: Destroying Controller Entry @ %p\n", ahciNode
);)
59 Remove(&ahciNode
->ac_Node
);
64 BOOL
AHCI__Hidd_StorageController__RemoveBus(OOP_Class
*cl
, OOP_Object
*o
, struct pHidd_StorageController_RemoveBus
*Msg
)
66 D(bug ("[AHCI:Controller] Hidd_StorageController__RemoveBus(%p)\n", o
);)
68 * Currently we don't support unloading AHCI bus drivers.
69 * This is a very-very big TODO.
74 BOOL
AHCI__Hidd_StorageController__SetUpBus(OOP_Class
*cl
, OOP_Object
*o
, struct pHidd_StorageController_SetUpBus
*Msg
)
76 struct AHCIBase
*AHCIBase
= cl
->UserData
;
78 struct ahci_Controller
*data
= OOP_INST_DATA(cl
, o
);
81 D(bug ("[AHCI:Controller] Hidd_StorageController__SetUpBus(%p)\n", Msg
->busObject
);)
83 /* Add the bus to the device and start service */
84 return Hidd_AHCIBus_Start(Msg
->busObject
, AHCIBase
);
87 void AHCI__Hidd_StorageController__CleanUpBus(OOP_Class
*cl
, OOP_Object
*o
, struct pHidd_StorageController_CleanUpBus
*msg
)
89 D(bug ("[AHCI:Controller] Hidd_StorageController__CleanUpBus(%p)\n", o
);)
90 /* By default we have nothing to do here */