2 Copyright (C) 2018-2019, The AROS Development Team.
6 #include <aros/debug.h>
8 #define __STORAGE_NOLIBBASE__
10 #include <proto/sysexp.h>
11 #include <proto/storage.h>
13 #include <proto/alib.h>
14 #include <proto/dos.h>
15 #include <proto/exec.h>
16 #include <proto/muimaster.h>
17 #include <proto/oop.h>
18 #include <proto/utility.h>
19 #include <proto/intuition.h>
21 #include <zune/customclasses.h>
22 #include <mui/NListtree_mcc.h>
23 #include <mui/NListview_mcc.h>
24 #include <utility/tagitem.h>
25 #include <utility/hooks.h>
27 #include <hidd/storage.h>
28 #include <hidd/hidd.h>
29 #include <hidd/ahci.h>
34 #include "ahci_classes.h"
35 #include "ahci_intern.h"
37 extern int AHCIBusWindow_Initialize(struct SysexpBase
*SysexpBase
);
38 extern void AHCIBusWindow_Deinitialize(struct SysexpBase
*SysexpBase
);
39 extern int AHCIUnitWindow_Initialize(struct SysexpBase
*SysexpBase
);
40 extern void AHCIUnitWindow_Deinitialize(struct SysexpBase
*SysexpBase
);
42 #if (1) // TODO : Move into libbase
43 extern OOP_AttrBase HiddStorageUnitAB
;
44 extern OOP_AttrBase HiddAHCIUnitAB
;
47 struct MUI_CustomClass
*DevicePage_CLASS
;
49 AROS_UFH3S(BOOL
, ahciunitenumFunc
,
50 AROS_UFHA(struct Hook
*, h
, A0
),
51 AROS_UFHA(OOP_Object
*, unit
, A2
),
52 AROS_UFHA(void *, parent
, A1
))
56 struct SysexpEnum_data
*edata
= (struct SysexpEnum_data
*)h
->h_Data
;
57 struct InsertObjectMsg msg
=
62 struct SysexpBase
*SysexpBase
;
63 struct SysexpAHCIBase
*AhciBase
;
65 D(bug("[ahci.sysexp] %s()\n", __func__
));
70 SysexpBase
= edata
->ed_sysexpbase
;
72 D(bug("[ahci.sysexp] ahciunit @ %p\n", unit
));
76 AhciBase
= GetBase("AHCI.Module");
77 msg
.winClass
= AhciBase
->seab_AHCIUnitWindowCLASS
;
78 SysexpBase
->GlobalCount
++;
80 OOP_GetAttr(unit
, aHidd_StorageUnit_Model
, (IPTR
*)&name
);
81 DoMethod(SysexpBase
->sesb_Tree
, MUIM_NListtree_Insert
, name
, &msg
,
82 parent
, MUIV_NListtree_Insert_PrevNode_Tail
, 0);
84 return FALSE
; /* Continue enumeration */
89 struct SysexpStorageBase
*StorageBase
;
90 static struct SysexpEnum_data privatehookdata
=
96 static void ahciBusEnum(OOP_Object
*obj
, struct MUI_NListtree_TreeNode
*parent
)
98 D(bug("[ahci.sysexp] ahcibus: \n"));
100 EnumBusUnits(obj
, parent
, ahciunitenumFunc
, &privatehookdata
);
103 void AHCIStartup(struct SysexpBase
*SysexpBase
)
105 struct SysexpAHCIBase
*AhciBase
;
106 D(bug("[ahci.sysexp] %s(%p)\n", __func__
, SysexpBase
));
108 StorageBase
= GetBase("Storage.Module");
109 D(bug("[ahci.sysexp] %s: StorageBase @ %p\n", __func__
, StorageBase
));
114 "AHCI enumerator requires `storage.sysexp'.", NULL
117 AhciBase
= GetBase("AHCI.Module");
118 D(bug("[ahci.sysexp] %s: AhciBase @ %p\n", __func__
, AhciBase
));
120 privatehookdata
.ed_sysexpbase
= SysexpBase
;
122 AhciBase
->seab_DevicePageCLASS
= GetBase("DevicePage.Class");
123 AhciBase
->seab_GenericWindowCLASS
= GetBase("GenericWindow.Class");
125 AHCIBusWindow_Initialize(SysexpBase
);
126 AHCIUnitWindow_Initialize(SysexpBase
);
128 RegisterStorageControllerHandler((CONST_STRPTR
)CLID_Hidd_AHCI
, 90, AhciBase
->seab_GenericWindowCLASS
, NULL
, NULL
);
129 RegisterStorageBusHandler((CONST_STRPTR
)CLID_Hidd_AHCIBus
, 90, AhciBase
->seab_AHCIBusWindowCLASS
, ahciBusEnum
, NULL
);
132 void AHCIShutdown(struct SysexpBase
*SysexpBase
)
134 D(bug("[ahci.sysexp] %s(%p)\n", __func__
, SysexpBase
));
136 AHCIUnitWindow_Deinitialize(SysexpBase
);
137 AHCIBusWindow_Deinitialize(SysexpBase
);