vc/amd/fsp/mendocino/FspmUpd: don't use pointers for usb_phy config

The size of a pointer changes between a 32 and 64 bit coreboot build. In
order to be able to use a 32 bit FSP in a 64 bit coreboot build, change
the pointer in the UPDs to a uint32_t to always have a 32 bit field in
the UPD for this.

Signed-off-by: Felix Held <felix-coreboot@felixheld.de>
Change-Id: I419fef73d2881e323487bc7fe641b2ac4041cb17
Reviewed-on: https://review.coreboot.org/c/coreboot/+/70135
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Fred Reitberger <reitbergerfred@gmail.com>
This commit is contained in:
Felix Held 2022-11-29 17:54:18 +01:00
parent cc846838b6
commit 7969a5c1b4
2 changed files with 11 additions and 3 deletions

View File

@ -6,6 +6,7 @@
#include <amdblocks/ioapic.h> #include <amdblocks/ioapic.h>
#include <amdblocks/memmap.h> #include <amdblocks/memmap.h>
#include <assert.h> #include <assert.h>
#include <console/console.h>
#include <console/uart.h> #include <console/uart.h>
#include <device/device.h> #include <device/device.h>
#include <fsp/api.h> #include <fsp/api.h>
@ -157,9 +158,15 @@ void platform_fsp_memory_init_params_cb(FSPM_UPD *mupd, uint32_t version)
lcl_usb_phy.Version_Major = FSP_USB_STRUCT_MAJOR_VERSION; lcl_usb_phy.Version_Major = FSP_USB_STRUCT_MAJOR_VERSION;
lcl_usb_phy.Version_Minor = FSP_USB_STRUCT_MINOR_VERSION; lcl_usb_phy.Version_Minor = FSP_USB_STRUCT_MINOR_VERSION;
lcl_usb_phy.TableLength = sizeof(struct usb_phy_config); lcl_usb_phy.TableLength = sizeof(struct usb_phy_config);
mcfg->usb_phy = &lcl_usb_phy; if ((uintptr_t)&lcl_usb_phy <= UINT32_MAX) {
mcfg->usb_phy_ptr = (uint32_t)(uintptr_t)&lcl_usb_phy;
} else {
printk(BIOS_ERR, "USB PHY config struct above 4GB; can't pass USB PHY "
"configuration to 32 bit FSP.\n");
mcfg->usb_phy_ptr = 0;
}
} else { } else {
mcfg->usb_phy = NULL; mcfg->usb_phy_ptr = 0;
} }
fsp_fill_pcie_ddi_descriptors(mcfg); fsp_fill_pcie_ddi_descriptors(mcfg);

View File

@ -94,7 +94,8 @@ typedef struct __packed {
/** Offset 0x04CF**/ uint32_t telemetry_vddcrsocfull_scale_current; /** Offset 0x04CF**/ uint32_t telemetry_vddcrsocfull_scale_current;
/** Offset 0x04D3**/ uint32_t telemetry_vddcrsocOffset; /** Offset 0x04D3**/ uint32_t telemetry_vddcrsocOffset;
/** Offset 0x04D7**/ uint8_t UnusedUpdSpace1; /** Offset 0x04D7**/ uint8_t UnusedUpdSpace1;
/** Offset 0x04D8**/ struct usb_phy_config *usb_phy; /* usb_phy_ptr is actually struct usb_phy_config *, but that won't work for 64bit coreboot */
/** Offset 0x04D8**/ uint32_t usb_phy_ptr;
/** Offset 0x04DC**/ uint8_t UnusedUpdSpace2[292]; /** Offset 0x04DC**/ uint8_t UnusedUpdSpace2[292];
/** Offset 0x0600**/ uint16_t UpdTerminator; /** Offset 0x0600**/ uint16_t UpdTerminator;
} FSP_M_CONFIG; } FSP_M_CONFIG;