2 Copyright © 2003-2006, The AROS Development Team. All rights reserved.
6 #include <aros/libcall.h>
7 #include <aros/asmcall.h>
9 #include <exec/execbase.h>
10 #include <exec/types.h>
11 #include <exec/resident.h>
12 #include <exec/libraries.h>
13 #include <exec/memory.h>
14 #include <exec/lists.h>
20 #include <utility/utility.h>
22 //#include "/usr/include/asm/unistd.h"
24 #include <proto/exec.h>
25 #include <proto/oop.h>
27 #include <aros/symbolsets.h>
30 #include <aros/debug.h>
35 #define __NR_iopl (110)
37 #define __NR_close (6)
39 static int PCILx_Init(LIBBASETYPEPTR LIBBASE
)
41 D(bug("LinuxPCI: Initializing\n"));
48 :"a"(__NR_iopl
),"b"(3)
53 :"=a"(LIBBASE
->psd
.fd
)
54 :"a"(__NR_open
),"b"("/dev/mem"),"c"(2)
57 D(bug("LinuxPCI: iopl(3)=%d\n", ret
));
58 D(bug("LinuxPCI: /dev/mem fd=%d\n", LIBBASE
->psd
.fd
));
65 D(bug("LinuxPCI: has to be root in order to use this hidd\n"));
71 static int PCILx_Expunge(LIBBASETYPEPTR LIBBASE
)
75 D(bug("[PCILinux] expunge\n"));
77 /* Try to open PCI subsystem */
78 OOP_Object
*pci
= OOP_NewObject(NULL
, CLID_Hidd_PCI
, NULL
);
81 /* If PCI successed to open, remove your driver from subsystem */
82 struct pHidd_PCI_RemHardwareDriver msg
;
84 msg
.driverClass
= LIBBASE
->psd
.driverClass
;
85 msg
.mID
= OOP_GetMethodID(IID_Hidd_PCI
, moHidd_PCI_RemHardwareDriver
);
87 D(bug("[PCILinux] Removing driver\n"));
88 if (OOP_DoMethod(pci
, (OOP_Msg
)&msg
) == FALSE
)
91 D(bug("[PCILinux] PCI class refused to remove driver for some reason. Delaying expunge then\n"));
93 OOP_DisposeObject(pci
);
99 ADD2INITLIB(PCILx_Init
, 0)
100 ADD2EXPUNGELIB(PCILx_Expunge
, 0)