Hi,
> + if (GuidHob != NULL) {
> + //
> + // Check whether the Required TileSize is enough.
> + //
> + if (TileSize > SIZE_8KB) {
> + DEBUG ((DEBUG_ERROR, "The Range of Smbase in SMRAM is not enough --
> Required TileSize = 0x%08x, Actual TileSize = 0x%08x\n", TileSize, SIZE_8KB));
> + CpuDeadLoop ();
> + return RETURN_BUFFER_TOO_SMALL;
> + }
Ok, so TileSize is what the firmware needs to store code and state.
Where does the SIZE_8KB come from? I assume this is the amount of
per-cpu memory allocated by the PEI module? Shouldn't this be passed
in the HOB instead of being hard-coded?
> + // Allocate buffer for all of the tiles.
> + //
> + // Intel(R) 64 and IA-32 Architectures Software Developer's Manual
> + // Volume 3C, Section 34.11 SMBASE Relocation
> + // For Pentium and Intel486 processors, the SMBASE values must be
> + // aligned on a 32-KByte boundary or the processor will enter shutdown
> + // state during the execution of a RSM instruction.
> + //
> + // Intel486 processors: FamilyId is 4
> + // Pentium processors : FamilyId is 5
> + //
> + BufferPages = EFI_SIZE_TO_PAGES (SIZE_32KB + TileSize *
> (mMaxNumberOfCpus - 1));
I think correct is:
BufferPages = EFI_SIZE_TO_PAGES(TileSize * mMaxNumberOfCpus);
> + if ((FamilyId == 4) || (FamilyId == 5)) {
> + Buffer = AllocateAlignedCodePages (BufferPages, SIZE_32KB);
Does that actually matter still? I'm pretty sure we can safely use
"ASSERT(FamilyId > 5)" here. Pentium processors have been built in
the last century, predating x64.
Beside that the code is broken for SMP, only cpu0 will get a properly
aligned smbase. Not sure penium processors support SMP in the first
place though ...
> for (Index = 0; Index < mMaxNumberOfCpus; Index++) {
> - mCpuHotPlugData.SmBase[Index] = (UINTN)Buffer + Index *
> TileSize - SMM_HANDLER_OFFSET;
> + mCpuHotPlugData.SmBase[Index] = mSmmRelocated ?
> (UINTN)SmmBaseHobData->SmBase[Index] : (UINTN)Buffer + Index * TileSize -
> SMM_HANDLER_OFFSET;
For Index = 0 this evaluates to "Buffer - SMM_HANDLER_OFFSET", which looks
wrong to me.
take care,
Gerd
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#100083): https://edk2.groups.io/g/devel/message/100083
Mute This Topic: https://groups.io/mt/96932003/21656
Group Owner: [email protected]
Unsubscribe: https://edk2.groups.io/g/devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-