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 892B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. /* Print all drivers */
  10. void print_drivers ( void ) {
  11. struct boot_driver *driver;
  12. for ( driver = boot_drivers ; driver < boot_drivers_end ; driver++ ) {
  13. printf ( "%s ", driver->name );
  14. }
  15. }
  16. /* Get the next available boot device */
  17. int probe ( struct dev *dev ) {
  18. for ( ; boot_driver < boot_drivers_end ; boot_driver++ ) {
  19. dev->name = "unknown";
  20. if ( boot_driver->probe ( dev ) )
  21. return 1;
  22. }
  23. /* No more boot devices found */
  24. boot_driver = boot_drivers;
  25. return 0;
  26. }
  27. /* Disable a device */
  28. void disable ( struct dev *dev ) {
  29. if ( dev->dev_op ) {
  30. dev->dev_op->disable ( dev );
  31. dev->dev_op = NULL;
  32. }
  33. }