Initial revision
[linux-2.6.git] / include / asm-xen / xen-public / physdev.h
1 /****************************************************************************
2  * (c) 2004 - Rolf Neugebauer - Intel Research Cambridge
3  * (c) 2004 - Keir Fraser - University of Cambridge
4  ****************************************************************************
5  * Description: Interface for domains to access physical devices on the PCI bus
6  */
7
8 #ifndef __XEN_PUBLIC_PHYSDEV_H__
9 #define __XEN_PUBLIC_PHYSDEV_H__
10
11 /* Commands to HYPERVISOR_physdev_op() */
12 #define PHYSDEVOP_PCI_CFGREG_READ       0
13 #define PHYSDEVOP_PCI_CFGREG_WRITE      1
14 #define PHYSDEVOP_PCI_INITIALISE_DEVICE 2
15 #define PHYSDEVOP_PCI_PROBE_ROOT_BUSES  3
16 #define PHYSDEVOP_IRQ_UNMASK_NOTIFY     4
17 #define PHYSDEVOP_IRQ_STATUS_QUERY      5
18 #define PHYSDEVOP_SET_IOPL              6
19 #define PHYSDEVOP_SET_IOBITMAP          7
20
21 /* Read from PCI configuration space. */
22 typedef struct {
23     /* IN */
24     u32 bus;                          /*  0 */
25     u32 dev;                          /*  4 */
26     u32 func;                         /*  8 */
27     u32 reg;                          /* 12 */
28     u32 len;                          /* 16 */
29     /* OUT */
30     u32 value;                        /* 20 */
31 } PACKED physdevop_pci_cfgreg_read_t; /* 24 bytes */
32
33 /* Write to PCI configuration space. */
34 typedef struct {
35     /* IN */
36     u32 bus;                          /*  0 */
37     u32 dev;                          /*  4 */
38     u32 func;                         /*  8 */
39     u32 reg;                          /* 12 */
40     u32 len;                          /* 16 */
41     u32 value;                        /* 20 */
42 } PACKED physdevop_pci_cfgreg_write_t; /* 24 bytes */
43
44 /* Do final initialisation of a PCI device (e.g., last-moment IRQ routing). */
45 typedef struct {
46     /* IN */
47     u32 bus;                          /*  0 */
48     u32 dev;                          /*  4 */
49     u32 func;                         /*  8 */
50 } PACKED physdevop_pci_initialise_device_t; /* 12 bytes */
51
52 /* Find the root buses for subsequent scanning. */
53 typedef struct {
54     /* OUT */
55     u32 busmask[256/32];              /*  0 */
56 } PACKED physdevop_pci_probe_root_buses_t; /* 32 bytes */
57
58 typedef struct {
59     /* IN */
60     u32 irq;                          /*  0 */
61     /* OUT */
62 /* Need to call PHYSDEVOP_IRQ_UNMASK_NOTIFY when the IRQ has been serviced? */
63 #define PHYSDEVOP_IRQ_NEEDS_UNMASK_NOTIFY (1<<0)
64     u32 flags;                        /*  4 */
65 } PACKED physdevop_irq_status_query_t; /* 8 bytes */
66
67 typedef struct {
68     /* IN */
69     u32 iopl;                         /*  0 */
70 } PACKED physdevop_set_iopl_t; /* 4 bytes */
71
72 typedef struct {
73     /* IN */
74     memory_t bitmap;                  /*  0 */
75     MEMORY_PADDING;
76     u32      nr_ports;                /*  8 */
77     u32      __pad0;                  /* 12 */
78 } PACKED physdevop_set_iobitmap_t; /* 16 bytes */
79
80 typedef struct _physdev_op_st 
81 {
82     u32 cmd;                          /*  0 */
83     u32 __pad;                        /*  4 */
84     union {                           /*  8 */
85         physdevop_pci_cfgreg_read_t       pci_cfgreg_read;
86         physdevop_pci_cfgreg_write_t      pci_cfgreg_write;
87         physdevop_pci_initialise_device_t pci_initialise_device;
88         physdevop_pci_probe_root_buses_t  pci_probe_root_buses;
89         physdevop_irq_status_query_t      irq_status_query;
90         physdevop_set_iopl_t              set_iopl;
91         physdevop_set_iobitmap_t          set_iobitmap;
92         u8                                __dummy[32];
93     } PACKED u;
94 } PACKED physdev_op_t; /* 40 bytes */
95
96 #endif /* __XEN_PUBLIC_PHYSDEV_H__ */
97
98 /*
99  * Local variables:
100  * mode: C
101  * c-set-style: "BSD"
102  * c-basic-offset: 4
103  * tab-width: 4
104  * indent-tabs-mode: nil
105  * End:
106  */