eisa.h 3.0 KB

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