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.

eisa.h 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. #ifndef EISA_H
  2. #define EISA_H
  3. #include <stdint.h>
  4. #include <gpxe/isa_ids.h>
  5. #include <gpxe/device.h>
  6. #include <gpxe/tables.h>
  7. /*
  8. * EISA constants
  9. *
  10. */
  11. #define EISA_MIN_SLOT (0x1)
  12. #define EISA_MAX_SLOT (0xf) /* Must be 2^n - 1 */
  13. #define EISA_SLOT_BASE( n ) ( 0x1000 * (n) )
  14. #define EISA_VENDOR_ID ( 0xc80 )
  15. #define EISA_PROD_ID ( 0xc82 )
  16. #define EISA_GLOBAL_CONFIG ( 0xc84 )
  17. #define EISA_CMD_RESET ( 1 << 2 )
  18. #define EISA_CMD_ENABLE ( 1 << 0 )
  19. /** An EISA device ID list entry */
  20. struct eisa_device_id {
  21. /** Name */
  22. const char *name;
  23. /** Manufacturer ID */
  24. uint16_t vendor_id;
  25. /** Product ID */
  26. uint16_t prod_id;
  27. };
  28. /** An EISA device */
  29. struct eisa_device {
  30. /** Generic device */
  31. struct device dev;
  32. /** Slot number */
  33. unsigned int slot;
  34. /** I/O address */
  35. uint16_t ioaddr;
  36. /** Manufacturer ID */
  37. uint16_t vendor_id;
  38. /** Product ID */
  39. uint16_t prod_id;
  40. /** Driver for this device */
  41. struct eisa_driver *driver;
  42. /** Driver-private data
  43. *
  44. * Use eisa_set_drvdata() and eisa_get_drvdata() to access
  45. * this field.
  46. */
  47. void *priv;
  48. /** Driver name */
  49. const char *driver_name;
  50. };
  51. /** An EISA driver */
  52. struct eisa_driver {
  53. /** EISA ID table */
  54. struct eisa_device_id *ids;
  55. /** Number of entries in EISA ID table */
  56. unsigned int id_count;
  57. /**
  58. * Probe device
  59. *
  60. * @v eisa EISA device
  61. * @v id Matching entry in ID table
  62. * @ret rc Return status code
  63. */
  64. int ( * probe ) ( struct eisa_device *eisa,
  65. const struct eisa_device_id *id );
  66. /**
  67. * Remove device
  68. *
  69. * @v eisa EISA device
  70. */
  71. void ( * remove ) ( struct eisa_device *eisa );
  72. };
  73. /** Declare an EISA driver */
  74. #define __eisa_driver __table ( struct eisa_driver, eisa_drivers, 01 )
  75. extern void eisa_device_enabled ( struct eisa_device *eisa, int enabled );
  76. /**
  77. * Enable EISA device
  78. *
  79. * @v eisa EISA device
  80. */
  81. static inline void enable_eisa_device ( struct eisa_device *eisa ) {
  82. eisa_device_enabled ( eisa, 1 );
  83. }
  84. /**
  85. * Disable EISA device
  86. *
  87. * @v eisa EISA device
  88. */
  89. static inline void disable_eisa_device ( struct eisa_device *eisa ) {
  90. eisa_device_enabled ( eisa, 0 );
  91. }
  92. /**
  93. * Set EISA driver-private data
  94. *
  95. * @v eisa EISA device
  96. * @v priv Private data
  97. */
  98. static inline void eisa_set_drvdata ( struct eisa_device *eisa, void *priv ) {
  99. eisa->priv = priv;
  100. }
  101. /**
  102. * Get EISA driver-private data
  103. *
  104. * @v eisa EISA device
  105. * @ret priv Private data
  106. */
  107. static inline void * eisa_get_drvdata ( struct eisa_device *eisa ) {
  108. return eisa->priv;
  109. }
  110. #endif /* EISA_H */