您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

isa_probe.c 1.6KB

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