Sync usage with man page.
[netbsd-mini2440.git] / sys / arch / xen / include / xen3-public / io / pciif.h
blobca2e991f988cc3948224f624c3ad77e09caba5a4
1 /* $NetBSD: pciif.h,v 1.4 2008/08/22 14:14:04 cegger Exp $ */
2 /*
3 * PCI Backend/Frontend Common Data Structures & Macros
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to
7 * deal in the Software without restriction, including without limitation the
8 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
9 * sell copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
23 * Author: Ryan Wilson <hap9@epoch.ncsc.mil>
25 #ifndef __XEN_PCI_COMMON_H__
26 #define __XEN_PCI_COMMON_H__
28 /* Be sure to bump this number if you change this file */
29 #define XEN_PCI_MAGIC "7"
31 /* xen_pci_sharedinfo flags */
32 #define _XEN_PCIF_active (0)
33 #define XEN_PCIF_active (1<<_XEN_PCIF_active)
35 /* xen_pci_op commands */
36 #define XEN_PCI_OP_conf_read (0)
37 #define XEN_PCI_OP_conf_write (1)
38 #define XEN_PCI_OP_enable_msi (2)
39 #define XEN_PCI_OP_disable_msi (3)
40 #define XEN_PCI_OP_enable_msix (4)
41 #define XEN_PCI_OP_disable_msix (5)
43 /* xen_pci_op error numbers */
44 #define XEN_PCI_ERR_success (0)
45 #define XEN_PCI_ERR_dev_not_found (-1)
46 #define XEN_PCI_ERR_invalid_offset (-2)
47 #define XEN_PCI_ERR_access_denied (-3)
48 #define XEN_PCI_ERR_not_implemented (-4)
49 /* XEN_PCI_ERR_op_failed - backend failed to complete the operation */
50 #define XEN_PCI_ERR_op_failed (-5)
53 * it should be PAGE_SIZE-sizeof(struct xen_pci_op))/sizeof(struct msix_entry))
54 * Should not exceed 128
56 #define SH_INFO_MAX_VEC 128
58 struct xen_msix_entry {
59 uint16_t vector;
60 uint16_t entry;
62 struct xen_pci_op {
63 /* IN: what action to perform: XEN_PCI_OP_* */
64 uint32_t cmd;
66 /* OUT: will contain an error number (if any) from errno.h */
67 int32_t err;
69 /* IN: which device to touch */
70 uint32_t domain; /* PCI Domain/Segment */
71 uint32_t bus;
72 uint32_t devfn;
74 /* IN: which configuration registers to touch */
75 int32_t offset;
76 int32_t size;
78 /* IN/OUT: Contains the result after a READ or the value to WRITE */
79 uint32_t value;
80 /* IN: Contains extra infor for this operation */
81 uint32_t info;
82 /*IN: param for msi-x */
83 struct xen_msix_entry msix_entries[SH_INFO_MAX_VEC];
86 struct xen_pci_sharedinfo {
87 /* flags - XEN_PCIF_* */
88 uint32_t flags;
89 struct xen_pci_op op;
92 #endif /* __XEN_PCI_COMMON_H__ */
95 * Local variables:
96 * mode: C
97 * c-set-style: "BSD"
98 * c-basic-offset: 4
99 * tab-width: 4
100 * indent-tabs-mode: nil
101 * End: