diff options
author | Tom Rini <trini@konsulko.com> | 2020-11-06 08:41:49 -0500 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2020-11-06 09:46:43 -0500 |
commit | d062c1344cefb6c368b96efea4c2a20e63657b8d (patch) | |
tree | 56dcc373217bbcb248c35f7253c9478c1ba7e715 /arch/x86/lib | |
parent | 71d3fa7efa4fc07e6f161c742397ddbe4466c631 (diff) | |
parent | e4f8e543f1a905857a753a1d411997a81f4f52aa (diff) | |
download | u-boot-d062c1344cefb6c368b96efea4c2a20e63657b8d.tar.gz |
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-x86
- Add a new SMBIOS parser and enable it when booting from coreboot
- Fix up various driver names to avoid dtoc warnings
- Fully enable ACPI support on Google Chromebook Coral
- Add a way to set SMBIOS properties using the devicetree
- Update existing boards to use devicetree for SMBIOS using a new
default sysinfo driver
Diffstat (limited to 'arch/x86/lib')
-rw-r--r-- | arch/x86/lib/acpi_nhlt.c | 19 | ||||
-rw-r--r-- | arch/x86/lib/acpi_table.c | 78 | ||||
-rw-r--r-- | arch/x86/lib/fsp/fsp_dram.c | 35 | ||||
-rw-r--r-- | arch/x86/lib/fsp/fsp_graphics.c | 2 | ||||
-rw-r--r-- | arch/x86/lib/fsp2/fsp_dram.c | 8 | ||||
-rw-r--r-- | arch/x86/lib/interrupts.c | 3 | ||||
-rw-r--r-- | arch/x86/lib/tables.c | 88 | ||||
-rw-r--r-- | arch/x86/lib/tpl.c | 2 | ||||
-rw-r--r-- | arch/x86/lib/zimage.c | 26 |
9 files changed, 187 insertions, 74 deletions
diff --git a/arch/x86/lib/acpi_nhlt.c b/arch/x86/lib/acpi_nhlt.c index c64dd9c008..6c8cd83e12 100644 --- a/arch/x86/lib/acpi_nhlt.c +++ b/arch/x86/lib/acpi_nhlt.c @@ -68,6 +68,7 @@ struct nhlt_endpoint *nhlt_add_endpoint(struct nhlt *nhlt, int link_type, endp->device_type = device_type; endp->direction = dir; endp->virtual_bus_id = DEFAULT_VIRTUAL_BUS_ID; + endp->num_formats = 0; nhlt->num_endpoints++; @@ -285,25 +286,26 @@ static void nhlt_free_resources(struct nhlt *nhlt) } struct cursor { + u8 *start; u8 *buf; }; static void ser8(struct cursor *cur, uint val) { *cur->buf = val; - cur->buf += sizeof(val); + cur->buf += sizeof(u8); } static void ser16(struct cursor *cur, uint val) { put_unaligned_le16(val, cur->buf); - cur->buf += sizeof(val); + cur->buf += sizeof(u16); } static void ser32(struct cursor *cur, uint val) { put_unaligned_le32(val, cur->buf); - cur->buf += sizeof(val); + cur->buf += sizeof(u32); } static void serblob(struct cursor *cur, void *from, size_t sz) @@ -315,12 +317,14 @@ static void serblob(struct cursor *cur, void *from, size_t sz) static void serialise_specific_config(struct nhlt_specific_config *cfg, struct cursor *cur) { + log_debug("%zx\n", cur->buf - cur->start); ser32(cur, cfg->size); serblob(cur, cfg->capabilities, cfg->size); } static void serialise_waveform(struct nhlt_waveform *wave, struct cursor *cur) { + log_debug("%zx\n", cur->buf - cur->start); ser16(cur, wave->tag); ser16(cur, wave->num_channels); ser32(cur, wave->samples_per_second); @@ -338,6 +342,7 @@ static void serialise_waveform(struct nhlt_waveform *wave, struct cursor *cur) static void serialise_format(struct nhlt_format *fmt, struct cursor *cur) { + log_debug("%zx\n", cur->buf - cur->start); serialise_waveform(&fmt->waveform, cur); serialise_specific_config(&fmt->config, cur); } @@ -346,6 +351,7 @@ static void serialise_endpoint(struct nhlt_endpoint *endp, struct cursor *cur) { int i; + log_debug("%zx\n", cur->buf - cur->start); ser32(cur, endp->length); ser8(cur, endp->link_type); ser8(cur, endp->instance_id); @@ -384,13 +390,13 @@ int nhlt_serialise_oem_overrides(struct acpi_ctx *ctx, struct nhlt *nhlt, size_t oem_table_id_len; int ret; - log_info("ACPI: * NHLT\n"); + log_debug("ACPI: * NHLT\n"); sz = nhlt_current_size(nhlt); /* Create header */ header = (void *)ctx->current; memset(header, '\0', sizeof(struct acpi_table_header)); - acpi_fill_header(header, "NHLT"); + memcpy(header->signature, "NHLT", 4); header->length = sz; header->revision = acpi_get_table_revision(ACPITAB_NHLT); @@ -403,12 +409,15 @@ int nhlt_serialise_oem_overrides(struct acpi_ctx *ctx, struct nhlt *nhlt, memcpy(header->oem_table_id, oem_table_id, oem_table_id_len); } header->oem_revision = oem_revision; + memcpy(header->aslc_id, ASLC_ID, 4); cur.buf = (void *)(header + 1); + cur.start = (void *)header; nhlt_serialise_endpoints(nhlt, &cur); header->checksum = table_compute_checksum(header, sz); nhlt_free_resources(nhlt); + assert(cur.buf - cur.start == sz); ret = acpi_add_table(ctx, ctx->current); if (ret) diff --git a/arch/x86/lib/acpi_table.c b/arch/x86/lib/acpi_table.c index 6d405b09fd..4fd8dc8ad9 100644 --- a/arch/x86/lib/acpi_table.c +++ b/arch/x86/lib/acpi_table.c @@ -470,8 +470,9 @@ static void acpi_create_spcr(struct acpi_spcr *spcr) header->checksum = table_compute_checksum((void *)spcr, header->length); } -void acpi_create_ssdt(struct acpi_ctx *ctx, struct acpi_table_header *ssdt, - const char *oem_table_id) +static int acpi_create_ssdt(struct acpi_ctx *ctx, + struct acpi_table_header *ssdt, + const char *oem_table_id) { memset((void *)ssdt, '\0', sizeof(struct acpi_table_header)); @@ -484,9 +485,19 @@ void acpi_create_ssdt(struct acpi_ctx *ctx, struct acpi_table_header *ssdt, acpi_fill_ssdt(ctx); - /* (Re)calculate length and checksum. */ + /* (Re)calculate length and checksum */ ssdt->length = ctx->current - (void *)ssdt; ssdt->checksum = table_compute_checksum((void *)ssdt, ssdt->length); + log_debug("SSDT at %p, length %x\n", ssdt, ssdt->length); + + /* Drop the table if it is empty */ + if (ssdt->length == sizeof(struct acpi_table_header)) { + ctx->current = ssdt; + return -ENOENT; + } + acpi_align(ctx); + + return 0; } /* @@ -494,7 +505,8 @@ void acpi_create_ssdt(struct acpi_ctx *ctx, struct acpi_table_header *ssdt, */ ulong write_acpi_tables(ulong start_addr) { - struct acpi_ctx sctx, *ctx = &sctx; + const int thl = sizeof(struct acpi_table_header); + struct acpi_ctx *ctx; struct acpi_facs *facs; struct acpi_table_header *dsdt; struct acpi_fadt *fadt; @@ -505,14 +517,21 @@ ulong write_acpi_tables(ulong start_addr) struct acpi_csrt *csrt; struct acpi_spcr *spcr; void *start; + int aml_len; ulong addr; int ret; int i; + ctx = calloc(1, sizeof(*ctx)); + if (!ctx) + return log_msg_ret("mem", -ENOMEM); + gd->acpi_ctx = ctx; + start = map_sysmem(start_addr, 0); debug("ACPI: Writing ACPI tables at %lx\n", start_addr); + acpi_reset_items(); acpi_setup_base_tables(ctx, start); debug("ACPI: * FACS\n"); @@ -525,21 +544,28 @@ ulong write_acpi_tables(ulong start_addr) dsdt = ctx->current; /* Put the table header first */ - memcpy(dsdt, &AmlCode, sizeof(struct acpi_table_header)); - acpi_inc(ctx, sizeof(struct acpi_table_header)); + memcpy(dsdt, &AmlCode, thl); + acpi_inc(ctx, thl); + log_debug("DSDT starts at %p, hdr ends at %p\n", dsdt, ctx->current); /* If the table is not empty, allow devices to inject things */ - if (dsdt->length >= sizeof(struct acpi_table_header)) - acpi_inject_dsdt(ctx); + aml_len = dsdt->length - thl; + if (aml_len) { + void *base = ctx->current; - /* Copy in the AML code itself if any (after the header) */ - memcpy(ctx->current, - (char *)&AmlCode + sizeof(struct acpi_table_header), - dsdt->length - sizeof(struct acpi_table_header)); + acpi_inject_dsdt(ctx); + log_debug("Added %x bytes from inject_dsdt, now at %p\n", + ctx->current - base, ctx->current); + log_debug("Copy AML code size %x to %p\n", aml_len, + ctx->current); + memcpy(ctx->current, AmlCode + thl, aml_len); + acpi_inc(ctx, aml_len); + } - acpi_inc(ctx, dsdt->length - sizeof(struct acpi_table_header)); dsdt->length = ctx->current - (void *)dsdt; acpi_align(ctx); + log_debug("Updated DSDT length to %x, total %x\n", dsdt->length, + ctx->current - (void *)dsdt); if (!IS_ENABLED(CONFIG_ACPI_GNVS_EXTERNAL)) { /* Pack GNVS into the ACPI table area */ @@ -591,11 +617,8 @@ ulong write_acpi_tables(ulong start_addr) debug("ACPI: * SSDT\n"); ssdt = (struct acpi_table_header *)ctx->current; - acpi_create_ssdt(ctx, ssdt, OEM_TABLE_ID); - if (ssdt->length > sizeof(struct acpi_table_header)) { - acpi_inc_align(ctx, ssdt->length); + if (!acpi_create_ssdt(ctx, ssdt, OEM_TABLE_ID)) acpi_add_table(ctx, ssdt); - } debug("ACPI: * MCFG\n"); mcfg = ctx->current; @@ -623,14 +646,17 @@ ulong write_acpi_tables(ulong start_addr) acpi_inc_align(ctx, madt->header.length); acpi_add_table(ctx, madt); - debug("ACPI: * TCPA\n"); - tcpa = (struct acpi_tcpa *)ctx->current; - ret = acpi_create_tcpa(tcpa); - if (ret) { - log_warning("Failed to create TCPA table (err=%d)\n", ret); - } else { - acpi_inc_align(ctx, tcpa->header.length); - acpi_add_table(ctx, tcpa); + if (IS_ENABLED(CONFIG_TPM_V1)) { + debug("ACPI: * TCPA\n"); + tcpa = (struct acpi_tcpa *)ctx->current; + ret = acpi_create_tcpa(tcpa); + if (ret) { + log_warning("Failed to create TCPA table (err=%d)\n", + ret); + } else { + acpi_inc_align(ctx, tcpa->header.length); + acpi_add_table(ctx, tcpa); + } } debug("ACPI: * CSRT\n"); @@ -741,7 +767,7 @@ int acpi_write_dbg2_pci_uart(struct acpi_ctx *ctx, struct udevice *dev, * 32-bits each. This is only for debugging so it is not a big deal. */ addr = dm_pci_read_bar32(dev, 0); - printf("UART addr %lx\n", (ulong)addr); + log_debug("UART addr %lx\n", (ulong)addr); memset(&address, '\0', sizeof(address)); address.space_id = ACPI_ADDRESS_SPACE_MEMORY; diff --git a/arch/x86/lib/fsp/fsp_dram.c b/arch/x86/lib/fsp/fsp_dram.c index a76497d4e0..3ffd40ce74 100644 --- a/arch/x86/lib/fsp/fsp_dram.c +++ b/arch/x86/lib/fsp/fsp_dram.c @@ -41,8 +41,10 @@ int fsp_scan_for_ram_size(void) int dram_init_banksize(void) { + efi_guid_t fsp = FSP_HOB_RESOURCE_OWNER_FSP_GUID; const struct hob_header *hdr; struct hob_res_desc *res_desc; + phys_addr_t mtrr_top; phys_addr_t low_end; uint bank; @@ -54,35 +56,42 @@ int dram_init_banksize(void) return 0; } - low_end = 0; + low_end = 0; /* top of low memory usable by U-Boot */ + mtrr_top = 0; /* top of low memory (even if reserved) */ for (bank = 1, hdr = gd->arch.hob_list; bank < CONFIG_NR_DRAM_BANKS && !end_of_hob(hdr); hdr = get_next_hob(hdr)) { if (hdr->type != HOB_TYPE_RES_DESC) continue; res_desc = (struct hob_res_desc *)hdr; + if (!guidcmp(&res_desc->owner, &fsp)) + low_end = res_desc->phys_start; if (res_desc->type != RES_SYS_MEM && res_desc->type != RES_MEM_RESERVED) continue; if (res_desc->phys_start < (1ULL << 32)) { - low_end = max(low_end, - res_desc->phys_start + res_desc->len); - continue; + mtrr_top = max(mtrr_top, + res_desc->phys_start + res_desc->len); + } else { + gd->bd->bi_dram[bank].start = res_desc->phys_start; + gd->bd->bi_dram[bank].size = res_desc->len; + mtrr_add_request(MTRR_TYPE_WRBACK, res_desc->phys_start, + res_desc->len); + log_debug("ram %llx %llx\n", + gd->bd->bi_dram[bank].start, + gd->bd->bi_dram[bank].size); } - - gd->bd->bi_dram[bank].start = res_desc->phys_start; - gd->bd->bi_dram[bank].size = res_desc->len; - mtrr_add_request(MTRR_TYPE_WRBACK, res_desc->phys_start, - res_desc->len); - log_debug("ram %llx %llx\n", gd->bd->bi_dram[bank].start, - gd->bd->bi_dram[bank].size); } /* Add the memory below 4GB */ gd->bd->bi_dram[0].start = 0; gd->bd->bi_dram[0].size = low_end; - mtrr_add_request(MTRR_TYPE_WRBACK, 0, low_end); + /* + * Set up an MTRR to the top of low, reserved memory. This is necessary + * for graphics to run at full speed in U-Boot. + */ + mtrr_add_request(MTRR_TYPE_WRBACK, 0, mtrr_top); return 0; } @@ -156,7 +165,7 @@ unsigned int install_e820_map(unsigned int max_entries, #if CONFIG_IS_ENABLED(HANDOFF) && IS_ENABLED(CONFIG_USE_HOB) int handoff_arch_save(struct spl_handoff *ho) { - ho->arch.usable_ram_top = fsp_get_usable_lowmem_top(gd->arch.hob_list); + ho->arch.usable_ram_top = gd->bd->bi_dram[0].size; ho->arch.hob_list = gd->arch.hob_list; return 0; diff --git a/arch/x86/lib/fsp/fsp_graphics.c b/arch/x86/lib/fsp/fsp_graphics.c index 858d7942fe..6534b6690b 100644 --- a/arch/x86/lib/fsp/fsp_graphics.c +++ b/arch/x86/lib/fsp/fsp_graphics.c @@ -139,7 +139,7 @@ static int fsp_video_acpi_write_tables(const struct udevice *dev, struct igd_opregion *opregion; int ret; - printf("ACPI: * IGD OpRegion\n"); + log_debug("ACPI: * IGD OpRegion\n"); opregion = (struct igd_opregion *)ctx->current; ret = intel_gma_init_igd_opregion((struct udevice *)dev, opregion); diff --git a/arch/x86/lib/fsp2/fsp_dram.c b/arch/x86/lib/fsp2/fsp_dram.c index c9f6402e6a..a95fdc46c1 100644 --- a/arch/x86/lib/fsp2/fsp_dram.c +++ b/arch/x86/lib/fsp2/fsp_dram.c @@ -4,6 +4,8 @@ * Written by Simon Glass <sjg@chromium.org> */ +#define LOG_CATEGORY LOGC_ARCH + #include <common.h> #include <handoff.h> #include <init.h> @@ -35,7 +37,7 @@ int dram_init(void) ret = fsp_memory_init(s3wake, IS_ENABLED(CONFIG_APL_BOOT_FROM_FAST_SPI_FLASH)); if (ret) { - debug("Memory init failed (err=%x)\n", ret); + log_debug("Memory init failed (err=%x)\n", ret); return ret; } @@ -60,7 +62,7 @@ int dram_init(void) struct spl_handoff *ho = gd->spl_handoff; if (!ho) { - debug("No SPL handoff found\n"); + log_debug("No SPL handoff found\n"); return -ESTRPIPE; } gd->ram_size = ho->ram_size; @@ -82,6 +84,8 @@ ulong board_get_usable_ram_top(ulong total_size) #if CONFIG_IS_ENABLED(HANDOFF) struct spl_handoff *ho = gd->spl_handoff; + log_debug("usable_ram_top = %lx\n", ho->arch.usable_ram_top); + return ho->arch.usable_ram_top; #endif diff --git a/arch/x86/lib/interrupts.c b/arch/x86/lib/interrupts.c index a81e429110..ff52959ed2 100644 --- a/arch/x86/lib/interrupts.c +++ b/arch/x86/lib/interrupts.c @@ -131,8 +131,11 @@ void do_irq(int hw_irq) int do_irqinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { #if !CONFIG_IS_ENABLED(X86_64) + struct idt_ptr ptr; int irq; + interrupt_read_idt(&ptr); + printf("IDT at %lx, size %x\n", ptr.address, ptr.size); printf("Spurious IRQ: %u, last unknown IRQ: %d\n", spurious_irq_cnt, spurious_irq); diff --git a/arch/x86/lib/tables.c b/arch/x86/lib/tables.c index 7bad5dd303..c4007fa486 100644 --- a/arch/x86/lib/tables.c +++ b/arch/x86/lib/tables.c @@ -4,6 +4,7 @@ */ #include <common.h> +#include <bloblist.h> #include <log.h> #include <malloc.h> #include <smbios.h> @@ -13,6 +14,8 @@ #include <asm/tables.h> #include <asm/coreboot_tables.h> +DECLARE_GLOBAL_DATA_PTR; + /** * Function prototype to write a specific configuration table * @@ -26,10 +29,16 @@ typedef ulong (*table_write)(ulong addr); * * @name: Name of table (for debugging) * @write: Function to call to write this table + * @tag: Bloblist tag if using CONFIG_BLOBLIST_TABLES + * @size: Maximum table size + * @align: Table alignment in bytes */ struct table_info { const char *name; table_write write; + enum bloblist_tag_t tag; + int size; + int align; }; static struct table_info table_list[] = { @@ -43,10 +52,10 @@ static struct table_info table_list[] = { { "mp", write_mp_table, }, #endif #ifdef CONFIG_GENERATE_ACPI_TABLE - { "acpi", write_acpi_tables, }, + { "acpi", write_acpi_tables, BLOBLISTT_ACPI_TABLES, 0x10000, 0x1000}, #endif #ifdef CONFIG_GENERATE_SMBIOS_TABLE - { "smbios", write_smbios_table, }, + { "smbios", write_smbios_table, BLOBLISTT_SMBIOS_TABLES, 0x1000, 0x100}, #endif }; @@ -64,45 +73,82 @@ void table_fill_string(char *dest, const char *src, size_t n, char pad) dest[i] = pad; } -void write_tables(void) +int write_tables(void) { - u32 rom_table_start = ROM_TABLE_ADDR; + u32 rom_table_start; u32 rom_table_end; -#ifdef CONFIG_SEABIOS u32 high_table, table_size; struct memory_area cfg_tables[ARRAY_SIZE(table_list) + 1]; -#endif int i; + rom_table_start = ROM_TABLE_ADDR; + debug("Writing tables to %x:\n", rom_table_start); for (i = 0; i < ARRAY_SIZE(table_list); i++) { const struct table_info *table = &table_list[i]; + int size = table->size ? : CONFIG_ROM_TABLE_SIZE; + if (IS_ENABLED(CONFIG_BLOBLIST_TABLES) && table->tag) { + rom_table_start = (ulong)bloblist_add(table->tag, size, + table->align); + if (!rom_table_start) + return log_msg_ret("bloblist", -ENOBUFS); + } rom_table_end = table->write(rom_table_start); rom_table_end = ALIGN(rom_table_end, ROM_TABLE_ALIGN); -#ifdef CONFIG_SEABIOS - table_size = rom_table_end - rom_table_start; - high_table = (u32)high_table_malloc(table_size); - if (high_table) { - table->write(high_table); + if (IS_ENABLED(CONFIG_SEABIOS)) { + table_size = rom_table_end - rom_table_start; + high_table = (u32)(ulong)high_table_malloc(table_size); + if (high_table) { + table->write(high_table); - cfg_tables[i].start = high_table; - cfg_tables[i].size = table_size; - } else { - printf("%d: no memory for configuration tables\n", i); + cfg_tables[i].start = high_table; + cfg_tables[i].size = table_size; + } else { + printf("%d: no memory for configuration tables\n", + i); + return -ENOSPC; + } } -#endif debug("- wrote '%s' to %x, end %x\n", table->name, rom_table_start, rom_table_end); + if (rom_table_end - rom_table_start > size) { + log_err("Out of space for configuration tables: need %x, have %x\n", + rom_table_end - rom_table_start, size); + return log_msg_ret("bloblist", -ENOSPC); + } rom_table_start = rom_table_end; } -#ifdef CONFIG_SEABIOS - /* make sure the last item is zero */ - cfg_tables[i].size = 0; - write_coreboot_table(CB_TABLE_ADDR, cfg_tables); -#endif + if (IS_ENABLED(CONFIG_SEABIOS)) { + /* make sure the last item is zero */ + cfg_tables[i].size = 0; + write_coreboot_table(CB_TABLE_ADDR, cfg_tables); + } + + if (IS_ENABLED(CONFIG_BLOBLIST_TABLES)) { + void *ptr = (void *)CONFIG_ROM_TABLE_ADDR; + + /* Write an RSDP pointing to the tables */ + if (IS_ENABLED(CONFIG_GENERATE_ACPI_TABLE)) { + struct acpi_ctx *ctx = gd_acpi_ctx(); + + acpi_write_rsdp(ptr, ctx->rsdt, ctx->xsdt); + ptr += ALIGN(sizeof(struct acpi_rsdp), 16); + } + if (IS_ENABLED(CONFIG_GENERATE_SMBIOS_TABLE)) { + void *smbios; + + smbios = bloblist_find(BLOBLISTT_SMBIOS_TABLES, 0); + if (!smbios) + return log_msg_ret("smbios", -ENOENT); + memcpy(ptr, smbios, sizeof(struct smbios_entry)); + } + } + debug("- done writing tables\n"); + + return 0; } diff --git a/arch/x86/lib/tpl.c b/arch/x86/lib/tpl.c index 6f7eb43a17..15b0212d19 100644 --- a/arch/x86/lib/tpl.c +++ b/arch/x86/lib/tpl.c @@ -75,7 +75,7 @@ void board_init_f_r(void) u32 spl_boot_device(void) { - return IS_ENABLED(CONFIG_CHROMEOS) ? BOOT_DEVICE_CROS_VBOOT : + return IS_ENABLED(CONFIG_CHROMEOS_VBOOT) ? BOOT_DEVICE_CROS_VBOOT : BOOT_DEVICE_SPI_MMAP; } diff --git a/arch/x86/lib/zimage.c b/arch/x86/lib/zimage.c index a00964cc8d..50fb16d2da 100644 --- a/arch/x86/lib/zimage.c +++ b/arch/x86/lib/zimage.c @@ -12,10 +12,13 @@ * linux/Documentation/i386/boot.txt */ +#define LOG_CATEGORY LOGC_BOOT + #include <common.h> #include <command.h> #include <env.h> #include <irq_func.h> +#include <log.h> #include <malloc.h> #include <acpi/acpi_table.h> #include <asm/io.h> @@ -28,6 +31,7 @@ #include <asm/arch/timestamp.h> #endif #include <linux/compiler.h> +#include <linux/ctype.h> #include <linux/libfdt.h> /* @@ -172,11 +176,19 @@ static const char *get_kernel_version(struct boot_params *params, { struct setup_header *hdr = ¶ms->hdr; int bootproto; + const char *s, *end; bootproto = get_boot_protocol(hdr, false); if (bootproto < 0x0200 || hdr->setup_sects < 15) return NULL; + /* sanity-check the kernel version in case it is missing */ + for (s = kernel_base + hdr->kernel_version + 0x200, end = s + 0x100; *s; + s++) { + if (!isprint(*s)) + return NULL; + } + return kernel_base + hdr->kernel_version + 0x200; } @@ -200,13 +212,13 @@ struct boot_params *load_zimage(char *image, unsigned long kernel_size, /* determine size of setup */ if (0 == hdr->setup_sects) { - printf("Setup Sectors = 0 (defaulting to 4)\n"); + log_warning("Setup Sectors = 0 (defaulting to 4)\n"); setup_size = 5 * 512; } else { setup_size = (hdr->setup_sects + 1) * 512; } - printf("Setup Size = 0x%8.8lx\n", (ulong)setup_size); + log_debug("Setup Size = 0x%8.8lx\n", (ulong)setup_size); if (setup_size > SETUP_MAX_SIZE) printf("Error: Setup is too large (%d bytes)\n", setup_size); @@ -214,8 +226,8 @@ struct boot_params *load_zimage(char *image, unsigned long kernel_size, /* determine boot protocol version */ bootproto = get_boot_protocol(hdr, true); - printf("Using boot protocol version %x.%02x\n", - (bootproto & 0xff00) >> 8, bootproto & 0xff); + log_debug("Using boot protocol version %x.%02x\n", + (bootproto & 0xff00) >> 8, bootproto & 0xff); version = get_kernel_version(params, image); if (version) @@ -292,6 +304,7 @@ int setup_zimage(struct boot_params *setup_base, char *cmd_line, int auto_boot, struct setup_header *hdr = &setup_base->hdr; int bootproto = get_boot_protocol(hdr, false); + log_debug("Setup E820 entries\n"); setup_base->e820_entries = install_e820_map( ARRAY_SIZE(setup_base->e820_map), setup_base->e820_map); @@ -317,6 +330,7 @@ int setup_zimage(struct boot_params *setup_base, char *cmd_line, int auto_boot, } if (cmd_line) { + log_debug("Setup cmdline\n"); if (bootproto >= 0x0202) { hdr->cmd_line_ptr = (uintptr_t)cmd_line; } else if (bootproto >= 0x0200) { @@ -340,6 +354,7 @@ int setup_zimage(struct boot_params *setup_base, char *cmd_line, int auto_boot, if (IS_ENABLED(CONFIG_GENERATE_ACPI_TABLE)) setup_base->acpi_rsdp_addr = acpi_get_rsdp_addr(); + log_debug("Setup devicetree\n"); setup_device_tree(hdr, (const void *)env_get_hex("fdtaddr", 0)); setup_video(&setup_base->screen_info); @@ -405,7 +420,8 @@ static int do_zboot_load(struct cmd_tbl *cmdtp, int flag, int argc, struct boot_params *from = (struct boot_params *)state.base_ptr; base_ptr = (struct boot_params *)DEFAULT_SETUP_BASE; - printf("Building boot_params at 0x%8.8lx\n", (ulong)base_ptr); + log_debug("Building boot_params at 0x%8.8lx\n", + (ulong)base_ptr); memset(base_ptr, '\0', sizeof(*base_ptr)); base_ptr->hdr = from->hdr; } else { |