~ubuntu-branches/ubuntu/gutsy/virtualbox-ose/gutsy

« back to all changes in this revision

Viewing changes to src/VBox/Devices/PC/Etherboot-src/core/isa_probe.c

  • Committer: Bazaar Package Importer
  • Author(s): Steve Kowalik
  • Date: 2007-09-08 16:44:58 UTC
  • Revision ID: james.westby@ubuntu.com-20070908164458-wao29470vqtr8ksy
Tags: upstream-1.5.0-dfsg2
ImportĀ upstreamĀ versionĀ 1.5.0-dfsg2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifdef CONFIG_ISA
 
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        "isa.h"
 
12
 
 
13
void isa_enumerate(void)
 
14
{
 
15
        const struct isa_driver *driver;
 
16
        for(driver = isa_drivers; driver < isa_drivers_end; driver++) {
 
17
                printf("%s ", driver->name);
 
18
        }
 
19
 
 
20
}
 
21
 
 
22
int isa_probe(struct dev *dev, const char *type_name)
 
23
{
 
24
/*
 
25
 *      NIC probing is in the order the drivers were linked togeter.
 
26
 *      If for some reason you want to change the order,
 
27
 *      just change the order you list the drivers in.
 
28
 */
 
29
        struct isa_probe_state *state = &dev->state.isa;
 
30
#ifndef VBOX
 
31
        printf("Probing isa %s...\n", type_name);
 
32
#endif /* !VBOX */
 
33
        if (dev->how_probe == PROBE_FIRST) {
 
34
                state->advance = 0;
 
35
                state->driver  = isa_drivers;
 
36
                dev->index     = -1;
 
37
        }
 
38
        for(;;)
 
39
        {
 
40
                if ((dev->how_probe != PROBE_AWAKE) && state->advance) {
 
41
                        state->driver++;
 
42
                        dev->index = -1;
 
43
                }
 
44
                state->advance = 1;
 
45
                
 
46
                if (state->driver >= isa_drivers_end)
 
47
                        break;
 
48
 
 
49
                if (state->driver->type != dev->type)
 
50
                        continue;
 
51
 
 
52
                if (dev->how_probe != PROBE_AWAKE) {
 
53
                        dev->type_index++;
 
54
                }
 
55
#ifndef VBOX
 
56
                printf("[%s]", state->driver->name);
 
57
#endif /* !VBOX */
 
58
                dev->devid.bus_type = ISA_BUS_TYPE;
 
59
                /* FIXME how do I handle dev->index + PROBE_AGAIN?? */
 
60
                /* driver will fill in vendor and device IDs */
 
61
                if (state->driver->probe(dev, state->driver->ioaddrs)) {
 
62
                        state->advance = (dev->index == -1);
 
63
                        return PROBE_WORKED;
 
64
                }
 
65
                putchar('\n');
 
66
        }
 
67
        return PROBE_FAILED;
 
68
}
 
69
 
 
70
#endif