Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _LINUX_EISA_H
0003 #define _LINUX_EISA_H
0004 
0005 #include <linux/ioport.h>
0006 #include <linux/device.h>
0007 #include <linux/mod_devicetable.h>
0008 
0009 #define EISA_MAX_SLOTS 8
0010 
0011 #define EISA_MAX_RESOURCES 4
0012 
0013 /* A few EISA constants/offsets... */
0014 
0015 #define EISA_DMA1_STATUS            8
0016 #define EISA_INT1_CTRL           0x20
0017 #define EISA_INT1_MASK           0x21
0018 #define EISA_INT2_CTRL           0xA0
0019 #define EISA_INT2_MASK           0xA1
0020 #define EISA_DMA2_STATUS         0xD0
0021 #define EISA_DMA2_WRITE_SINGLE   0xD4
0022 #define EISA_EXT_NMI_RESET_CTRL 0x461
0023 #define EISA_INT1_EDGE_LEVEL    0x4D0
0024 #define EISA_INT2_EDGE_LEVEL    0x4D1
0025 #define EISA_VENDOR_ID_OFFSET   0xC80
0026 #define EISA_CONFIG_OFFSET      0xC84
0027 
0028 #define EISA_CONFIG_ENABLED         1
0029 #define EISA_CONFIG_FORCED          2
0030 
0031 /* There is not much we can say about an EISA device, apart from
0032  * signature, slot number, and base address. dma_mask is set by
0033  * default to parent device mask..*/
0034 
0035 struct eisa_device {
0036     struct eisa_device_id id;
0037     int                   slot;
0038     int                   state;
0039     unsigned long         base_addr;
0040     struct resource       res[EISA_MAX_RESOURCES];
0041     u64                   dma_mask;
0042     struct device         dev; /* generic device */
0043 #ifdef CONFIG_EISA_NAMES
0044     char              pretty_name[50];
0045 #endif
0046 };
0047 
0048 #define to_eisa_device(n) container_of(n, struct eisa_device, dev)
0049 
0050 static inline int eisa_get_region_index (void *addr)
0051 {
0052     unsigned long x = (unsigned long) addr;
0053 
0054     x &= 0xc00;
0055     return (x >> 12);
0056 }
0057 
0058 struct eisa_driver {
0059     const struct eisa_device_id *id_table;
0060     struct device_driver         driver;
0061 };
0062 
0063 #define to_eisa_driver(drv) container_of(drv,struct eisa_driver, driver)
0064 
0065 /* These external functions are only available when EISA support is enabled. */
0066 #ifdef CONFIG_EISA
0067 
0068 extern struct bus_type eisa_bus_type;
0069 int eisa_driver_register (struct eisa_driver *edrv);
0070 void eisa_driver_unregister (struct eisa_driver *edrv);
0071 
0072 #else /* !CONFIG_EISA */
0073 
0074 static inline int eisa_driver_register (struct eisa_driver *edrv) { return 0; }
0075 static inline void eisa_driver_unregister (struct eisa_driver *edrv) { }
0076 
0077 #endif /* !CONFIG_EISA */
0078 
0079 /* Mimics pci.h... */
0080 static inline void *eisa_get_drvdata (struct eisa_device *edev)
0081 {
0082         return dev_get_drvdata(&edev->dev);
0083 }
0084 
0085 static inline void eisa_set_drvdata (struct eisa_device *edev, void *data)
0086 {
0087         dev_set_drvdata(&edev->dev, data);
0088 }
0089 
0090 /* The EISA root device. There's rumours about machines with multiple
0091  * busses (PA-RISC ?), so we try to handle that. */
0092 
0093 struct eisa_root_device {
0094     struct device   *dev;    /* Pointer to bridge device */
0095     struct resource *res;
0096     unsigned long    bus_base_addr;
0097     int      slots;  /* Max slot number */
0098     int      force_probe; /* Probe even when no slot 0 */
0099     u64      dma_mask; /* from bridge device */
0100     int              bus_nr; /* Set by eisa_root_register */
0101     struct resource  eisa_root_res; /* ditto */
0102 };
0103 
0104 int eisa_root_register (struct eisa_root_device *root);
0105 
0106 #ifdef CONFIG_EISA
0107 extern int EISA_bus;
0108 #else
0109 # define EISA_bus 0
0110 #endif
0111 
0112 #endif