2 Copyright © 2013-2019, The AROS Development Team. All rights reserved
9 #include <aros/debug.h>
11 #include <proto/exec.h>
13 /* We want all other bases obtained from our base */
16 #include <proto/oop.h>
18 #include <aros/symbolsets.h>
20 #include <hidd/storage.h>
21 #include <hidd/hidd.h>
24 #include "bus_class.h"
26 static CONST_STRPTR attrBaseIDs
[] =
37 #define AB_MANDATORY 2
39 #if defined(__OOP_NOMETHODBASES__)
40 static CONST_STRPTR
const methBaseIDs
[] =
43 IID_Hidd_StorageController
,
48 static int pciata_init(struct atapciBase
*base
)
50 D(bug("[ATA:PCI] %s()\n", __PRETTY_FUNCTION__
));
52 base
->cs_UtilityBase
= OpenLibrary("utility.library", 36);
53 if (!base
->cs_UtilityBase
)
56 base
->cs_KernelBase
= OpenResource("kernel.resource");
57 if (!base
->cs_KernelBase
)
61 * We handle also legacy ISA devices, so we can work without PCI subsystem.
62 * Because of this, we do not obtain PCI bases here. We do it later, in device
65 if (OOP_ObtainAttrBasesArray(&base
->hiddAttrBase
, &attrBaseIDs
[AB_MANDATORY
]))
68 base
->storageRoot
= OOP_NewObject(NULL
, CLID_Hidd_Storage
, NULL
);
69 if (!base
->storageRoot
)
70 base
->storageRoot
= OOP_NewObject(NULL
, CLID_HW_Root
, NULL
);
71 if (!base
->storageRoot
)
73 OOP_ReleaseAttrBasesArray(&base
->hiddAttrBase
, &attrBaseIDs
[AB_MANDATORY
]);
76 D(bug("[ATA:PCI] %s: storage root @ 0x%p\n", __PRETTY_FUNCTION__
, base
->storageRoot
);)
78 if ((base
->ataClass
= OOP_FindClass(CLID_Hidd_ATA
)) == NULL
)
80 OOP_ReleaseAttrBasesArray(&base
->hiddAttrBase
, &attrBaseIDs
[AB_MANDATORY
]);
84 bug("[ATA:PCI] %s: Base %s Class @ 0x%p\n", __PRETTY_FUNCTION__
, CLID_Hidd_ATA
, base
->ataClass
);
85 bug("[ATA:PCI] %s: PCI %s Class @ 0x%p\n", __PRETTY_FUNCTION__
, CLID_Hidd_ATABus
, base
->busClass
);
88 #if defined(__OOP_NOMETHODBASES__)
89 if (OOP_ObtainMethodBasesArray(&base
->HWMethodBase
, methBaseIDs
))
91 bug("[ATA:PCI] %s: Failed to obtain MethodBases!\n", __PRETTY_FUNCTION__
);
92 bug("[ATA:PCI] %s: %s = %p\n", __PRETTY_FUNCTION__
, methBaseIDs
[0], base
->HWMethodBase
);
93 bug("[ATA:PCI] %s: %s = %p\n", __PRETTY_FUNCTION__
, methBaseIDs
[1], base
->HiddSCMethodBase
);
94 OOP_ReleaseAttrBasesArray(&base
->hiddAttrBase
, attrBaseIDs
);
102 static int pciata_expunge(struct atapciBase
*base
)
104 /* Release all attribute bases */
105 OOP_ReleaseAttrBasesArray(&base
->hiddAttrBase
, &attrBaseIDs
[AB_MANDATORY
]);
107 if (base
->cs_UtilityBase
)
108 CloseLibrary(base
->cs_UtilityBase
);
113 ADD2INITLIB(pciata_init
, 0)
114 ADD2EXPUNGELIB(pciata_expunge
, 0)