[coreboot-gerrit] Change in coreboot[master]: vendorcode/amd/pi/Lib/amdlib.c: remove StdHeader references
Martin Roth (Code Review)
gerrit at coreboot.org
Sat Jul 1 20:26:22 CEST 2017
Martin Roth has uploaded this change for review. ( https://review.coreboot.org/20451
Change subject: vendorcode/amd/pi/Lib/amdlib.c: remove StdHeader references
......................................................................
vendorcode/amd/pi/Lib/amdlib.c: remove StdHeader references
Nothing in the amdlib.c file actually uses the StdHeader structure, so
remove the asserts verifying that it's not null, and remove references
to it from calls.
For now, I've left it in the parameters for the functions for
compatibility, but we might want to remove these at some point as well.
Change-Id: Ib13e9209c8119fdcc3720470aaa9dcdbde6ac388
Signed-off-by: Martin Roth <martinroth at google.com>
---
M src/vendorcode/amd/pi/Lib/amdlib.c
1 file changed, 38 insertions(+), 42 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/51/20451/1
diff --git a/src/vendorcode/amd/pi/Lib/amdlib.c b/src/vendorcode/amd/pi/Lib/amdlib.c
index 03ca207..a5f6898 100644
--- a/src/vendorcode/amd/pi/Lib/amdlib.c
+++ b/src/vendorcode/amd/pi/Lib/amdlib.c
@@ -605,9 +605,9 @@
UINT32 TempMask;
UINT32 Value;
LibAmdGetDataFromPtr (AccessWidth, Data, DataMask, &TempData, &TempMask);
- LibAmdIoRead (AccessWidth, IoAddress, &Value, StdHeader);
+ LibAmdIoRead (AccessWidth, IoAddress, &Value, NULL);
Value = (Value & (~TempMask)) | TempData;
- LibAmdIoWrite (AccessWidth, IoAddress, &Value, StdHeader);
+ LibAmdIoWrite (AccessWidth, IoAddress, &Value, NULL);
}
/*---------------------------------------------------------------------------------------*/
@@ -639,7 +639,7 @@
UINT32 Value;
LibAmdGetDataFromPtr (AccessWidth, Data, DataMask, &TempData, &TempMask);
do {
- LibAmdIoRead (AccessWidth, IoAddress, &Value, StdHeader);
+ LibAmdIoRead (AccessWidth, IoAddress, &Value, NULL);
} while (TempData != (Value & TempMask));
}
@@ -744,9 +744,9 @@
UINT32 TempMask;
UINT32 Value;
LibAmdGetDataFromPtr (AccessWidth, Data, DataMask, &TempData, &TempMask);
- LibAmdMemRead (AccessWidth, MemAddress, &Value, StdHeader);
+ LibAmdMemRead (AccessWidth, MemAddress, &Value, NULL);
Value = (Value & (~TempMask)) | TempData;
- LibAmdMemWrite (AccessWidth, MemAddress, &Value, StdHeader);
+ LibAmdMemWrite (AccessWidth, MemAddress, &Value, NULL);
}
/*---------------------------------------------------------------------------------------*/
@@ -778,7 +778,7 @@
UINT32 Value;
LibAmdGetDataFromPtr (AccessWidth, Data, DataMask, &TempData, &TempMask);
do {
- LibAmdMemRead (AccessWidth, MemAddress, &Value, StdHeader);
+ LibAmdMemRead (AccessWidth, MemAddress, &Value, NULL);
} while (TempData != (Value & TempMask));
}
@@ -807,28 +807,28 @@
UINT64 RMWritePrevious;
UINT64 MMIOAddress;
- ASSERT (StdHeader != NULL);
+
ASSERT (PciAddress.AddressValue != ILLEGAL_SBDFO);
- if (!GetPciMmioAddress (&MMIOAddress, &MMIOSize, StdHeader)) {
+ if (!GetPciMmioAddress (&MMIOAddress, &MMIOSize, NULL)) {
// We need to convert our "portable" PCI address into a "real" PCI access
LegacyPciAccess = ((1 << 31) + (PciAddress.Address.Register & 0xFC) + (PciAddress.Address.Function << 8) + (PciAddress.Address.Device << 11) + (PciAddress.Address.Bus << 16) + ((PciAddress.Address.Register & 0xF00) << (24 - 8)));
if (PciAddress.Address.Register <= 0xFF) {
- LibAmdIoWrite (AccessWidth32, IOCF8, &LegacyPciAccess, StdHeader);
- LibAmdIoRead (AccessWidth, IOCFC + (UINT16) (PciAddress.Address.Register & 0x3), Value, StdHeader);
+ LibAmdIoWrite (AccessWidth32, IOCF8, &LegacyPciAccess, NULL);
+ LibAmdIoRead (AccessWidth, IOCFC + (UINT16) (PciAddress.Address.Register & 0x3), Value, NULL);
} else {
- LibAmdMsrRead (NB_CFG, &RMWritePrevious, StdHeader);
+ LibAmdMsrRead (NB_CFG, &RMWritePrevious, NULL);
RMWrite = RMWritePrevious | 0x0000400000000000;
- LibAmdMsrWrite (NB_CFG, &RMWrite, StdHeader);
- LibAmdIoWrite (AccessWidth32, IOCF8, &LegacyPciAccess, StdHeader);
- LibAmdIoRead (AccessWidth, IOCFC + (UINT16) (PciAddress.Address.Register & 0x3), Value, StdHeader);
- LibAmdMsrWrite (NB_CFG, &RMWritePrevious, StdHeader);
+ LibAmdMsrWrite (NB_CFG, &RMWrite, NULL);
+ LibAmdIoWrite (AccessWidth32, IOCF8, &LegacyPciAccess, NULL);
+ LibAmdIoRead (AccessWidth, IOCFC + (UINT16) (PciAddress.Address.Register & 0x3), Value, NULL);
+ LibAmdMsrWrite (NB_CFG, &RMWritePrevious, NULL);
}
//IDS_HDT_CONSOLE (LIB_PCI_RD, "~PCI RD %08x = %08x\n", LegacyPciAccess, *(UINT32 *)Value);
} else {
// Setup the MMIO address
ASSERT ((MMIOAddress + MMIOSize) > (MMIOAddress + (PciAddress.AddressValue & 0x0FFFFFFF)));
MMIOAddress += (PciAddress.AddressValue & 0x0FFFFFFF);
- LibAmdMemRead (AccessWidth, MMIOAddress, Value, StdHeader);
+ LibAmdMemRead (AccessWidth, MMIOAddress, Value, NULL);
//IDS_HDT_CONSOLE (LIB_PCI_RD, "~MMIO RD %08x = %08x\n", (UINT32) MMIOAddress, *(UINT32 *)Value);
}
}
@@ -858,21 +858,21 @@
UINT64 RMWritePrevious;
UINT64 MMIOAddress;
- ASSERT (StdHeader != NULL);
+
ASSERT (PciAddress.AddressValue != ILLEGAL_SBDFO);
- if (!GetPciMmioAddress (&MMIOAddress, &MMIOSize, StdHeader)) {
+ if (!GetPciMmioAddress (&MMIOAddress, &MMIOSize, NULL)) {
// We need to convert our "portable" PCI address into a "real" PCI access
LegacyPciAccess = ((1 << 31) + (PciAddress.Address.Register & 0xFC) + (PciAddress.Address.Function << 8) + (PciAddress.Address.Device << 11) + (PciAddress.Address.Bus << 16) + ((PciAddress.Address.Register & 0xF00) << (24 - 8)));
if (PciAddress.Address.Register <= 0xFF) {
- LibAmdIoWrite (AccessWidth32, IOCF8, &LegacyPciAccess, StdHeader);
- LibAmdIoWrite (AccessWidth, IOCFC + (UINT16) (PciAddress.Address.Register & 0x3), Value, StdHeader);
+ LibAmdIoWrite (AccessWidth32, IOCF8, &LegacyPciAccess, NULL);
+ LibAmdIoWrite (AccessWidth, IOCFC + (UINT16) (PciAddress.Address.Register & 0x3), Value, NULL);
} else {
- LibAmdMsrRead (NB_CFG, &RMWritePrevious, StdHeader);
+ LibAmdMsrRead (NB_CFG, &RMWritePrevious, NULL);
RMWrite = RMWritePrevious | 0x0000400000000000;
- LibAmdMsrWrite (NB_CFG, &RMWrite, StdHeader);
- LibAmdIoWrite (AccessWidth32, IOCF8, &LegacyPciAccess, StdHeader);
- LibAmdIoWrite (AccessWidth, IOCFC + (UINT16) (PciAddress.Address.Register & 0x3), Value, StdHeader);
- LibAmdMsrWrite (NB_CFG, &RMWritePrevious, StdHeader);
+ LibAmdMsrWrite (NB_CFG, &RMWrite, NULL);
+ LibAmdIoWrite (AccessWidth32, IOCF8, &LegacyPciAccess, NULL);
+ LibAmdIoWrite (AccessWidth, IOCFC + (UINT16) (PciAddress.Address.Register & 0x3), Value, NULL);
+ LibAmdMsrWrite (NB_CFG, &RMWritePrevious, NULL);
}
//IDS_HDT_CONSOLE (LIB_PCI_WR, "~PCI WR %08x = %08x\n", LegacyPciAccess, *(UINT32 *)Value);
//printk(BIOS_DEBUG, "~PCI WR %08x = %08x\n", LegacyPciAccess, *(UINT32 *)Value);
@@ -881,7 +881,7 @@
// Setup the MMIO address
ASSERT ((MMIOAddress + MMIOSize) > (MMIOAddress + (PciAddress.AddressValue & 0x0FFFFFFF)));
MMIOAddress += (PciAddress.AddressValue & 0x0FFFFFFF);
- LibAmdMemWrite (AccessWidth, MMIOAddress, Value, StdHeader);
+ LibAmdMemWrite (AccessWidth, MMIOAddress, Value, NULL);
//IDS_HDT_CONSOLE (LIB_PCI_WR, "~MMIO WR %08x = %08x\n", (UINT32) MMIOAddress, *(UINT32 *)Value);
//printk(BIOS_DEBUG, "~MMIO WR %08x = %08x\n", (UINT32) MMIOAddress, *(UINT32 *)Value);
//printk(BIOS_DEBUG, "LibAmdPciWrite mmio\n");
@@ -913,9 +913,9 @@
UINT32 TempMask = 0;
UINT32 Value;
LibAmdGetDataFromPtr (AccessWidth, Data, DataMask, &TempData, &TempMask);
- LibAmdPciRead (AccessWidth, PciAddress, &Value, StdHeader);
+ LibAmdPciRead (AccessWidth, PciAddress, &Value, NULL);
Value = (Value & (~TempMask)) | TempData;
- LibAmdPciWrite (AccessWidth, PciAddress, &Value, StdHeader);
+ LibAmdPciWrite (AccessWidth, PciAddress, &Value, NULL);
}
/*---------------------------------------------------------------------------------------*/
@@ -947,7 +947,7 @@
UINT32 Value;
LibAmdGetDataFromPtr (AccessWidth, Data, DataMask, &TempData, &TempMask);
do {
- LibAmdPciRead (AccessWidth, PciAddress, &Value, StdHeader);
+ LibAmdPciRead (AccessWidth, PciAddress, &Value, NULL);
} while (TempData != (Value & TempMask));
}
@@ -973,10 +973,8 @@
UINT32 EncodedSize;
UINT64 LocalMsrRegister;
- ASSERT (StdHeader != NULL);
-
MmioIsEnabled = FALSE;
- LibAmdMsrRead (MSR_MMIO_Cfg_Base, &LocalMsrRegister, StdHeader);
+ LibAmdMsrRead (MSR_MMIO_Cfg_Base, &LocalMsrRegister, NULL);
if ((LocalMsrRegister & BIT0) != 0) {
*MmioAddress = LocalMsrRegister & 0xFFFFFFFFFFF00000;
EncodedSize = (UINT32) ((LocalMsrRegister & 0x3C) >> 2);
@@ -1009,7 +1007,7 @@
{
ASSERT (Highbit < 32 && Lowbit < 32 && Highbit >= Lowbit && (Address.AddressValue & 3) == 0);
- LibAmdPciRead (AccessWidth32, Address, Value, StdHeader);
+ LibAmdPciRead (AccessWidth32, Address, Value, NULL);
*Value >>= Lowbit; // Shift
// A 1 << 32 == 1 << 0 due to x86 SHL instruction, so skip if that is the case
@@ -1053,10 +1051,10 @@
Mask = (UINT32) 0xFFFFFFFF;
}
- LibAmdPciRead (AccessWidth32, Address, &Temp, StdHeader);
+ LibAmdPciRead (AccessWidth32, Address, &Temp, NULL);
Temp &= ~(Mask << Lowbit);
Temp |= (*Value & Mask) << Lowbit;
- LibAmdPciWrite (AccessWidth32, Address, &Temp, StdHeader);
+ LibAmdPciWrite (AccessWidth32, Address, &Temp, NULL);
}
/*---------------------------------------------------------------------------------------*/
@@ -1093,7 +1091,7 @@
Address->AddressValue = (UINT32) ILLEGAL_SBDFO;
// Verify that the SBDFO points to a valid PCI device SANITY CHECK
- LibAmdPciRead (AccessWidth32, Base, &Temp, StdHeader);
+ LibAmdPciRead (AccessWidth32, Base, &Temp, NULL);
if (Temp == 0xFFFFFFFF) {
ASSERT (FALSE);
return; // There is no device at this address
@@ -1101,7 +1099,7 @@
// Verify that the device supports a capability list
TempAddress.AddressValue = Base.AddressValue + 0x04;
- LibAmdPciReadBits (TempAddress, 20, 20, &Temp, StdHeader);
+ LibAmdPciReadBits (TempAddress, 20, 20, &Temp, NULL);
if (Temp == 0) {
return; // This PCI device does not support capability lists
}
@@ -1109,11 +1107,11 @@
if (Offset != 0) {
// If we are continuing on an existing list
TempAddress.AddressValue = Base.AddressValue + Offset;
- LibAmdPciReadBits (TempAddress, 15, 8, &Temp, StdHeader);
+ LibAmdPciReadBits (TempAddress, 15, 8, &Temp, NULL);
} else {
// We are starting on a new list
TempAddress.AddressValue = Base.AddressValue + 0x34;
- LibAmdPciReadBits (TempAddress, 7, 0, &Temp, StdHeader);
+ LibAmdPciReadBits (TempAddress, 7, 0, &Temp, NULL);
}
if (Temp == 0) {
@@ -1152,7 +1150,6 @@
)
{
UINT8 *Dest;
- ASSERT (StdHeader != NULL);
Dest = Destination;
while ((FillLength--) != 0) {
*Dest++ = Value;
@@ -1179,7 +1176,6 @@
{
UINT8 *Dest;
CONST UINT8 *SourcePtr;
- ASSERT (StdHeader != NULL);
Dest = Destination;
SourcePtr = Source;
while ((CopyLength--) != 0) {
@@ -1287,7 +1283,7 @@
UINT32 ProcessorPackageType;
CPUID_DATA CpuId;
- LibAmdCpuidRead (0x80000001, &CpuId, StdHeader);
+ LibAmdCpuidRead (0x80000001, &CpuId, NULL);
ProcessorPackageType = (UINT32) (CpuId.EBX_Reg >> 28) & 0xF; // bit 31:28
return (UINT32) (1 << ProcessorPackageType);
}
--
To view, visit https://review.coreboot.org/20451
To unsubscribe, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib13e9209c8119fdcc3720470aaa9dcdbde6ac388
Gerrit-Change-Number: 20451
Gerrit-PatchSet: 1
Gerrit-Owner: Martin Roth <martinroth at google.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20170701/5a0f7956/attachment-0001.html>
More information about the coreboot-gerrit
mailing list