Exemplo n.º 1
0
void PSPProgBar3Msr(void *Buffer)
{
	u32 Bar3Addr;
	u64 Tmp64;
	/* Get Bar3 Addr */
	Bar3Addr = PspLibPciReadPspConfig(0x20);
	Tmp64 = Bar3Addr;
	printk(BIOS_DEBUG, "Bar3=%llx\n", Tmp64);
	LibAmdMsrWrite(0xC00110A2, &Tmp64, NULL);
	LibAmdMsrRead(0xC00110A2, &Tmp64, NULL);
}
Exemplo n.º 2
0
/// @todo Change function to some status type and appropriate status
/// Also add code in caller to handle this change
BOOLEAN
SendPspCommand (
  IN       VOID       *MboxBuffer,
  IN       MBOX_COMMAND       Cmd
  )
{
  UINT32     Command;
  BOOLEAN    Status;
  PSP_MBOX   *PspMbox;

  Status = TRUE;

  PSP_DEBUG ("Psp.SendC2PCMD [0x%x]\n", Cmd);

  // Get PspMbox location. fail if not found
  if (EFI_ERROR (GetPspMboxLocation (&PspMbox))) {
    PSP_DEBUG ("GetPspMboxLocation Error\n");
    ASSERT (FALSE); // Assertion in the debug build
    return (FALSE);
  }

  // The Command register may be disable by PSP driver when entering D3.
  // Save Command register
  Command = PspLibPciReadPspConfig (PSP_PCIE_CMD_REG);
   //Enable BusMaster & MemAccess
  PspLibPciWritePspConfig (PSP_PCIE_CMD_REG, Command | 0x6);

  if (PspMbox->MboxSts.Halt) {
    PSP_DEBUG ("MboxSts Halt\n");
    ASSERT (FALSE); // Assertion in the debug build
    //Restore Command register
    PspLibPciWritePspConfig (PSP_PCIE_CMD_REG, Command);
    return (FALSE);
  }

  if (PspMbox->MboxSts.Recovery) {
    PSP_DEBUG ("Recovery Flag detected, ignore the command\n");
    //Restore Command register
    PspLibPciWritePspConfig (PSP_PCIE_CMD_REG, Command);
    return (FALSE);
  }

  // Wait till mailbox is initialized or done processing command
  /// Wait for PSP to be ready. @todo add timeout
  while ( (!PspMbox->MboxSts.MboxInitialized) ||  (PspMbox->MboxCmd)) {
    ;
  }

  // Now send the command
  PspMbox->Buffer = (MBOX_BUFFER *)MboxBuffer;
  PspMbox->MboxCmd = Cmd;


  /// Wait for PSP to be done or reflect error @todo add timeout
  while (PspMbox->MboxCmd) {
    ;
  }

  // error vs. terminated
  if (PspMbox->MboxSts.Error || PspMbox->MboxSts.Terminated) {
    PSP_DEBUG ("MboxSts Error\n");
    Status = FALSE;
  }
  //Restore Command register
  PspLibPciWritePspConfig (PSP_PCIE_CMD_REG, Command);
  return Status;

}