staticinlineconstchar *
pci_epc_interface_string(enum pci_epc_interface_type type)
{ switch (type) { case PRIMARY_INTERFACE: return"primary"; case SECONDARY_INTERFACE: return"secondary"; default: return"UNKNOWN interface";
}
}
/** * struct pci_epc_map - information about EPC memory for mapping a RC PCI * address range * @pci_addr: start address of the RC PCI address range to map * @pci_size: size of the RC PCI address range mapped from @pci_addr * @map_pci_addr: RC PCI address used as the first address mapped (may be lower * than @pci_addr) * @map_size: size of the controller memory needed for mapping the RC PCI address * range @map_pci_addr..@pci_addr+@pci_size * @phys_base: base physical address of the allocated EPC memory for mapping the * RC PCI address range * @phys_addr: physical address at which @pci_addr is mapped * @virt_base: base virtual address of the allocated EPC memory for mapping the * RC PCI address range * @virt_addr: virtual address at which @pci_addr is mapped
*/ struct pci_epc_map {
u64 pci_addr;
size_t pci_size;
/** * struct pci_epc_ops - set of function pointers for performing EPC operations * @write_header: ops to populate configuration space header * @set_bar: ops to configure the BAR * @clear_bar: ops to reset the BAR * @align_addr: operation to get the mapping address, mapping size and offset * into a controller memory window needed to map an RC PCI address * region * @map_addr: ops to map CPU address to PCI address * @unmap_addr: ops to unmap CPU address and PCI address * @set_msi: ops to set the requested number of MSI interrupts in the MSI * capability register * @get_msi: ops to get the number of MSI interrupts allocated by the RC from * the MSI capability register * @set_msix: ops to set the requested number of MSI-X interrupts in the * MSI-X capability register * @get_msix: ops to get the number of MSI-X interrupts allocated by the RC * from the MSI-X capability register * @raise_irq: ops to raise a legacy, MSI or MSI-X interrupt * @map_msi_irq: ops to map physical address to MSI address and return MSI data * @start: ops to start the PCI link * @stop: ops to stop the PCI link * @get_features: ops to get the features supported by the EPC * @owner: the module owner containing the ops
*/ struct pci_epc_ops { int (*write_header)(struct pci_epc *epc, u8 func_no, u8 vfunc_no, struct pci_epf_header *hdr); int (*set_bar)(struct pci_epc *epc, u8 func_no, u8 vfunc_no, struct pci_epf_bar *epf_bar); void (*clear_bar)(struct pci_epc *epc, u8 func_no, u8 vfunc_no, struct pci_epf_bar *epf_bar);
u64 (*align_addr)(struct pci_epc *epc, u64 pci_addr, size_t *size,
size_t *offset); int (*map_addr)(struct pci_epc *epc, u8 func_no, u8 vfunc_no,
phys_addr_t addr, u64 pci_addr, size_t size); void (*unmap_addr)(struct pci_epc *epc, u8 func_no, u8 vfunc_no,
phys_addr_t addr); int (*set_msi)(struct pci_epc *epc, u8 func_no, u8 vfunc_no,
u8 nr_irqs); int (*get_msi)(struct pci_epc *epc, u8 func_no, u8 vfunc_no); int (*set_msix)(struct pci_epc *epc, u8 func_no, u8 vfunc_no,
u16 nr_irqs, enum pci_barno, u32 offset); int (*get_msix)(struct pci_epc *epc, u8 func_no, u8 vfunc_no); int (*raise_irq)(struct pci_epc *epc, u8 func_no, u8 vfunc_no, unsignedint type, u16 interrupt_num); int (*map_msi_irq)(struct pci_epc *epc, u8 func_no, u8 vfunc_no,
phys_addr_t phys_addr, u8 interrupt_num,
u32 entry_size, u32 *msi_data,
u32 *msi_addr_offset); int (*start)(struct pci_epc *epc); void (*stop)(struct pci_epc *epc); conststruct pci_epc_features* (*get_features)(struct pci_epc *epc,
u8 func_no, u8 vfunc_no); struct module *owner;
};
/** * struct pci_epc_mem_window - address window of the endpoint controller * @phys_base: physical base address of the PCI address window * @size: the size of the PCI address window * @page_size: size of each page
*/ struct pci_epc_mem_window {
phys_addr_t phys_base;
size_t size;
size_t page_size;
};
/** * struct pci_epc_mem - address space of the endpoint controller * @window: address window of the endpoint controller * @bitmap: bitmap to manage the PCI address space * @pages: number of bits representing the address region * @lock: mutex to protect bitmap
*/ struct pci_epc_mem { struct pci_epc_mem_window window; unsignedlong *bitmap; int pages; /* mutex to protect against concurrent access for memory allocation*/ struct mutex lock;
};
/** * struct pci_epc - represents the PCI EPC device * @dev: PCI EPC device * @pci_epf: list of endpoint functions present in this EPC device * @list_lock: Mutex for protecting pci_epf list * @ops: function pointers for performing endpoint operations * @windows: array of address space of the endpoint controller * @mem: first window of the endpoint controller, which corresponds to * default address space of the endpoint controller supporting * single window. * @num_windows: number of windows supported by device * @max_functions: max number of functions that can be configured in this EPC * @max_vfs: Array indicating the maximum number of virtual functions that can * be associated with each physical function * @group: configfs group representing the PCI EPC device * @lock: mutex to protect pci_epc ops * @function_num_map: bitmap to manage physical function number * @domain_nr: PCI domain number of the endpoint controller * @init_complete: flag to indicate whether the EPC initialization is complete * or not
*/ struct pci_epc { struct device dev; struct list_head pci_epf; struct mutex list_lock; conststruct pci_epc_ops *ops; struct pci_epc_mem **windows; struct pci_epc_mem *mem; unsignedint num_windows;
u8 max_functions;
u8 *max_vfs; struct config_group *group; /* mutex to protect against concurrent access of EP controller */ struct mutex lock; unsignedlong function_num_map; int domain_nr; bool init_complete;
};
/** * enum pci_epc_bar_type - configurability of endpoint BAR * @BAR_PROGRAMMABLE: The BAR mask can be configured by the EPC. * @BAR_FIXED: The BAR mask is fixed by the hardware. * @BAR_RESIZABLE: The BAR implements the PCI-SIG Resizable BAR Capability. * NOTE: An EPC driver can currently only set a single supported * size. * @BAR_RESERVED: The BAR should not be touched by an EPF driver.
*/ enum pci_epc_bar_type {
BAR_PROGRAMMABLE = 0,
BAR_FIXED,
BAR_RESIZABLE,
BAR_RESERVED,
};
/** * struct pci_epc_bar_desc - hardware description for a BAR * @type: the type of the BAR * @fixed_size: the fixed size, only applicable if type is BAR_FIXED_MASK. * @only_64bit: if true, an EPF driver is not allowed to choose if this BAR * should be configured as 32-bit or 64-bit, the EPF driver must * configure this BAR as 64-bit. Additionally, the BAR succeeding * this BAR must be set to type BAR_RESERVED. * * only_64bit should not be set on a BAR of type BAR_RESERVED. * (If BARx is a 64-bit BAR that an EPF driver is not allowed to * touch, then both BARx and BARx+1 must be set to type * BAR_RESERVED.)
*/ struct pci_epc_bar_desc { enum pci_epc_bar_type type;
u64 fixed_size; bool only_64bit;
};
/** * struct pci_epc_features - features supported by a EPC device per function * @linkup_notifier: indicate if the EPC device can notify EPF driver on link up * @msi_capable: indicate if the endpoint function has MSI capability * @msix_capable: indicate if the endpoint function has MSI-X capability * @intx_capable: indicate if the endpoint can raise INTx interrupts * @bar: array specifying the hardware description for each BAR * @align: alignment size required for BAR buffer allocation
*/ struct pci_epc_features { unsignedint linkup_notifier : 1; unsignedint msi_capable : 1; unsignedint msix_capable : 1; unsignedint intx_capable : 1; struct pci_epc_bar_desc bar[PCI_STD_NUM_BARS];
size_t align;
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.