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 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. #ifndef EISA_H
  2. #define EISA_H
  3. #include "stdint.h"
  4. #include "isa_ids.h"
  5. #include "nic.h"
  6. /*
  7. * EISA constants
  8. *
  9. */
  10. #define EISA_MIN_SLOT (0x1)
  11. #define EISA_MAX_SLOT (0xf) /* Must be 2^n - 1 */
  12. #define EISA_SLOT_BASE( n ) ( 0x1000 * (n) )
  13. #define EISA_MFG_ID_HI ( 0xc80 )
  14. #define EISA_MFG_ID_LO ( 0xc81 )
  15. #define EISA_PROD_ID_HI ( 0xc82 )
  16. #define EISA_PROD_ID_LO ( 0xc83 )
  17. #define EISA_GLOBAL_CONFIG ( 0xc84 )
  18. #define EISA_CMD_RESET ( 1 << 2 )
  19. #define EISA_CMD_ENABLE ( 1 << 0 )
  20. /*
  21. * A location on an EISA bus
  22. *
  23. */
  24. struct eisa_loc {
  25. unsigned int slot;
  26. };
  27. /*
  28. * A physical EISA device
  29. *
  30. */
  31. struct eisa_device {
  32. const char *name;
  33. unsigned int slot;
  34. uint16_t ioaddr;
  35. uint16_t mfg_id;
  36. uint16_t prod_id;
  37. };
  38. /*
  39. * An individual EISA device identified by ID
  40. *
  41. */
  42. struct eisa_id {
  43. const char *name;
  44. uint16_t mfg_id, prod_id;
  45. };
  46. /*
  47. * An EISA driver, with a device ID (struct eisa_id) table.
  48. *
  49. */
  50. struct eisa_driver {
  51. const char *name;
  52. struct eisa_id *ids;
  53. unsigned int id_count;
  54. };
  55. /*
  56. * Define an EISA driver
  57. *
  58. */
  59. #define EISA_DRIVER( _name, _ids ) \
  60. static struct eisa_driver _name = { \
  61. .ids = _ids, \
  62. .id_count = sizeof ( _ids ) / sizeof ( _ids[0] ), \
  63. }
  64. /*
  65. * Functions in eisa.c
  66. *
  67. */
  68. extern void eisa_device_enabled ( struct eisa_device *eisa, int enabled );
  69. extern void eisa_fill_nic ( struct nic *nic, struct eisa_device *eisa );
  70. static inline void enable_eisa_device ( struct eisa_device *eisa ) {
  71. eisa_device_enabled ( eisa, 1 );
  72. }
  73. static inline void disable_eisa_device ( struct eisa_device *eisa ) {
  74. eisa_device_enabled ( eisa, 0 );
  75. }
  76. /*
  77. * EISA bus global definition
  78. *
  79. */
  80. extern struct bus_driver eisa_driver;
  81. #endif /* EISA_H */