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.9KB

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