Skip to content

Commit

Permalink
hdata: Add "mpipl-boot" property to "dump" node
Browse files Browse the repository at this point in the history
During MPIPL boot, hostboot updates HDAT to indicate its MPIPL boot. Lets
add "mpipl-boot" property to device tree. So that kernel can detect its
MPIPL boot and create dump.

Device tree property:
  /ibm,opal/dump/mpipl-boot - Indicate kernel that its MPIPL boot

Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
[oliver: rebased]
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
  • Loading branch information
Vasant Hegde authored and oohal committed Aug 15, 2019
1 parent 4a669d0 commit 6326c71
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
43 changes: 43 additions & 0 deletions hdata/spira.c
Expand Up @@ -928,6 +928,46 @@ static void dt_init_secureboot_node(const struct iplparams_sysparams *sysparams)
dt_add_property_cells(node, "hw-key-hash-size", hw_key_hash_size);
}

static void opal_dump_add_mpipl_boot(const struct iplparams_iplparams *p)
{
u32 mdrt_cnt = spira.ntuples.mdump_res.act_cnt;
u32 mdrt_max_cnt = MDRT_TABLE_SIZE / sizeof(struct mdrt_table);
struct dt_node *dump_node;

dump_node = dt_find_by_path(opal_node, "dump");
if (!dump_node)
return;

/* Check boot params to detect MPIPL boot or not */
if (p->cec_ipl_maj_type != IPLPARAMS_MAJ_TYPE_REIPL)
return;

/*
* On FSP system we get minor type as post dump IPL and on BMC system
* we get platform reboot. Hence lets check for both values.
*/
if (p->cec_ipl_min_type != IPLPARAMS_MIN_TYPE_POST_DUMP &&
p->cec_ipl_min_type != IPLPARAMS_MIN_TYPE_PLAT_REBOOT) {
prlog(PR_NOTICE, "DUMP: Non MPIPL reboot "
"[minor type = 0x%x]\n", p->cec_ipl_min_type);
return;
}

if (p->cec_ipl_attrib != IPLPARAMS_ATTRIB_MEM_PRESERVE) {
prlog(PR_DEBUG, "DUMP: Memory not preserved\n");
return;
}

if (mdrt_cnt == 0 || mdrt_cnt >= mdrt_max_cnt) {
prlog(PR_DEBUG, "DUMP: Invalid MDRT count : %x\n", mdrt_cnt);
return;
}

prlog(PR_NOTICE, "DUMP: Dump found, MDRT count = 0x%x\n", mdrt_cnt);

dt_add_property(dump_node, "mpipl-boot", NULL, 0);
}

static void add_opal_dump_node(void)
{
u64 fw_load_area[4];
Expand Down Expand Up @@ -1088,6 +1128,9 @@ static void add_iplparams_ipl_params(const void *iplp, struct dt_node *node)
else
dt_add_property_strings(led_node, DT_PROPERTY_LED_MODE,
LED_MODE_GUIDING_LIGHT);

/* Populate opal dump result table */
opal_dump_add_mpipl_boot(p);
}

static void add_iplparams_serials(const void *iplp, struct dt_node *node)
Expand Down
4 changes: 4 additions & 0 deletions hdata/spira.h
Expand Up @@ -388,8 +388,12 @@ struct iplparams_iplparams {
#define IPLPARAMS_FSP_FW_IPL_SIDE_TEMP 0x01
uint8_t ipl_speed;
__be16 cec_ipl_attrib;
#define IPLPARAMS_ATTRIB_MEM_PRESERVE PPC_BIT16(2)
uint8_t cec_ipl_maj_type;
#define IPLPARAMS_MAJ_TYPE_REIPL 0x1
uint8_t cec_ipl_min_type;
#define IPLPARAMS_MIN_TYPE_POST_DUMP 0xc
#define IPLPARAMS_MIN_TYPE_PLAT_REBOOT 0xd
uint8_t os_ipl_mode;
uint8_t keylock_pos;
uint8_t lmb_size;
Expand Down

0 comments on commit 6326c71

Please sign in to comment.