Blame view
drivers/misc/ioc4.c
14.4 KB
1da177e4c Linux-2.6.12-rc2 |
1 2 3 4 5 |
/* * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. * |
107d5a72f [PATCH] ioc4: Rem... |
6 |
* Copyright (C) 2005-2006 Silicon Graphics, Inc. All Rights Reserved. |
1da177e4c Linux-2.6.12-rc2 |
7 |
*/ |
22329b511 [PATCH] ioc4: Cor... |
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
/* This file contains the master driver module for use by SGI IOC4 subdrivers. * * It allocates any resources shared between multiple subdevices, and * provides accessor functions (where needed) and the like for those * resources. It also provides a mechanism for the subdevice modules * to support loading and unloading. * * Non-shared resources (e.g. external interrupt A_INT_OUT register page * alias, serial port and UART registers) are handled by the subdevice * modules themselves. * * This is all necessary because IOC4 is not implemented as a multi-function * PCI device, but an amalgamation of disparate registers for several * types of device (ATA, serial, external interrupts). The normal * resource management in the kernel doesn't have quite the right interfaces * to handle this situation (e.g. multiple modules can't claim the same * PCI ID), thus this IOC4 master module. |
1da177e4c Linux-2.6.12-rc2 |
25 26 27 28 29 |
*/ #include <linux/errno.h> #include <linux/module.h> #include <linux/pci.h> |
22329b511 [PATCH] ioc4: Cor... |
30 |
#include <linux/ioc4.h> |
107d5a72f [PATCH] ioc4: Rem... |
31 |
#include <linux/ktime.h> |
5a0e3ad6a include cleanup: ... |
32 |
#include <linux/slab.h> |
6e586f329 [IA64-SGI] sem2mu... |
33 |
#include <linux/mutex.h> |
107d5a72f [PATCH] ioc4: Rem... |
34 |
#include <linux/time.h> |
2099c99e3 [PATCH] missing i... |
35 |
#include <asm/io.h> |
d4c477ca5 [PATCH] ioc4: PCI... |
36 37 38 39 40 41 42 43 |
/*************** * Definitions * ***************/ /* Tweakable values */ /* PCI bus speed detection/calibration */ |
107d5a72f [PATCH] ioc4: Rem... |
44 |
#define IOC4_CALIBRATE_COUNT 63 /* Calibration cycle period */ |
d4c477ca5 [PATCH] ioc4: PCI... |
45 46 47 48 49 |
#define IOC4_CALIBRATE_CYCLES 256 /* Average over this many cycles */ #define IOC4_CALIBRATE_DISCARD 2 /* Discard first few cycles */ #define IOC4_CALIBRATE_LOW_MHZ 25 /* Lower bound on bus speed sanity */ #define IOC4_CALIBRATE_HIGH_MHZ 75 /* Upper bound on bus speed sanity */ #define IOC4_CALIBRATE_DEFAULT_MHZ 66 /* Assumed if sanity check fails */ |
1da177e4c Linux-2.6.12-rc2 |
50 |
|
22329b511 [PATCH] ioc4: Cor... |
51 52 53 |
/************************ * Submodule management * ************************/ |
1da177e4c Linux-2.6.12-rc2 |
54 |
|
6e586f329 [IA64-SGI] sem2mu... |
55 |
static DEFINE_MUTEX(ioc4_mutex); |
22329b511 [PATCH] ioc4: Cor... |
56 |
|
6e586f329 [IA64-SGI] sem2mu... |
57 |
static LIST_HEAD(ioc4_devices); |
22329b511 [PATCH] ioc4: Cor... |
58 |
static LIST_HEAD(ioc4_submodules); |
22329b511 [PATCH] ioc4: Cor... |
59 60 61 62 63 64 |
/* Register an IOC4 submodule */ int ioc4_register_submodule(struct ioc4_submodule *is) { struct ioc4_driver_data *idd; |
6e586f329 [IA64-SGI] sem2mu... |
65 |
mutex_lock(&ioc4_mutex); |
22329b511 [PATCH] ioc4: Cor... |
66 |
list_add(&is->is_list, &ioc4_submodules); |
22329b511 [PATCH] ioc4: Cor... |
67 68 69 |
/* Initialize submodule for each IOC4 */ if (!is->is_probe) |
6e586f329 [IA64-SGI] sem2mu... |
70 |
goto out; |
22329b511 [PATCH] ioc4: Cor... |
71 |
|
22329b511 [PATCH] ioc4: Cor... |
72 73 74 75 76 |
list_for_each_entry(idd, &ioc4_devices, idd_list) { if (is->is_probe(idd)) { printk(KERN_WARNING "%s: IOC4 submodule %s probe failed " "for pci_dev %s", |
6e574195b drivers/misc: rep... |
77 |
__func__, module_name(is->is_owner), |
22329b511 [PATCH] ioc4: Cor... |
78 79 80 |
pci_name(idd->idd_pdev)); } } |
6e586f329 [IA64-SGI] sem2mu... |
81 82 |
out: mutex_unlock(&ioc4_mutex); |
22329b511 [PATCH] ioc4: Cor... |
83 84 85 86 87 88 |
return 0; } /* Unregister an IOC4 submodule */ void ioc4_unregister_submodule(struct ioc4_submodule *is) |
1da177e4c Linux-2.6.12-rc2 |
89 |
{ |
22329b511 [PATCH] ioc4: Cor... |
90 |
struct ioc4_driver_data *idd; |
6e586f329 [IA64-SGI] sem2mu... |
91 |
mutex_lock(&ioc4_mutex); |
22329b511 [PATCH] ioc4: Cor... |
92 |
list_del(&is->is_list); |
22329b511 [PATCH] ioc4: Cor... |
93 94 95 |
/* Remove submodule for each IOC4 */ if (!is->is_remove) |
6e586f329 [IA64-SGI] sem2mu... |
96 |
goto out; |
22329b511 [PATCH] ioc4: Cor... |
97 |
|
22329b511 [PATCH] ioc4: Cor... |
98 99 100 101 102 103 |
list_for_each_entry(idd, &ioc4_devices, idd_list) { if (is->is_remove(idd)) { printk(KERN_WARNING "%s: IOC4 submodule %s remove failed " "for pci_dev %s. ", |
6e574195b drivers/misc: rep... |
104 |
__func__, module_name(is->is_owner), |
22329b511 [PATCH] ioc4: Cor... |
105 106 107 |
pci_name(idd->idd_pdev)); } } |
6e586f329 [IA64-SGI] sem2mu... |
108 109 |
out: mutex_unlock(&ioc4_mutex); |
22329b511 [PATCH] ioc4: Cor... |
110 111 112 113 114 |
} /********************* * Device management * *********************/ |
d4c477ca5 [PATCH] ioc4: PCI... |
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
#define IOC4_CALIBRATE_LOW_LIMIT \ (1000*IOC4_EXTINT_COUNT_DIVISOR/IOC4_CALIBRATE_LOW_MHZ) #define IOC4_CALIBRATE_HIGH_LIMIT \ (1000*IOC4_EXTINT_COUNT_DIVISOR/IOC4_CALIBRATE_HIGH_MHZ) #define IOC4_CALIBRATE_DEFAULT \ (1000*IOC4_EXTINT_COUNT_DIVISOR/IOC4_CALIBRATE_DEFAULT_MHZ) #define IOC4_CALIBRATE_END \ (IOC4_CALIBRATE_CYCLES + IOC4_CALIBRATE_DISCARD) #define IOC4_INT_OUT_MODE_TOGGLE 0x7 /* Toggle INT_OUT every COUNT+1 ticks */ /* Determines external interrupt output clock period of the PCI bus an * IOC4 is attached to. This value can be used to determine the PCI * bus speed. * * IOC4 has a design feature that various internal timers are derived from * the PCI bus clock. This causes IOC4 device drivers to need to take the * bus speed into account when setting various register values (e.g. INT_OUT * register COUNT field, UART divisors, etc). Since this information is * needed by several subdrivers, it is determined by the main IOC4 driver, * even though the following code utilizes external interrupt registers * to perform the speed calculation. */ |
2ea5d35a4 ioc3/ioc4: variou... |
139 |
static void __devinit |
d4c477ca5 [PATCH] ioc4: PCI... |
140 141 |
ioc4_clock_calibrate(struct ioc4_driver_data *idd) { |
d4c477ca5 [PATCH] ioc4: PCI... |
142 143 144 |
union ioc4_int_out int_out; union ioc4_gpcr gpcr; unsigned int state, last_state = 1; |
107d5a72f [PATCH] ioc4: Rem... |
145 146 |
struct timespec start_ts, end_ts; uint64_t start, end, period; |
d4c477ca5 [PATCH] ioc4: PCI... |
147 148 149 150 151 152 153 154 155 156 157 |
unsigned int count = 0; /* Enable output */ gpcr.raw = 0; gpcr.fields.dir = IOC4_GPCR_DIR_0; gpcr.fields.int_out_en = 1; writel(gpcr.raw, &idd->idd_misc_regs->gpcr_s.raw); /* Reset to power-on state */ writel(0, &idd->idd_misc_regs->int_out.raw); mmiowb(); |
d4c477ca5 [PATCH] ioc4: PCI... |
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
/* Set up square wave */ int_out.raw = 0; int_out.fields.count = IOC4_CALIBRATE_COUNT; int_out.fields.mode = IOC4_INT_OUT_MODE_TOGGLE; int_out.fields.diag = 0; writel(int_out.raw, &idd->idd_misc_regs->int_out.raw); mmiowb(); /* Check square wave period averaged over some number of cycles */ do { int_out.raw = readl(&idd->idd_misc_regs->int_out.raw); state = int_out.fields.int_out; if (!last_state && state) { count++; if (count == IOC4_CALIBRATE_END) { |
107d5a72f [PATCH] ioc4: Rem... |
173 |
ktime_get_ts(&end_ts); |
d4c477ca5 [PATCH] ioc4: PCI... |
174 175 |
break; } else if (count == IOC4_CALIBRATE_DISCARD) |
107d5a72f [PATCH] ioc4: Rem... |
176 |
ktime_get_ts(&start_ts); |
d4c477ca5 [PATCH] ioc4: PCI... |
177 178 179 180 181 182 |
} last_state = state; } while (1); /* Calculation rearranged to preserve intermediate precision. * Logically: |
107d5a72f [PATCH] ioc4: Rem... |
183 184 185 186 |
* 1. "end - start" gives us the measurement period over all * the square wave cycles. * 2. Divide by number of square wave cycles to get the period * of a square wave cycle. |
d4c477ca5 [PATCH] ioc4: PCI... |
187 188 |
* 3. Divide by 2*(int_out.fields.count+1), which is the formula * by which the IOC4 generates the square wave, to get the |
107d5a72f [PATCH] ioc4: Rem... |
189 |
* period of an IOC4 INT_OUT count. |
d4c477ca5 [PATCH] ioc4: PCI... |
190 |
*/ |
107d5a72f [PATCH] ioc4: Rem... |
191 192 193 194 |
end = end_ts.tv_sec * NSEC_PER_SEC + end_ts.tv_nsec; start = start_ts.tv_sec * NSEC_PER_SEC + start_ts.tv_nsec; period = (end - start) / (IOC4_CALIBRATE_CYCLES * 2 * (IOC4_CALIBRATE_COUNT + 1)); |
d4c477ca5 [PATCH] ioc4: PCI... |
195 196 197 198 |
/* Bounds check the result. */ if (period > IOC4_CALIBRATE_LOW_LIMIT || period < IOC4_CALIBRATE_HIGH_LIMIT) { |
f5befceb5 [PATCH] SGI IOC4:... |
199 200 201 202 203 |
printk(KERN_INFO "IOC4 %s: Clock calibration failed. Assuming" "PCI clock is %d ns. ", pci_name(idd->idd_pdev), |
d4c477ca5 [PATCH] ioc4: PCI... |
204 205 206 |
IOC4_CALIBRATE_DEFAULT / IOC4_EXTINT_COUNT_DIVISOR); period = IOC4_CALIBRATE_DEFAULT; } else { |
59f148005 [PATCH] ioc4: Ena... |
207 208 209 |
u64 ns = period; do_div(ns, IOC4_EXTINT_COUNT_DIVISOR); |
f5befceb5 [PATCH] SGI IOC4:... |
210 |
printk(KERN_DEBUG |
760fe9ad1 [PATCH] ioc4: fix... |
211 212 213 |
"IOC4 %s: PCI clock is %llu ns. ", pci_name(idd->idd_pdev), (unsigned long long)ns); |
d4c477ca5 [PATCH] ioc4: PCI... |
214 215 216 217 218 219 220 221 222 |
} /* Remember results. We store the extint clock period rather * than the PCI clock period so that greater precision is * retained. Divide by IOC4_EXTINT_COUNT_DIVISOR to get * PCI clock period. */ idd->count_period = period; } |
f5befceb5 [PATCH] SGI IOC4:... |
223 224 225 226 227 228 229 230 |
/* There are three variants of IOC4 cards: IO9, IO10, and PCI-RT. * Each brings out different combinations of IOC4 signals, thus. * the IOC4 subdrivers need to know to which we're attached. * * We look for the presence of a SCSI (IO9) or SATA (IO10) controller * on the same PCI bus at slot number 3 to differentiate IO9 from IO10. * If neither is present, it's a PCI-RT. */ |
2ea5d35a4 ioc3/ioc4: variou... |
231 |
static unsigned int __devinit |
f5befceb5 [PATCH] SGI IOC4:... |
232 233 234 235 236 237 238 239 240 241 242 243 244 |
ioc4_variant(struct ioc4_driver_data *idd) { struct pci_dev *pdev = NULL; int found = 0; /* IO9: Look for a QLogic ISP 12160 at the same bus and slot 3. */ do { pdev = pci_get_device(PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_QLOGIC_ISP12160, pdev); if (pdev && idd->idd_pdev->bus->number == pdev->bus->number && 3 == PCI_SLOT(pdev->devfn)) found = 1; |
f5befceb5 [PATCH] SGI IOC4:... |
245 |
} while (pdev && !found); |
90d8dabf7 drivers/misc: Mov... |
246 247 |
if (NULL != pdev) { pci_dev_put(pdev); |
f5befceb5 [PATCH] SGI IOC4:... |
248 |
return IOC4_VARIANT_IO9; |
90d8dabf7 drivers/misc: Mov... |
249 |
} |
f5befceb5 [PATCH] SGI IOC4:... |
250 251 252 253 254 255 256 257 258 259 |
/* IO10: Look for a Vitesse VSC 7174 at the same bus and slot 3. */ pdev = NULL; do { pdev = pci_get_device(PCI_VENDOR_ID_VITESSE, PCI_DEVICE_ID_VITESSE_VSC7174, pdev); if (pdev && idd->idd_pdev->bus->number == pdev->bus->number && 3 == PCI_SLOT(pdev->devfn)) found = 1; |
f5befceb5 [PATCH] SGI IOC4:... |
260 |
} while (pdev && !found); |
90d8dabf7 drivers/misc: Mov... |
261 262 |
if (NULL != pdev) { pci_dev_put(pdev); |
f5befceb5 [PATCH] SGI IOC4:... |
263 |
return IOC4_VARIANT_IO10; |
90d8dabf7 drivers/misc: Mov... |
264 |
} |
f5befceb5 [PATCH] SGI IOC4:... |
265 266 267 268 |
/* PCI-RT: No SCSI/SATA controller will be present */ return IOC4_VARIANT_PCI_RT; } |
1fc6e987d drivers/misc/ioc4... |
269 |
static void |
08adefd47 ioc4: automatical... |
270 271 |
ioc4_load_modules(struct work_struct *work) { |
08adefd47 ioc4: automatical... |
272 |
request_module("sgiioc4"); |
08adefd47 ioc4: automatical... |
273 |
} |
883624a08 ioc4: use static ... |
274 |
static DECLARE_WORK(ioc4_load_modules_work, ioc4_load_modules); |
22329b511 [PATCH] ioc4: Cor... |
275 |
/* Adds a new instance of an IOC4 card */ |
2ea5d35a4 ioc3/ioc4: variou... |
276 |
static int __devinit |
22329b511 [PATCH] ioc4: Cor... |
277 278 279 280 281 |
ioc4_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id) { struct ioc4_driver_data *idd; struct ioc4_submodule *is; uint32_t pcmd; |
1da177e4c Linux-2.6.12-rc2 |
282 |
int ret; |
22329b511 [PATCH] ioc4: Cor... |
283 |
/* Enable IOC4 and take ownership of it */ |
1da177e4c Linux-2.6.12-rc2 |
284 285 |
if ((ret = pci_enable_device(pdev))) { printk(KERN_WARNING |
22329b511 [PATCH] ioc4: Cor... |
286 287 |
"%s: Failed to enable IOC4 device for pci_dev %s. ", |
6e574195b drivers/misc: rep... |
288 |
__func__, pci_name(pdev)); |
22329b511 [PATCH] ioc4: Cor... |
289 |
goto out; |
1da177e4c Linux-2.6.12-rc2 |
290 291 |
} pci_set_master(pdev); |
22329b511 [PATCH] ioc4: Cor... |
292 293 294 295 296 297 |
/* Set up per-IOC4 data */ idd = kmalloc(sizeof(struct ioc4_driver_data), GFP_KERNEL); if (!idd) { printk(KERN_WARNING "%s: Failed to allocate IOC4 data for pci_dev %s. ", |
6e574195b drivers/misc: rep... |
298 |
__func__, pci_name(pdev)); |
22329b511 [PATCH] ioc4: Cor... |
299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 |
ret = -ENODEV; goto out_idd; } idd->idd_pdev = pdev; idd->idd_pci_id = pci_id; /* Map IOC4 misc registers. These are shared between subdevices * so the main IOC4 module manages them. */ idd->idd_bar0 = pci_resource_start(idd->idd_pdev, 0); if (!idd->idd_bar0) { printk(KERN_WARNING "%s: Unable to find IOC4 misc resource " "for pci_dev %s. ", |
6e574195b drivers/misc: rep... |
314 |
__func__, pci_name(idd->idd_pdev)); |
22329b511 [PATCH] ioc4: Cor... |
315 316 317 |
ret = -ENODEV; goto out_pci; } |
52c9ae0ac [PATCH] IOC3/IOC4... |
318 |
if (!request_mem_region(idd->idd_bar0, sizeof(struct ioc4_misc_regs), |
22329b511 [PATCH] ioc4: Cor... |
319 320 321 322 323 |
"ioc4_misc")) { printk(KERN_WARNING "%s: Unable to request IOC4 misc region " "for pci_dev %s. ", |
6e574195b drivers/misc: rep... |
324 |
__func__, pci_name(idd->idd_pdev)); |
22329b511 [PATCH] ioc4: Cor... |
325 326 327 328 329 330 331 332 333 334 |
ret = -ENODEV; goto out_pci; } idd->idd_misc_regs = ioremap(idd->idd_bar0, sizeof(struct ioc4_misc_regs)); if (!idd->idd_misc_regs) { printk(KERN_WARNING "%s: Unable to remap IOC4 misc region " "for pci_dev %s. ", |
6e574195b drivers/misc: rep... |
335 |
__func__, pci_name(idd->idd_pdev)); |
22329b511 [PATCH] ioc4: Cor... |
336 337 338 339 340 |
ret = -ENODEV; goto out_misc_region; } /* Failsafe portion of per-IOC4 initialization */ |
f5befceb5 [PATCH] SGI IOC4:... |
341 342 343 344 345 346 347 |
/* Detect card variant */ idd->idd_variant = ioc4_variant(idd); printk(KERN_INFO "IOC4 %s: %s card detected. ", pci_name(pdev), idd->idd_variant == IOC4_VARIANT_IO9 ? "IO9" : idd->idd_variant == IOC4_VARIANT_PCI_RT ? "PCI-RT" : idd->idd_variant == IOC4_VARIANT_IO10 ? "IO10" : "unknown"); |
22329b511 [PATCH] ioc4: Cor... |
348 349 350 351 |
/* Initialize IOC4 */ pci_read_config_dword(idd->idd_pdev, PCI_COMMAND, &pcmd); pci_write_config_dword(idd->idd_pdev, PCI_COMMAND, pcmd | PCI_COMMAND_PARITY | PCI_COMMAND_SERR); |
d4c477ca5 [PATCH] ioc4: PCI... |
352 353 |
/* Determine PCI clock */ ioc4_clock_calibrate(idd); |
22329b511 [PATCH] ioc4: Cor... |
354 355 356 357 358 359 360 361 362 363 364 365 366 367 |
/* Disable/clear all interrupts. Need to do this here lest * one submodule request the shared IOC4 IRQ, but interrupt * is generated by a different subdevice. */ /* Disable */ writel(~0, &idd->idd_misc_regs->other_iec.raw); writel(~0, &idd->idd_misc_regs->sio_iec); /* Clear (i.e. acknowledge) */ writel(~0, &idd->idd_misc_regs->other_ir.raw); writel(~0, &idd->idd_misc_regs->sio_ir); /* Track PCI-device specific data */ idd->idd_serial_data = NULL; pci_set_drvdata(idd->idd_pdev, idd); |
6e586f329 [IA64-SGI] sem2mu... |
368 369 |
mutex_lock(&ioc4_mutex); |
8683dc999 [PATCH] Altix: co... |
370 |
list_add_tail(&idd->idd_list, &ioc4_devices); |
22329b511 [PATCH] ioc4: Cor... |
371 372 |
/* Add this IOC4 to all submodules */ |
22329b511 [PATCH] ioc4: Cor... |
373 374 375 376 377 378 |
list_for_each_entry(is, &ioc4_submodules, is_list) { if (is->is_probe && is->is_probe(idd)) { printk(KERN_WARNING "%s: IOC4 submodule 0x%s probe failed " "for pci_dev %s. ", |
6e574195b drivers/misc: rep... |
379 |
__func__, module_name(is->is_owner), |
22329b511 [PATCH] ioc4: Cor... |
380 381 382 |
pci_name(idd->idd_pdev)); } } |
6e586f329 [IA64-SGI] sem2mu... |
383 |
mutex_unlock(&ioc4_mutex); |
22329b511 [PATCH] ioc4: Cor... |
384 |
|
08adefd47 ioc4: automatical... |
385 386 387 388 389 390 391 |
/* Request sgiioc4 IDE driver on boards that bring that functionality * off of IOC4. The root filesystem may be hosted on a drive connected * to IOC4, so we need to make sure the sgiioc4 driver is loaded as it * won't be picked up by modprobes due to the ioc4 module owning the * PCI device. */ if (idd->idd_variant != IOC4_VARIANT_PCI_RT) { |
883624a08 ioc4: use static ... |
392 393 394 395 396 397 398 |
/* Request the module from a work procedure as the modprobe * goes out to a userland helper and that will hang if done * directly from ioc4_probe(). */ printk(KERN_INFO "IOC4 loading sgiioc4 submodule "); schedule_work(&ioc4_load_modules_work); |
08adefd47 ioc4: automatical... |
399 |
} |
22329b511 [PATCH] ioc4: Cor... |
400 401 402 |
return 0; out_misc_region: |
52c9ae0ac [PATCH] IOC3/IOC4... |
403 |
release_mem_region(idd->idd_bar0, sizeof(struct ioc4_misc_regs)); |
22329b511 [PATCH] ioc4: Cor... |
404 405 406 407 408 409 |
out_pci: kfree(idd); out_idd: pci_disable_device(pdev); out: return ret; |
1da177e4c Linux-2.6.12-rc2 |
410 |
} |
22329b511 [PATCH] ioc4: Cor... |
411 |
/* Removes a particular instance of an IOC4 card. */ |
2ea5d35a4 ioc3/ioc4: variou... |
412 |
static void __devexit |
22329b511 [PATCH] ioc4: Cor... |
413 414 415 416 417 418 419 420 |
ioc4_remove(struct pci_dev *pdev) { struct ioc4_submodule *is; struct ioc4_driver_data *idd; idd = pci_get_drvdata(pdev); /* Remove this IOC4 from all submodules */ |
6e586f329 [IA64-SGI] sem2mu... |
421 |
mutex_lock(&ioc4_mutex); |
22329b511 [PATCH] ioc4: Cor... |
422 423 424 425 426 427 |
list_for_each_entry(is, &ioc4_submodules, is_list) { if (is->is_remove && is->is_remove(idd)) { printk(KERN_WARNING "%s: IOC4 submodule 0x%s remove failed " "for pci_dev %s. ", |
6e574195b drivers/misc: rep... |
428 |
__func__, module_name(is->is_owner), |
22329b511 [PATCH] ioc4: Cor... |
429 430 431 |
pci_name(idd->idd_pdev)); } } |
6e586f329 [IA64-SGI] sem2mu... |
432 |
mutex_unlock(&ioc4_mutex); |
22329b511 [PATCH] ioc4: Cor... |
433 434 435 436 437 438 439 440 |
/* Release resources */ iounmap(idd->idd_misc_regs); if (!idd->idd_bar0) { printk(KERN_WARNING "%s: Unable to get IOC4 misc mapping for pci_dev %s. " "Device removal may be incomplete. ", |
6e574195b drivers/misc: rep... |
441 |
__func__, pci_name(idd->idd_pdev)); |
22329b511 [PATCH] ioc4: Cor... |
442 |
} |
52c9ae0ac [PATCH] IOC3/IOC4... |
443 |
release_mem_region(idd->idd_bar0, sizeof(struct ioc4_misc_regs)); |
22329b511 [PATCH] ioc4: Cor... |
444 445 446 447 448 |
/* Disable IOC4 and relinquish */ pci_disable_device(pdev); /* Remove and free driver data */ |
6e586f329 [IA64-SGI] sem2mu... |
449 |
mutex_lock(&ioc4_mutex); |
22329b511 [PATCH] ioc4: Cor... |
450 |
list_del(&idd->idd_list); |
6e586f329 [IA64-SGI] sem2mu... |
451 |
mutex_unlock(&ioc4_mutex); |
22329b511 [PATCH] ioc4: Cor... |
452 453 454 455 |
kfree(idd); } static struct pci_device_id ioc4_id_table[] = { |
1da177e4c Linux-2.6.12-rc2 |
456 457 458 459 |
{PCI_VENDOR_ID_SGI, PCI_DEVICE_ID_SGI_IOC4, PCI_ANY_ID, PCI_ANY_ID, 0x0b4000, 0xFFFFFF}, {0} }; |
1da177e4c Linux-2.6.12-rc2 |
460 |
|
85bd84345 [PATCH] remove de... |
461 |
static struct pci_driver ioc4_driver = { |
22329b511 [PATCH] ioc4: Cor... |
462 463 464 |
.name = "IOC4", .id_table = ioc4_id_table, .probe = ioc4_probe, |
2ea5d35a4 ioc3/ioc4: variou... |
465 |
.remove = __devexit_p(ioc4_remove), |
1da177e4c Linux-2.6.12-rc2 |
466 |
}; |
22329b511 [PATCH] ioc4: Cor... |
467 468 469 470 471 472 473 |
MODULE_DEVICE_TABLE(pci, ioc4_id_table); /********************* * Module management * *********************/ /* Module load */ |
2ea5d35a4 ioc3/ioc4: variou... |
474 |
static int __init |
22329b511 [PATCH] ioc4: Cor... |
475 |
ioc4_init(void) |
1da177e4c Linux-2.6.12-rc2 |
476 |
{ |
22329b511 [PATCH] ioc4: Cor... |
477 478 |
return pci_register_driver(&ioc4_driver); } |
1da177e4c Linux-2.6.12-rc2 |
479 |
|
22329b511 [PATCH] ioc4: Cor... |
480 |
/* Module unload */ |
2ea5d35a4 ioc3/ioc4: variou... |
481 |
static void __exit |
22329b511 [PATCH] ioc4: Cor... |
482 483 |
ioc4_exit(void) { |
08adefd47 ioc4: automatical... |
484 |
/* Ensure ioc4_load_modules() has completed before exiting */ |
883624a08 ioc4: use static ... |
485 |
flush_work_sync(&ioc4_load_modules_work); |
22329b511 [PATCH] ioc4: Cor... |
486 |
pci_unregister_driver(&ioc4_driver); |
1da177e4c Linux-2.6.12-rc2 |
487 |
} |
1da177e4c Linux-2.6.12-rc2 |
488 |
|
22329b511 [PATCH] ioc4: Cor... |
489 490 491 492 493 |
module_init(ioc4_init); module_exit(ioc4_exit); MODULE_AUTHOR("Brent Casavant - Silicon Graphics, Inc. <bcasavan@sgi.com>"); MODULE_DESCRIPTION("PCI driver master module for SGI IOC4 Base-IO Card"); |
1da177e4c Linux-2.6.12-rc2 |
494 |
MODULE_LICENSE("GPL"); |
22329b511 [PATCH] ioc4: Cor... |
495 496 497 |
EXPORT_SYMBOL(ioc4_register_submodule); EXPORT_SYMBOL(ioc4_unregister_submodule); |