]> Git Repo - qemu.git/blame - hw/acpi/pci.c
hw/acpi: Consolidate build_mcfg to pci.c
[qemu.git] / hw / acpi / pci.c
CommitLineData
f13a944c
WY
1/*
2 * Support for generating PCI related ACPI tables and passing them to Guests
3 *
4 * Copyright (C) 2006 Fabrice Bellard
5 * Copyright (C) 2008-2010 Kevin O'Connor <[email protected]>
6 * Copyright (C) 2013-2019 Red Hat Inc
7 * Copyright (C) 2019 Intel Corporation
8 *
9 * Author: Wei Yang <[email protected]>
10 * Author: Michael S. Tsirkin <[email protected]>
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21
22 * You should have received a copy of the GNU General Public License along
23 * with this program; if not, see <http://www.gnu.org/licenses/>.
24 */
25
26#include "qemu/osdep.h"
27#include "hw/acpi/aml-build.h"
28#include "hw/acpi/pci.h"
29#include "hw/pci/pcie_host.h"
30
31void build_mcfg(GArray *table_data, BIOSLinker *linker, AcpiMcfgInfo *info)
32{
33 AcpiTableMcfg *mcfg;
34 int len = sizeof(*mcfg) + sizeof(mcfg->allocation[0]);
35
36 mcfg = acpi_data_push(table_data, len);
37 mcfg->allocation[0].address = cpu_to_le64(info->base);
38
39 /* Only a single allocation so no need to play with segments */
40 mcfg->allocation[0].pci_segment = cpu_to_le16(0);
41 mcfg->allocation[0].start_bus_number = 0;
42 mcfg->allocation[0].end_bus_number = PCIE_MMCFG_BUS(info->size - 1);
43
44 build_header(linker, table_data, (void *)mcfg, "MCFG", len, 1, NULL, NULL);
45}
46
This page took 0.025915 seconds and 4 git commands to generate.