/* * PCI Backend - Common data structures for overriding the configuration space * * Author: Ryan Wilson */ #ifndef __XEN_PCIBACK_CONF_SPACE_H__ #define __XEN_PCIBACK_CONF_SPACE_H__ #include #include /* conf_field_init can return an errno in a ptr with ERR_PTR() */ typedef void *(*conf_field_init) (struct pci_dev *dev, int offset); typedef void (*conf_field_reset) (struct pci_dev *dev, int offset, void *data); typedef void (*conf_field_free) (struct pci_dev *dev, int offset, void *data); typedef int (*conf_dword_write) (struct pci_dev *dev, int offset, u32 value, void *data); typedef int (*conf_word_write) (struct pci_dev *dev, int offset, u16 value, void *data); typedef int (*conf_byte_write) (struct pci_dev *dev, int offset, u8 value, void *data); typedef int (*conf_dword_read) (struct pci_dev *dev, int offset, u32 *value, void *data); typedef int (*conf_word_read) (struct pci_dev *dev, int offset, u16 *value, void *data); typedef int (*conf_byte_read) (struct pci_dev *dev, int offset, u8 *value, void *data); /* These are the fields within the configuration space which we * are interested in intercepting reads/writes to and changing their * values. */ struct config_field { unsigned int offset; unsigned int size; unsigned int mask; conf_field_init init; conf_field_reset reset; conf_field_free release; void (*clean) (struct config_field *field); union { struct { conf_dword_write write; conf_dword_read read; } dw; struct { conf_word_write write; conf_word_read read; } w; struct { conf_byte_write write; conf_byte_read read; } b; } u; struct list_head list; }; struct config_field_entry { struct list_head list; const struct config_field *field; unsigned int base_offset; void *data; }; extern bool xen_pcibk_permissive; #define OFFSET(cfg_entry) ((cfg_entry)->base_offset+(cfg_entry)->field->offset) /* Add fields to a device - the add_fields macro expects to get a pointer to * the first entry in an array (of which the ending is marked by size==0) */ int xen_pcibk_config_add_field_offset(struct pci_dev *dev, const struct config_field *field, unsigned int offset); static inline int xen_pcibk_config_add_field(struct pci_dev *dev, const struct config_field *field) { return xen_pcibk_config_add_field_offset(dev, field, 0); } static inline int xen_pcibk_config_add_fields(struct pci_dev *dev, const struct config_field *field) { int i, err = 0; for (i = 0; field[i].size != 0; i++) { err = xen_pcibk_config_add_field(dev, &field[i]); if (err) break; } return err; } static inline int xen_pcibk_config_add_fields_offset(struct pci_dev *dev, const struct config_field *field, unsigned int offset) { int i, err = 0; for (i = 0; field[i].size != 0; i++) { err = xen_pcibk_config_add_field_offset(dev, &field[i], offset); if (err) break; } return err; } /* Read/Write the real configuration space */ int xen_pcibk_read_config_byte(struct pci_dev *dev, int offset, u8 *value, void *data); int xen_pcibk_read_config_word(struct pci_dev *dev, int offset, u16 *value, void *data); int xen_pcibk_read_config_dword(struct pci_dev *dev, int offset, u32 *value, void *data); int xen_pcibk_write_config_byte(struct pci_dev *dev, int offset, u8 value, void *data); int xen_pcibk_write_config_word(struct pci_dev *dev, int offset, u16 value, void *data); int xen_pcibk_write_config_dword(struct pci_dev *dev, int offset, u32 value, void *data); int xen_pcibk_config_capability_init(void); int xen_pcibk_config_header_add_fields(struct pci_dev *dev); int xen_pcibk_config_capability_add_fields(struct pci_dev *dev); #endif /* __XEN_PCIBACK_CONF_SPACE_H__ */ div class='cgit-panel'>diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-01-08 11:42:04 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2017-01-08 11:42:04 -0800
commit83280e90ef001f77a64e2ce59c25ab66e47ab1f0 (patch)
treeec0a5842e2fbc0f4abaff55299acac397b8da5c3 /tools/perf/tests/bpf-script-test-prologue.c
parentcc250e267bd56c531b0bee455fc724d50af83fac (diff)
parent0a8fd1346254974c3a852338508e4a4cddbb35f1 (diff)
Merge tag 'usb-4.10-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull USB fixes from Greg KH: "Here are a bunch of USB fixes for 4.10-rc3. Yeah, it's a lot, an artifact of the holiday break I think. Lots of gadget and the usual XHCI fixups for reported issues (one day that driver will calm down...) Also included are a bunch of usb-serial driver fixes, and for good measure, a number of much-reported MUSB driver issues have finally been resolved. All of these have been in linux-next with no reported issues" * tag 'usb-4.10-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (72 commits) USB: fix problems with duplicate endpoint addresses usb: ohci-at91: use descriptor-based gpio APIs correctly usb: storage: unusual_uas: Add JMicron JMS56x to unusual device usb: hub: Move hub_port_disable() to fix warning if PM is disabled usb: musb: blackfin: add bfin_fifo_offset in bfin_ops usb: musb: fix compilation warning on unused function usb: musb: Fix trying to free already-free IRQ 4 usb: musb: dsps: implement clear_ep_rxintr() callback usb: musb: core: add clear_ep_rxintr() to musb_platform_ops USB: serial: ti_usb_3410_5052: fix NULL-deref at open USB: serial: spcp8x5: fix NULL-deref at open USB: serial: quatech2: fix sleep-while-atomic in close USB: serial: pl2303: fix NULL-deref at open USB: serial: oti6858: fix NULL-deref at open USB: serial: omninet: fix NULL-derefs at open and disconnect USB: serial: mos7840: fix misleading interrupt-URB comment USB: serial: mos7840: remove unused write URB USB: serial: mos7840: fix NULL-deref at open USB: serial: mos7720: remove obsolete port initialisation USB: serial: mos7720: fix parallel probe ...
Diffstat (limited to 'tools/perf/tests/bpf-script-test-prologue.c')