soc/amd/common/block/psp: move psp_load_named_blob to psp_gen1.c
This function is only needed and valid for the 1st generation PSP interface used on stoneyridge. BUG=b:153677737 Change-Id: Ia1be09c32271fe9480a0acbe324c4a45d8620882 Signed-off-by: Felix Held <felix-coreboot@felixheld.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/40360 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Raul Rangel <rrangel@chromium.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:
parent
609b7fb303
commit
1ad73926f2
@ -3,8 +3,6 @@
|
|||||||
|
|
||||||
#include <device/mmio.h>
|
#include <device/mmio.h>
|
||||||
#include <cpu/x86/msr.h>
|
#include <cpu/x86/msr.h>
|
||||||
#include <cbfs.h>
|
|
||||||
#include <region_file.h>
|
|
||||||
#include <timer.h>
|
#include <timer.h>
|
||||||
#include <bootstate.h>
|
#include <bootstate.h>
|
||||||
#include <console/console.h>
|
#include <console/console.h>
|
||||||
@ -50,7 +48,7 @@ static u32 rd_resp_sts(struct mbox_default_buffer *buffer)
|
|||||||
* Print meaningful status to the console. Caller only passes a pointer to a
|
* Print meaningful status to the console. Caller only passes a pointer to a
|
||||||
* buffer if it's expected to contain its own status.
|
* buffer if it's expected to contain its own status.
|
||||||
*/
|
*/
|
||||||
static void print_cmd_status(int cmd_status, struct mbox_default_buffer *buffer)
|
void psp_print_cmd_status(int cmd_status, struct mbox_default_buffer *buffer)
|
||||||
{
|
{
|
||||||
if (buffer && rd_resp_sts(buffer))
|
if (buffer && rd_resp_sts(buffer))
|
||||||
printk(BIOS_DEBUG, "buffer status=0x%x ", rd_resp_sts(buffer));
|
printk(BIOS_DEBUG, "buffer status=0x%x ", rd_resp_sts(buffer));
|
||||||
@ -79,7 +77,7 @@ int psp_notify_dram(void)
|
|||||||
cmd_status = send_psp_command(MBOX_BIOS_CMD_DRAM_INFO, &buffer);
|
cmd_status = send_psp_command(MBOX_BIOS_CMD_DRAM_INFO, &buffer);
|
||||||
|
|
||||||
/* buffer's status shouldn't change but report it if it does */
|
/* buffer's status shouldn't change but report it if it does */
|
||||||
print_cmd_status(cmd_status, &buffer);
|
psp_print_cmd_status(cmd_status, &buffer);
|
||||||
|
|
||||||
return cmd_status;
|
return cmd_status;
|
||||||
}
|
}
|
||||||
@ -103,58 +101,7 @@ static void psp_notify_boot_done(void *unused)
|
|||||||
cmd_status = send_psp_command(MBOX_BIOS_CMD_BOOT_DONE, &buffer);
|
cmd_status = send_psp_command(MBOX_BIOS_CMD_BOOT_DONE, &buffer);
|
||||||
|
|
||||||
/* buffer's status shouldn't change but report it if it does */
|
/* buffer's status shouldn't change but report it if it does */
|
||||||
print_cmd_status(cmd_status, &buffer);
|
psp_print_cmd_status(cmd_status, &buffer);
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Tell the PSP to load a firmware blob from a location in the BIOS image.
|
|
||||||
*/
|
|
||||||
int psp_load_named_blob(enum psp_blob_type type, const char *name)
|
|
||||||
{
|
|
||||||
int cmd_status;
|
|
||||||
u32 command;
|
|
||||||
void *blob;
|
|
||||||
struct cbfsf cbfs_file;
|
|
||||||
struct region_device rdev;
|
|
||||||
|
|
||||||
switch (type) {
|
|
||||||
case BLOB_SMU_FW:
|
|
||||||
command = MBOX_BIOS_CMD_SMU_FW;
|
|
||||||
break;
|
|
||||||
case BLOB_SMU_FW2:
|
|
||||||
command = MBOX_BIOS_CMD_SMU_FW2;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
printk(BIOS_ERR, "BUG: Invalid PSP blob type %x\n", type);
|
|
||||||
return -PSPSTS_INVALID_BLOB;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* type can only be BLOB_SMU_FW or BLOB_SMU_FW2 here, so don't re-check for this */
|
|
||||||
if (!CONFIG(SOC_AMD_PSP_SELECTABLE_SMU_FW)) {
|
|
||||||
printk(BIOS_ERR, "BUG: Selectable firmware is not supported\n");
|
|
||||||
return -PSPSTS_UNSUPPORTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cbfs_boot_locate(&cbfs_file, name, NULL)) {
|
|
||||||
printk(BIOS_ERR, "BUG: Cannot locate blob for PSP loading\n");
|
|
||||||
return -PSPSTS_INVALID_NAME;
|
|
||||||
}
|
|
||||||
|
|
||||||
cbfs_file_data(&rdev, &cbfs_file);
|
|
||||||
blob = rdev_mmap_full(&rdev);
|
|
||||||
if (!blob) {
|
|
||||||
printk(BIOS_ERR, "BUG: Cannot map blob for PSP loading\n");
|
|
||||||
return -PSPSTS_INVALID_NAME;
|
|
||||||
}
|
|
||||||
|
|
||||||
printk(BIOS_DEBUG, "PSP: Load blob type %x from @%p... ", type, blob);
|
|
||||||
|
|
||||||
/* Blob commands use the buffer registers as data, not pointer to buf */
|
|
||||||
cmd_status = send_psp_command(command, blob);
|
|
||||||
print_cmd_status(cmd_status, NULL);
|
|
||||||
|
|
||||||
rdev_munmap(&rdev, blob);
|
|
||||||
return cmd_status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOT_STATE_INIT_ENTRY(BS_PAYLOAD_BOOT, BS_ON_ENTRY,
|
BOOT_STATE_INIT_ENTRY(BS_PAYLOAD_BOOT, BS_ON_ENTRY,
|
||||||
|
@ -89,6 +89,8 @@ struct mbox_cmd_sx_info_buffer {
|
|||||||
#define PSP_INIT_TIMEOUT 10000 /* 10 seconds */
|
#define PSP_INIT_TIMEOUT 10000 /* 10 seconds */
|
||||||
#define PSP_CMD_TIMEOUT 1000 /* 1 second */
|
#define PSP_CMD_TIMEOUT 1000 /* 1 second */
|
||||||
|
|
||||||
|
void psp_print_cmd_status(int cmd_status, struct mbox_default_buffer *buffer);
|
||||||
|
|
||||||
/* This command needs to be implemented by the generation specific code. */
|
/* This command needs to be implemented by the generation specific code. */
|
||||||
int send_psp_command(u32 command, void *buffer);
|
int send_psp_command(u32 command, void *buffer);
|
||||||
|
|
||||||
|
@ -2,8 +2,11 @@
|
|||||||
/* This file is part of the coreboot project. */
|
/* This file is part of the coreboot project. */
|
||||||
|
|
||||||
#include <device/mmio.h>
|
#include <device/mmio.h>
|
||||||
|
#include <cbfs.h>
|
||||||
|
#include <region_file.h>
|
||||||
#include <timer.h>
|
#include <timer.h>
|
||||||
#include <bootstate.h>
|
#include <bootstate.h>
|
||||||
|
#include <console/console.h>
|
||||||
#include <amdblocks/psp.h>
|
#include <amdblocks/psp.h>
|
||||||
#include <soc/iomap.h>
|
#include <soc/iomap.h>
|
||||||
#include <soc/northbridge.h>
|
#include <soc/northbridge.h>
|
||||||
@ -91,3 +94,54 @@ int send_psp_command(u32 command, void *buffer)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Tell the PSP to load a firmware blob from a location in the BIOS image.
|
||||||
|
*/
|
||||||
|
int psp_load_named_blob(enum psp_blob_type type, const char *name)
|
||||||
|
{
|
||||||
|
int cmd_status;
|
||||||
|
u32 command;
|
||||||
|
void *blob;
|
||||||
|
struct cbfsf cbfs_file;
|
||||||
|
struct region_device rdev;
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case BLOB_SMU_FW:
|
||||||
|
command = MBOX_BIOS_CMD_SMU_FW;
|
||||||
|
break;
|
||||||
|
case BLOB_SMU_FW2:
|
||||||
|
command = MBOX_BIOS_CMD_SMU_FW2;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
printk(BIOS_ERR, "BUG: Invalid PSP blob type %x\n", type);
|
||||||
|
return -PSPSTS_INVALID_BLOB;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* type can only be BLOB_SMU_FW or BLOB_SMU_FW2 here, so don't re-check for this */
|
||||||
|
if (!CONFIG(SOC_AMD_PSP_SELECTABLE_SMU_FW)) {
|
||||||
|
printk(BIOS_ERR, "BUG: Selectable firmware is not supported\n");
|
||||||
|
return -PSPSTS_UNSUPPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cbfs_boot_locate(&cbfs_file, name, NULL)) {
|
||||||
|
printk(BIOS_ERR, "BUG: Cannot locate blob for PSP loading\n");
|
||||||
|
return -PSPSTS_INVALID_NAME;
|
||||||
|
}
|
||||||
|
|
||||||
|
cbfs_file_data(&rdev, &cbfs_file);
|
||||||
|
blob = rdev_mmap_full(&rdev);
|
||||||
|
if (!blob) {
|
||||||
|
printk(BIOS_ERR, "BUG: Cannot map blob for PSP loading\n");
|
||||||
|
return -PSPSTS_INVALID_NAME;
|
||||||
|
}
|
||||||
|
|
||||||
|
printk(BIOS_DEBUG, "PSP: Load blob type %x from @%p... ", type, blob);
|
||||||
|
|
||||||
|
/* Blob commands use the buffer registers as data, not pointer to buf */
|
||||||
|
cmd_status = send_psp_command(command, blob);
|
||||||
|
psp_print_cmd_status(cmd_status, NULL);
|
||||||
|
|
||||||
|
rdev_munmap(&rdev, blob);
|
||||||
|
return cmd_status;
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user