1 /* SPDX-License-Identifier: GPL-2.0+ */
4 * Daniel Engström, Omicron Ceti AB, daniel@omicron.se
12 /* bus mapping constants (used for PCI core initialization) */
13 #define PCI_REG_ADDR 0xcf8
14 #define PCI_REG_DATA 0xcfc
16 #define PCI_CFG_EN 0x80000000
21 * pci_x86_read_config() - Read a configuration value from a device
23 * This function can be called before PCI is set up in driver model.
25 * @bdf: PCI device address: bus, device and function -see PCI_BDF()
26 * @offset: Register offset to read
27 * @valuep: Place to put the returned value
29 * @return 0 if OK, -ve on error
31 int pci_x86_read_config(pci_dev_t bdf, uint offset, ulong *valuep,
32 enum pci_size_t size);
35 * pci_bus_write_config() - Write a configuration value to a device
37 * This function can be called before PCI is set up in driver model.
39 * @bdf: PCI device address: bus, device and function -see PCI_BDF()
40 * @offset: Register offset to write
41 * @value: Value to write
43 * @return 0 if OK, -ve on error
45 int pci_x86_write_config(pci_dev_t bdf, uint offset, ulong value,
46 enum pci_size_t size);
49 * pci_bus_clrset_config32() - Update a configuration value for a device
51 * The register at @offset is updated to (oldvalue & ~clr) | set. This function
52 * can be called before PCI is set up in driver model.
54 * @bdf: PCI device address: bus, device and function -see PCI_BDF()
55 * @offset: Register offset to update
58 * @return 0 if OK, -ve on error
60 int pci_x86_clrset_config(pci_dev_t bdf, uint offset, ulong clr, ulong set,
61 enum pci_size_t size);
64 * Assign IRQ number to a PCI device
66 * This function assigns IRQ for a PCI device. If the device does not exist
67 * or does not require interrupts then this function has no effect.
69 * @bus: PCI bus number
70 * @device: PCI device number
71 * @irq: An array of IRQ numbers that are assigned to INTA through
72 * INTD of this PCI device.
74 void pci_assign_irqs(int bus, int device, u8 irq[4]);
76 #endif /* __ASSEMBLY__ */
78 #endif /* _PCI_I386_H_ */