Path: blob/master/include/xen/interface/io/pciif.h
10818 views
/*1* PCI Backend/Frontend Common Data Structures & Macros2*3* Permission is hereby granted, free of charge, to any person obtaining a copy4* of this software and associated documentation files (the "Software"), to5* deal in the Software without restriction, including without limitation the6* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or7* sell copies of the Software, and to permit persons to whom the Software is8* furnished to do so, subject to the following conditions:9*10* The above copyright notice and this permission notice shall be included in11* all copies or substantial portions of the Software.12*13* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR14* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,15* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE16* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER17* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING18* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER19* DEALINGS IN THE SOFTWARE.20*21* Author: Ryan Wilson <[email protected]>22*/23#ifndef __XEN_PCI_COMMON_H__24#define __XEN_PCI_COMMON_H__2526/* Be sure to bump this number if you change this file */27#define XEN_PCI_MAGIC "7"2829/* xen_pci_sharedinfo flags */30#define _XEN_PCIF_active (0)31#define XEN_PCIF_active (1<<_XEN_PCIF_active)32#define _XEN_PCIB_AERHANDLER (1)33#define XEN_PCIB_AERHANDLER (1<<_XEN_PCIB_AERHANDLER)34#define _XEN_PCIB_active (2)35#define XEN_PCIB_active (1<<_XEN_PCIB_active)3637/* xen_pci_op commands */38#define XEN_PCI_OP_conf_read (0)39#define XEN_PCI_OP_conf_write (1)40#define XEN_PCI_OP_enable_msi (2)41#define XEN_PCI_OP_disable_msi (3)42#define XEN_PCI_OP_enable_msix (4)43#define XEN_PCI_OP_disable_msix (5)44#define XEN_PCI_OP_aer_detected (6)45#define XEN_PCI_OP_aer_resume (7)46#define XEN_PCI_OP_aer_mmio (8)47#define XEN_PCI_OP_aer_slotreset (9)4849/* xen_pci_op error numbers */50#define XEN_PCI_ERR_success (0)51#define XEN_PCI_ERR_dev_not_found (-1)52#define XEN_PCI_ERR_invalid_offset (-2)53#define XEN_PCI_ERR_access_denied (-3)54#define XEN_PCI_ERR_not_implemented (-4)55/* XEN_PCI_ERR_op_failed - backend failed to complete the operation */56#define XEN_PCI_ERR_op_failed (-5)5758/*59* it should be PAGE_SIZE-sizeof(struct xen_pci_op))/sizeof(struct msix_entry))60* Should not exceed 12861*/62#define SH_INFO_MAX_VEC 1286364struct xen_msix_entry {65uint16_t vector;66uint16_t entry;67};68struct xen_pci_op {69/* IN: what action to perform: XEN_PCI_OP_* */70uint32_t cmd;7172/* OUT: will contain an error number (if any) from errno.h */73int32_t err;7475/* IN: which device to touch */76uint32_t domain; /* PCI Domain/Segment */77uint32_t bus;78uint32_t devfn;7980/* IN: which configuration registers to touch */81int32_t offset;82int32_t size;8384/* IN/OUT: Contains the result after a READ or the value to WRITE */85uint32_t value;86/* IN: Contains extra infor for this operation */87uint32_t info;88/*IN: param for msi-x */89struct xen_msix_entry msix_entries[SH_INFO_MAX_VEC];90};9192/*used for pcie aer handling*/93struct xen_pcie_aer_op {94/* IN: what action to perform: XEN_PCI_OP_* */95uint32_t cmd;96/*IN/OUT: return aer_op result or carry error_detected state as input*/97int32_t err;9899/* IN: which device to touch */100uint32_t domain; /* PCI Domain/Segment*/101uint32_t bus;102uint32_t devfn;103};104struct xen_pci_sharedinfo {105/* flags - XEN_PCIF_* */106uint32_t flags;107struct xen_pci_op op;108struct xen_pcie_aer_op aer_op;109};110111#endif /* __XEN_PCI_COMMON_H__ */112113114