Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #include "etherboot.h"
  2. #include "stddef.h"
  3. #include "dev.h"
  4. /*
  5. * Each driver specifies a name, the bus-scanning function
  6. * (find_bus_boot_device) that it wants to use, a driver information
  7. * structure (bus_driver) containing e.g. device IDs to be passed to
  8. * find_bus_boot_device, and a probe function (probe) to be called
  9. * whenever a suitable device is found.
  10. *
  11. * The generic device-probing code knows nothing about particular bus
  12. * types; it simply passes the driver information structure
  13. * (bus_driver) to the bus-scanning function (find_bus_boot_device),
  14. * then passes the result of that function (if not NULL) to the probe
  15. * function (probe).
  16. */
  17. /* Defined by linker */
  18. extern struct boot_driver boot_drivers[];
  19. extern struct boot_driver boot_drivers_end[];
  20. /* Current attempted boot driver */
  21. static struct boot_driver *boot_driver = boot_drivers;
  22. /* Print all drivers */
  23. void print_drivers ( void ) {
  24. struct boot_driver *driver;
  25. for ( driver = boot_drivers ; driver < boot_drivers_end ; driver++ ) {
  26. printf ( "%s ", driver->name );
  27. }
  28. }
  29. /* Get the next available boot device */
  30. int find_boot_device ( struct dev *dev ) {
  31. for ( ; boot_driver < boot_drivers_end ; boot_driver++ ) {
  32. dev->driver = boot_driver;
  33. dev->name = boot_driver->name;
  34. DBG ( "Probing driver %s...\n", dev->name );
  35. if ( boot_driver->find_bus_boot_device ( dev,
  36. boot_driver->bus_driver ) ) {
  37. DBG ( "Found device %s (ID %hhx:%hx:%hx)\n",
  38. dev->name, dev->devid->bus_type,
  39. dev->devid->vendor_id, dev->devid->device_id );
  40. return 1;
  41. }
  42. }
  43. /* No more boot devices found */
  44. boot_driver = boot_drivers;
  45. return 0;
  46. }
  47. /* Probe the boot device */
  48. int probe ( struct dev *dev ) {
  49. return dev->driver->probe ( dev, dev->bus );
  50. }
  51. /* Disable a device */
  52. void disable ( struct dev *dev ) {
  53. if ( dev->dev_op ) {
  54. dev->dev_op->disable ( dev );
  55. dev->dev_op = NULL;
  56. }
  57. }