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.

isa.h 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. #ifndef ISA_H
  2. #define ISA_H
  3. FILE_LICENCE ( GPL2_OR_LATER );
  4. #include <stdint.h>
  5. #include <ipxe/isa_ids.h>
  6. #include <ipxe/device.h>
  7. #include <ipxe/tables.h>
  8. /** An ISA device */
  9. struct isa_device {
  10. /** Generic device */
  11. struct device dev;
  12. /** I/O address */
  13. uint16_t ioaddr;
  14. /** Driver for this device */
  15. struct isa_driver *driver;
  16. /** Driver-private data
  17. *
  18. * Use isa_set_drvdata() and isa_get_drvdata() to access
  19. * this field.
  20. */
  21. void *priv;
  22. };
  23. /*
  24. * An individual ISA device, identified by probe address
  25. *
  26. */
  27. typedef uint16_t isa_probe_addr_t;
  28. /** An ISA driver */
  29. struct isa_driver {
  30. /** Name */
  31. const char *name;
  32. /** Probe address list */
  33. isa_probe_addr_t *probe_addrs;
  34. /** Number of entries in probe address list */
  35. unsigned int addr_count;
  36. /** Manufacturer ID to be assumed for this device */
  37. uint16_t vendor_id;
  38. /** Product ID to be assumed for this device */
  39. uint16_t prod_id;
  40. /**
  41. * Probe device
  42. *
  43. * @v isa ISA device
  44. * @v id Matching entry in ID table
  45. * @ret rc Return status code
  46. */
  47. int ( * probe ) ( struct isa_device *isa );
  48. /**
  49. * Remove device
  50. *
  51. * @v isa ISA device
  52. */
  53. void ( * remove ) ( struct isa_device *isa );
  54. };
  55. /** ISA driver table */
  56. #define ISA_DRIVERS __table ( struct isa_driver, "isa_drivers" )
  57. /** Declare an ISA driver */
  58. #define __isa_driver __table_entry ( ISA_DRIVERS, 01 )
  59. /**
  60. * Set ISA driver-private data
  61. *
  62. * @v isa ISA device
  63. * @v priv Private data
  64. */
  65. static inline void isa_set_drvdata ( struct isa_device *isa, void *priv ) {
  66. isa->priv = priv;
  67. }
  68. /**
  69. * Get ISA driver-private data
  70. *
  71. * @v isa ISA device
  72. * @ret priv Private data
  73. */
  74. static inline void * isa_get_drvdata ( struct isa_device *isa ) {
  75. return isa->priv;
  76. }
  77. /*
  78. * ISA_ROM is parsed by parserom.pl to generate Makefile rules and
  79. * files for rom-o-matic.
  80. *
  81. */
  82. #define ISA_ROM( IMAGE, DESCRIPTION )
  83. #endif /* ISA_H */