acpi: Move PCI functions to separate file

Signed-off-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Change-Id: Idc96b99da9f9037267c0bec2c839014b13ceb8cc
Reviewed-on: https://review.coreboot.org/c/coreboot/+/51106
Reviewed-by: Furquan Shaikh <furquan@google.com>
Reviewed-by: Lance Zhao
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Tim Wawrzynczak
2021-02-25 13:14:49 -07:00
committed by Patrick Georgi
parent 740cd31858
commit d40a4c2bb4
11 changed files with 46 additions and 21 deletions

26
src/acpi/acpigen_pci.c Normal file
View File

@@ -0,0 +1,26 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <acpi/acpigen.h>
#include <acpi/acpigen_pci.h>
#include <assert.h>
#include <device/device.h>
#include <device/pci_def.h>
#include <device/pci_type.h>
#include <types.h>
void acpigen_write_ADR_pci_devfn(pci_devfn_t devfn)
{
/*
* _ADR for PCI Bus is encoded as follows:
* [63:32] - unused
* [31:16] - device #
* [15:0] - function #
*/
acpigen_write_ADR(PCI_SLOT(devfn) << 16 | PCI_FUNC(devfn));
}
void acpigen_write_ADR_pci_device(const struct device *dev)
{
assert(dev->path.type == DEVICE_PATH_PCI);
acpigen_write_ADR_pci_devfn(dev->path.pci.devfn);
}