Merge tag 'ti-v2020.07-rc3' of https://gitlab.denx.de/u-boot/custodians/u-boot-ti
[oweals/u-boot.git] / arch / x86 / include / asm / pci.h
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * (C) Copyright 2002
4  * Daniel Engström, Omicron Ceti AB, daniel@omicron.se
5  */
6
7 #ifndef _PCI_I386_H_
8 #define _PCI_I386_H_
9
10 #include <pci.h>
11
12 /* bus mapping constants (used for PCI core initialization) */
13 #define PCI_REG_ADDR    0xcf8
14 #define PCI_REG_DATA    0xcfc
15
16 #define PCI_CFG_EN      0x80000000
17
18 #ifndef __ASSEMBLY__
19
20 /**
21  * pci_x86_read_config() - Read a configuration value from a device
22  *
23  * This function can be called before PCI is set up in driver model.
24  *
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
28  * @size:       Access size
29  * @return 0 if OK, -ve on error
30  */
31 int pci_x86_read_config(pci_dev_t bdf, uint offset, ulong *valuep,
32                         enum pci_size_t size);
33
34 /**
35  * pci_bus_write_config() - Write a configuration value to a device
36  *
37  * This function can be called before PCI is set up in driver model.
38  *
39  * @bdf:        PCI device address: bus, device and function -see PCI_BDF()
40  * @offset:     Register offset to write
41  * @value:      Value to write
42  * @size:       Access size
43  * @return 0 if OK, -ve on error
44  */
45 int pci_x86_write_config(pci_dev_t bdf, uint offset, ulong value,
46                          enum pci_size_t size);
47
48 /**
49  * pci_bus_clrset_config32() - Update a configuration value for a device
50  *
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.
53  *
54  * @bdf:        PCI device address: bus, device and function -see PCI_BDF()
55  * @offset:     Register offset to update
56  * @clr:        Bits to clear
57  * @set:        Bits to set
58  * @return 0 if OK, -ve on error
59  */
60 int pci_x86_clrset_config(pci_dev_t bdf, uint offset, ulong clr, ulong set,
61                           enum pci_size_t size);
62
63 /**
64  * Assign IRQ number to a PCI device
65  *
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.
68  *
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.
73  */
74 void pci_assign_irqs(int bus, int device, u8 irq[4]);
75
76 #endif /* __ASSEMBLY__ */
77
78 #endif /* _PCI_I386_H_ */