[PATCH] e1000: Added hardware support for PCI express, 82546GB, and 82571 Fiber
[deliverable/linux.git] / drivers / macintosh / macio_asic.c
CommitLineData
1da177e4
LT
1/*
2 * Bus & driver management routines for devices within
3 * a MacIO ASIC. Interface to new driver model mostly
4 * stolen from the PCI version.
5 *
2c5bd01f
BH
6 * Copyright (C) 2005 Ben. Herrenschmidt (benh@kernel.crashing.org)
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version.
12 *
1da177e4
LT
13 * TODO:
14 *
15 * - Don't probe below media bay by default, but instead provide
16 * some hooks for media bay to dynamically add/remove it's own
17 * sub-devices.
18 */
19
20#include <linux/config.h>
21#include <linux/string.h>
22#include <linux/kernel.h>
23#include <linux/pci.h>
24#include <linux/pci_ids.h>
25#include <linux/init.h>
26#include <linux/module.h>
4e57b681
TS
27#include <linux/slab.h>
28
1da177e4
LT
29#include <asm/machdep.h>
30#include <asm/macio.h>
31#include <asm/pmac_feature.h>
32#include <asm/prom.h>
33#include <asm/pci-bridge.h>
34
35#undef DEBUG
36
37#define MAX_NODE_NAME_SIZE (BUS_ID_SIZE - 12)
38
39static struct macio_chip *macio_on_hold;
40
41static int macio_bus_match(struct device *dev, struct device_driver *drv)
42{
43 struct macio_dev * macio_dev = to_macio_device(dev);
44 struct macio_driver * macio_drv = to_macio_driver(drv);
5e655772 45 const struct of_device_id * matches = macio_drv->match_table;
1da177e4
LT
46
47 if (!matches)
48 return 0;
49
50 return of_match_device(matches, &macio_dev->ofdev) != NULL;
51}
52
53struct macio_dev *macio_dev_get(struct macio_dev *dev)
54{
55 struct device *tmp;
56
57 if (!dev)
58 return NULL;
59 tmp = get_device(&dev->ofdev.dev);
60 if (tmp)
61 return to_macio_device(tmp);
62 else
63 return NULL;
64}
65
66void macio_dev_put(struct macio_dev *dev)
67{
68 if (dev)
69 put_device(&dev->ofdev.dev);
70}
71
72
73static int macio_device_probe(struct device *dev)
74{
75 int error = -ENODEV;
76 struct macio_driver *drv;
77 struct macio_dev *macio_dev;
5e655772 78 const struct of_device_id *match;
1da177e4
LT
79
80 drv = to_macio_driver(dev->driver);
81 macio_dev = to_macio_device(dev);
82
83 if (!drv->probe)
84 return error;
85
86 macio_dev_get(macio_dev);
87
88 match = of_match_device(drv->match_table, &macio_dev->ofdev);
89 if (match)
90 error = drv->probe(macio_dev, match);
91 if (error)
92 macio_dev_put(macio_dev);
93
94 return error;
95}
96
97static int macio_device_remove(struct device *dev)
98{
99 struct macio_dev * macio_dev = to_macio_device(dev);
100 struct macio_driver * drv = to_macio_driver(dev->driver);
101
102 if (dev->driver && drv->remove)
103 drv->remove(macio_dev);
104 macio_dev_put(macio_dev);
105
106 return 0;
107}
108
109static void macio_device_shutdown(struct device *dev)
110{
111 struct macio_dev * macio_dev = to_macio_device(dev);
112 struct macio_driver * drv = to_macio_driver(dev->driver);
113
114 if (dev->driver && drv->shutdown)
115 drv->shutdown(macio_dev);
116}
117
f4513904 118static int macio_device_suspend(struct device *dev, pm_message_t state)
1da177e4
LT
119{
120 struct macio_dev * macio_dev = to_macio_device(dev);
121 struct macio_driver * drv = to_macio_driver(dev->driver);
122
123 if (dev->driver && drv->suspend)
124 return drv->suspend(macio_dev, state);
125 return 0;
126}
127
128static int macio_device_resume(struct device * dev)
129{
130 struct macio_dev * macio_dev = to_macio_device(dev);
131 struct macio_driver * drv = to_macio_driver(dev->driver);
132
133 if (dev->driver && drv->resume)
134 return drv->resume(macio_dev);
135 return 0;
136}
137
312c004d 138static int macio_uevent(struct device *dev, char **envp, int num_envp,
184f6eb8
JM
139 char *buffer, int buffer_size)
140{
141 struct macio_dev * macio_dev;
142 struct of_device * of;
143 char *scratch, *compat;
144 int i = 0;
145 int length = 0;
146 int cplen, seen = 0;
147
148 if (!dev)
149 return -ENODEV;
150
151 macio_dev = to_macio_device(dev);
152 if (!macio_dev)
153 return -ENODEV;
154
155 of = &macio_dev->ofdev;
156 scratch = buffer;
157
158 /* stuff we want to pass to /sbin/hotplug */
159 envp[i++] = scratch;
160 length += scnprintf (scratch, buffer_size - length, "OF_NAME=%s",
161 of->node->name);
162 if ((buffer_size - length <= 0) || (i >= num_envp))
163 return -ENOMEM;
164 ++length;
165 scratch += length;
166
167 envp[i++] = scratch;
168 length += scnprintf (scratch, buffer_size - length, "OF_TYPE=%s",
169 of->node->type);
170 if ((buffer_size - length <= 0) || (i >= num_envp))
171 return -ENOMEM;
172 ++length;
173 scratch += length;
174
175 /* Since the compatible field can contain pretty much anything
176 * it's not really legal to split it out with commas. We split it
177 * up using a number of environment variables instead. */
178
179 compat = (char *) get_property(of->node, "compatible", &cplen);
180 while (compat && cplen > 0) {
181 int l;
182 envp[i++] = scratch;
183 length += scnprintf (scratch, buffer_size - length,
184 "OF_COMPATIBLE_%d=%s", seen, compat);
185 if ((buffer_size - length <= 0) || (i >= num_envp))
186 return -ENOMEM;
187 length++;
188 scratch += length;
189 l = strlen (compat) + 1;
190 compat += l;
191 cplen -= l;
192 seen++;
193 }
194
195 envp[i++] = scratch;
196 length += scnprintf (scratch, buffer_size - length,
197 "OF_COMPATIBLE_N=%d", seen);
198 if ((buffer_size - length <= 0) || (i >= num_envp))
199 return -ENOMEM;
200 ++length;
201 scratch += length;
202
203 envp[i] = NULL;
204
205 return 0;
206}
207
b5bf5b67
JM
208extern struct device_attribute macio_dev_attrs[];
209
1da177e4
LT
210struct bus_type macio_bus_type = {
211 .name = "macio",
212 .match = macio_bus_match,
312c004d 213 .uevent = macio_uevent,
4866b124
RK
214 .probe = macio_device_probe,
215 .remove = macio_device_remove,
216 .shutdown = macio_device_shutdown,
1da177e4
LT
217 .suspend = macio_device_suspend,
218 .resume = macio_device_resume,
b5bf5b67 219 .dev_attrs = macio_dev_attrs,
1da177e4
LT
220};
221
222static int __init macio_bus_driver_init(void)
223{
224 return bus_register(&macio_bus_type);
225}
226
227postcore_initcall(macio_bus_driver_init);
228
229
230/**
2c5bd01f
BH
231 * macio_release_dev - free a macio device structure when all users of it are
232 * finished.
1da177e4
LT
233 * @dev: device that's been disconnected
234 *
2c5bd01f
BH
235 * Will be called only by the device core when all users of this macio device
236 * are done. This currently means never as we don't hot remove any macio
237 * device yet, though that will happen with mediabay based devices in a later
238 * implementation.
1da177e4
LT
239 */
240static void macio_release_dev(struct device *dev)
241{
242 struct macio_dev *mdev;
243
244 mdev = to_macio_device(dev);
245 kfree(mdev);
246}
247
248/**
249 * macio_resource_quirks - tweak or skip some resources for a device
250 * @np: pointer to the device node
251 * @res: resulting resource
252 * @index: index of resource in node
253 *
254 * If this routine returns non-null, then the resource is completely
255 * skipped.
256 */
2c5bd01f
BH
257static int macio_resource_quirks(struct device_node *np, struct resource *res,
258 int index)
1da177e4
LT
259{
260 if (res->flags & IORESOURCE_MEM) {
261 /* Grand Central has too large resource 0 on some machines */
cc5d0189 262 if (index == 0 && !strcmp(np->name, "gc"))
1da177e4 263 res->end = res->start + 0x1ffff;
cc5d0189 264
1da177e4
LT
265 /* Airport has bogus resource 2 */
266 if (index >= 2 && !strcmp(np->name, "radio"))
267 return 1;
cc5d0189
BH
268
269#ifndef CONFIG_PPC64
1da177e4 270 /* DBDMAs may have bogus sizes */
cc5d0189 271 if ((res->start & 0x0001f000) == 0x00008000)
1da177e4 272 res->end = res->start + 0xff;
cc5d0189
BH
273#endif /* CONFIG_PPC64 */
274
2c5bd01f
BH
275 /* ESCC parent eats child resources. We could have added a
276 * level of hierarchy, but I don't really feel the need
277 * for it
278 */
1da177e4
LT
279 if (!strcmp(np->name, "escc"))
280 return 1;
cc5d0189 281
1da177e4 282 /* ESCC has bogus resources >= 3 */
2c5bd01f
BH
283 if (index >= 3 && !(strcmp(np->name, "ch-a") &&
284 strcmp(np->name, "ch-b")))
1da177e4 285 return 1;
cc5d0189 286
1da177e4
LT
287 /* Media bay has too many resources, keep only first one */
288 if (index > 0 && !strcmp(np->name, "media-bay"))
289 return 1;
cc5d0189 290
1da177e4
LT
291 /* Some older IDE resources have bogus sizes */
292 if (!(strcmp(np->name, "IDE") && strcmp(np->name, "ATA") &&
293 strcmp(np->type, "ide") && strcmp(np->type, "ata"))) {
cc5d0189 294 if (index == 0 && (res->end - res->start) > 0xfff)
1da177e4 295 res->end = res->start + 0xfff;
cc5d0189 296 if (index == 1 && (res->end - res->start) > 0xff)
1da177e4 297 res->end = res->start + 0xff;
1da177e4
LT
298 }
299 }
300 return 0;
301}
302
303
2c5bd01f
BH
304static void macio_setup_interrupts(struct macio_dev *dev)
305{
306 struct device_node *np = dev->ofdev.node;
307 int i,j;
308
309 /* For now, we use pre-parsed entries in the device-tree for
310 * interrupt routing and addresses, but we should change that
311 * to dynamically parsed entries and so get rid of most of the
312 * clutter in struct device_node
313 */
314 for (i = j = 0; i < np->n_intrs; i++) {
315 struct resource *res = &dev->interrupt[j];
316
317 if (j >= MACIO_DEV_COUNT_IRQS)
318 break;
319 res->start = np->intrs[i].line;
320 res->flags = IORESOURCE_IO;
321 if (np->intrs[j].sense)
322 res->flags |= IORESOURCE_IRQ_LOWLEVEL;
323 else
324 res->flags |= IORESOURCE_IRQ_HIGHEDGE;
325 res->name = dev->ofdev.dev.bus_id;
326 if (macio_resource_quirks(np, res, i))
327 memset(res, 0, sizeof(struct resource));
328 else
329 j++;
330 }
331 dev->n_interrupts = j;
332}
333
334static void macio_setup_resources(struct macio_dev *dev,
335 struct resource *parent_res)
336{
337 struct device_node *np = dev->ofdev.node;
d2dd482b 338 struct resource r;
2c5bd01f
BH
339 int index;
340
d2dd482b 341 for (index = 0; of_address_to_resource(np, index, &r) == 0; index++) {
2c5bd01f
BH
342 struct resource *res = &dev->resource[index];
343 if (index >= MACIO_DEV_COUNT_RESOURCES)
344 break;
d2dd482b 345 *res = r;
2c5bd01f
BH
346 res->name = dev->ofdev.dev.bus_id;
347
348 if (macio_resource_quirks(np, res, index)) {
349 memset(res, 0, sizeof(struct resource));
350 continue;
351 }
352 /* Currently, we consider failure as harmless, this may
353 * change in the future, once I've found all the device
354 * tree bugs in older machines & worked around them
cc5d0189 355 */
2c5bd01f
BH
356 if (insert_resource(parent_res, res)) {
357 printk(KERN_WARNING "Can't request resource "
358 "%d for MacIO device %s\n",
359 index, dev->ofdev.dev.bus_id);
360 }
361 }
362 dev->n_resources = index;
363}
364
1da177e4
LT
365/**
366 * macio_add_one_device - Add one device from OF node to the device tree
367 * @chip: pointer to the macio_chip holding the device
368 * @np: pointer to the device node in the OF tree
369 * @in_bay: set to 1 if device is part of a media-bay
370 *
371 * When media-bay is changed to hotswap drivers, this function will
372 * be exposed to the bay driver some way...
373 */
2c5bd01f
BH
374static struct macio_dev * macio_add_one_device(struct macio_chip *chip,
375 struct device *parent,
376 struct device_node *np,
377 struct macio_dev *in_bay,
1da177e4
LT
378 struct resource *parent_res)
379{
380 struct macio_dev *dev;
1da177e4
LT
381 u32 *reg;
382
383 if (np == NULL)
384 return NULL;
385
386 dev = kmalloc(sizeof(*dev), GFP_KERNEL);
387 if (!dev)
388 return NULL;
389 memset(dev, 0, sizeof(*dev));
390
391 dev->bus = &chip->lbus;
392 dev->media_bay = in_bay;
393 dev->ofdev.node = np;
394 dev->ofdev.dma_mask = 0xffffffffUL;
395 dev->ofdev.dev.dma_mask = &dev->ofdev.dma_mask;
396 dev->ofdev.dev.parent = parent;
397 dev->ofdev.dev.bus = &macio_bus_type;
398 dev->ofdev.dev.release = macio_release_dev;
399
400#ifdef DEBUG
401 printk("preparing mdev @%p, ofdev @%p, dev @%p, kobj @%p\n",
402 dev, &dev->ofdev, &dev->ofdev.dev, &dev->ofdev.dev.kobj);
403#endif
404
405 /* MacIO itself has a different reg, we use it's PCI base */
406 if (np == chip->of_node) {
2c5bd01f
BH
407 sprintf(dev->ofdev.dev.bus_id, "%1d.%08lx:%.*s",
408 chip->lbus.index,
1da177e4
LT
409#ifdef CONFIG_PCI
410 pci_resource_start(chip->lbus.pdev, 0),
411#else
412 0, /* NuBus may want to do something better here */
413#endif
414 MAX_NODE_NAME_SIZE, np->name);
415 } else {
416 reg = (u32 *)get_property(np, "reg", NULL);
2c5bd01f
BH
417 sprintf(dev->ofdev.dev.bus_id, "%1d.%08x:%.*s",
418 chip->lbus.index,
1da177e4
LT
419 reg ? *reg : 0, MAX_NODE_NAME_SIZE, np->name);
420 }
421
2c5bd01f
BH
422 /* Setup interrupts & resources */
423 macio_setup_interrupts(dev);
424 macio_setup_resources(dev, parent_res);
1da177e4 425
2c5bd01f 426 /* Register with core */
1da177e4
LT
427 if (of_device_register(&dev->ofdev) != 0) {
428 printk(KERN_DEBUG"macio: device registration error for %s!\n",
429 dev->ofdev.dev.bus_id);
430 kfree(dev);
431 return NULL;
432 }
433
434 return dev;
435}
436
437static int macio_skip_device(struct device_node *np)
438{
439 if (strncmp(np->name, "battery", 7) == 0)
440 return 1;
441 if (strncmp(np->name, "escc-legacy", 11) == 0)
442 return 1;
443 return 0;
444}
445
446/**
447 * macio_pci_add_devices - Adds sub-devices of mac-io to the device tree
448 * @chip: pointer to the macio_chip holding the devices
449 *
450 * This function will do the job of extracting devices from the
451 * Open Firmware device tree, build macio_dev structures and add
452 * them to the Linux device tree.
453 *
454 * For now, childs of media-bay are added now as well. This will
455 * change rsn though.
456 */
457static void macio_pci_add_devices(struct macio_chip *chip)
458{
459 struct device_node *np, *pnode;
460 struct macio_dev *rdev, *mdev, *mbdev = NULL, *sdev = NULL;
461 struct device *parent = NULL;
462 struct resource *root_res = &iomem_resource;
463
464 /* Add a node for the macio bus itself */
465#ifdef CONFIG_PCI
466 if (chip->lbus.pdev) {
467 parent = &chip->lbus.pdev->dev;
468 root_res = &chip->lbus.pdev->resource[0];
469 }
470#endif
471 pnode = of_node_get(chip->of_node);
472 if (pnode == NULL)
473 return;
474
475 /* Add macio itself to hierarchy */
476 rdev = macio_add_one_device(chip, parent, pnode, NULL, root_res);
477 if (rdev == NULL)
478 return;
479 root_res = &rdev->resource[0];
480
481 /* First scan 1st level */
482 for (np = NULL; (np = of_get_next_child(pnode, np)) != NULL;) {
2c5bd01f
BH
483 if (macio_skip_device(np))
484 continue;
485 of_node_get(np);
486 mdev = macio_add_one_device(chip, &rdev->ofdev.dev, np, NULL,
487 root_res);
488 if (mdev == NULL)
489 of_node_put(np);
490 else if (strncmp(np->name, "media-bay", 9) == 0)
491 mbdev = mdev;
492 else if (strncmp(np->name, "escc", 4) == 0)
493 sdev = mdev;
1da177e4
LT
494 }
495
496 /* Add media bay devices if any */
497 if (mbdev)
2c5bd01f
BH
498 for (np = NULL; (np = of_get_next_child(mbdev->ofdev.node, np))
499 != NULL;) {
500 if (macio_skip_device(np))
501 continue;
502 of_node_get(np);
503 if (macio_add_one_device(chip, &mbdev->ofdev.dev, np,
504 mbdev, root_res) == NULL)
505 of_node_put(np);
506 }
507
1da177e4
LT
508 /* Add serial ports if any */
509 if (sdev) {
2c5bd01f
BH
510 for (np = NULL; (np = of_get_next_child(sdev->ofdev.node, np))
511 != NULL;) {
512 if (macio_skip_device(np))
513 continue;
514 of_node_get(np);
515 if (macio_add_one_device(chip, &sdev->ofdev.dev, np,
516 NULL, root_res) == NULL)
517 of_node_put(np);
518 }
1da177e4
LT
519 }
520}
521
522
523/**
524 * macio_register_driver - Registers a new MacIO device driver
525 * @drv: pointer to the driver definition structure
526 */
527int macio_register_driver(struct macio_driver *drv)
528{
529 int count = 0;
530
531 /* initialize common driver fields */
532 drv->driver.name = drv->name;
533 drv->driver.bus = &macio_bus_type;
1da177e4
LT
534
535 /* register with core */
536 count = driver_register(&drv->driver);
537 return count ? count : 1;
538}
539
540/**
541 * macio_unregister_driver - Unregisters a new MacIO device driver
542 * @drv: pointer to the driver definition structure
543 */
544void macio_unregister_driver(struct macio_driver *drv)
545{
546 driver_unregister(&drv->driver);
547}
548
549/**
550 * macio_request_resource - Request an MMIO resource
551 * @dev: pointer to the device holding the resource
552 * @resource_no: resource number to request
553 * @name: resource name
554 *
555 * Mark memory region number @resource_no associated with MacIO
556 * device @dev as being reserved by owner @name. Do not access
557 * any address inside the memory regions unless this call returns
558 * successfully.
559 *
560 * Returns 0 on success, or %EBUSY on error. A warning
561 * message is also printed on failure.
562 */
2c5bd01f
BH
563int macio_request_resource(struct macio_dev *dev, int resource_no,
564 const char *name)
1da177e4
LT
565{
566 if (macio_resource_len(dev, resource_no) == 0)
567 return 0;
568
569 if (!request_mem_region(macio_resource_start(dev, resource_no),
570 macio_resource_len(dev, resource_no),
571 name))
572 goto err_out;
573
574 return 0;
575
576err_out:
577 printk (KERN_WARNING "MacIO: Unable to reserve resource #%d:%lx@%lx"
578 " for device %s\n",
579 resource_no,
580 macio_resource_len(dev, resource_no),
581 macio_resource_start(dev, resource_no),
582 dev->ofdev.dev.bus_id);
583 return -EBUSY;
584}
585
586/**
587 * macio_release_resource - Release an MMIO resource
588 * @dev: pointer to the device holding the resource
589 * @resource_no: resource number to release
590 */
591void macio_release_resource(struct macio_dev *dev, int resource_no)
592{
593 if (macio_resource_len(dev, resource_no) == 0)
594 return;
595 release_mem_region(macio_resource_start(dev, resource_no),
596 macio_resource_len(dev, resource_no));
597}
598
599/**
600 * macio_request_resources - Reserve all memory resources
601 * @dev: MacIO device whose resources are to be reserved
602 * @name: Name to be associated with resource.
603 *
604 * Mark all memory regions associated with MacIO device @dev as
605 * being reserved by owner @name. Do not access any address inside
606 * the memory regions unless this call returns successfully.
607 *
608 * Returns 0 on success, or %EBUSY on error. A warning
609 * message is also printed on failure.
610 */
611int macio_request_resources(struct macio_dev *dev, const char *name)
612{
613 int i;
614
615 for (i = 0; i < dev->n_resources; i++)
616 if (macio_request_resource(dev, i, name))
617 goto err_out;
618 return 0;
619
620err_out:
621 while(--i >= 0)
622 macio_release_resource(dev, i);
623
624 return -EBUSY;
625}
626
627/**
628 * macio_release_resources - Release reserved memory resources
629 * @dev: MacIO device whose resources were previously reserved
630 */
631
632void macio_release_resources(struct macio_dev *dev)
633{
634 int i;
635
636 for (i = 0; i < dev->n_resources; i++)
637 macio_release_resource(dev, i);
638}
639
640
641#ifdef CONFIG_PCI
642
643static int __devinit macio_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
644{
645 struct device_node* np;
646 struct macio_chip* chip;
647
648 if (ent->vendor != PCI_VENDOR_ID_APPLE)
649 return -ENODEV;
650
2c5bd01f
BH
651 /* Note regarding refcounting: We assume pci_device_to_OF_node() is
652 * ported to new OF APIs and returns a node with refcount incremented.
1da177e4
LT
653 */
654 np = pci_device_to_OF_node(pdev);
655 if (np == NULL)
656 return -ENODEV;
657
2c5bd01f
BH
658 /* The above assumption is wrong !!!
659 * fix that here for now until I fix the arch code
660 */
1da177e4
LT
661 of_node_get(np);
662
2c5bd01f
BH
663 /* We also assume that pmac_feature will have done a get() on nodes
664 * stored in the macio chips array
1da177e4
LT
665 */
666 chip = macio_find(np, macio_unknown);
667 of_node_put(np);
668 if (chip == NULL)
669 return -ENODEV;
670
671 /* XXX Need locking ??? */
672 if (chip->lbus.pdev == NULL) {
673 chip->lbus.pdev = pdev;
674 chip->lbus.chip = chip;
675 pci_set_drvdata(pdev, &chip->lbus);
676 pci_set_master(pdev);
677 }
678
679 printk(KERN_INFO "MacIO PCI driver attached to %s chipset\n",
680 chip->name);
681
682 /*
683 * HACK ALERT: The WallStreet PowerBook and some OHare based machines
2c5bd01f
BH
684 * have 2 macio ASICs. I must probe the "main" one first or IDE
685 * ordering will be incorrect. So I put on "hold" the second one since
686 * it seem to appear first on PCI
1da177e4
LT
687 */
688 if (chip->type == macio_gatwick || chip->type == macio_ohareII)
689 if (macio_chips[0].lbus.pdev == NULL) {
690 macio_on_hold = chip;
691 return 0;
692 }
693
694 macio_pci_add_devices(chip);
695 if (macio_on_hold && macio_chips[0].lbus.pdev != NULL) {
696 macio_pci_add_devices(macio_on_hold);
697 macio_on_hold = NULL;
698 }
699
700 return 0;
701}
702
703static void __devexit macio_pci_remove(struct pci_dev* pdev)
704{
705 panic("removing of macio-asic not supported !\n");
706}
707
708/*
709 * MacIO is matched against any Apple ID, it's probe() function
710 * will then decide wether it applies or not
711 */
712static const struct pci_device_id __devinitdata pci_ids [] = { {
713 .vendor = PCI_VENDOR_ID_APPLE,
714 .device = PCI_ANY_ID,
715 .subvendor = PCI_ANY_ID,
716 .subdevice = PCI_ANY_ID,
717
718 }, { /* end: all zeroes */ }
719};
720MODULE_DEVICE_TABLE (pci, pci_ids);
721
722/* pci driver glue; this is a "new style" PCI driver module */
723static struct pci_driver macio_pci_driver = {
724 .name = (char *) "macio",
725 .id_table = pci_ids,
726
727 .probe = macio_pci_probe,
728 .remove = macio_pci_remove,
729};
730
731#endif /* CONFIG_PCI */
732
733static int __init macio_module_init (void)
734{
735#ifdef CONFIG_PCI
736 int rc;
737
738 rc = pci_register_driver(&macio_pci_driver);
739 if (rc)
740 return rc;
741#endif /* CONFIG_PCI */
742 return 0;
743}
744
745module_init(macio_module_init);
746
747EXPORT_SYMBOL(macio_register_driver);
748EXPORT_SYMBOL(macio_unregister_driver);
749EXPORT_SYMBOL(macio_dev_get);
750EXPORT_SYMBOL(macio_dev_put);
751EXPORT_SYMBOL(macio_request_resource);
752EXPORT_SYMBOL(macio_release_resource);
753EXPORT_SYMBOL(macio_request_resources);
754EXPORT_SYMBOL(macio_release_resources);
This page took 0.145691 seconds and 5 git commands to generate.