grub2: bring back build of aros-side grub2 tools
[AROS.git] / rom / hidds / ata_pci / class_init.c
blob0f076f16f08f256e0e3191519ab3ca63f76203bd
1 /*
2 Copyright © 2013, The AROS Development Team. All rights reserved
3 $Id$
5 Desc:
6 Lang: English
7 */
9 #include <aros/symbolsets.h>
10 #include <hidd/ata.h>
11 #include <hidd/hidd.h>
12 #include <hidd/pci.h>
13 #include <proto/exec.h>
14 #include <proto/oop.h>
16 #include "bus_class.h"
18 static CONST_STRPTR attrBaseIDs[] =
20 IID_Hidd_PCIDevice,
21 IID_Hidd_PCIDriver,
22 IID_Hidd,
23 IID_Hidd_ATABus,
24 NULL
27 #define AB_MANDATORY 2
29 static int pciata_init(struct ataBase *base)
31 base->cs_UtilityBase = OpenLibrary("utility.library", 36);
32 if (!base->cs_UtilityBase)
33 return FALSE;
35 base->cs_KernelBase = OpenResource("kernel.resource");
36 if (!base->cs_KernelBase)
37 return FALSE;
40 * We handle also legacy ISA devices, so we can work without PCI subsystem.
41 * Because of this, we do not obtain PCI bases here. We do it later, in device
42 * discovery code.
44 if (OOP_ObtainAttrBasesArray(&base->hiddAttrBase, &attrBaseIDs[AB_MANDATORY]))
45 return FALSE;
47 return TRUE;
50 static int pciata_expunge(struct ataBase *base)
52 /* Release all attribute bases */
53 OOP_ReleaseAttrBasesArray(&base->hiddAttrBase, attrBaseIDs);
55 if (base->cs_UtilityBase)
56 CloseLibrary(base->cs_UtilityBase);
58 return TRUE;
61 ADD2INITLIB(pciata_init, 0)
62 ADD2EXPUNGELIB(pciata_expunge, 0)