1 // PCI -> HAL interface
2 // this file is part of linux_wrapper.h
4 //FIXME: Move this file, make its definitions more general
5 #include "../host/ohci_main.h"
8 Initialize device before it's used by a driver. Ask low-level code to enable I/O and memory.
9 Wake up the device if it was suspended. Beware, this function can fail.
11 static int __inline__
pci_enable_device(struct pci_dev
*dev
)
13 DPRINT1("pci_enable_device() called...\n");
17 // Get physical address where resource x resides
18 static PHYSICAL_ADDRESS __inline__
pci_resource_start (struct pci_dev
*dev
, int x
)
20 POHCI_DEVICE_EXTENSION dev_ext
= (POHCI_DEVICE_EXTENSION
)dev
->dev_ext
;
21 DPRINT1("pci_resource_start() called, x=0x%x\n", x
);
23 //FIXME: Take x into account
24 return dev_ext
->BaseAddress
;
25 //return dev->base[x];
29 static unsigned long __inline__
pci_resource_len (struct pci_dev
*dev
, int x
)
31 POHCI_DEVICE_EXTENSION ext
= (POHCI_DEVICE_EXTENSION
)dev
->dev_ext
;
33 DPRINT1("pci_resource_len() called, x=0x%x\n", x
);
35 //FIXME: Take x into account
36 return ext
->BaseAddrLength
;
40 static int __inline__
pci_resource_flags(struct pci_dev
*dev
, int x
)
42 POHCI_DEVICE_EXTENSION ext
= (POHCI_DEVICE_EXTENSION
)dev
->dev_ext
;
44 DPRINT1("pci_resource_flags() called, x=0x%x\n", x
);
46 //FIXME: Take x into account
51 Enables bus-mastering for device dev
53 static int __inline__
pci_set_master(struct pci_dev
*dev
) {return 0;}
55 // Store pointer to data for this device
56 static int __inline__
pci_set_drvdata(struct pci_dev
*dev
, void* d
)
58 DPRINT1("pci_set_drvdata() called...\n");
63 // Get pointer to previously saved data
64 static void __inline__
*pci_get_drvdata(struct pci_dev
*dev
)
66 DPRINT1("pci_get_drvdata() called...\n");
72 ===========================================================================
73 I/O mem related stuff below
77 Allocate I/O memory region.
82 name name of requester
84 static int __inline__
request_region(PHYSICAL_ADDRESS addr
, unsigned long len
, const char * d
)
86 DPRINT1("request_region(): addr=0x%lx, len=0x%lx\n", addr
.u
.LowPart
, len
);
91 Unmap I/O memory from kernel address space.
94 addr virtual start address
97 static int __inline__
iounmap(void* p
)
99 DPRINT1("iounmap(): p=0x%x. FIXME - how to obtain len of mapped region?\n", p
);
107 Release I/O port region.
110 start begin of region
113 static int __inline__
release_region(PHYSICAL_ADDRESS addr
, unsigned long len
)
115 DPRINT1("release_region(): addr=0x%lx, len=0x%lx\n", addr
.u
.LowPart
, len
);
120 Allocate I/O memory region.
123 start begin of region
125 name name of requester
127 static int __inline__
request_mem_region(PHYSICAL_ADDRESS addr
, unsigned long len
, const char * d
)
129 DPRINT1("request_mem_region(): addr=0x%lx, len=0x%lx\n", addr
.u
.LowPart
, len
);
134 Remap I/O memory into kernel address space (no cache).
137 phys_addr begin of physical address range
138 size size of physical address range
141 virtual start address of mapped range
143 static void __inline__
*ioremap_nocache(PHYSICAL_ADDRESS addr
, unsigned long len
)
145 // MmMapIoSpace with NoCache param
146 DPRINT1("ioremap_nocache(): addr=0x%lx, len=0x%lx\n", addr
.u
.LowPart
, len
);
148 return MmMapIoSpace(addr
, len
, MmNonCached
);
152 Release I/O memory region.
155 start begin of region
158 static int __inline__
release_mem_region(PHYSICAL_ADDRESS addr
, unsigned long len
)
160 DPRINT1("release_mem_region(): addr=0x%lx, len=0x%lx\n", addr
.u
.LowPart
, len
);