eisa.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. #ifndef _LINUX_EISA_H
  2. #define _LINUX_EISA_H
  3. #include <linux/ioport.h>
  4. #include <linux/device.h>
  5. #include <linux/mod_devicetable.h>
  6. #define EISA_MAX_SLOTS 8
  7. #define EISA_MAX_RESOURCES 4
  8. /* A few EISA constants/offsets... */
  9. #define EISA_DMA1_STATUS 8
  10. #define EISA_INT1_CTRL 0x20
  11. #define EISA_INT1_MASK 0x21
  12. #define EISA_INT2_CTRL 0xA0
  13. #define EISA_INT2_MASK 0xA1
  14. #define EISA_DMA2_STATUS 0xD0
  15. #define EISA_DMA2_WRITE_SINGLE 0xD4
  16. #define EISA_EXT_NMI_RESET_CTRL 0x461
  17. #define EISA_INT1_EDGE_LEVEL 0x4D0
  18. #define EISA_INT2_EDGE_LEVEL 0x4D1
  19. #define EISA_VENDOR_ID_OFFSET 0xC80
  20. #define EISA_CONFIG_OFFSET 0xC84
  21. #define EISA_CONFIG_ENABLED 1
  22. #define EISA_CONFIG_FORCED 2
  23. /* There is not much we can say about an EISA device, apart from
  24. * signature, slot number, and base address. dma_mask is set by
  25. * default to parent device mask..*/
  26. struct eisa_device {
  27. struct eisa_device_id id;
  28. int slot;
  29. int state;
  30. unsigned long base_addr;
  31. struct resource res[EISA_MAX_RESOURCES];
  32. u64 dma_mask;
  33. struct device dev; /* generic device */
  34. #ifdef CONFIG_EISA_NAMES
  35. char pretty_name[50];
  36. #endif
  37. };
  38. #define to_eisa_device(n) container_of(n, struct eisa_device, dev)
  39. static inline int eisa_get_region_index (void *addr)
  40. {
  41. unsigned long x = (unsigned long) addr;
  42. x &= 0xc00;
  43. return (x >> 12);
  44. }
  45. struct eisa_driver {
  46. const struct eisa_device_id *id_table;
  47. struct device_driver driver;
  48. };
  49. #define to_eisa_driver(drv) container_of(drv,struct eisa_driver, driver)
  50. /* These external functions are only available when EISA support is enabled. */
  51. #ifdef CONFIG_EISA
  52. extern struct bus_type eisa_bus_type;
  53. int eisa_driver_register (struct eisa_driver *edrv);
  54. void eisa_driver_unregister (struct eisa_driver *edrv);
  55. #else /* !CONFIG_EISA */
  56. static inline int eisa_driver_register (struct eisa_driver *edrv) { return 0; }
  57. static inline void eisa_driver_unregister (struct eisa_driver *edrv) { }
  58. #endif /* !CONFIG_EISA */
  59. /* Mimics pci.h... */
  60. static inline void *eisa_get_drvdata (struct eisa_device *edev)
  61. {
  62. return dev_get_drvdata(&edev->dev);
  63. }
  64. static inline void eisa_set_drvdata (struct eisa_device *edev, void *data)
  65. {
  66. dev_set_drvdata(&edev->dev, data);
  67. }
  68. /* The EISA root device. There's rumours about machines with multiple
  69. * busses (PA-RISC ?), so we try to handle that. */
  70. struct eisa_root_device {
  71. struct device *dev; /* Pointer to bridge device */
  72. struct resource *res;
  73. unsigned long bus_base_addr;
  74. int slots; /* Max slot number */
  75. int force_probe; /* Probe even when no slot 0 */
  76. u64 dma_mask; /* from bridge device */
  77. int bus_nr; /* Set by eisa_root_register */
  78. struct resource eisa_root_res; /* ditto */
  79. };
  80. int eisa_root_register (struct eisa_root_device *root);
  81. #ifdef CONFIG_EISA
  82. extern int EISA_bus;
  83. #else
  84. # define EISA_bus 0
  85. #endif
  86. #endif