linux/drivers/xen/xen-pciback/conf_space.h

/* SPDX-License-Identifier: GPL-2.0 */
/*
 * PCI Backend - Common data structures for overriding the configuration space
 *
 * Author: Ryan Wilson <[email protected]>
 */

#ifndef __XEN_PCIBACK_CONF_SPACE_H__
#define __XEN_PCIBACK_CONF_SPACE_H__

#include <linux/list.h>
#include <linux/err.h>

/* conf_field_init can return an errno in a ptr with ERR_PTR() */
conf_field_init;
conf_field_reset;
conf_field_free;

conf_dword_write;
conf_word_write;
conf_byte_write;
conf_dword_read;
conf_word_read;
conf_byte_read;

/* These are the fields within the configuration space which we
 * are interested in intercepting reads/writes to and changing their
 * values.
 */
struct config_field {};

struct config_field_entry {};

#define INTERRUPT_TYPE_NONE
#define INTERRUPT_TYPE_INTX
#define INTERRUPT_TYPE_MSI
#define INTERRUPT_TYPE_MSIX

extern bool xen_pcibk_permissive;

#define OFFSET(cfg_entry)

/* 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)
{}

static inline int xen_pcibk_config_add_fields(struct pci_dev *dev,
					    const struct config_field *field)
{}

static inline int xen_pcibk_config_add_fields_offset(struct pci_dev *dev,
					const struct config_field *field,
					unsigned int offset)
{}

/* 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);

int xen_pcibk_get_interrupt_type(struct pci_dev *dev);

#endif				/* __XEN_PCIBACK_CONF_SPACE_H__ */