You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

dev.c 935B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #include "etherboot.h"
  2. #include "stddef.h"
  3. #include "dev.h"
  4. /* Defined by linker */
  5. extern struct boot_driver boot_drivers[];
  6. extern struct boot_driver boot_drivers_end[];
  7. /* Current attempted boot driver */
  8. static struct boot_driver *boot_driver = boot_drivers;
  9. /* Current boot device */
  10. struct dev dev;
  11. /* Print all drivers */
  12. void print_drivers ( void ) {
  13. struct boot_driver *driver;
  14. for ( driver = boot_drivers ; driver < boot_drivers_end ; driver++ ) {
  15. printf ( "%s ", driver->name );
  16. }
  17. }
  18. /* Get the next available boot device */
  19. int probe ( struct dev *dev ) {
  20. for ( ; boot_driver < boot_drivers_end ; boot_driver++ ) {
  21. dev->name = "unknown";
  22. if ( boot_driver->probe ( dev ) )
  23. return 1;
  24. }
  25. /* No more boot devices found */
  26. boot_driver = boot_drivers;
  27. return 0;
  28. }
  29. /* Disable a device */
  30. void disable ( struct dev *dev ) {
  31. if ( dev->dev_op ) {
  32. dev->dev_op->disable ( dev );
  33. dev->dev_op = NULL;
  34. }
  35. }