From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mx.groups.io with SMTP id smtpd.web12.49719.1591050756494545160 for ; Mon, 01 Jun 2020 15:32:36 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.120, mailfrom: deric.cole@intel.com) IronPort-SDR: Ov6MnjX7SVQodMr3CWA4vD5gJVYPlo49OFey2axF2OlL0Yt4O2F1yCjG/hWLbH+s8mLWp+DJv5 XCvQS0FIhbYg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jun 2020 15:32:35 -0700 IronPort-SDR: bi9/83mJvVDlZEdY617hkBqvfcD918IC+EQ0uPy7s79/N3fjdt7FtiLxaLzIGofd7m8Xaq6utX SKYnHjwX2DJw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,462,1583222400"; d="scan'208";a="268478060" Received: from fcole-desk.amr.corp.intel.com ([10.7.144.170]) by orsmga003.jf.intel.com with ESMTP; 01 Jun 2020 15:32:35 -0700 From: Deric Cole To: devel@edk2.groups.io Cc: Deric Cole , Eric Dong , Ray Ni , Laszlo Ersek Subject: [PATCH] UefiCpuPkg/SecCore: Add pre-memory AP vector Date: Mon, 1 Jun 2020 15:32:25 -0700 Message-Id: <20200601223225.1925-1-deric.cole@intel.com> X-Mailer: git-send-email 2.26.2.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D2776 Add a vector at 0xFF000 (0xFFFFF000) that can be used by Init-SIPI-SIPI to start an AP before memory is initialized. This vector jumps into the same SEC entry point as the ordinary reset vector, with a special value of "AP" in the DI register. The platform-specific SEC code is expected to check for that value and take a different path for APs, if this feature is supported by the platform. Cc: Eric Dong Cc: Ray Ni Cc: Laszlo Ersek Signed-off-by: Deric Cole --- UefiCpuPkg/SecCore/Ia32/ResetVec.nasmb | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/UefiCpuPkg/SecCore/Ia32/ResetVec.nasmb b/UefiCpuPkg/SecCore/Ia= 32/ResetVec.nasmb index f41b9669d0..1dfc4efe4c 100644 --- a/UefiCpuPkg/SecCore/Ia32/ResetVec.nasmb +++ b/UefiCpuPkg/SecCore/Ia32/ResetVec.nasmb @@ -10,7 +10,7 @@ ; Abstract:=0D ;=0D ; Reset Vector Data structure=0D -; This structure is located at 0xFFFFFFC0=0D +; This structure is located at 0xFFFFF000=0D ;=0D ;-------------------------------------------------------------------------= -----=0D =0D @@ -23,19 +23,36 @@ USE16 ;=0D =0D ORG 0h=0D +=0D +;=0D +; 0xFFFFF000=0D +;=0D +; We enter here with CS:IP =3D 0xFF00:0x0000. Do a far-jump to change CS t= o 0xF000=0D +; and IP to ApStartup.=0D +;=0D +ApVector:=0D + mov di, "AP"=0D + jmp 0xF000:0xF000+ApStartup=0D +=0D + TIMES 0xFC0-($-$$) nop=0D +=0D +;=0D +; This should be at 0xFFFFFFC0=0D +;=0D +=0D ;=0D ; Reserved=0D ;=0D ReservedData: DD 0eeeeeeeeh, 0eeeeeeeeh=0D =0D - TIMES 0x10-($-$$) DB 0=0D + TIMES 0xFD0-($-$$) nop=0D ;=0D -; This is located at 0xFFFFFFD0h=0D +; This is located at 0xFFFFFFD0=0D ;=0D mov di, "PA"=0D jmp ApStartup=0D =0D - TIMES 0x20-($-$$) DB 0=0D + TIMES 0xFE0-($-$$) nop=0D ;=0D ; Pointer to the entry point of the PEI core=0D ; It is located at 0xFFFFFFE0, and is fixed up by some build tool=0D @@ -53,7 +70,7 @@ ASM_PFX(InterruptHandler): jmp $=0D iret=0D =0D - TIMES 0x30-($-$$) DB 0=0D + TIMES 0xFF0-($-$$) nop=0D ;=0D ; For IA32, the reset vector must be at 0xFFFFFFF0, i.e., 4G-16 byte=0D ; Execution starts here upon power-on/platform-reset.=0D @@ -74,7 +91,7 @@ ApStartup: DW -3=0D =0D =0D - TIMES 0x38-($-$$) DB 0=0D + TIMES 0xFF8-($-$$) nop=0D ;=0D ; Ap reset vector segment address is at 0xFFFFFFF8=0D ; This will be fixed up by some build tool,=0D @@ -83,7 +100,7 @@ ApStartup: ;=0D ApSegAddress: dd 12345678h=0D =0D - TIMES 0x3c-($-$$) DB 0=0D + TIMES 0xFFC-($-$$) nop=0D ;=0D ; BFV Base is at 0xFFFFFFFC=0D ; This will be fixed up by some build tool,=0D --=20 2.26.2.windows.1