Import changeset
[linux-flexiantxendom0-3.2.10.git] / include / asm-parisc / gsc.h
1 #ifndef ASM_PARISC_GSC_H
2 #define ASM_PARISC_GSC_H
3 #ifdef __KERNEL__
4
5 #include <linux/types.h>
6 #include <asm/hardware.h>       /* for struct hp_device */
7
8 /*
9  * The convention used for inb/outb etc. is that names starting with
10  * two underscores are the inline versions, names starting with a
11  * single underscore are proper functions, and names starting with a
12  * letter are macros that map in some way to inline or proper function
13  * versions.  Not all that pretty, but before you change it, be sure
14  * to convince yourself that it won't break anything (in particular
15  * module support).
16  */
17 extern   u8 _gsc_readb(void *);
18 extern  u16 _gsc_readw(void *);
19 extern  u32 _gsc_readl(void *);
20 extern  u64 _gsc_readq(void *);
21 extern void _gsc_writeb(u8, void *);
22 extern void _gsc_writew(u16,void *);
23 extern void _gsc_writel(u32,void *);
24 extern void _gsc_writeq(u64,void *);
25
26 #define gsc_readb(a)    _gsc_readb((void *)(a))
27 #define gsc_readw(a)    _gsc_readw((void *)(a))
28 #define gsc_readl(a)    _gsc_readl((void *)(a))
29 #define gsc_readq(a)    _gsc_readq((void *)(a))
30 #define gsc_writeb(v,a) _gsc_writeb((v),(void *)(a))
31 #define gsc_writew(v,a) _gsc_writew((v),(void *)(a))
32 #define gsc_writel(v,a) _gsc_writel((v),(void *)(a))
33 #define gsc_writeq(v,a) _gsc_writeq((v),(void *)(a))
34
35 struct gsc_dev {
36         struct gsc_bus  *bus;           /* bus this device is on */
37         struct gsc_dev  *next;          /* chain of all devices */
38         struct gsc_dev  *next_bus;      /* chain of all devices on a bus */
39         struct gsc_dev  *next_submod;   /* chain of all devices on a module */
40
41         unsigned        irq;            /* irq generated by this device */
42         void            *hpa;           /* hard physical address */
43
44         u16             hversion;
45         u8              spa;            /* SPA requirements */
46         u8              type;
47         u32             sversion;
48 };
49
50 struct gsc_irq {
51         unsigned long txn_addr; /* IRQ "target" */
52         int txn_data;           /* HW "IRQ" */
53         int irq;                /* virtual IRQ */
54 };
55
56 /* PA I/O Architected devices support at least 5 bits in the EIM register. */
57 #define GSC_EIM_WIDTH 5
58
59 extern int gsc_alloc_irq(struct gsc_irq *dev);  /* dev needs an irq */
60 extern int gsc_claim_irq(struct gsc_irq *dev, int irq); /* dev needs this irq */
61
62 struct gsc_bus {
63         void            *hpa;           /* HPA of device 0, function 0 of this bus */
64 };
65
66 /*
67  * There is one gsc_dev structure for each slot-number/function-number
68  * combination:
69  */
70
71 struct gsc_dev *gsc_find_device(u16 hversion, struct gsc_dev *from);
72
73 extern void probe_serial_gsc(void);
74
75 /* returns a virtual irq for device at dev->hpa (works for all LASI/ASP/WAX) */
76 extern int busdevice_alloc_irq( struct hp_device *dev );
77
78 #endif /* __KERNEL__ */
79 #endif /* LINUX_GSC_H */