Skip to content

Commit 590164e

Browse files
committed
Fix x86 FSP freestanding build regressions
1 parent 88befb6 commit 590164e

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

src/x86/ata.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,14 +457,19 @@ static int security_command_passphrase(int drv, uint8_t ata_cmd,
457457
struct hba_cmd_table *tbl;
458458
struct fis_reg_h2d *cmdfis;
459459
struct ata_drive *ata = &ATA_Drv[drv];
460+
size_t passphrase_len = 0;
460461
int ret;
461462
int slot = prepare_cmd_h2d_slot(drv, buffer,
462463
ATA_SECURITY_COMMAND_LEN, 1);
463464
memset(buffer, 0, ATA_SECURITY_COMMAND_LEN);
464465
if (master)
465466
buffer[0] = 0x1;
467+
while (passphrase_len < ATA_SECURITY_PASSWORD_LEN &&
468+
passphrase[passphrase_len] != '\0') {
469+
passphrase_len++;
470+
}
466471
memcpy(buffer + ATA_SECURITY_PASSWORD_OFFSET, passphrase,
467-
strnlen(passphrase, ATA_SECURITY_PASSWORD_LEN));
472+
passphrase_len);
468473
if (slot < 0) {
469474
return slot;
470475
}

src/x86/mptable.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
/* TGL mptable */
3434
static struct mptable _mptable = {
3535
.mpf = {
36-
.signature = "_MP_",
36+
.signature = {'_', 'M', 'P', '_'},
3737
.phy_addr = (int)MPTABLE_LOAD_BASE + sizeof(struct mp_float),
3838
.length = 1,
3939
.spec_rev = 0x4,
@@ -45,7 +45,7 @@ static struct mptable _mptable = {
4545
.feature5 = 0
4646
},
4747
.mpc_table = {
48-
.signature = MPC_SIGNATURE,
48+
.signature = {'P', 'C', 'M', 'P'},
4949
.base_table_len = sizeof(struct mp_conf_table_header) +
5050
sizeof(struct mp_conf_entry_processor) * MP_CPU_NUM_ENTRY +
5151
sizeof(struct mp_conf_entry_bus) * MP_BUS_NUM_ENTRY +
@@ -248,7 +248,7 @@ static struct mptable _mptable = {
248248
/* MPtables for qemu */
249249
struct mptable _mptable = {
250250
.mpf = {
251-
.signature = "_MP_",
251+
.signature = {'_', 'M', 'P', '_'},
252252
.phy_addr = (int)MPTABLE_LOAD_BASE + sizeof(struct mp_float),
253253
.length = 1,
254254
.spec_rev = 1,
@@ -260,7 +260,7 @@ struct mptable _mptable = {
260260
.feature5 = 0
261261
},
262262
.mpc_table = {
263-
.signature = MPC_SIGNATURE,
263+
.signature = {'P', 'C', 'M', 'P'},
264264
.base_table_len = sizeof(struct mp_conf_table_header) +
265265
sizeof(struct mp_conf_entry_processor) * MP_CPU_NUM_ENTRY +
266266
sizeof(struct mp_conf_entry_bus) * MP_BUS_NUM_ENTRY +

0 commit comments

Comments
 (0)