Bryant Ou has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/45410 )
Change subject: mb/ocp/deltalake: Insert IO port in linux command line ......................................................................
mb/ocp/deltalake: Insert IO port in linux command line
Search "uart8250,io," string in CONFIG_LINUX_COMMAND_LINE, then insert uart base address which defined in VPD.
Tested=On OCP Delta Lake, payload use correct uart base address to output messages via VPD variable.
Signed-off-by: Bryant Ou Bryant.Ou.Q@gmail.com Change-Id: I8747a23c7246aabe8c01ad5be668e1672b586f2c --- M src/mainboard/ocp/deltalake/Kconfig M src/mainboard/ocp/deltalake/ramstage.c 2 files changed, 76 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/10/45410/1
diff --git a/src/mainboard/ocp/deltalake/Kconfig b/src/mainboard/ocp/deltalake/Kconfig index 5671664..0ab8bbb 100644 --- a/src/mainboard/ocp/deltalake/Kconfig +++ b/src/mainboard/ocp/deltalake/Kconfig @@ -54,4 +54,10 @@ bool default y
+config LINUX_COMMAND_LINE_OVERRIDE + bool + default y + help + Override linux command line by using VPD. + endif # BOARD_OCP_DELTALAKE diff --git a/src/mainboard/ocp/deltalake/ramstage.c b/src/mainboard/ocp/deltalake/ramstage.c index e00f1c3..115f7d3 100644 --- a/src/mainboard/ocp/deltalake/ramstage.c +++ b/src/mainboard/ocp/deltalake/ramstage.c @@ -10,6 +10,7 @@ #include <soc/ramstage.h> #include <soc/soc_util.h> #include <stdio.h> +#include <stdlib.h> #include <string.h> #include <smbios.h> #include <device/pci_def.h> @@ -18,10 +19,13 @@ #include <hob_iiouds.h> #include <hob_memmap.h> #include <cpxsp_dl_gpio.h> - +#include <program_loading.h> +#include <drivers/vpd/vpd.h> +#include "vpd.h" #include "ipmi.h"
#define SLOT_ID_LEN 2 +#define COMMAND_LINE_LOC 0x91000
extern struct fru_info_str fru_strings; static char slot_id_str[SLOT_ID_LEN]; @@ -285,3 +289,68 @@ }
BOOT_STATE_INIT_ENTRY(BS_PAYLOAD_BOOT, BS_ON_ENTRY, pull_post_complete_pin, NULL); + +#if (CONFIG(LINUX_COMMAND_LINE_OVERRIDE)) +void platform_segment_loaded(uintptr_t start, size_t size, int flags) +{ + char *port; + char *dupstr = strdup((char*)start); + const char s[] = {"uart8250,io,"}; + char *new = NULL; + char *p; + char *slice[10]; + char *found; + char *pre; + char *t1; + char *t2; + int count = 0; + int i; + int c; + int len; + int pos; + + /* Add IO port into linux command line */ + if (start == COMMAND_LINE_LOC) { + port = malloc(VPD_LEN); + if (vpd_gets(UART_IOPORT, port, VPD_LEN, VPD_RW_THEN_RO)) { + port = strconcat(port, ","); + } else { + printk(BIOS_ERR, "UART_IOPORT is not found in VPD\n"); + port = strconcat(UART_IOPORT_DEFAULT, ","); + } + strcpy(new, ""); + for (p = strtok(dupstr, " "); p; p = strtok(NULL, " ")) { + slice[count] = p; + count++; + } + for (i = 0; i < count; i++) { + len = strlen(slice[i]); + found = strstr(slice[i], s); + if (found != NULL) { + pos = found - slice[i] + strlen(s); + t1 = malloc(pos); + for (c = 0; c < pos; c++) { + *(t1 + c) = *(slice[i] + c); + } + *(t1 + c) = '\0'; + pre = strconcat(t1, port); + free(t1); + t2 = malloc(len - pos + 2); + for (c = 0; c < (len - pos + 1); c++) { + *(t2 + c) = *((slice[i] + pos) + c); + } + *(t2 + c) = '\0'; + pre = strconcat(pre, t2); + free(t2); + slice[i] = strdup(pre); + } + new = strconcat(new, slice[i]); + if (i < count - 1) + new = strconcat(new, " "); + } + free(port); + memset((uint8_t*)start, 0, size); + memcpy((uint8_t*)start, new, strlen(new)); + } +} +#endif
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/45410 )
Change subject: mb/ocp/deltalake: Insert IO port in linux command line ......................................................................
Patch Set 1:
(23 comments)
https://review.coreboot.org/c/coreboot/+/45410/1/src/mainboard/ocp/deltalake... File src/mainboard/ocp/deltalake/ramstage.c:
https://review.coreboot.org/c/coreboot/+/45410/1/src/mainboard/ocp/deltalake... PS1, Line 297: char *dupstr = strdup((char*)start); "(foo*)" should be "(foo *)"
https://review.coreboot.org/c/coreboot/+/45410/1/src/mainboard/ocp/deltalake... PS1, Line 327: len = strlen(slice[i]); code indent should use tabs where possible
https://review.coreboot.org/c/coreboot/+/45410/1/src/mainboard/ocp/deltalake... PS1, Line 327: len = strlen(slice[i]); please, no space before tabs
https://review.coreboot.org/c/coreboot/+/45410/1/src/mainboard/ocp/deltalake... PS1, Line 327: len = strlen(slice[i]); please, no spaces at the start of a line
https://review.coreboot.org/c/coreboot/+/45410/1/src/mainboard/ocp/deltalake... PS1, Line 328: found = strstr(slice[i], s); code indent should use tabs where possible
https://review.coreboot.org/c/coreboot/+/45410/1/src/mainboard/ocp/deltalake... PS1, Line 328: found = strstr(slice[i], s); please, no space before tabs
https://review.coreboot.org/c/coreboot/+/45410/1/src/mainboard/ocp/deltalake... PS1, Line 328: found = strstr(slice[i], s); please, no spaces at the start of a line
https://review.coreboot.org/c/coreboot/+/45410/1/src/mainboard/ocp/deltalake... PS1, Line 332: for (c = 0; c < pos; c++) { braces {} are not necessary for single statement blocks
https://review.coreboot.org/c/coreboot/+/45410/1/src/mainboard/ocp/deltalake... PS1, Line 339: for (c = 0; c < (len - pos + 1); c++) { braces {} are not necessary for single statement blocks
https://review.coreboot.org/c/coreboot/+/45410/1/src/mainboard/ocp/deltalake... PS1, Line 340: *(t2 + c) = *((slice[i] + pos) + c); code indent should use tabs where possible
https://review.coreboot.org/c/coreboot/+/45410/1/src/mainboard/ocp/deltalake... PS1, Line 340: *(t2 + c) = *((slice[i] + pos) + c); please, no space before tabs
https://review.coreboot.org/c/coreboot/+/45410/1/src/mainboard/ocp/deltalake... PS1, Line 340: *(t2 + c) = *((slice[i] + pos) + c); please, no spaces at the start of a line
https://review.coreboot.org/c/coreboot/+/45410/1/src/mainboard/ocp/deltalake... PS1, Line 341: } code indent should use tabs where possible
https://review.coreboot.org/c/coreboot/+/45410/1/src/mainboard/ocp/deltalake... PS1, Line 341: } please, no space before tabs
https://review.coreboot.org/c/coreboot/+/45410/1/src/mainboard/ocp/deltalake... PS1, Line 341: } please, no spaces at the start of a line
https://review.coreboot.org/c/coreboot/+/45410/1/src/mainboard/ocp/deltalake... PS1, Line 342: *(t2 + c) = '\0'; code indent should use tabs where possible
https://review.coreboot.org/c/coreboot/+/45410/1/src/mainboard/ocp/deltalake... PS1, Line 342: *(t2 + c) = '\0'; please, no space before tabs
https://review.coreboot.org/c/coreboot/+/45410/1/src/mainboard/ocp/deltalake... PS1, Line 342: *(t2 + c) = '\0'; please, no spaces at the start of a line
https://review.coreboot.org/c/coreboot/+/45410/1/src/mainboard/ocp/deltalake... PS1, Line 350: } code indent should use tabs where possible
https://review.coreboot.org/c/coreboot/+/45410/1/src/mainboard/ocp/deltalake... PS1, Line 350: } please, no space before tabs
https://review.coreboot.org/c/coreboot/+/45410/1/src/mainboard/ocp/deltalake... PS1, Line 350: } please, no spaces at the start of a line
https://review.coreboot.org/c/coreboot/+/45410/1/src/mainboard/ocp/deltalake... PS1, Line 352: memset((uint8_t*)start, 0, size); "(foo*)" should be "(foo *)"
https://review.coreboot.org/c/coreboot/+/45410/1/src/mainboard/ocp/deltalake... PS1, Line 353: memcpy((uint8_t*)start, new, strlen(new)); "(foo*)" should be "(foo *)"
Bryant Ou has uploaded a new patch set (#2). ( https://review.coreboot.org/c/coreboot/+/45410 )
Change subject: mb/ocp/deltalake: Insert IO port in linux command line ......................................................................
mb/ocp/deltalake: Insert IO port in linux command line
Search "uart8250,io," string in CONFIG_LINUX_COMMAND_LINE, then insert uart base address which defined in VPD.
Tested=On OCP Delta Lake, payload use correct uart base address to output messages via VPD variable.
Signed-off-by: Bryant Ou Bryant.Ou.Q@gmail.com Change-Id: I8747a23c7246aabe8c01ad5be668e1672b586f2c --- M src/mainboard/ocp/deltalake/Kconfig M src/mainboard/ocp/deltalake/ramstage.c 2 files changed, 74 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/10/45410/2
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/45410 )
Change subject: mb/ocp/deltalake: Insert IO port in linux command line ......................................................................
Patch Set 2:
(4 comments)
I’d do this unconditionally, when VPD is selected.
https://review.coreboot.org/c/coreboot/+/45410/2//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/45410/2//COMMIT_MSG@12 PS2, Line 12: use uses
https://review.coreboot.org/c/coreboot/+/45410/2//COMMIT_MSG@12 PS2, Line 12: payload Linux payload?
https://review.coreboot.org/c/coreboot/+/45410/2/src/mainboard/ocp/deltalake... File src/mainboard/ocp/deltalake/Kconfig:
https://review.coreboot.org/c/coreboot/+/45410/2/src/mainboard/ocp/deltalake... PS2, Line 57: config LINUX_COMMAND_LINE_OVERRIDE The name needs to be namespaced. I’d prefer it in the Linux payload section though.
https://review.coreboot.org/c/coreboot/+/45410/2/src/mainboard/ocp/deltalake... PS2, Line 61: Override linux command line by using VPD. Please elaborate.
Jonathan Zhang has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/45410 )
Change subject: mb/ocp/deltalake: Insert IO port in linux command line ......................................................................
Patch Set 2: Code-Review-1
This will be superceded by [CB:47055].
Bryant Ou has abandoned this change. ( https://review.coreboot.org/c/coreboot/+/45410 )
Change subject: mb/ocp/deltalake: Insert IO port in linux command line ......................................................................
Abandoned