s390/ipl: support NVMe IPL kernel parameters
Enable extracting of extra kernel command-line parameters from the NVMe IPL block passed by the firmware to the kernel at boot. Signed-off-by: Alexander Egorenkov <egorenar@linux.ibm.com> Reviewed-by: Vasily Gorbik <gor@linux.ibm.com> Reviewed-by: Philipp Rudo <prudo@linux.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
This commit is contained in:
parent
d70e38cb1d
commit
d9f12e48d0
|
@ -70,30 +70,44 @@ static size_t scpdata_length(const u8 *buf, size_t count)
|
||||||
static size_t ipl_block_get_ascii_scpdata(char *dest, size_t size,
|
static size_t ipl_block_get_ascii_scpdata(char *dest, size_t size,
|
||||||
const struct ipl_parameter_block *ipb)
|
const struct ipl_parameter_block *ipb)
|
||||||
{
|
{
|
||||||
size_t count;
|
const __u8 *scp_data;
|
||||||
size_t i;
|
__u32 scp_data_len;
|
||||||
int has_lowercase;
|
int has_lowercase;
|
||||||
|
size_t count = 0;
|
||||||
|
size_t i;
|
||||||
|
|
||||||
count = min(size - 1, scpdata_length(ipb->fcp.scp_data,
|
switch (ipb->pb0_hdr.pbt) {
|
||||||
ipb->fcp.scp_data_len));
|
case IPL_PBT_FCP:
|
||||||
|
scp_data_len = ipb->fcp.scp_data_len;
|
||||||
|
scp_data = ipb->fcp.scp_data;
|
||||||
|
break;
|
||||||
|
case IPL_PBT_NVME:
|
||||||
|
scp_data_len = ipb->nvme.scp_data_len;
|
||||||
|
scp_data = ipb->nvme.scp_data;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
count = min(size - 1, scpdata_length(scp_data, scp_data_len));
|
||||||
if (!count)
|
if (!count)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
has_lowercase = 0;
|
has_lowercase = 0;
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
if (!isascii(ipb->fcp.scp_data[i])) {
|
if (!isascii(scp_data[i])) {
|
||||||
count = 0;
|
count = 0;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (!has_lowercase && islower(ipb->fcp.scp_data[i]))
|
if (!has_lowercase && islower(scp_data[i]))
|
||||||
has_lowercase = 1;
|
has_lowercase = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (has_lowercase)
|
if (has_lowercase)
|
||||||
memcpy(dest, ipb->fcp.scp_data, count);
|
memcpy(dest, scp_data, count);
|
||||||
else
|
else
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
dest[i] = tolower(ipb->fcp.scp_data[i]);
|
dest[i] = tolower(scp_data[i]);
|
||||||
out:
|
out:
|
||||||
dest[count] = '\0';
|
dest[count] = '\0';
|
||||||
return count;
|
return count;
|
||||||
|
@ -115,6 +129,7 @@ static void append_ipl_block_parm(void)
|
||||||
parm, COMMAND_LINE_SIZE - len - 1, &ipl_block);
|
parm, COMMAND_LINE_SIZE - len - 1, &ipl_block);
|
||||||
break;
|
break;
|
||||||
case IPL_PBT_FCP:
|
case IPL_PBT_FCP:
|
||||||
|
case IPL_PBT_NVME:
|
||||||
rc = ipl_block_get_ascii_scpdata(
|
rc = ipl_block_get_ascii_scpdata(
|
||||||
parm, COMMAND_LINE_SIZE - len - 1, &ipl_block);
|
parm, COMMAND_LINE_SIZE - len - 1, &ipl_block);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue