EFI_DEBUG_STATUS DebuggerGo ( IN CHAR16 *CommandArg, IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate, IN EFI_EXCEPTION_TYPE ExceptionType, IN OUT EFI_SYSTEM_CONTEXT SystemContext ) /*++ Routine Description: DebuggerCommand - Go Arguments: CommandArg - The argument for this command DebuggerPrivate - EBC Debugger private data structure InterruptType - Interrupt type. SystemContext - EBC system context. Returns: EFI_DEBUG_BREAK - formal return value EFI_DEBUG_CONTINUE - something wrong --*/ { UINTN Address; CHAR16 *CommandStr; EFI_STATUS Status; // // Check argument // if (CommandArg != NULL) { if (EfiStriCmp (CommandArg, L"til") == 0) { CommandStr = StrGetNextTokenLine (L" "); if (CommandStr != NULL) { // // Enable GoTil break now // set BreakAddress, and set feature flag. // Status = Symboltoi (CommandStr, &Address); if (EFI_ERROR (Status)) { if (Status == EFI_NOT_FOUND) { Address = Xtoi(CommandStr); } else { // // Something wrong, let Symboltoi print error info. // EDBPrint (L"Command Argument error!\n"); return EFI_DEBUG_CONTINUE; } } DebuggerPrivate->GoTilContext.BreakAddress = Address; DebuggerPrivate->FeatureFlags |= EFI_DEBUG_FLAG_EBC_GT; } else { EDBPrint (L"Command Argument error!\n"); return EFI_DEBUG_CONTINUE; } } else { EDBPrint (L"Command Argument error!\n"); return EFI_DEBUG_CONTINUE; } } // // Done // return EFI_DEBUG_BREAK; }
/** * update the option rom Image. * @param Device the Pci Device option rom to be updated. * @return EFI_SUCCESS the Rom was updated successfully. */ EFI_STATUS WriteMaskBytes ( IN PCIDev *Device ) { UINTN Index; UINT32 MemoryAddress; UINT32 BaseAddress; UINT8 Offset; UINT8 Length; CHAR16 Buffer[MAX_STRING_LENGTH]; // //get the address offset. // Input ( L"Please input the Address Offset in this Pci configuration space (4 bytes alligned),such as 0x80\r\n", Buffer, MAX_STRING_LENGTH ); Print (L"\r\n"); for (Index = 0; Buffer[Index] == L' '; Index++) { ; } if (Buffer[Index] == L'\0') { return EFI_ABORTED; } Offset = (UINT8) Xtoi (&Buffer[Index]); Offset = (UINT8) (Offset & 0xfc); // //then get the Address length to be masked. // Input ( L"Please input the Address length to be masked (dividable by 4), such as 0x20\r\n", Buffer, MAX_STRING_LENGTH ); Print (L"\r\n"); for (Index = 0; Buffer[Index] == L' '; Index++) { ; } if (Buffer[Index] == L'\0') { return EFI_ABORTED; } Length = (UINT8) Xtoi (&Buffer[Index]); Length = (UINT8) (Length & 0xfc); BaseAddress = (UINT32)(NC_ROM_TOP_ADDRESS + NC_BYTES_PER_FUNCTION + Offset); for (MemoryAddress = BaseAddress; MemoryAddress < BaseAddress + Length; MemoryAddress += sizeof (UINT32)) { // //write mask address value. // WriteConfigDWord ( Device->RootBridgeIo, Device->BaseInfo.BusNum, Device->BaseInfo.DevNum, Device->BaseInfo.FuncNum, NC_MEMORY_ADDRESS_REG, MemoryAddress ); // //write mask data value to all 1's. // WriteConfigDWord ( Device->RootBridgeIo, Device->BaseInfo.BusNum, Device->BaseInfo.DevNum, Device->BaseInfo.FuncNum, NC_MEMORY_DATA_REG, 0xffffffff ); } // //done successfully // return EFI_SUCCESS; }
EFI_STATUS EdbGetMemoryAddressValue ( IN CHAR16 *CommandArg, IN UINTN *Address, IN UINT64 *Value ) /*++ Routine Description: Get memory address and value Arguments: CommandArg - The argument for this command Address - Memory Address Value - Memory Value Returns: EFI_SUCCESS - memory address and value are got EFI_INVALID_PARAMETER - something wrong --*/ { CHAR16 *CommandStr; UINTN MemAddress; EFI_STATUS Status; // // Get Address // CommandStr = CommandArg; if (CommandStr == NULL) { EDBPrint (L"Memory: Address error!\n"); return EFI_INVALID_PARAMETER; } Status = Symboltoi (CommandStr, &MemAddress); if (EFI_ERROR (Status)) { if (Status == EFI_NOT_FOUND) { MemAddress = Xtoi(CommandStr); } else { // // Something wrong, let Symboltoi print error info. // EDBPrint (L"Command Argument error!\n"); return EFI_INVALID_PARAMETER; } } *Address = MemAddress; // // Get Value // CommandStr = StrGetNextTokenLine (L" "); if (CommandStr == NULL) { EDBPrint (L"Memory: Value error!\n"); return EFI_INVALID_PARAMETER; } *Value = LXtoi(CommandStr); // // Done // return EFI_SUCCESS; }