1fed7ddb4f462b25efb5cfd28aa3eeaa784fd815
[reactos.git] / reactos / drivers / usb / cromwell / linux / pci_hal.c
1 // PCI -> HAL interface
2 // this file is part of linux_wrapper.h
3
4 //FIXME: Move this file, make its definitions more general
5 #include "../host/ohci_main.h"
6
7 /*
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.
10 */
11 static int __inline__ pci_enable_device(struct pci_dev *dev)
12 {
13 DPRINT1("pci_enable_device() called...\n");
14 return 0;
15 }
16
17 // Get physical address where resource x resides
18 static PHYSICAL_ADDRESS __inline__ pci_resource_start (struct pci_dev *dev, int x)
19 {
20 POHCI_DEVICE_EXTENSION dev_ext = (POHCI_DEVICE_EXTENSION)dev->dev_ext;
21 DPRINT1("pci_resource_start() called, x=0x%x\n", x);
22
23 //FIXME: Take x into account
24 return dev_ext->BaseAddress;
25 //return dev->base[x];
26 }
27
28 // ???
29 static unsigned long __inline__ pci_resource_len (struct pci_dev *dev, int x)
30 {
31 POHCI_DEVICE_EXTENSION ext = (POHCI_DEVICE_EXTENSION)dev->dev_ext;
32
33 DPRINT1("pci_resource_len() called, x=0x%x\n", x);
34
35 //FIXME: Take x into account
36 return ext->BaseAddrLength;
37 }
38
39 // ???
40 static int __inline__ pci_resource_flags(struct pci_dev *dev, int x)
41 {
42 DPRINT1("pci_resource_flags() called, x=0x%x\n");
43 return dev->flags[x];
44 }
45
46 /*
47 Enables bus-mastering for device dev
48 */
49 static int __inline__ pci_set_master(struct pci_dev *dev) {return 0;}
50
51 // Store pointer to data for this device
52 static int __inline__ pci_set_drvdata(struct pci_dev *dev, void* d)
53 {
54 DPRINT1("pci_set_drvdata() called...\n");
55 dev->data=(void*)d;
56 return 0;
57 }
58
59 // Get pointer to previously saved data
60 static void __inline__ *pci_get_drvdata(struct pci_dev *dev)
61 {
62 DPRINT1("pci_get_drvdata() called...\n");
63 return dev->data;
64 }
65
66
67 /*
68 ===========================================================================
69 I/O mem related stuff below
70 */
71
72 /*
73 Allocate I/O memory region.
74
75 Parameters:
76 start begin of region
77 n length of region
78 name name of requester
79 */
80 static int __inline__ request_region(PHYSICAL_ADDRESS addr, unsigned long len, const char * d)
81 {
82 DPRINT1("request_region(): addr=0x%x, len=0x%x\n", addr, len);
83 return 0;
84 }
85
86 /*
87 Unmap I/O memory from kernel address space.
88
89 Parameters:
90 addr virtual start address
91
92 */
93 static int __inline__ iounmap(void* p)
94 {
95 DPRINT1("iounmap(): p=0x%x. FIXME - how to obtain len of mapped region?\n", p);
96
97 //MmUnnapIoSpace(p);
98
99 return 0;
100 }
101
102 /*
103 Release I/O port region.
104
105 Parameters:
106 start begin of region
107 n length of region
108 */
109 static int __inline__ release_region(PHYSICAL_ADDRESS addr, unsigned long len)
110 {
111 DPRINT1("release_region(): addr=0x%x, len=0x%x\n", addr, len);
112 return 0;
113 }
114
115 /*
116 Allocate I/O memory region.
117
118 Parameters:
119 start begin of region
120 n length of region
121 name name of requester
122 */
123 static int __inline__ request_mem_region(PHYSICAL_ADDRESS addr, unsigned long len, const char * d)
124 {
125 DPRINT1("request_mem_region(): addr=0x%x, len=0x%x\n", addr, len);
126 return 1;
127 }
128
129 /*
130 Remap I/O memory into kernel address space (no cache).
131
132 Parameters:
133 phys_addr begin of physical address range
134 size size of physical address range
135
136 Returns:
137 virtual start address of mapped range
138 */
139 static void __inline__ *ioremap_nocache(PHYSICAL_ADDRESS addr, unsigned long len)
140 {
141 // MmMapIoSpace with NoCache param
142 DPRINT1("ioremap_nocache(): addr=0x%x, len=0x%x\n", addr, len);
143
144 return MmMapIoSpace(addr, len, MmNonCached);
145 }
146
147 /*
148 Release I/O memory region.
149
150 Parameters:
151 start begin of region
152 n length of region
153 */
154 static int __inline__ release_mem_region(PHYSICAL_ADDRESS addr, unsigned long len)
155 {
156 DPRINT1("release_mem_region(): addr=0x%x, len=0x%x\n", addr, len);
157 return 0;
158 }