Attention is currently required from: Jakub Czapiga, ron minnich, Paul Menzel, Stefan Reinauer, Julius Werner, Angel Pons, Arthur Heymans, Keith Hui, Patrick Rudolph, Branden Waldner, Martin L Roth, Christian Walter, Felix Held.
Erik van den Bogaert has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/55068 )
Change subject: Allow to build romstage sources inside the bootblock
......................................................................
Patch Set 33: Code-Review+1
--
To view, visit https://review.coreboot.org/c/coreboot/+/55068
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Id68390edc1ba228b121cca89b80c64a92553e284
Gerrit-Change-Number: 55068
Gerrit-PatchSet: 33
Gerrit-Owner: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-Reviewer: Aaron Durbin <adurbin(a)chromium.org>
Gerrit-Reviewer: Andrey Petrov <andrey.petrov(a)gmail.com>
Gerrit-Reviewer: Christian Walter <christian.walter(a)9elements.com>
Gerrit-Reviewer: Erik van den Bogaert <ebogaert(a)eltan.com>
Gerrit-Reviewer: Felix Held <felix-coreboot(a)felixheld.de>
Gerrit-Reviewer: Frans Hendriks <fhendriks(a)eltan.com>
Gerrit-Reviewer: Furquan Shaikh <furquan.m.shaikh(a)gmail.com>
Gerrit-Reviewer: Jakub Czapiga <jacz(a)semihalf.com>
Gerrit-Reviewer: Jason Glenesk <jason.glenesk(a)gmail.com>
Gerrit-Reviewer: Julius Werner <jwerner(a)chromium.org>
Gerrit-Reviewer: Marshall Dawson <marshalldawson3rd(a)gmail.com>
Gerrit-Reviewer: Martin L Roth <gaumless(a)gmail.com>
Gerrit-Reviewer: Michał Żygowski <michal.zygowski(a)3mdeb.com>
Gerrit-Reviewer: Patrick Rudolph <siro(a)das-labor.org>
Gerrit-Reviewer: Philipp Hug <philipp(a)hug.cx>
Gerrit-Reviewer: Piotr Król <piotr.krol(a)3mdeb.com>
Gerrit-Reviewer: Raul Rangel <rrangel(a)chromium.org>
Gerrit-Reviewer: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
Gerrit-Reviewer: Subrata Banik <subrata.banik(a)intel.com>
Gerrit-Reviewer: Yu-Ping Wu <yupingso(a)google.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Reviewer: ron minnich <rminnich(a)chromium.org>
Gerrit-Reviewer: ron minnich <rminnich(a)gmail.com>
Gerrit-CC: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-CC: Branden Waldner <scruffy99(a)gmail.com>
Gerrit-CC: Keith Hui <buurin(a)gmail.com>
Gerrit-CC: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-Attention: Jakub Czapiga <jacz(a)semihalf.com>
Gerrit-Attention: ron minnich <rminnich(a)chromium.org>
Gerrit-Attention: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-Attention: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
Gerrit-Attention: Julius Werner <jwerner(a)chromium.org>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Attention: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-Attention: Keith Hui <buurin(a)gmail.com>
Gerrit-Attention: Patrick Rudolph <siro(a)das-labor.org>
Gerrit-Attention: Branden Waldner <scruffy99(a)gmail.com>
Gerrit-Attention: Martin L Roth <gaumless(a)gmail.com>
Gerrit-Attention: Christian Walter <christian.walter(a)9elements.com>
Gerrit-Attention: Felix Held <felix-coreboot(a)felixheld.de>
Gerrit-Comment-Date: Mon, 07 Nov 2022 14:01:29 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: Felix Singer, Frans Hendriks, Patrick Rudolph, Jonathan Zhang, Jeremy Soller, Angel Pons, Arthur Heymans, Jonathon Hall, Michael Niewöhner, Piotr Król, Tim Crawford, Tarun Tuli, Nico Huber, Michał Żygowski, Maxim Polyakov, Johnny Lin, Christian Walter, Morgan Jang, Werner Zeh, Tim Chu.
Erik van den Bogaert has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/69303 )
Change subject: mb/*: Remove lapic from devicetree
......................................................................
Patch Set 3: Code-Review+1
--
To view, visit https://review.coreboot.org/c/coreboot/+/69303
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I5258a769c0f0ee4bbc4facc19737eed187b68c73
Gerrit-Change-Number: 69303
Gerrit-PatchSet: 3
Gerrit-Owner: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Christian Walter <christian.walter(a)9elements.com>
Gerrit-Reviewer: Erik van den Bogaert <ebogaert(a)eltan.com>
Gerrit-Reviewer: Felix Singer <felixsinger(a)posteo.net>
Gerrit-Reviewer: Frans Hendriks <fhendriks(a)eltan.com>
Gerrit-Reviewer: Jeremy Soller <jeremy(a)system76.com>
Gerrit-Reviewer: Johnny Lin <Johnny_Lin(a)wiwynn.com>
Gerrit-Reviewer: Jonathan Zhang <jonzhang(a)fb.com>
Gerrit-Reviewer: Jonathon Hall <jonathon.hall(a)puri.sm>
Gerrit-Reviewer: Maxim Polyakov <max.senia.poliak(a)gmail.com>
Gerrit-Reviewer: Michael Niewöhner <foss(a)mniewoehner.de>
Gerrit-Reviewer: Michał Żygowski <michal.zygowski(a)3mdeb.com>
Gerrit-Reviewer: Morgan Jang <Morgan_Jang(a)wiwynn.com>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: Patrick Rudolph <patrick.rudolph(a)9elements.com>
Gerrit-Reviewer: Piotr Król <piotr.krol(a)3mdeb.com>
Gerrit-Reviewer: Sean Rhodes <sean(a)starlabs.systems>
Gerrit-Reviewer: Tarun Tuli <taruntuli(a)google.com>
Gerrit-Reviewer: Tim Chu <Tim.Chu(a)quantatw.com>
Gerrit-Reviewer: Tim Crawford <tcrawford(a)system76.com>
Gerrit-Reviewer: Werner Zeh <werner.zeh(a)siemens.com>
Gerrit-Attention: Felix Singer <felixsinger(a)posteo.net>
Gerrit-Attention: Frans Hendriks <fhendriks(a)eltan.com>
Gerrit-Attention: Patrick Rudolph <patrick.rudolph(a)9elements.com>
Gerrit-Attention: Jonathan Zhang <jonzhang(a)fb.com>
Gerrit-Attention: Jeremy Soller <jeremy(a)system76.com>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Attention: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-Attention: Jonathon Hall <jonathon.hall(a)puri.sm>
Gerrit-Attention: Michael Niewöhner <foss(a)mniewoehner.de>
Gerrit-Attention: Piotr Król <piotr.krol(a)3mdeb.com>
Gerrit-Attention: Tim Crawford <tcrawford(a)system76.com>
Gerrit-Attention: Tarun Tuli <taruntuli(a)google.com>
Gerrit-Attention: Nico Huber <nico.h(a)gmx.de>
Gerrit-Attention: Michał Żygowski <michal.zygowski(a)3mdeb.com>
Gerrit-Attention: Maxim Polyakov <max.senia.poliak(a)gmail.com>
Gerrit-Attention: Johnny Lin <Johnny_Lin(a)wiwynn.com>
Gerrit-Attention: Christian Walter <christian.walter(a)9elements.com>
Gerrit-Attention: Morgan Jang <Morgan_Jang(a)wiwynn.com>
Gerrit-Attention: Werner Zeh <werner.zeh(a)siemens.com>
Gerrit-Attention: Tim Chu <Tim.Chu(a)quantatw.com>
Gerrit-Comment-Date: Mon, 07 Nov 2022 14:00:58 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Arthur Heymans has submitted this change. ( https://review.coreboot.org/c/coreboot/+/69140 )
Change subject: device/resource_allocator_v3: Drop code
......................................................................
device/resource_allocator_v3: Drop code
No platform uses this anymore.
Change-Id: Ifccb59ae45daa8fec41a9a2d46c628ff24a0c998
Signed-off-by: Arthur Heymans <arthur(a)aheymans.xyz>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/69140
Reviewed-by: Elyes Haouas <ehaouas(a)noos.fr>
Tested-by: build bot (Jenkins) <no-reply(a)coreboot.org>
Reviewed-by: Angel Pons <th3fanbus(a)gmail.com>
Reviewed-by: Eric Lai <eric_lai(a)quanta.corp-partner.google.com>
---
M src/device/Kconfig
M src/device/Makefile.inc
D src/device/resource_allocator_v3.c
3 files changed, 18 insertions(+), 564 deletions(-)
Approvals:
build bot (Jenkins): Verified
Elyes Haouas: Looks good to me, but someone else must approve
Angel Pons: Looks good to me, approved
Eric Lai: Looks good to me, but someone else must approve
diff --git a/src/device/Kconfig b/src/device/Kconfig
index 60ee047..a41f261 100644
--- a/src/device/Kconfig
+++ b/src/device/Kconfig
@@ -699,7 +699,6 @@
config PCIEXP_HOTPLUG_PREFETCH_MEM_ABOVE_4G
bool
- depends on RESOURCE_ALLOCATOR_V4
default y if !PCIEXP_HOTPLUG_PREFETCH_MEM_BELOW_4G
default n
help
@@ -922,28 +921,9 @@
maximum time a device could stretch clock bits before the transfer
is aborted and an error returned.
-config RESOURCE_ALLOCATOR_V3
- bool
- default n
- help
- This config option enables resource allocator v3 which performs
- top down allocation of resources in a single MMIO window. This is the
- old resource allocator meant to be used only until the broken AMD
- chipsets are fixed. DO NOT USE THIS FOR ANY NEW CHIPSETS!
-
-config RESOURCE_ALLOCATOR_V4
- bool
- default n if RESOURCE_ALLOCATOR_V3
- default y if !RESOURCE_ALLOCATOR_V3
- help
- This config option enables resource allocator v4 which uses multiple
- ranges for allocating resources. This allows allocation of resources
- above 4G boundary as well.
-
config RESOURCE_ALLOCATION_TOP_DOWN
bool "Allocate resources from top down"
default n
- depends on RESOURCE_ALLOCATOR_V4
help
Should be the default, but many platforms don't report resources
correctly. Hence, the allocator might cause conflicts.
diff --git a/src/device/Makefile.inc b/src/device/Makefile.inc
index 808648d..28acd73 100644
--- a/src/device/Makefile.inc
+++ b/src/device/Makefile.inc
@@ -59,8 +59,7 @@
ramstage-y += mmio.c
ramstage-y += resource_allocator_common.c
-ramstage-$(CONFIG_RESOURCE_ALLOCATOR_V3) += resource_allocator_v3.c
-ramstage-$(CONFIG_RESOURCE_ALLOCATOR_V4) += resource_allocator_v4.c
+ramstage-y += resource_allocator_v4.c
ramstage-$(CONFIG_XHCI_UTILS) += xhci.c
diff --git a/src/device/resource_allocator_v3.c b/src/device/resource_allocator_v3.c
deleted file mode 100644
index 236e149..0000000
--- a/src/device/resource_allocator_v3.c
+++ /dev/null
@@ -1,542 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-
-#include <console/console.h>
-#include <device/device.h>
-#include <post.h>
-
-/**
- * Round a number up to an alignment.
- *
- * @param val The starting value.
- * @param pow Alignment as a power of two.
- * @return Rounded up number.
- */
-static resource_t round(resource_t val, unsigned long pow)
-{
- resource_t mask;
- mask = (1ULL << pow) - 1ULL;
- val += mask;
- val &= ~mask;
- return val;
-}
-
-static const char *resource2str(struct resource *res)
-{
- if (res->flags & IORESOURCE_IO)
- return "io";
- if (res->flags & IORESOURCE_PREFETCH)
- return "prefmem";
- if (res->flags & IORESOURCE_MEM)
- return "mem";
- return "undefined";
-}
-
-/**
- * This function is the guts of the resource allocator.
- *
- * The problem.
- * - Allocate resource locations for every device.
- * - Don't overlap, and follow the rules of bridges.
- * - Don't overlap with resources in fixed locations.
- * - Be efficient so we don't have ugly strategies.
- *
- * The strategy.
- * - Devices that have fixed addresses are the minority so don't
- * worry about them too much. Instead only use part of the address
- * space for devices with programmable addresses. This easily handles
- * everything except bridges.
- *
- * - PCI devices are required to have their sizes and their alignments
- * equal. In this case an optimal solution to the packing problem
- * exists. Allocate all devices from highest alignment to least
- * alignment or vice versa. Use this.
- *
- * - So we can handle more than PCI run two allocation passes on bridges. The
- * first to see how large the resources are behind the bridge, and what
- * their alignment requirements are. The second to assign a safe address to
- * the devices behind the bridge. This allows us to treat a bridge as just
- * a device with a couple of resources, and not need to special case it in
- * the allocator. Also this allows handling of other types of bridges.
- *
- * @param bus The bus we are traversing.
- * @param bridge The bridge resource which must contain the bus' resources.
- * @param type_mask This value gets ANDed with the resource type.
- * @param type This value must match the result of the AND.
- * @return TODO
- */
-static void compute_resources(struct bus *bus, struct resource *bridge,
- unsigned long type_mask, unsigned long type)
-{
- const struct device *dev;
- struct resource *resource;
- resource_t base;
- base = round(bridge->base, bridge->align);
-
- if (!bus)
- return;
-
- printk(BIOS_SPEW, "%s %s: base: %llx size: %llx align: %d gran: %d"
- " limit: %llx\n", dev_path(bus->dev), resource2str(bridge),
- base, bridge->size, bridge->align,
- bridge->gran, bridge->limit);
-
- /* For each child which is a bridge, compute the resource needs. */
- for (dev = bus->children; dev; dev = dev->sibling) {
- struct resource *child_bridge;
-
- if (!dev->link_list)
- continue;
-
- /* Find the resources with matching type flags. */
- for (child_bridge = dev->resource_list; child_bridge;
- child_bridge = child_bridge->next) {
- struct bus* link;
-
- if (!(child_bridge->flags & IORESOURCE_BRIDGE)
- || (child_bridge->flags & type_mask) != type)
- continue;
-
- /*
- * Split prefetchable memory if combined. Many domains
- * use the same address space for prefetchable memory
- * and non-prefetchable memory. Bridges below them need
- * it separated. Add the PREFETCH flag to the type_mask
- * and type.
- */
- link = dev->link_list;
- while (link && link->link_num !=
- IOINDEX_LINK(child_bridge->index))
- link = link->next;
-
- if (link == NULL) {
- printk(BIOS_ERR, "link %ld not found on %s\n",
- IOINDEX_LINK(child_bridge->index),
- dev_path(dev));
- }
-
- compute_resources(link, child_bridge,
- type_mask | IORESOURCE_PREFETCH,
- type | (child_bridge->flags &
- IORESOURCE_PREFETCH));
- }
- }
-
- /* Remember we haven't found anything yet. */
- resource = NULL;
-
- /*
- * Walk through all the resources on the current bus and compute the
- * amount of address space taken by them. Take granularity and
- * alignment into account.
- */
- while ((dev = largest_resource(bus, &resource, type_mask, type))) {
-
- /* Size 0 resources can be skipped. */
- if (!resource->size)
- continue;
-
- /* Propagate the resource alignment to the bridge resource. */
- if (resource->align > bridge->align)
- bridge->align = resource->align;
-
- /* Propagate the resource limit to the bridge register. */
- if (bridge->limit > resource->limit)
- bridge->limit = resource->limit;
-
- /* Warn if it looks like APICs aren't declared. */
- if ((resource->limit == 0xffffffff) &&
- (resource->flags & IORESOURCE_ASSIGNED)) {
- printk(BIOS_ERR,
- "Resource limit looks wrong! (no APIC?)\n");
- printk(BIOS_ERR, "%s %02lx limit %08llx\n",
- dev_path(dev), resource->index, resource->limit);
- }
-
- if (resource->flags & IORESOURCE_IO) {
- /*
- * Don't allow potential aliases over the legacy PCI
- * expansion card addresses. The legacy PCI decodes
- * only 10 bits, uses 0x100 - 0x3ff. Therefore, only
- * 0x00 - 0xff can be used out of each 0x400 block of
- * I/O space.
- */
- if ((base & 0x300) != 0) {
- base = (base & ~0x3ff) + 0x400;
- }
- /*
- * Don't allow allocations in the VGA I/O range.
- * PCI has special cases for that.
- */
- else if ((base >= 0x3b0) && (base <= 0x3df)) {
- base = 0x3e0;
- }
- }
- /* Base must be aligned. */
- base = round(base, resource->align);
- resource->base = base;
- base += resource->size;
-
- printk(BIOS_SPEW, "%s %02lx * [0x%llx - 0x%llx] %s\n",
- dev_path(dev), resource->index, resource->base,
- resource->base + resource->size - 1,
- resource2str(resource));
- }
-
- /*
- * A PCI bridge resource does not need to be a power of two size, but
- * it does have a minimum granularity. Round the size up to that
- * minimum granularity so we know not to place something else at an
- * address positively decoded by the bridge.
- */
- bridge->size = round(base, bridge->gran) -
- round(bridge->base, bridge->align);
-
- printk(BIOS_SPEW, "%s %s: base: %llx size: %llx align: %d gran: %d"
- " limit: %llx done\n", dev_path(bus->dev),
- resource2str(bridge),
- base, bridge->size, bridge->align, bridge->gran, bridge->limit);
-}
-
-/**
- * This function is the second part of the resource allocator.
- *
- * See the compute_resources function for a more detailed explanation.
- *
- * This function assigns the resources a value.
- *
- * @param bus The bus we are traversing.
- * @param bridge The bridge resource which must contain the bus' resources.
- * @param type_mask This value gets ANDed with the resource type.
- * @param type This value must match the result of the AND.
- *
- * @see compute_resources
- */
-static void __allocate_resources(struct bus *bus, struct resource *bridge,
- unsigned long type_mask, unsigned long type)
-{
- const struct device *dev;
- struct resource *resource;
- resource_t base;
- base = bridge->base;
-
- if (!bus)
- return;
-
- printk(BIOS_SPEW, "%s %s: base:%llx size:%llx align:%d gran:%d "
- "limit:%llx\n", dev_path(bus->dev),
- resource2str(bridge),
- base, bridge->size, bridge->align, bridge->gran, bridge->limit);
-
- /* Remember we haven't found anything yet. */
- resource = NULL;
-
- /*
- * Walk through all the resources on the current bus and allocate them
- * address space.
- */
- while ((dev = largest_resource(bus, &resource, type_mask, type))) {
-
- /* Propagate the bridge limit to the resource register. */
- if (resource->limit > bridge->limit)
- resource->limit = bridge->limit;
-
- /* Size 0 resources can be skipped. */
- if (!resource->size)
- continue;
-
- if (resource->flags & IORESOURCE_IO) {
- /*
- * Don't allow potential aliases over the legacy PCI
- * expansion card addresses. The legacy PCI decodes
- * only 10 bits, uses 0x100 - 0x3ff. Therefore, only
- * 0x00 - 0xff can be used out of each 0x400 block of
- * I/O space.
- */
- if ((base & 0x300) != 0) {
- base = (base & ~0x3ff) + 0x400;
- }
- /*
- * Don't allow allocations in the VGA I/O range.
- * PCI has special cases for that.
- */
- else if ((base >= 0x3b0) && (base <= 0x3df)) {
- base = 0x3e0;
- }
- }
-
- if ((round(base, resource->align) + resource->size - 1) <=
- resource->limit) {
- /* Base must be aligned. */
- base = round(base, resource->align);
- resource->base = base;
- resource->limit = resource->base + resource->size - 1;
- resource->flags |= IORESOURCE_ASSIGNED;
- resource->flags &= ~IORESOURCE_STORED;
- base += resource->size;
- } else {
- printk(BIOS_ERR, "!! Resource didn't fit !!\n");
- printk(BIOS_ERR, " aligned base %llx size %llx "
- "limit %llx\n", round(base, resource->align),
- resource->size, resource->limit);
- printk(BIOS_ERR, " %llx needs to be <= %llx "
- "(limit)\n", (round(base, resource->align) +
- resource->size) - 1, resource->limit);
- printk(BIOS_ERR, " %s%s %02lx * [0x%llx - 0x%llx]"
- " %s\n", (resource->flags & IORESOURCE_ASSIGNED)
- ? "Assigned: " : "", dev_path(dev),
- resource->index, resource->base,
- resource->base + resource->size - 1,
- resource2str(resource));
- }
-
- printk(BIOS_SPEW, "%s %02lx * [0x%llx - 0x%llx] %s\n",
- dev_path(dev), resource->index, resource->base,
- resource->size ? resource->base + resource->size - 1 :
- resource->base, resource2str(resource));
- }
-
- /*
- * A PCI bridge resource does not need to be a power of two size, but
- * it does have a minimum granularity. Round the size up to that
- * minimum granularity so we know not to place something else at an
- * address positively decoded by the bridge.
- */
-
- bridge->flags |= IORESOURCE_ASSIGNED;
-
- printk(BIOS_SPEW, "%s %s: next_base: %llx size: %llx align: %d "
- "gran: %d done\n", dev_path(bus->dev),
- resource2str(bridge), base, bridge->size, bridge->align,
- bridge->gran);
-
- /* For each child which is a bridge, __allocate_resources. */
- for (dev = bus->children; dev; dev = dev->sibling) {
- struct resource *child_bridge;
-
- if (!dev->link_list)
- continue;
-
- /* Find the resources with matching type flags. */
- for (child_bridge = dev->resource_list; child_bridge;
- child_bridge = child_bridge->next) {
- struct bus* link;
-
- if (!(child_bridge->flags & IORESOURCE_BRIDGE) ||
- (child_bridge->flags & type_mask) != type)
- continue;
-
- /*
- * Split prefetchable memory if combined. Many domains
- * use the same address space for prefetchable memory
- * and non-prefetchable memory. Bridges below them need
- * it separated. Add the PREFETCH flag to the type_mask
- * and type.
- */
- link = dev->link_list;
- while (link && link->link_num !=
- IOINDEX_LINK(child_bridge->index))
- link = link->next;
- if (link == NULL)
- printk(BIOS_ERR, "link %ld not found on %s\n",
- IOINDEX_LINK(child_bridge->index),
- dev_path(dev));
-
- __allocate_resources(link, child_bridge,
- type_mask | IORESOURCE_PREFETCH,
- type | (child_bridge->flags &
- IORESOURCE_PREFETCH));
- }
- }
-}
-
-static int resource_is(struct resource *res, u32 type)
-{
- return (res->flags & IORESOURCE_TYPE_MASK) == type;
-}
-
-struct constraints {
- struct resource io, mem;
-};
-
-static struct resource *resource_limit(struct constraints *limits,
- struct resource *res)
-{
- struct resource *lim = NULL;
-
- /* MEM, or I/O - skip any others. */
- if (resource_is(res, IORESOURCE_MEM))
- lim = &limits->mem;
- else if (resource_is(res, IORESOURCE_IO))
- lim = &limits->io;
-
- return lim;
-}
-
-static void constrain_resources(const struct device *dev,
- struct constraints* limits)
-{
- const struct device *child;
- struct resource *res;
- struct resource *lim;
- struct bus *link;
-
- /* Constrain limits based on the fixed resources of this device. */
- for (res = dev->resource_list; res; res = res->next) {
- if (!(res->flags & IORESOURCE_FIXED))
- continue;
- if (!res->size) {
- /* It makes no sense to have 0-sized, fixed resources.*/
- printk(BIOS_ERR, "skipping %s@%lx fixed resource, "
- "size=0!\n", dev_path(dev), res->index);
- continue;
- }
-
- lim = resource_limit(limits, res);
- if (!lim)
- continue;
-
- /*
- * Is it a fixed resource outside the current known region?
- * If so, we don't have to consider it - it will be handled
- * correctly and doesn't affect current region's limits.
- */
- if (((res->base + res->size -1) < lim->base)
- || (res->base > lim->limit))
- continue;
-
- printk(BIOS_SPEW, "%s: %s %02lx base %08llx limit %08llx %s (fixed)\n",
- __func__, dev_path(dev), res->index, res->base,
- res->base + res->size - 1, resource2str(res));
-
- /*
- * Choose to be above or below fixed resources. This check is
- * signed so that "negative" amounts of space are handled
- * correctly.
- */
- if ((signed long long)(lim->limit - (res->base + res->size -1))
- > (signed long long)(res->base - lim->base))
- lim->base = res->base + res->size;
- else
- lim->limit = res->base -1;
- }
-
- /* Descend into every enabled child and look for fixed resources. */
- for (link = dev->link_list; link; link = link->next) {
- for (child = link->children; child; child = child->sibling) {
- if (child->enabled)
- constrain_resources(child, limits);
- }
- }
-}
-
-static void avoid_fixed_resources(const struct device *dev)
-{
- struct constraints limits;
- struct resource *res;
- struct resource *lim;
-
- printk(BIOS_SPEW, "%s: %s\n", __func__, dev_path(dev));
-
- /* Initialize constraints to maximum size. */
- limits.io.base = 0;
- limits.io.limit = 0xffffffffffffffffULL;
- limits.mem.base = 0;
- limits.mem.limit = 0xffffffffffffffffULL;
-
- /* Constrain the limits to dev's initial resources. */
- for (res = dev->resource_list; res; res = res->next) {
- if ((res->flags & IORESOURCE_FIXED))
- continue;
- printk(BIOS_SPEW, "%s:@%s %02lx limit %08llx\n", __func__,
- dev_path(dev), res->index, res->limit);
-
- lim = resource_limit(&limits, res);
- if (!lim)
- continue;
-
- if (res->base > lim->base)
- lim->base = res->base;
- if (res->limit < lim->limit)
- lim->limit = res->limit;
- }
-
- /* Look through the tree for fixed resources and update the limits. */
- constrain_resources(dev, &limits);
-
- /* Update dev's resources with new limits. */
- for (res = dev->resource_list; res; res = res->next) {
- if ((res->flags & IORESOURCE_FIXED))
- continue;
-
- lim = resource_limit(&limits, res);
- if (!lim)
- continue;
-
- /* Is the resource outside the limits? */
- if (lim->base > res->base)
- res->base = lim->base;
- if (res->limit > lim->limit)
- res->limit = lim->limit;
-
- /* MEM resources need to start at the highest address manageable. */
- if (res->flags & IORESOURCE_MEM)
- res->base = resource_max(res);
-
- printk(BIOS_SPEW, "%s:@%s %02lx base %08llx limit %08llx\n",
- __func__, dev_path(dev), res->index, res->base, res->limit);
- }
-}
-
-void allocate_resources(const struct device *root)
-{
- struct resource *res;
- const struct device *child;
-
- /* Compute resources for all domains. */
- for (child = root->link_list->children; child; child = child->sibling) {
- if (!(child->path.type == DEVICE_PATH_DOMAIN))
- continue;
- post_log_path(child);
- for (res = child->resource_list; res; res = res->next) {
- if (res->flags & IORESOURCE_FIXED)
- continue;
- if (res->flags & IORESOURCE_MEM) {
- compute_resources(child->link_list,
- res, IORESOURCE_TYPE_MASK, IORESOURCE_MEM);
- continue;
- }
- if (res->flags & IORESOURCE_IO) {
- compute_resources(child->link_list,
- res, IORESOURCE_TYPE_MASK, IORESOURCE_IO);
- continue;
- }
- }
- }
-
- /* For all domains. */
- for (child = root->link_list->children; child; child=child->sibling)
- if (child->path.type == DEVICE_PATH_DOMAIN)
- avoid_fixed_resources(child);
-
- /* Store the computed resource allocations into device registers ... */
- printk(BIOS_INFO, "Setting resources...\n");
- for (child = root->link_list->children; child; child = child->sibling) {
- if (!(child->path.type == DEVICE_PATH_DOMAIN))
- continue;
- post_log_path(child);
- for (res = child->resource_list; res; res = res->next) {
- if (res->flags & IORESOURCE_FIXED)
- continue;
- if (res->flags & IORESOURCE_MEM) {
- __allocate_resources(child->link_list,
- res, IORESOURCE_TYPE_MASK, IORESOURCE_MEM);
- continue;
- }
- if (res->flags & IORESOURCE_IO) {
- __allocate_resources(child->link_list,
- res, IORESOURCE_TYPE_MASK, IORESOURCE_IO);
- continue;
- }
- }
- }
-}
--
To view, visit https://review.coreboot.org/c/coreboot/+/69140
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Ifccb59ae45daa8fec41a9a2d46c628ff24a0c998
Gerrit-Change-Number: 69140
Gerrit-PatchSet: 4
Gerrit-Owner: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-Reviewer: Elyes Haouas <ehaouas(a)noos.fr>
Gerrit-Reviewer: Eric Lai <eric_lai(a)quanta.corp-partner.google.com>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-MessageType: merged
Attention is currently required from: Frans Hendriks, Arthur Heymans, Andrey Petrov.
Erik van den Bogaert has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/63419 )
Change subject: Kconfig: Set better defaults for building romstage
......................................................................
Patch Set 35: Code-Review+1
--
To view, visit https://review.coreboot.org/c/coreboot/+/63419
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I4c53b6fa7a3e66415c5b1c539918a6c1cd8defa1
Gerrit-Change-Number: 63419
Gerrit-PatchSet: 35
Gerrit-Owner: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-Reviewer: Andrey Petrov <andrey.petrov(a)gmail.com>
Gerrit-Reviewer: Erik van den Bogaert <ebogaert(a)eltan.com>
Gerrit-Reviewer: Frans Hendriks <fhendriks(a)eltan.com>
Gerrit-Reviewer: Sean Rhodes <sean(a)starlabs.systems>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-Attention: Frans Hendriks <fhendriks(a)eltan.com>
Gerrit-Attention: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-Attention: Andrey Petrov <andrey.petrov(a)gmail.com>
Gerrit-Comment-Date: Mon, 07 Nov 2022 14:00:14 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Arthur Heymans has submitted this change. ( https://review.coreboot.org/c/coreboot/+/69122 )
Change subject: cpu/x86: Drop !CPU_INFO_V2 code
......................................................................
cpu/x86: Drop !CPU_INFO_V2 code
Now that all platforms use parallel_mp this is the only codepath used
for cpu_info() local thread storage.
Change-Id: I119214e703aea8a4fe93f83b784159cf86d859d3
Signed-off-by: Arthur Heymans <arthur(a)aheymans.xyz>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/69122
Reviewed-by: Elyes Haouas <ehaouas(a)noos.fr>
Tested-by: build bot (Jenkins) <no-reply(a)coreboot.org>
Reviewed-by: Angel Pons <th3fanbus(a)gmail.com>
---
M src/Kconfig
M src/arch/x86/c_start.S
M src/arch/x86/include/arch/cpu.h
M src/cpu/x86/Kconfig
M src/security/intel/txt/getsec_enteraccs.S
5 files changed, 20 insertions(+), 25 deletions(-)
Approvals:
build bot (Jenkins): Verified
Elyes Haouas: Looks good to me, approved
Angel Pons: Looks good to me, approved
diff --git a/src/Kconfig b/src/Kconfig
index b33ea62..08b2437 100644
--- a/src/Kconfig
+++ b/src/Kconfig
@@ -715,7 +715,7 @@
config COOP_MULTITASKING
def_bool n
select TIMER_QUEUE
- depends on ARCH_X86 && CPU_INFO_V2
+ depends on ARCH_X86
help
Cooperative multitasking allows callbacks to be multiplexed on the
main thread. With this enabled it allows for multiple execution paths
diff --git a/src/arch/x86/c_start.S b/src/arch/x86/c_start.S
index 84fbed2..02a9b89 100644
--- a/src/arch/x86/c_start.S
+++ b/src/arch/x86/c_start.S
@@ -80,7 +80,6 @@
push_cpu_info
-#if CONFIG(CPU_INFO_V2)
/* Allocate the per_cpu_segment_data on the stack */
push_per_cpu_segment_data
@@ -93,7 +92,6 @@
mov $per_cpu_segment_selector, %eax
movl (%eax), %eax
mov %eax, %gs
-#endif
/*
* Now we are finished. Memory is up, data is copied and
@@ -222,7 +220,6 @@
.word 0xffff, 0x0000
.byte 0x00, 0x9b, 0xaf, 0x00
#endif
-#if CONFIG(CPU_INFO_V2)
per_cpu_segment_descriptors:
.rept CONFIG_MAX_CPUS
/* flat data segment */
@@ -233,14 +230,11 @@
.byte 0x00, 0x93, 0xcf, 0x00
#endif
.endr
-#endif /* CPU_INFO_V2 */
gdt_end:
-#if CONFIG(CPU_INFO_V2)
/* Segment selector pointing to the first per_cpu_segment_descriptor. */
per_cpu_segment_selector:
.long per_cpu_segment_descriptors - gdt
-#endif /* CPU_INFO_V2 */
.section ".text._start", "ax", @progbits
#if ENV_X86_64
diff --git a/src/arch/x86/include/arch/cpu.h b/src/arch/x86/include/arch/cpu.h
index 2d2879f6..0087a79 100644
--- a/src/arch/x86/include/arch/cpu.h
+++ b/src/arch/x86/include/arch/cpu.h
@@ -149,8 +149,6 @@
static inline struct cpu_info *cpu_info(void)
{
-/* We use a #if because we don't want to mess with the &s below. */
-#if CONFIG(CPU_INFO_V2)
struct cpu_info *ci = NULL;
__asm__("mov %%gs:%c[offset], %[ci]"
@@ -159,11 +157,6 @@
);
return ci;
-#else
- char s;
- uintptr_t info = ALIGN_UP((uintptr_t)&s, CONFIG_STACK_SIZE) - sizeof(struct cpu_info);
- return (struct cpu_info *)info;
-#endif /* CPU_INFO_V2 */
}
struct cpuinfo_x86 {
diff --git a/src/cpu/x86/Kconfig b/src/cpu/x86/Kconfig
index b136e9e..1d6b489 100644
--- a/src/cpu/x86/Kconfig
+++ b/src/cpu/x86/Kconfig
@@ -2,7 +2,6 @@
config PARALLEL_MP
def_bool y
- select CPU_INFO_V2
help
This option uses common MP infrastructure for bringing up APs
in parallel. It additionally provides a more flexible mechanism
@@ -210,12 +209,4 @@
However, modern OSes use PAT to control cacheability instead of
using MTRRs.
-config CPU_INFO_V2
- bool
- depends on PARALLEL_MP
- help
- Enables the new method of locating struct cpu_info. This new method
- uses the %gs segment to locate the cpu_info pointer. The old method
- relied on the stack being CONFIG_STACK_SIZE aligned.
-
endif # ARCH_X86
diff --git a/src/security/intel/txt/getsec_enteraccs.S b/src/security/intel/txt/getsec_enteraccs.S
index cbb24b6..ff9db05 100644
--- a/src/security/intel/txt/getsec_enteraccs.S
+++ b/src/security/intel/txt/getsec_enteraccs.S
@@ -227,7 +227,7 @@
movd %esp, %xmm0
movd %ebp, %xmm1
- /* Backup %gs used by CPU_INFO_V2 */
+ /* Backup %gs used by cpu_info() */
movl %gs, %eax
movd %eax, %xmm2
@@ -265,7 +265,7 @@
movl %eax, %es
movl %eax, %ss
movl %eax, %fs
- /* Restore %gs used by CPU_INFO_V2 */
+ /* Restore %gs used by cpu_info */
movd %xmm2, %eax
movl %eax, %gs
--
To view, visit https://review.coreboot.org/c/coreboot/+/69122
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I119214e703aea8a4fe93f83b784159cf86d859d3
Gerrit-Change-Number: 69122
Gerrit-PatchSet: 17
Gerrit-Owner: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-Reviewer: Elyes Haouas <ehaouas(a)noos.fr>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-MessageType: merged