/*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)48#define XEN_PCI_OP_enable_multi_msi (10)4950/* xen_pci_op error numbers */51#define XEN_PCI_ERR_success (0)52#define XEN_PCI_ERR_dev_not_found (-1)53#define XEN_PCI_ERR_invalid_offset (-2)54#define XEN_PCI_ERR_access_denied (-3)55#define XEN_PCI_ERR_not_implemented (-4)56/* XEN_PCI_ERR_op_failed - backend failed to complete the operation */57#define XEN_PCI_ERR_op_failed (-5)5859/*60* it should be PAGE_SIZE-sizeof(struct xen_pci_op))/sizeof(struct msix_entry))61* Should not exceed 12862*/63#define SH_INFO_MAX_VEC 1286465struct xen_msix_entry {66uint16_t vector;67uint16_t entry;68};69struct xen_pci_op {70/* IN: what action to perform: XEN_PCI_OP_* */71uint32_t cmd;7273/* OUT: will contain an error number (if any) from errno.h */74int32_t err;7576/* IN: which device to touch */77uint32_t domain; /* PCI Domain/Segment */78uint32_t bus;79uint32_t devfn;8081/* IN: which configuration registers to touch */82int32_t offset;83int32_t size;8485/* IN/OUT: Contains the result after a READ or the value to WRITE */86uint32_t value;87/* IN: Contains extra infor for this operation */88uint32_t info;89/*IN: param for msi-x */90struct xen_msix_entry msix_entries[SH_INFO_MAX_VEC];91};9293/*used for pcie aer handling*/94struct xen_pcie_aer_op95{9697/* IN: what action to perform: XEN_PCI_OP_* */98uint32_t cmd;99/*IN/OUT: return aer_op result or carry error_detected state as input*/100int32_t err;101102/* IN: which device to touch */103uint32_t domain; /* PCI Domain/Segment*/104uint32_t bus;105uint32_t devfn;106};107struct xen_pci_sharedinfo {108/* flags - XEN_PCIF_* */109uint32_t flags;110struct xen_pci_op op;111struct xen_pcie_aer_op aer_op;112};113114#endif /* __XEN_PCI_COMMON_H__ */115116/*117* Local variables:118* mode: C119* c-file-style: "BSD"120* c-basic-offset: 4121* tab-width: 4122* indent-tabs-mode: nil123* End:124*/125126127