boolean CInterruptSystem::Initialize (void) { TExceptionTable *pTable = (TExceptionTable *) ARM_EXCEPTION_TABLE_BASE; pTable->IRQ = ARM_OPCODE_BRANCH (ARM_DISTANCE (pTable->IRQ, IRQStub)); CleanDataCache (); DataSyncBarrier (); InvalidateInstructionCache (); FlushBranchTargetCache (); DataSyncBarrier (); InstructionSyncBarrier (); #ifndef USE_RPI_STUB_AT DataMemBarrier (); write32 (ARM_IC_FIQ_CONTROL, 0); write32 (ARM_IC_DISABLE_IRQS_1, (u32) -1); write32 (ARM_IC_DISABLE_IRQS_2, (u32) -1); write32 (ARM_IC_DISABLE_BASIC_IRQS, (u32) -1); DataMemBarrier (); #endif EnableInterrupts (); return TRUE; }
VOID ShutdownEfi ( VOID ) { EFI_STATUS Status; UINTN MemoryMapSize; EFI_MEMORY_DESCRIPTOR *MemoryMap; UINTN MapKey; UINTN DescriptorSize; UINTN DescriptorVersion; UINTN Pages; MemoryMap = NULL; MemoryMapSize = 0; do { Status = gBS->GetMemoryMap ( &MemoryMapSize, MemoryMap, &MapKey, &DescriptorSize, &DescriptorVersion ); if (Status == EFI_BUFFER_TOO_SMALL) { Pages = EFI_SIZE_TO_PAGES (MemoryMapSize) + 1; MemoryMap = AllocatePages (Pages); // // Get System MemoryMap // Status = gBS->GetMemoryMap ( &MemoryMapSize, MemoryMap, &MapKey, &DescriptorSize, &DescriptorVersion ); // Don't do anything between the GetMemoryMap() and ExitBootServices() if (!EFI_ERROR (Status)) { Status = gBS->ExitBootServices (gImageHandle, MapKey); if (EFI_ERROR (Status)) { FreePages (MemoryMap, Pages); MemoryMap = NULL; MemoryMapSize = 0; } } } } while (EFI_ERROR (Status)); //Clean and invalidate caches. WriteBackInvalidateDataCache(); InvalidateInstructionCache(); //Turning off Caches and MMU ArmDisableDataCache (); ArmDisableInstructionCache (); ArmDisableMmu (); }
/** Invalidate data & instruction caches. All APs execute this function in parallel. The BSP executes the function separately. @param[in,out] WorkSpace Pointer to the input/output argument workspace shared by all processors. **/ STATIC VOID EFIAPI ClearCache ( IN OUT VOID *WorkSpace ) { WriteBackInvalidateDataCache (); InvalidateInstructionCache (); }