|
@@ -1,70 +0,0 @@
|
1
|
|
-#ifdef CONFIG_PCI
|
2
|
|
-/*
|
3
|
|
- * This program is free software; you can redistribute it and/or
|
4
|
|
- * modify it under the terms of the GNU General Public License as
|
5
|
|
- * published by the Free Software Foundation; either version 2, or (at
|
6
|
|
- * your option) any later version.
|
7
|
|
- */
|
8
|
|
-
|
9
|
|
-#include "etherboot.h"
|
10
|
|
-#include "nic.h"
|
11
|
|
-#include "pci.h"
|
12
|
|
-
|
13
|
|
-void pci_enumerate(void)
|
14
|
|
-{
|
15
|
|
- const struct pci_driver *driver;
|
16
|
|
- for(driver = pci_drivers; driver < pci_drivers_end; driver++) {
|
17
|
|
- printf("%s ", driver->name);
|
18
|
|
- }
|
19
|
|
-}
|
20
|
|
-
|
21
|
|
-int pci_probe(struct dev *dev, const char *type_name)
|
22
|
|
-{
|
23
|
|
-/*
|
24
|
|
- * NIC probing is in pci device order, followed by the
|
25
|
|
- * link order of the drivers. A driver that matches
|
26
|
|
- * on vendor and device id will supersede a driver
|
27
|
|
- * that matches on pci class.
|
28
|
|
- *
|
29
|
|
- * If you want to probe for another device behind the same pci
|
30
|
|
- * device just increment index. And the previous probe call
|
31
|
|
- * will be repeated.
|
32
|
|
- */
|
33
|
|
- struct pci_probe_state *state = &dev->state.pci;
|
34
|
|
- printf("Probing pci %s...\n", type_name);
|
35
|
|
- if (dev->how_probe == PROBE_FIRST) {
|
36
|
|
- state->advance = 1;
|
37
|
|
- state->dev.driver = 0;
|
38
|
|
- state->dev.bus = 0;
|
39
|
|
- state->dev.devfn = 0;
|
40
|
|
- dev->index = -1;
|
41
|
|
- }
|
42
|
|
- for(;;) {
|
43
|
|
- if ((dev->how_probe != PROBE_AWAKE) && state->advance) {
|
44
|
|
- find_pci(dev->type, &state->dev);
|
45
|
|
- dev->index = -1;
|
46
|
|
- }
|
47
|
|
- state->advance = 1;
|
48
|
|
-
|
49
|
|
- if (state->dev.driver == 0)
|
50
|
|
- break;
|
51
|
|
-
|
52
|
|
- if (dev->how_probe != PROBE_AWAKE) {
|
53
|
|
- dev->type_index++;
|
54
|
|
- }
|
55
|
|
- dev->devid.bus_type = PCI_BUS_TYPE;
|
56
|
|
- dev->devid.vendor_id = htons(state->dev.vendor);
|
57
|
|
- dev->devid.device_id = htons(state->dev.dev_id);
|
58
|
|
- /* FIXME how do I handle dev->index + PROBE_AGAIN?? */
|
59
|
|
-
|
60
|
|
- printf("[%s]", state->dev.name);
|
61
|
|
- if (state->dev.driver->probe(dev, &state->dev)) {
|
62
|
|
- state->advance = (dev->index == -1);
|
63
|
|
- return PROBE_WORKED;
|
64
|
|
- }
|
65
|
|
- putchar('\n');
|
66
|
|
- }
|
67
|
|
- return PROBE_FAILED;
|
68
|
|
-}
|
69
|
|
-
|
70
|
|
-#endif
|