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.

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