acpi: Add support for SSDT generation
[platform/kernel/u-boot.git] / include / dm / pci.h
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright (c) 2019 Google, Inc
4  */
5
6 #ifndef __DM_PCI_H
7 #define __DM_PCI_H
8
9 struct udevice;
10
11 /**
12  * pci_get_devfn() - Extract the devfn from fdt_pci_addr of the device
13  *
14  * Get devfn from fdt_pci_addr of the specified device
15  *
16  * This returns an int to avoid a dependency on pci.h
17  *
18  * @dev:        PCI device
19  * @return devfn in bits 15...8 if found (pci_dev_t format), or -ENODEV if not
20  *      found
21  */
22 int pci_get_devfn(struct udevice *dev);
23
24 /**
25  * pci_ofplat_get_devfn() - Get the PCI dev/fn from of-platdata
26  *
27  * This function is used to obtain a PCI device/function from of-platdata
28  * register data. In this case the first cell of the 'reg' property contains
29  * the required information.
30  *
31  * This returns an int to avoid a dependency on pci.h
32  *
33  * @reg: reg value from dt-platdata.c array (first member). This is not a
34  *      pointer type, since the caller may use fdt32_t or fdt64_t depending on
35  *      the address sizes.
36  * @return device/function for that device (pci_dev_t format)
37  */
38 static inline int pci_ofplat_get_devfn(u32 reg)
39 {
40         return reg & 0xff00;
41 }
42
43 #endif