diff --git a/drivers/firmware/efi/libstub/efi-stub.c b/drivers/firmware/efi/libstub/efi-stub.c index d824d954da268..b969c25d6d150 100644 --- a/drivers/firmware/efi/libstub/efi-stub.c +++ b/drivers/firmware/efi/libstub/efi-stub.c @@ -177,6 +177,7 @@ efi_status_t __efiapi efi_pe_entry(efi_handle_t handle, } } */ + uint8_t *base = (uint8_t*) 0x6000d000; /* * Figure out on which Windows RT device is booted. @@ -359,10 +360,39 @@ efi_status_t __efiapi efi_pe_entry(efi_handle_t handle, } install_memreserve_table(); +/* + for (i = 0; i < 0x1000; i++) { + if (i % 16 == 0) { + tegra_uart_print("\n"); + tegra_uart_print("%02x: ", i); + } + tegra_uart_print("%02x ", *(base+i)); + } +*/ +/** + * @brief lock Vbus GPIO + * locks the VBus GPIO so ExitBootService call can't turn it off. + */ +/* + uint16_t *gpio = (uint16_t*) 0x6000d208; + uint16_t cur_val = *gpio; + cur_val = cur_val | 0x200; + *gpio = cur_val; +*/ status = allocate_new_fdt_and_exit_boot(handle, &fdt_addr, initrd_addr, initrd_size, cmdline_ptr, fdt_addr, fdt_size); +/* + for (i = 0; i < 0x1000; i++) { + if (i % 16 == 0) { + tegra_uart_print("\n"); + tegra_uart_print("%02x: ", i); + } + + tegra_uart_print("%02x ", *(base+i)); + } +*/ if (status != EFI_SUCCESS) goto fail_free_initrd; diff --git a/drivers/firmware/efi/libstub/efistub.h b/drivers/firmware/efi/libstub/efistub.h index 7830f720e0ece..c59ef33127088 100644 --- a/drivers/firmware/efi/libstub/efistub.h +++ b/drivers/firmware/efi/libstub/efistub.h @@ -907,7 +907,7 @@ enum winrt_device_names winrt_setup(void); /** * Tegra specific UART stuff */ -void tegra_uart_print(const char *string); +void tegra_uart_print(const char *string, ...); void tegra_uart_init(void); /** diff --git a/drivers/firmware/efi/libstub/tegra_uart.c b/drivers/firmware/efi/libstub/tegra_uart.c index 9bd04e022888e..0ae174a71d0bd 100644 --- a/drivers/firmware/efi/libstub/tegra_uart.c +++ b/drivers/firmware/efi/libstub/tegra_uart.c @@ -98,28 +98,34 @@ void tegra_uart_init() tegra_uart_print("hi from tegra_uart_init :)\n"); } -void tegra_uart_print(const char *string) +void tegra_uart_print(const char *fmt, ...) { + char printf_buf[256]; + va_list args; + int printed_size; + int i; + /* If uart isn't setup (yet); send nothing */ if (reg_read(PMC_BASE, APBDEV_PMC_SCRATCH42_0) != MAGIC_VALUE) return; + va_start(args, fmt); + printed_size = vsnprintf(printf_buf, sizeof(printf_buf), fmt, args); + va_end(args); + /* send all characters until NULL to uart-N */ - while (*string) { + for (i = 0; i < printed_size; i++) { /* put the char into the tx fifo */ - if (*string == '\n') { + if (printf_buf[i] == '\n') { reg_write(UART_BASE, UART_THR_DLAB, '\r'); while (!((reg_read(UART_BASE, UART_LSR) >> 5) & 0x01)) ; } - reg_write(UART_BASE, UART_THR_DLAB, (char) *string); + reg_write(UART_BASE, UART_THR_DLAB, (char) printf_buf[i]); /* wait for tx fifo to clear */ while (!((reg_read(UART_BASE, UART_LSR) >> 5) & 0x01)) ; - - /* move on to next char */ - ++string; } }