2 Copyright © 2003-2006, The AROS Development Team. All rights reserved.
6 #include <aros/symbolsets.h>
8 #include <exec/execbase.h>
9 #include <exec/types.h>
10 #include <exec/resident.h>
11 #include <exec/libraries.h>
12 #include <exec/memory.h>
13 #include <exec/lists.h>
14 #include <exec/semaphores.h>
17 #include <utility/utility.h>
21 #include <proto/exec.h>
22 #include <proto/oop.h>
23 #include <aros/debug.h>
27 #include LC_LIBDEFS_FILE
29 static int PCI_Init(LIBBASETYPEPTR LIBBASE
)
31 D(bug("[PCI] Initializing PCI system\n"));
32 LIBBASE
->MemPool
= CreatePool(MEMF_CLEAR
| MEMF_PUBLIC
, 8192, 4096);
33 D(bug("[PCI] Created pool 0x%p\n", LIBBASE
->MemPool
));
35 LIBBASE
->psd
.MemPool
= LIBBASE
->MemPool
;
37 InitSemaphore(&LIBBASE
->psd
.driver_lock
);
38 NEWLIST(&LIBBASE
->psd
.drivers
);
40 return LIBBASE
->psd
.MemPool
!= NULL
;
43 static int PCI_Expunge(LIBBASETYPEPTR LIBBASE
)
45 #if 0 // Removing of drivers already done by driver classes
47 Ok. Class is not used ATM and therefore it is safe (well
48 Disable/Enable protected) to iterate through driver lists and free
49 everything that can be freed
51 D(bug("[PCI] Expunging drivers and devices\n"));
52 ForeachNodeSafe(&LIBBASE
->psd
.drivers
, (struct Node
*)dn
, (struct Node
*)next
)
54 struct PciDevice
*dev
, *next
;
56 Remove((struct Node
*)dn
);
58 /* For every device */
59 ForeachNodeSafe(&dn
->devices
, (struct Node
*)dev
, (struct Node
*)next
)
61 /* Dispose PCIDevice object instance */
62 OOP_DisposeObject(dev
->device
);
64 /* Remove device from device list */
65 Remove((struct Node
*)dev
);
69 OOP_DisposeObject(dn
->driverObject
);
72 /* All objects deleted by now. Free classes */
75 D(bug("[PCI] Destroying MemoryPool\n"));
76 DeletePool(LIBBASE
->MemPool
);
78 D(bug("[PCI] Goodbye\n"));
83 ADD2INITLIB(PCI_Init
, 0)
84 ADD2EXPUNGELIB(PCI_Expunge
, 0)