2 Copyright © 2013-2019, The AROS Development Team. All rights reserved
5 Desc: A600/A1200/A4000 ATA HIDD
9 #include <aros/debug.h>
10 #include <proto/exec.h>
12 #include <aros/symbolsets.h>
13 #include <hidd/hidd.h>
14 #include <hidd/storage.h>
17 #include <proto/oop.h>
19 #include "bus_class.h"
22 static void GayleATA_Cleanup(struct ataBase
*base
)
24 D(bug("[ATA:Gayle] %s()\n", __func__
);)
25 OOP_ReleaseAttrBase(HiddAttrBase
);
26 OOP_ReleaseAttrBase(HiddATABusAB
);
27 OOP_ReleaseAttrBase(HiddBusAB
);
28 OOP_ReleaseAttrBase(HWAttrBase
);
29 CloseLibrary(base
->cs_UtilityBase
);
32 static int GayleATA_Init(struct ataBase
*base
)
34 D(bug("[ATA:Gayle] %s()\n", __func__
);)
36 base
->cs_UtilityBase
= OpenLibrary("utility.library", 36);
37 if (!base
->cs_UtilityBase
)
40 HiddAttrBase
= OOP_ObtainAttrBase(IID_Hidd
);
41 D(bug("[ATA:Gayle] %s: %s AB %x @ 0x%p\n", __func__
, IID_Hidd
, HiddAttrBase
, &HiddAttrBase
);)
43 HiddBusAB
= OOP_ObtainAttrBase(IID_Hidd_Bus
);
44 D(bug("[ATA:Gayle] %s: %s AB %x @ 0x%p\n", __func__
, IID_Hidd_Bus
, HiddBusAB
, &HiddBusAB
);)
46 HiddATABusAB
= OOP_ObtainAttrBase(IID_Hidd_ATABus
);
47 D(bug("[ATA:Gayle] %s: %s AB %x @ 0x%p\n", __func__
, IID_Hidd_ATABus
, HiddATABusAB
, &HiddATABusAB
);)
49 HWAttrBase
= OOP_ObtainAttrBase(IID_HW
);
50 D(bug("[ATA:Gayle] %s: %s AB %x @ 0x%p\n", __func__
, IID_HW
, HWAttrBase
, &HWAttrBase
);)
52 if (!HiddAttrBase
|| !HiddBusAB
|| !HiddATABusAB
|| !HWAttrBase
)
55 HWBase
= OOP_GetMethodID(IID_HW
, 0);
56 HiddStorageControllerBase
= OOP_GetMethodID(IID_HW
, 0);
58 base
->storageRoot
= OOP_NewObject(NULL
, CLID_Hidd_Storage
, NULL
);
59 if (!base
->storageRoot
)
60 base
->storageRoot
= OOP_NewObject(NULL
, CLID_HW_Root
, NULL
);
61 if (!base
->storageRoot
)
63 GayleATA_Cleanup(base
);
67 D(bug("[ATA:Gayle] %s: storage root @ 0x%p\n", __func__
, base
->storageRoot
);)
69 base
->ataClass
= OOP_FindClass(CLID_Hidd_ATA
);
70 D(bug("[ATA:Gayle] %s: %s @ 0x%p\n", __func__
, CLID_Hidd_ATA
, base
->ataClass
);)
75 static int GayleATA_Expunge(struct ataBase
*base
)
77 D(bug("[ATA:Gayle] %s()\n", __func__
);)
79 GayleATA_Cleanup(base
);
84 ADD2INITLIB(GayleATA_Init
, 0)
85 ADD2EXPUNGELIB(GayleATA_Expunge
, 0)