From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: hpe.com, ip: 148.163.143.35, mailfrom: prvs=0142e58505=abner.chang@hpe.com) Received: from mx0b-002e3701.pphosted.com (mx0b-002e3701.pphosted.com [148.163.143.35]) by groups.io with SMTP; Mon, 26 Aug 2019 23:31:09 -0700 Received: from pps.filterd (m0150245.ppops.net [127.0.0.1]) by mx0b-002e3701.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x7R6V8vv024939 for ; Tue, 27 Aug 2019 06:31:08 GMT Received: from g2t2354.austin.hpe.com (g2t2354.austin.hpe.com [15.233.44.27]) by mx0b-002e3701.pphosted.com with ESMTP id 2umkh74a1t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 27 Aug 2019 06:31:08 +0000 Received: from g2t2360.austin.hpecorp.net (g2t2360.austin.hpecorp.net [16.196.225.135]) by g2t2354.austin.hpe.com (Postfix) with ESMTP id B3491B5 for ; Tue, 27 Aug 2019 06:30:37 +0000 (UTC) Received: from UB16Abner.asiapacific.hpqcorp.net (ub16abner.asiapacific.hpqcorp.net [15.119.209.44]) by g2t2360.austin.hpecorp.net (Postfix) with ESMTP id 929FC3A; Tue, 27 Aug 2019 06:30:36 +0000 (UTC) From: "Abner Chang" To: devel@edk2.groups.io Cc: abner.chang@hpe.com Subject: [edk2-staging/RISC-V PATCH v1 8/14]: RiscVPkg/Universal: Remove stale moudles Date: Tue, 27 Aug 2019 14:00:26 +0800 Message-Id: <1566885632-5747-8-git-send-email-abner.chang@hpe.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1566885632-5747-1-git-send-email-abner.chang@hpe.com> References: <1566885632-5747-1-git-send-email-abner.chang@hpe.com> X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-HPE-SCL: -1 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:5.22.84,1.0.8 definitions=2019-08-26_08:2019-08-26,2019-08-26 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 malwarescore=0 lowpriorityscore=0 phishscore=0 adultscore=0 clxscore=1015 impostorscore=0 bulkscore=0 spamscore=0 mlxlogscore=999 suspectscore=1 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1906280000 definitions=main-1908270072 - Remove Timer DXE driver from RISC-V package becasue it is platform level driver has platform-specific implementation. - Remove SEC module from RISC-V package because this is RISC-V processor-implementation specific. RISC-V platform code should provide this module. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Abner Chang --- RiscVPkg/Universal/Sec/Riscv64/SecEntry.s | 109 ------ RiscVPkg/Universal/Sec/SecMain.c | 563 ----------------------------- RiscVPkg/Universal/Sec/SecMain.h | 56 --- RiscVPkg/Universal/Sec/SecMain.inf | 72 ---- RiscVPkg/Universal/Sec/TrapHandler.c | 99 ----- RiscVPkg/Universal/TimerDxe/Timer.c | 288 --------------- RiscVPkg/Universal/TimerDxe/Timer.h | 179 --------- RiscVPkg/Universal/TimerDxe/Timer.uni | Bin 1678 -> 0 bytes RiscVPkg/Universal/TimerDxe/TimerDxe.inf | 54 --- RiscVPkg/Universal/TimerDxe/TimerExtra.uni | Bin 1374 -> 0 bytes 10 files changed, 1420 deletions(-) delete mode 100644 RiscVPkg/Universal/Sec/Riscv64/SecEntry.s delete mode 100644 RiscVPkg/Universal/Sec/SecMain.c delete mode 100644 RiscVPkg/Universal/Sec/SecMain.h delete mode 100644 RiscVPkg/Universal/Sec/SecMain.inf delete mode 100644 RiscVPkg/Universal/Sec/TrapHandler.c delete mode 100644 RiscVPkg/Universal/TimerDxe/Timer.c delete mode 100644 RiscVPkg/Universal/TimerDxe/Timer.h delete mode 100644 RiscVPkg/Universal/TimerDxe/Timer.uni delete mode 100644 RiscVPkg/Universal/TimerDxe/TimerDxe.inf delete mode 100644 RiscVPkg/Universal/TimerDxe/TimerExtra.uni diff --git a/RiscVPkg/Universal/Sec/Riscv64/SecEntry.s b/RiscVPkg/Universal/Sec/Riscv64/SecEntry.s deleted file mode 100644 index cc4ca6d..0000000 --- a/RiscVPkg/Universal/Sec/Riscv64/SecEntry.s +++ /dev/null @@ -1,109 +0,0 @@ -//------------------------------------------------------------------------------ -// -// RISC-V Sec module. -// -// Copyright (c) 2016-2017, Hewlett Packard Enterprise Development LP. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php. -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -//------------------------------------------------------------------------------ -#include -#include - -.data - -.text -.align 3 - -.global ASM_PFX(_ModuleEntryPoint) - -.dword ASM_PFX(TrapFromUserModeHandler) -.align 3 -.dword ASM_PFX(TrapFromSupervisorModeHandler) -.align 3 -.dword ASM_PFX(TrapFromHypervisorModeHandler) -.align 3 -.dword ASM_PFX(TrapFromMachineModeHandler) -.align 3 -.dword ASM_PFX(NmiHandler) -.align 3 -ASM_PFX(_ModuleEntryPoint): - // - // Set vector base to. - // -// li a0, 0xfffffec0 -// csrrw a1, 0x301, a0 // Machine vector base. -// li a0, 0xfffffe80 -// csrrw a1, 0x201, a0 // Hypervisor vector base. -// li a0, 0xfffffe40 -// csrrw a1, 0x101, a0 // Supervisor vector base. - li a0, 0xfffffe00 - csrrw a1, RISCV_CSR_MACHINE_MTVEC, a0 // Machine vector base. - - // - // Platform SEC PEI temporary memory init. - // - call RiscVPlatformTemporaryMemInit - // - // Set up temporary memory for SEC and PEI phase. - // PcdOvmfSecPeiTempRamBase and PcdOvmfSecPeiTempRamSize - // map to the specific region within system memory. - // - li a0, FixedPcdGet32 (PcdRiscVSecPeiTempRamBase) - li a1, FixedPcdGet32 (PcdRiscVSecPeiTempRamSize) - add a2, a0, a1 // a2 is top of temporary memory. - add sp, a0, a1 // Set stack pointer to top of temporary memory. - - // - // Call startup with stack - // - li a1, 0x20 - sub sp, sp, a1 - li a0, FixedPcdGet32 (PcdRiscVPeiFvBase) // Load boot FV in a0. - add a1, a2, 0 // Load top of stack in a1. - call SecCoreStartupWithStack - // - // Never return here. - // - -// -// User mode trap handler. -// -ASM_PFX(TrapFromUserModeHandler): - call RiscVUserModeTrapHandler - mret - -// -//Supervisor mode trap handler. -// -ASM_PFX(TrapFromSupervisorModeHandler): - call RiscVSupervisorModeTrapHandler - mret - -// -// Hypervisor mode trap handler. -// -ASM_PFX(TrapFromHypervisorModeHandler): - call RiscVHypervisorModeTrapHandler - mret - -// -// Machine mode trap handler. -// -ASM_PFX(TrapFromMachineModeHandler): - call RiscVMachineModeTrapHandler - mret - -// -// NMI trap handler. -// -ASM_PFX(NmiHandler): - call RiscVNmiHandler - mret - diff --git a/RiscVPkg/Universal/Sec/SecMain.c b/RiscVPkg/Universal/Sec/SecMain.c deleted file mode 100644 index be87ce1..0000000 --- a/RiscVPkg/Universal/Sec/SecMain.c +++ /dev/null @@ -1,563 +0,0 @@ -/** @file - RISC-V SEC phase module. - - Copyright (c) 2016, Hewlett Packard Enterprise Development LP. All rights reserved.
- - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -**/ - -#include "SecMain.h" - -EFI_PEI_TEMPORARY_RAM_SUPPORT_PPI mTemporaryRamSupportPpi = { - TemporaryRamMigration -}; - -EFI_PEI_TEMPORARY_RAM_DONE_PPI mTemporaryRamDonePpi = { - TemporaryRamDone -}; - -EFI_PEI_PPI_DESCRIPTOR mPrivateDispatchTable[] = { - { - EFI_PEI_PPI_DESCRIPTOR_PPI, - &gEfiTemporaryRamSupportPpiGuid, - &mTemporaryRamSupportPpi - }, - { - (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST), - &gEfiTemporaryRamDonePpiGuid, - &mTemporaryRamDonePpi - }, -}; - -/** - Locates a section within a series of sections - with the specified section type. - - The Instance parameter indicates which instance of the section - type to return. (0 is first instance, 1 is second...) - - @param[in] Sections The sections to search - @param[in] SizeOfSections Total size of all sections - @param[in] SectionType The section type to locate - @param[in] Instance The section instance number - @param[out] FoundSection The FFS section if found - - @retval EFI_SUCCESS The file and section was found - @retval EFI_NOT_FOUND The file and section was not found - @retval EFI_VOLUME_CORRUPTED The firmware volume was corrupted - -**/ -EFI_STATUS -FindFfsSectionInstance ( - IN VOID *Sections, - IN UINTN SizeOfSections, - IN EFI_SECTION_TYPE SectionType, - IN UINTN Instance, - OUT EFI_COMMON_SECTION_HEADER **FoundSection - ) -{ - EFI_PHYSICAL_ADDRESS CurrentAddress; - UINT32 Size; - EFI_PHYSICAL_ADDRESS EndOfSections; - EFI_COMMON_SECTION_HEADER *Section; - EFI_PHYSICAL_ADDRESS EndOfSection; - - // - // Loop through the FFS file sections within the PEI Core FFS file - // - EndOfSection = (EFI_PHYSICAL_ADDRESS)(UINTN) Sections; - EndOfSections = EndOfSection + SizeOfSections; - for (;;) { - if (EndOfSection == EndOfSections) { - break; - } - CurrentAddress = (EndOfSection + 3) & ~(3ULL); - if (CurrentAddress >= EndOfSections) { - return EFI_VOLUME_CORRUPTED; - } - - Section = (EFI_COMMON_SECTION_HEADER*)(UINTN) CurrentAddress; - - Size = SECTION_SIZE (Section); - if (Size < sizeof (*Section)) { - return EFI_VOLUME_CORRUPTED; - } - - EndOfSection = CurrentAddress + Size; - if (EndOfSection > EndOfSections) { - return EFI_VOLUME_CORRUPTED; - } - - // - // Look for the requested section type - // - if (Section->Type == SectionType) { - if (Instance == 0) { - *FoundSection = Section; - return EFI_SUCCESS; - } else { - Instance--; - } - } - } - - return EFI_NOT_FOUND; -} - -/** - Locates a section within a series of sections - with the specified section type. - - @param[in] Sections The sections to search - @param[in] SizeOfSections Total size of all sections - @param[in] SectionType The section type to locate - @param[out] FoundSection The FFS section if found - - @retval EFI_SUCCESS The file and section was found - @retval EFI_NOT_FOUND The file and section was not found - @retval EFI_VOLUME_CORRUPTED The firmware volume was corrupted - -**/ -EFI_STATUS -FindFfsSectionInSections ( - IN VOID *Sections, - IN UINTN SizeOfSections, - IN EFI_SECTION_TYPE SectionType, - OUT EFI_COMMON_SECTION_HEADER **FoundSection - ) -{ - return FindFfsSectionInstance ( - Sections, - SizeOfSections, - SectionType, - 0, - FoundSection - ); -} - -/** - Locates a FFS file with the specified file type and a section - within that file with the specified section type. - - @param[in] Fv The firmware volume to search - @param[in] FileType The file type to locate - @param[in] SectionType The section type to locate - @param[out] FoundSection The FFS section if found - - @retval EFI_SUCCESS The file and section was found - @retval EFI_NOT_FOUND The file and section was not found - @retval EFI_VOLUME_CORRUPTED The firmware volume was corrupted - -**/ -EFI_STATUS -FindFfsFileAndSection ( - IN EFI_FIRMWARE_VOLUME_HEADER *Fv, - IN EFI_FV_FILETYPE FileType, - IN EFI_SECTION_TYPE SectionType, - OUT EFI_COMMON_SECTION_HEADER **FoundSection - ) -{ - EFI_STATUS Status; - EFI_PHYSICAL_ADDRESS CurrentAddress; - EFI_PHYSICAL_ADDRESS EndOfFirmwareVolume; - EFI_FFS_FILE_HEADER *File; - UINT32 Size; - EFI_PHYSICAL_ADDRESS EndOfFile; - - if (Fv->Signature != EFI_FVH_SIGNATURE) { - DEBUG ((EFI_D_ERROR, "FV at %p does not have FV header signature\n", Fv)); - return EFI_VOLUME_CORRUPTED; - } - - CurrentAddress = (EFI_PHYSICAL_ADDRESS)(UINTN) Fv; - EndOfFirmwareVolume = CurrentAddress + Fv->FvLength; - - // - // Loop through the FFS files in the Boot Firmware Volume - // - for (EndOfFile = CurrentAddress + Fv->HeaderLength; ; ) { - - CurrentAddress = (EndOfFile + 7) & ~(7ULL); - if (CurrentAddress > EndOfFirmwareVolume) { - return EFI_VOLUME_CORRUPTED; - } - - File = (EFI_FFS_FILE_HEADER*)(UINTN) CurrentAddress; - Size = *(UINT32*) File->Size & 0xffffff; - if (Size < (sizeof (*File) + sizeof (EFI_COMMON_SECTION_HEADER))) { - return EFI_VOLUME_CORRUPTED; - } - - EndOfFile = CurrentAddress + Size; - if (EndOfFile > EndOfFirmwareVolume) { - return EFI_VOLUME_CORRUPTED; - } - - // - // Look for the request file type - // - if (File->Type != FileType) { - continue; - } - - Status = FindFfsSectionInSections ( - (VOID*) (File + 1), - (UINTN) EndOfFile - (UINTN) (File + 1), - SectionType, - FoundSection - ); - if (!EFI_ERROR (Status) || (Status == EFI_VOLUME_CORRUPTED)) { - return Status; - } - } -} - -/** - Locates the PEI Core entry point address - - @param[in] Fv The firmware volume to search - @param[out] PeiCoreEntryPoint The entry point of the PEI Core image - - @retval EFI_SUCCESS The file and section was found - @retval EFI_NOT_FOUND The file and section was not found - @retval EFI_VOLUME_CORRUPTED The firmware volume was corrupted - -**/ -EFI_STATUS -FindPeiCoreImageBaseInFv ( - IN EFI_FIRMWARE_VOLUME_HEADER *Fv, - OUT EFI_PHYSICAL_ADDRESS *PeiCoreImageBase - ) -{ - EFI_STATUS Status; - EFI_COMMON_SECTION_HEADER *Section; - - Status = FindFfsFileAndSection ( - Fv, - EFI_FV_FILETYPE_PEI_CORE, - EFI_SECTION_PE32, - &Section - ); - if (EFI_ERROR (Status)) { - Status = FindFfsFileAndSection ( - Fv, - EFI_FV_FILETYPE_PEI_CORE, - EFI_SECTION_TE, - &Section - ); - if (EFI_ERROR (Status)) { - DEBUG ((EFI_D_ERROR, "Unable to find PEI Core image\n")); - return Status; - } - } - DEBUG ((EFI_D_ERROR, "PeiCoreImageBase found\n")); - *PeiCoreImageBase = (EFI_PHYSICAL_ADDRESS)(UINTN)(Section + 1); - return EFI_SUCCESS; -} - -/** - Reads 8-bits of CMOS data. - - Reads the 8-bits of CMOS data at the location specified by Index. - The 8-bit read value is returned. - - @param Index The CMOS location to read. - - @return The value read. - -**/ -STATIC -UINT8 -CmosRead8 ( - IN UINTN Index - ) -{ - IoWrite8 (0x70, (UINT8) Index); - return IoRead8 (0x71); -} - -STATIC -BOOLEAN -IsS3Resume ( - VOID - ) -{ - return (CmosRead8 (0xF) == 0xFE); -} - -/** - Locates the PEI Core entry point address - - @param[in,out] Fv The firmware volume to search - @param[out] PeiCoreEntryPoint The entry point of the PEI Core image - - @retval EFI_SUCCESS The file and section was found - @retval EFI_NOT_FOUND The file and section was not found - @retval EFI_VOLUME_CORRUPTED The firmware volume was corrupted - -**/ -VOID -FindPeiCoreImageBase ( - IN OUT EFI_FIRMWARE_VOLUME_HEADER **BootFv, - OUT EFI_PHYSICAL_ADDRESS *PeiCoreImageBase - ) -{ - *PeiCoreImageBase = 0; - - if (IsS3Resume ()) { - DEBUG ((EFI_D_VERBOSE, "SEC: S3 resume not supported.\n")); - ASSERT (FALSE); - } else { - DEBUG ((EFI_D_VERBOSE, "SEC: Normal boot\n")); - } - DEBUG ((EFI_D_INFO, "FindPeiCoreImageBaseInFv\n")); - FindPeiCoreImageBaseInFv (*BootFv, PeiCoreImageBase); -} - -/* - Find and return Pei Core entry point. - - It also find SEC and PEI Core file debug inforamtion. It will report them if - remote debug is enabled. - -**/ -VOID -FindAndReportEntryPoints ( - IN EFI_FIRMWARE_VOLUME_HEADER **BootFirmwareVolumePtr, - OUT EFI_PEI_CORE_ENTRY_POINT *PeiCoreEntryPoint - ) -{ - EFI_STATUS Status; - EFI_PHYSICAL_ADDRESS PeiCoreImageBase; - - DEBUG ((EFI_D_INFO, "FindAndReportEntryPoints\n")); - - FindPeiCoreImageBase (BootFirmwareVolumePtr, &PeiCoreImageBase); - // - // Find PEI Core entry point - // - Status = PeCoffLoaderGetEntryPoint ((VOID *) (UINTN) PeiCoreImageBase, (VOID**) PeiCoreEntryPoint); - if (EFI_ERROR(Status)) { - *PeiCoreEntryPoint = 0; - } - DEBUG ((EFI_D_INFO, "PeCoffLoaderGetEntryPoint success: %x\n", *PeiCoreEntryPoint)); - - return; -} - -VOID -EFIAPI -SecCoreStartupWithStack ( - IN EFI_FIRMWARE_VOLUME_HEADER *BootFv, - IN VOID *TopOfCurrentStack - ) -{ - EFI_SEC_PEI_HAND_OFF SecCoreData; - RISCV_MACHINE_MODE_CONTEXT *RiscvContext; - - ProcessLibraryConstructorList (NULL, NULL); - DEBUG ((EFI_D_INFO, - "SecCoreStartupWithStack(0x%x, 0x%x)\n", - (UINT32)(UINTN)BootFv, - (UINT32)(UINTN)TopOfCurrentStack - )); - - // - // Initialize SEC hand-off state - // - SecCoreData.DataSize = sizeof(EFI_SEC_PEI_HAND_OFF); - - // - // Temporary memory usage - // - // (TemporaryRamBase + TemporaryRamSize) = --> |============================== - // | ^ - // | | - // | 1/2 * (TemporaryRamSize - RISCV_MACHINE_MODE_CONTEXT) - // | | - // | v - // StackBase = --> |============================== - // | ^ - // | | - // | 1/2 * (TemporaryRamSize - RISCV_MACHINE_MODE_CONTEXT) - // | | - // | v - // PeiTemporaryRamBase ----> |============================== - // | - //TemporaryRamBase = RISCV_MACHINE_MODE_CONTEXT-> ============================== - - SecCoreData.TemporaryRamSize = (UINTN) PcdGet32 (PcdRiscVSecPeiTempRamSize) - RISCV_MACHINE_CONTEXT_SIZE; - SecCoreData.TemporaryRamBase = (VOID*)((UINT8 *)TopOfCurrentStack - SecCoreData.TemporaryRamSize); - - SecCoreData.PeiTemporaryRamBase = SecCoreData.TemporaryRamBase; - SecCoreData.PeiTemporaryRamSize = SecCoreData.TemporaryRamSize >> 1; - - SecCoreData.StackBase = (UINT8 *)SecCoreData.TemporaryRamBase + - (SecCoreData.TemporaryRamSize >> 1); - SecCoreData.StackSize = (SecCoreData.TemporaryRamSize >> 1); - - SecCoreData.BootFirmwareVolumeBase = BootFv; - SecCoreData.BootFirmwareVolumeSize = (UINTN) BootFv->FvLength; - - // - // Setup RISCV_MACHINE_MODE_CONTEXT. - // - RiscvContext = (RISCV_MACHINE_MODE_CONTEXT *)(SecCoreData.TemporaryRamBase - RISCV_MACHINE_CONTEXT_SIZE); - RiscvContext->MachineModeTrapHandler = (EFI_PHYSICAL_ADDRESS)(UINTN)SecMachineModeTrapHandler; - RiscVSetScratch (RiscvContext); - DEBUG ((DEBUG_INFO, "RISC-V Machine mode context at %x\n", RiscVGetScratch ())); - - // - // Initialize Debug Agent to support source level debug in SEC/PEI phases before memory ready. - // - InitializeDebugAgent(DEBUG_AGENT_INIT_PREMEM_SEC, &SecCoreData, SecStartupPhase2); -} - -/** - Caller provided function to be invoked at the end of InitializeDebugAgent(). - - Entry point to the C language phase of SEC. After the SEC assembly - code has initialized some temporary memory and set up the stack, - the control is transferred to this function. - - @param[in] Context The first input parameter of InitializeDebugAgent(). - -**/ -VOID -EFIAPI -SecStartupPhase2( - IN VOID *Context - ) -{ - EFI_SEC_PEI_HAND_OFF *SecCoreData; - EFI_FIRMWARE_VOLUME_HEADER *BootFv; - EFI_PEI_CORE_ENTRY_POINT PeiCoreEntryPoint; - - DEBUG ((EFI_D_INFO, "SecStartupPhase2\n")); - - SecCoreData = (EFI_SEC_PEI_HAND_OFF *) Context; - - // - // Find PEI Core entry point. It will report SEC and Pei Core debug information if remote debug - // is enabled. - // - BootFv = (EFI_FIRMWARE_VOLUME_HEADER *)SecCoreData->BootFirmwareVolumeBase; - FindAndReportEntryPoints (&BootFv, &PeiCoreEntryPoint); - SecCoreData->BootFirmwareVolumeBase = BootFv; - SecCoreData->BootFirmwareVolumeSize = (UINTN) BootFv->FvLength; - - DEBUG ((EFI_D_INFO, "Transfer the control to the PEI core BootFv:%x , FvLength:%x\n", BootFv, BootFv->FvLength)); - // - // Transfer the control to the PEI core - // - (*PeiCoreEntryPoint) (SecCoreData, (EFI_PEI_PPI_DESCRIPTOR *)&mPrivateDispatchTable); - - // - // If we get here then the PEI Core returned, which is not recoverable. - // - ASSERT (FALSE); - //CpuDeadLoop (); -} - -EFI_STATUS -EFIAPI -TemporaryRamMigration ( - IN CONST EFI_PEI_SERVICES **PeiServices, - IN EFI_PHYSICAL_ADDRESS TemporaryMemoryBase, - IN EFI_PHYSICAL_ADDRESS PermanentMemoryBase, - IN UINTN CopySize - ) -{ - VOID *OldHeap; - VOID *NewHeap; - VOID *OldStack; - VOID *NewStack; - DEBUG_AGENT_CONTEXT_POSTMEM_SEC DebugAgentContext; - BOOLEAN OldStatus; - BASE_LIBRARY_JUMP_BUFFER JumpBuffer; - - DEBUG ((EFI_D_INFO, - "TemporaryRamMigration(0x%Lx, 0x%Lx, 0x%Lx)\n", - TemporaryMemoryBase, - PermanentMemoryBase, - (UINT64)CopySize - )); - - OldHeap = (VOID*)(UINTN)TemporaryMemoryBase; - NewHeap = (VOID*)((UINTN)PermanentMemoryBase + (CopySize >> 1)); - - OldStack = (VOID*)((UINTN)TemporaryMemoryBase + (CopySize >> 1)); - NewStack = (VOID*)(UINTN)PermanentMemoryBase; - - DebugAgentContext.HeapMigrateOffset = (UINTN)NewHeap - (UINTN)OldHeap; - DebugAgentContext.StackMigrateOffset = (UINTN)NewStack - (UINTN)OldStack; - - OldStatus = SaveAndSetDebugTimerInterrupt (FALSE); - InitializeDebugAgent (DEBUG_AGENT_INIT_POSTMEM_SEC, (VOID *) &DebugAgentContext, NULL); - - CopyMem (NewHeap, OldHeap, CopySize >> 1); // Migrate Heap - CopyMem (NewStack, OldStack, CopySize >> 1); // Migrate Stack - - // - // Use SetJump()/LongJump() to switch to a new stack. - // - if (SetJump (&JumpBuffer) == 0) { - DEBUG ((EFI_D_INFO,"Return from SetJump\n")); - JumpBuffer.SP = JumpBuffer.SP + DebugAgentContext.StackMigrateOffset; - LongJump (&JumpBuffer, (UINTN)-1); - // - // LongJump will return to before TemporaryRamMigration. - // - } - - SaveAndSetDebugTimerInterrupt (OldStatus); - - return EFI_SUCCESS; -} - -EFI_STATUS -EFIAPI -TemporaryRamDone ( - VOID - ) -{ - EFI_PEI_SERVICES **PeiServices; - EFI_STATUS Status; - RISCV_MACHINE_MODE_CONTEXT *MachineModeContext; - RISCV_MACHINE_MODE_CONTEXT *OldMachineModeContext; - EFI_HOB_GUID_TYPE *HobGuid; - - DEBUG ((EFI_D_INFO, "TemporaryRamDone\n")); - - OldMachineModeContext = (RISCV_MACHINE_MODE_CONTEXT *)(UINTN)RiscVGetScratch (); - PeiServices = (EFI_PEI_SERVICES **)(UINTN)OldMachineModeContext->PeiService; - - // - // Copy RISCV_MACHINE_MODE_CONTEXT to HOB. - // - Status = (*PeiServices)->CreateHob ( - (const EFI_PEI_SERVICES**)PeiServices, - EFI_HOB_TYPE_GUID_EXTENSION, - sizeof (EFI_HOB_GUID_TYPE) + sizeof (RISCV_MACHINE_MODE_CONTEXT), - (VOID **)&HobGuid - ); - ASSERT (!EFI_ERROR (Status)); - HobGuid->Name = gUefiRiscVMachineContextGuid; - OldMachineModeContext = (RISCV_MACHINE_MODE_CONTEXT *)(UINTN)RiscVGetScratch (); - MachineModeContext = (RISCV_MACHINE_MODE_CONTEXT *)(HobGuid + 1); - CopyMem (MachineModeContext, OldMachineModeContext, sizeof (RISCV_MACHINE_MODE_CONTEXT)); - RiscVSetScratch (MachineModeContext); - DEBUG ((DEBUG_INFO, "New RISCV_MACHINE_MODE_CONTEXT at %x.\n", RiscVGetScratch ())); - - // - // Platform temporary memory done. - // - //RiscVPlatformTemporaryRamDone (); - return EFI_SUCCESS; -} diff --git a/RiscVPkg/Universal/Sec/SecMain.h b/RiscVPkg/Universal/Sec/SecMain.h deleted file mode 100644 index 5863351..0000000 --- a/RiscVPkg/Universal/Sec/SecMain.h +++ /dev/null @@ -1,56 +0,0 @@ -/** @file - RISC-V SEC phase module definitions.. - - Copyright (c) 2016, Hewlett Packard Enterprise Development LP. All rights reserved.
- - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -**/ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -VOID -SecMachineModeTrapHandler ( - IN VOID - ); - -VOID -EFIAPI -SecStartupPhase2 ( - IN VOID *Context - ); - -EFI_STATUS -EFIAPI -TemporaryRamMigration ( - IN CONST EFI_PEI_SERVICES **PeiServices, - IN EFI_PHYSICAL_ADDRESS TemporaryMemoryBase, - IN EFI_PHYSICAL_ADDRESS PermanentMemoryBase, - IN UINTN CopySize - ); - -EFI_STATUS -EFIAPI -TemporaryRamDone ( - VOID - ); diff --git a/RiscVPkg/Universal/Sec/SecMain.inf b/RiscVPkg/Universal/Sec/SecMain.inf deleted file mode 100644 index cb678a5..0000000 --- a/RiscVPkg/Universal/Sec/SecMain.inf +++ /dev/null @@ -1,72 +0,0 @@ -## @file -# RISC-V SEC module. -# -# Copyright (c) 2016, Hewlett Packard Enterprise Development LP. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = SecMain - FILE_GUID = df1ccef6-f301-4a63-9661-fc6030dcc880 - MODULE_TYPE = SEC - VERSION_STRING = 1.0 - ENTRY_POINT = SecMain - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = RISCV64 RISCV32 EBC -# - -[Sources] - SecMain.c - TrapHandler.c - -[Sources.RISCV32] - -[Sources.RISCV64] - Riscv64/SecEntry.s - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - OvmfPkg/OvmfPkg.dec - RiscVPkg/RiscVPkg.dec - RiscVVirtPkg/RiscVVirtPkg.dec - -[LibraryClasses] - BaseLib - DebugLib - BaseMemoryLib - PcdLib - DebugAgentLib - IoLib - PeCoffLib - PeCoffGetEntryPointLib - PeCoffExtraActionLib - ExtractGuidedSectionLib - RiscVPlatformTempMemoryInitLib - RiscVCpuLib - -[Ppis] - gEfiTemporaryRamSupportPpiGuid # PPI ALWAYS_PRODUCED - gEfiTemporaryRamDonePpiGuid # PPI ALWAYS_PRODUCED - -[Guids] - gUefiRiscVMachineContextGuid - -[Pcd] - gUefiRiscVPkgTokenSpaceGuid.PcdRiscVPeiFvBase - gUefiRiscVPkgTokenSpaceGuid.PcdRiscVPeiFvSize - gUefiRiscVPkgTokenSpaceGuid.PcdRiscVSecPeiTempRamSize - gUefiRiscVPkgTokenSpaceGuid.PcdRiscVSecPeiTempRamBase - diff --git a/RiscVPkg/Universal/Sec/TrapHandler.c b/RiscVPkg/Universal/Sec/TrapHandler.c deleted file mode 100644 index 6783501..0000000 --- a/RiscVPkg/Universal/Sec/TrapHandler.c +++ /dev/null @@ -1,99 +0,0 @@ -/** @file - RISC-V trap handler. - - Copyright (c) 2016, Hewlett Packard Enterprise Development LP. All rights reserved.
- - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "SecMain.h" - -/** - RISC-V User mode trap handler. - -**/ -VOID -RiscVUserModeTrapHandler ( - VOID - ) -{ - DEBUG ((EFI_D_INFO, "Enter RISC-V User Mode Trap Handler.\n")); - //while (TRUE); -} - -/** - RISC-V Supervisor mode trap handler. - -**/ -VOID -RiscVSupervisorModeTrapHandler ( - VOID - ) -{ - DEBUG ((EFI_D_INFO, "Enter RISC-V Supervisor Mode Trap Handler.\n")); - //while (TRUE); -} - -/** - RISC-V Hypervisor mode trap handler. - -**/ -VOID -RiscVHypervisorModeTrapHandler ( - VOID - ) -{ - DEBUG ((EFI_D_INFO, "Enter RISC-V Hypervisor Mode Trap Handler.\n")); - //while (TRUE); -} - -/** - RISC-V Machine mode trap handler. - -**/ -VOID -RiscVMachineModeTrapHandler ( - VOID - ) -{ - RISCV_TRAP_HANDLER TrapHandle; - RISCV_MACHINE_MODE_CONTEXT *Context; - - //DEBUG ((EFI_D_INFO, "Enter RISC-V Machine Mode Trap Handler.\n")); - Context = (RISCV_MACHINE_MODE_CONTEXT *)(UINTN)RiscVGetScratch (); - TrapHandle = (RISCV_TRAP_HANDLER)(UINTN)Context->MachineModeTrapHandler; - TrapHandle (); -} - -/** - RISC-V NMI trap handler. - -**/ -VOID -RiscVNmiHandler ( - VOID - ) -{ - DEBUG ((EFI_D_INFO, "Enter RISC-V NMI Trap Handler.\n")); - //while (TRUE); -} - -/** - SEC RISC-V Machine mode trap handler. - -**/ -VOID -SecMachineModeTrapHandler ( - IN VOID - ) -{ - //DEBUG ((EFI_D_INFO, "SEC RISC-V Machine Mode Trap Handler.\n")); - //while (TRUE); -} diff --git a/RiscVPkg/Universal/TimerDxe/Timer.c b/RiscVPkg/Universal/TimerDxe/Timer.c deleted file mode 100644 index 1a454c2..0000000 --- a/RiscVPkg/Universal/TimerDxe/Timer.c +++ /dev/null @@ -1,288 +0,0 @@ -/** @file - RISC-V Timer Architectural Protocol as defined in the DXE CIS - - Copyright (c) 2016, Hewlett Packard Enterprise Development LP. All rights reserved.
- - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -**/ - -#include "Timer.h" - -// -// The handle onto which the Timer Architectural Protocol will be installed -// -EFI_HANDLE mTimerHandle = NULL; - -// -// The Timer Architectural Protocol that this driver produces -// -EFI_TIMER_ARCH_PROTOCOL mTimer = { - TimerDriverRegisterHandler, - TimerDriverSetTimerPeriod, - TimerDriverGetTimerPeriod, - TimerDriverGenerateSoftInterrupt -}; - -// -// Pointer to the CPU Architectural Protocol instance -// -EFI_CPU_ARCH_PROTOCOL *mCpu; - -// -// The notification function to call on every timer interrupt. -// A bug in the compiler prevents us from initializing this here. -// -EFI_TIMER_NOTIFY mTimerNotifyFunction; - -// -// The current period of the timer interrupt -// -volatile UINT64 mTimerPeriod = 0; - -/** - 8254 Timer #0 Interrupt Handler. - - @param InterruptType The type of interrupt that occured - @param SystemContext A pointer to the system context when the interrupt occured -**/ -VOID -EFIAPI -TimerInterruptHandler ( - IN EFI_EXCEPTION_TYPE InterruptType, - IN EFI_SYSTEM_CONTEXT SystemContext - ) -{ - EFI_TPL OriginalTPL; - UINT32 RiscvTimer; - - OriginalTPL = gBS->RaiseTPL (TPL_HIGH_LEVEL); - if (mTimerPeriod == 0) { - gBS->RestoreTPL (OriginalTPL); - return; - } - if (mTimerNotifyFunction != NULL) { - mTimerNotifyFunction (mTimerPeriod); - } - RiscvTimer = RiscVReadMachineTimer(); - RiscvTimer += ((mTimerPeriod * 100) / PcdGet64 (PcdRiscVMachineTimerTickInNanoSecond)); - RiscVSetMachineTimerCmp (RiscvTimer); // Clear previous interrupt status and also set another timer. - gBS->RestoreTPL (OriginalTPL); -} - -/** - - This function registers the handler NotifyFunction so it is called every time - the timer interrupt fires. It also passes the amount of time since the last - handler call to the NotifyFunction. If NotifyFunction is NULL, then the - handler is unregistered. If the handler is registered, then EFI_SUCCESS is - returned. If the CPU does not support registering a timer interrupt handler, - then EFI_UNSUPPORTED is returned. If an attempt is made to register a handler - when a handler is already registered, then EFI_ALREADY_STARTED is returned. - If an attempt is made to unregister a handler when a handler is not registered, - then EFI_INVALID_PARAMETER is returned. If an error occurs attempting to - register the NotifyFunction with the timer interrupt, then EFI_DEVICE_ERROR - is returned. - - @param This The EFI_TIMER_ARCH_PROTOCOL instance. - @param NotifyFunction The function to call when a timer interrupt fires. This - function executes at TPL_HIGH_LEVEL. The DXE Core will - register a handler for the timer interrupt, so it can know - how much time has passed. This information is used to - signal timer based events. NULL will unregister the handler. - - @retval EFI_SUCCESS The timer handler was registered. - @retval EFI_UNSUPPORTED The platform does not support timer interrupts. - @retval EFI_ALREADY_STARTED NotifyFunction is not NULL, and a handler is already - registered. - @retval EFI_INVALID_PARAMETER NotifyFunction is NULL, and a handler was not - previously registered. - @retval EFI_DEVICE_ERROR The timer handler could not be registered. - -**/ -EFI_STATUS -EFIAPI -TimerDriverRegisterHandler ( - IN EFI_TIMER_ARCH_PROTOCOL *This, - IN EFI_TIMER_NOTIFY NotifyFunction - ) -{ - DEBUG ((DEBUG_INFO, "TimerDriverRegisterHandler\n")); - mTimerNotifyFunction = NotifyFunction; - return EFI_SUCCESS; -} - -/** - - This function adjusts the period of timer interrupts to the value specified - by TimerPeriod. If the timer period is updated, then the selected timer - period is stored in EFI_TIMER.TimerPeriod, and EFI_SUCCESS is returned. If - the timer hardware is not programmable, then EFI_UNSUPPORTED is returned. - If an error occurs while attempting to update the timer period, then the - timer hardware will be put back in its state prior to this call, and - EFI_DEVICE_ERROR is returned. If TimerPeriod is 0, then the timer interrupt - is disabled. This is not the same as disabling the CPU's interrupts. - Instead, it must either turn off the timer hardware, or it must adjust the - interrupt controller so that a CPU interrupt is not generated when the timer - interrupt fires. - - - @param This The EFI_TIMER_ARCH_PROTOCOL instance. - @param TimerPeriod The rate to program the timer interrupt in 100 nS units. If - the timer hardware is not programmable, then EFI_UNSUPPORTED is - returned. If the timer is programmable, then the timer period - will be rounded up to the nearest timer period that is supported - by the timer hardware. If TimerPeriod is set to 0, then the - timer interrupts will be disabled. - - @retval EFI_SUCCESS The timer period was changed. - @retval EFI_UNSUPPORTED The platform cannot change the period of the timer interrupt. - @retval EFI_DEVICE_ERROR The timer period could not be changed due to a device error. - -**/ -EFI_STATUS -EFIAPI -TimerDriverSetTimerPeriod ( - IN EFI_TIMER_ARCH_PROTOCOL *This, - IN UINT64 TimerPeriod - ) -{ - UINT32 RiscvTimer; - - TimerPeriod = 10 *1000 * 50; - mTimerPeriod = TimerPeriod; - if (TimerPeriod == 0) { - return EFI_SUCCESS; - } - RiscvTimer = RiscVReadMachineTimer(); - RiscvTimer += ((TimerPeriod * 100) / PcdGet64 (PcdRiscVMachineTimerTickInNanoSecond)); - RiscVSetMachineTimerCmp (RiscvTimer); - return EFI_SUCCESS; -} - -/** - - This function retrieves the period of timer interrupts in 100 ns units, - returns that value in TimerPeriod, and returns EFI_SUCCESS. If TimerPeriod - is NULL, then EFI_INVALID_PARAMETER is returned. If a TimerPeriod of 0 is - returned, then the timer is currently disabled. - - - @param This The EFI_TIMER_ARCH_PROTOCOL instance. - @param TimerPeriod A pointer to the timer period to retrieve in 100 ns units. If - 0 is returned, then the timer is currently disabled. - - @retval EFI_SUCCESS The timer period was returned in TimerPeriod. - @retval EFI_INVALID_PARAMETER TimerPeriod is NULL. - -**/ -EFI_STATUS -EFIAPI -TimerDriverGetTimerPeriod ( - IN EFI_TIMER_ARCH_PROTOCOL *This, - OUT UINT64 *TimerPeriod - ) -{ - DEBUG ((DEBUG_INFO, "TimerDriverGetTimerPeriod\n")); - *TimerPeriod = mTimerPeriod; - return EFI_SUCCESS; -} - -/** - - This function generates a soft timer interrupt. If the platform does not support soft - timer interrupts, then EFI_UNSUPPORTED is returned. Otherwise, EFI_SUCCESS is returned. - If a handler has been registered through the EFI_TIMER_ARCH_PROTOCOL.RegisterHandler() - service, then a soft timer interrupt will be generated. If the timer interrupt is - enabled when this service is called, then the registered handler will be invoked. The - registered handler should not be able to distinguish a hardware-generated timer - interrupt from a software-generated timer interrupt. - - - @param This The EFI_TIMER_ARCH_PROTOCOL instance. - - @retval EFI_SUCCESS The soft timer interrupt was generated. - @retval EFI_UNSUPPORTEDT The platform does not support the generation of soft timer interrupts. - -**/ -EFI_STATUS -EFIAPI -TimerDriverGenerateSoftInterrupt ( - IN EFI_TIMER_ARCH_PROTOCOL *This - ) -{ - return EFI_SUCCESS; -} - -/** - Initialize the Timer Architectural Protocol driver - - @param ImageHandle ImageHandle of the loaded driver - @param SystemTable Pointer to the System Table - - @retval EFI_SUCCESS Timer Architectural Protocol created - @retval EFI_OUT_OF_RESOURCES Not enough resources available to initialize driver. - @retval EFI_DEVICE_ERROR A device error occured attempting to initialize the driver. - -**/ -EFI_STATUS -EFIAPI -TimerDriverInitialize ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - - // - // Initialize the pointer to our notify function. - // - mTimerNotifyFunction = NULL; - - // - // Make sure the Timer Architectural Protocol is not already installed in the system - // - ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiTimerArchProtocolGuid); - - // - // Find the CPU architectural protocol. - // - Status = gBS->LocateProtocol (&gEfiCpuArchProtocolGuid, NULL, (VOID **) &mCpu); - ASSERT_EFI_ERROR (Status); - - // - // Force the timer to be disabled - // - Status = TimerDriverSetTimerPeriod (&mTimer, 0); - ASSERT_EFI_ERROR (Status); - - // - // Install interrupt handler for RISC-V Timer. - // - Status = mCpu->RegisterInterruptHandler (mCpu, EXCEPT_RISCV_TIMER_INT, TimerInterruptHandler); - ASSERT_EFI_ERROR (Status); - - // - // Force the timer to be enabled at its default period - // - Status = TimerDriverSetTimerPeriod (&mTimer, DEFAULT_TIMER_TICK_DURATION); - ASSERT_EFI_ERROR (Status); - - // - // Install the Timer Architectural Protocol onto a new handle - // - Status = gBS->InstallMultipleProtocolInterfaces ( - &mTimerHandle, - &gEfiTimerArchProtocolGuid, &mTimer, - NULL - ); - ASSERT_EFI_ERROR (Status); - - return Status; -} - diff --git a/RiscVPkg/Universal/TimerDxe/Timer.h b/RiscVPkg/Universal/TimerDxe/Timer.h deleted file mode 100644 index cae30b6..0000000 --- a/RiscVPkg/Universal/TimerDxe/Timer.h +++ /dev/null @@ -1,179 +0,0 @@ -/** @file - RISC-V Timer Architectural Protocol definitions. - - Copyright (c) 2016, Hewlett Packard Enterprise Development LP. All rights reserved.
- - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -**/ - -#ifndef _TIMER_H_ -#define _TIMER_H_ - -#include - -#include -#include - -#include -#include -#include -#include -#include - -// -// RISC-V use 100us timer. -// The default timer tick duration is set to 10 ms = 10 * 1000 * 10 100 ns units -// -#define DEFAULT_TIMER_TICK_DURATION 100000 - -extern VOID RiscvSetTimerPeriod (UINT32 TimerPeriod); - -// -// Function Prototypes -// -/** - Initialize the Timer Architectural Protocol driver - - @param ImageHandle ImageHandle of the loaded driver - @param SystemTable Pointer to the System Table - - @retval EFI_SUCCESS Timer Architectural Protocol created - @retval EFI_OUT_OF_RESOURCES Not enough resources available to initialize driver. - @retval EFI_DEVICE_ERROR A device error occured attempting to initialize the driver. - -**/ -EFI_STATUS -EFIAPI -TimerDriverInitialize ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -; - -/** - - This function adjusts the period of timer interrupts to the value specified - by TimerPeriod. If the timer period is updated, then the selected timer - period is stored in EFI_TIMER.TimerPeriod, and EFI_SUCCESS is returned. If - the timer hardware is not programmable, then EFI_UNSUPPORTED is returned. - If an error occurs while attempting to update the timer period, then the - timer hardware will be put back in its state prior to this call, and - EFI_DEVICE_ERROR is returned. If TimerPeriod is 0, then the timer interrupt - is disabled. This is not the same as disabling the CPU's interrupts. - Instead, it must either turn off the timer hardware, or it must adjust the - interrupt controller so that a CPU interrupt is not generated when the timer - interrupt fires. - - - @param This The EFI_TIMER_ARCH_PROTOCOL instance. - @param NotifyFunction The rate to program the timer interrupt in 100 nS units. If - the timer hardware is not programmable, then EFI_UNSUPPORTED is - returned. If the timer is programmable, then the timer period - will be rounded up to the nearest timer period that is supported - by the timer hardware. If TimerPeriod is set to 0, then the - timer interrupts will be disabled. - - @retval EFI_SUCCESS The timer period was changed. - @retval EFI_UNSUPPORTED The platform cannot change the period of the timer interrupt. - @retval EFI_DEVICE_ERROR The timer period could not be changed due to a device error. - -**/ -EFI_STATUS -EFIAPI -TimerDriverRegisterHandler ( - IN EFI_TIMER_ARCH_PROTOCOL *This, - IN EFI_TIMER_NOTIFY NotifyFunction - ) -; - -/** - - This function adjusts the period of timer interrupts to the value specified - by TimerPeriod. If the timer period is updated, then the selected timer - period is stored in EFI_TIMER.TimerPeriod, and EFI_SUCCESS is returned. If - the timer hardware is not programmable, then EFI_UNSUPPORTED is returned. - If an error occurs while attempting to update the timer period, then the - timer hardware will be put back in its state prior to this call, and - EFI_DEVICE_ERROR is returned. If TimerPeriod is 0, then the timer interrupt - is disabled. This is not the same as disabling the CPU's interrupts. - Instead, it must either turn off the timer hardware, or it must adjust the - interrupt controller so that a CPU interrupt is not generated when the timer - interrupt fires. - - - @param This The EFI_TIMER_ARCH_PROTOCOL instance. - @param TimerPeriod The rate to program the timer interrupt in 100 nS units. If - the timer hardware is not programmable, then EFI_UNSUPPORTED is - returned. If the timer is programmable, then the timer period - will be rounded up to the nearest timer period that is supported - by the timer hardware. If TimerPeriod is set to 0, then the - timer interrupts will be disabled. - - @retval EFI_SUCCESS The timer period was changed. - @retval EFI_UNSUPPORTED The platform cannot change the period of the timer interrupt. - @retval EFI_DEVICE_ERROR The timer period could not be changed due to a device error. - -**/ -EFI_STATUS -EFIAPI -TimerDriverSetTimerPeriod ( - IN EFI_TIMER_ARCH_PROTOCOL *This, - IN UINT64 TimerPeriod - ) -; - -/** - - This function retrieves the period of timer interrupts in 100 ns units, - returns that value in TimerPeriod, and returns EFI_SUCCESS. If TimerPeriod - is NULL, then EFI_INVALID_PARAMETER is returned. If a TimerPeriod of 0 is - returned, then the timer is currently disabled. - - - @param This The EFI_TIMER_ARCH_PROTOCOL instance. - @param TimerPeriod A pointer to the timer period to retrieve in 100 ns units. If - 0 is returned, then the timer is currently disabled. - - @retval EFI_SUCCESS The timer period was returned in TimerPeriod. - @retval EFI_INVALID_PARAMETER TimerPeriod is NULL. - -**/ -EFI_STATUS -EFIAPI -TimerDriverGetTimerPeriod ( - IN EFI_TIMER_ARCH_PROTOCOL *This, - OUT UINT64 *TimerPeriod - ) -; - -/** - - This function generates a soft timer interrupt. If the platform does not support soft - timer interrupts, then EFI_UNSUPPORTED is returned. Otherwise, EFI_SUCCESS is returned. - If a handler has been registered through the EFI_TIMER_ARCH_PROTOCOL.RegisterHandler() - service, then a soft timer interrupt will be generated. If the timer interrupt is - enabled when this service is called, then the registered handler will be invoked. The - registered handler should not be able to distinguish a hardware-generated timer - interrupt from a software-generated timer interrupt. - - - @param This The EFI_TIMER_ARCH_PROTOCOL instance. - - @retval EFI_SUCCESS The soft timer interrupt was generated. - @retval EFI_UNSUPPORTEDT The platform does not support the generation of soft timer interrupts. - -**/ -EFI_STATUS -EFIAPI -TimerDriverGenerateSoftInterrupt ( - IN EFI_TIMER_ARCH_PROTOCOL *This - ) -; - -#endif diff --git a/RiscVPkg/Universal/TimerDxe/Timer.uni b/RiscVPkg/Universal/TimerDxe/Timer.uni deleted file mode 100644 index 173c8f47c316cbff43773e0f44d7c373f0bca3bb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1678 zcmd6nPjAye5XI+=#CNdL3!pXu4jd3dB*Z{OsiV}Pa6 zBFnq8yR&cJyq(=YzZ=%Di2n&+WN&P0ndLUIhxUNk#=eiNXC1q=w{~Wq@l5fXj&1-3jPs)&di$83g3mzu7UzEduA`}6#E0w zZk$`;K3yB&^__NQW7cD06wXL2GNMhGZPRY}bB`j%@`~)-y08)V+<9t8h`wfag`f7X zeD4^~SJpy-*GKrLa8|T3`x(0iXcN&coLPZ~xQMTGnUk;9wmV%SW(GU%8CDKjrH}H{ z?i}wC*20-7;}T!H$GZp{Y@Oi1hP2xE(^-U*DwzbG=FYlA5i{}4V3N75oR(BX#7xMb zMFq4OpC53kxZb!Hp%(6Do54ni!U}pRR#_iIc$RT>E~>B)bIM9MBeDL4*IibJ$^S-kX0R}}_z<*$mKaPCX28S95J*31myKIS$YuGB%f=C3rV ztdts#;nk&*5_?bEv`>t6uT-h(Q@>{|>tn^Pb>A-NW9FqvK&Z~4!~KczxOC(MOEs;w zMlW2U*63S4*68#WyDQd(ns~&>uJGzPvkT@spb8`L=siZ_t~td_@s*FF2CsMcD*9LY zkF1Ef?ryw`60(Tx%O0mf@1RAO%2Les(U(GRRCtl3ss59F{pfv(U?Kg!fs}yJ2Q6mQ zB=@k=M6DFRe|;yMrtZUx3K-Dp{-`F-z!K9M=u)tJ1y!--D>$Z7GJh}hCaTI+ZRM-5 lVNG{*&CLDY&YEX<|14D_VkU;&{ka^=^nc2-j;7^l{srBn12O;r diff --git a/RiscVPkg/Universal/TimerDxe/TimerDxe.inf b/RiscVPkg/Universal/TimerDxe/TimerDxe.inf deleted file mode 100644 index 406994b..0000000 --- a/RiscVPkg/Universal/TimerDxe/TimerDxe.inf +++ /dev/null @@ -1,54 +0,0 @@ -## @file -# RISC-V Timer Arch protocol module. -# -# Copyright (c) 2016, Hewlett Packard Enterprise Development LP. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = Timer - MODULE_UNI_FILE = Timer.uni - FILE_GUID = f2765dec-6b41-11d5-8e71-00902707b35e - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - - ENTRY_POINT = TimerDriverInitialize - -[Packages] - MdePkg/MdePkg.dec - RiscVPkg/RiscVPkg.dec - -[LibraryClasses] - UefiBootServicesTableLib - BaseLib - DebugLib - UefiDriverEntryPoint - IoLib - RiscVCpuLib - -[Sources] - Timer.h - Timer.c - -[Protocols] - gEfiCpuArchProtocolGuid ## CONSUMES - gEfiTimerArchProtocolGuid ## PRODUCES - -[Pcd] - gUefiRiscVPkgTokenSpaceGuid.PcdRiscVMachineTimerTickInNanoSecond - gUefiRiscVPkgTokenSpaceGuid.PcdRiscVMachineTimerFrequencyInHerz - -[Depex] - gEfiCpuArchProtocolGuid - -[UserExtensions.TianoCore."ExtraFiles"] - TimerExtra.uni diff --git a/RiscVPkg/Universal/TimerDxe/TimerExtra.uni b/RiscVPkg/Universal/TimerDxe/TimerExtra.uni deleted file mode 100644 index 0db560f27965e588e37f60f42ff6a9910786c80a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1374 zcmZXUTW=Ck6ovP*iT`0jU(~dqKKNja5z1(ZElenQd1?k|=|m`Gz*hY6>bLgHnW31; zoXftfz0Nv&=I@`DwJhR&!4ugByRpm`c5P4X30C<=Se96F*5|gesij0@_8Z#_+of&s zWp-zC+pter$$m=g9lmQH174U5|Jrt*JGWaRBYOt=bLQ9f(q7pcJ7#?b!h>_#dQ3uv zsr_Kgy-r+K$!+ae8{#ADGT!qpV6k@o;-V8I)?{wuSul%vQC-|~GL)Zt?u^KH*0G_z zuk@(-kKmm7iB)$6N)D$bC_#ZO5#l1gQzDiyk#AS36=6wTA+eCEo2rho#3sU;ku4R) zOv(m)WzWhA_pEhusZAJ__md2Hb#H-*ZX>7a{ymAAA~T{gU(36q6Y9JUx7=la{)kJh z#e-`xW&HoN88w9{4uxK-wPCMQPv9Bq>R!}ug=#l=iaQePUql_UdaO*L=8mWd@e%x2 zr3T`(-BVV*w&gC~dWWk&3Uw8qyVgx|b8fVCp#BES1nx6CIq)<=x#bO-gjwe~vlu=J zeKfF7jBUGM-$PUNspb*Z9-TI36}!@7>odpLYlQk1dVF0m5toiUV5N@M*kBf}P#er0 z-)nbVaf|FLe(@T3MeW;E60<(`9;m_?c=aJWahFXsM?@(`Rg0*P#47VU^JhF_t}iz( zs}!e*?OTOYqxaAvp|4c4%l8&^3v=Xurk2}fJE}TI{~P^%q}^4iZUV}%I>8m#15n4{ z$HequdBG}jv?Fd%U(%dgPZ`xS>Vp&F#ZT25ph>$^tY5J0{|mdEM_66&WBqG#;*}NN EfA`naA^-pY -- 2.7.4