x86: Support a 64-bit ramdisk address
authorSimon Glass <sjg@chromium.org>
Sat, 15 Mar 2025 14:25:56 +0000 (14:25 +0000)
committerTom Rini <trini@konsulko.com>
Thu, 3 Apr 2025 17:41:55 +0000 (11:41 -0600)
Add some missing pieces to bootparams so that a 64-bit ramdisk address
can be used. Tidy up the logging while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
arch/x86/include/asm/bootparam.h
arch/x86/lib/zimage.c

index ac48653..657d920 100644 (file)
@@ -122,6 +122,14 @@ struct efi_info {
        __u32 efi_memmap_hi;
 };
 
+/* Gleaned from OFW's set-parameters in cpu/x86/pc/linux.fth */
+struct olpc_ofw_header {
+       __u32 ofw_magic;        /* OFW signature */
+       __u32 ofw_version;
+       __u32 cif_handler;      /* callback into OFW */
+       __u32 irq_desc_table;
+} __attribute__((packed));
+
 /* The so-called "zeropage" */
 struct boot_params {
        struct screen_info screen_info;                 /* 0x000 */
@@ -134,7 +142,12 @@ struct boot_params {
        __u8  hd0_info[16];     /* obsolete! */         /* 0x080 */
        __u8  hd1_info[16];     /* obsolete! */         /* 0x090 */
        struct sys_desc_table sys_desc_table;           /* 0x0a0 */
-       __u8  _pad4[144];                               /* 0x0b0 */
+       struct olpc_ofw_header olpc_ofw_header;         /* 0x0b0 */
+       __u32 ext_ramdisk_image;                        /* 0x0c0 */
+       __u32 ext_ramdisk_size;                         /* 0x0c4 */
+       __u32 ext_cmd_line_ptr;                         /* 0x0c8 */
+       __u8  _pad4[112];                               /* 0x0cc */
+       __u32 cc_blob_address;                          /* 0x13c */
        struct edid_info edid_info;                     /* 0x140 */
        struct efi_info efi_info;                       /* 0x1c0 */
        __u32 alt_mem_k;                                /* 0x1e0 */
index e661d75..65bccda 100644 (file)
@@ -222,7 +222,7 @@ struct boot_params *load_zimage(char *image, unsigned long kernel_size,
        else
                *load_addressp = ZIMAGE_LOAD_ADDR;
 
-       printf("Building boot_params at 0x%8.8lx\n", (ulong)setup_base);
+       printf("Building boot_params at %lx\n", (ulong)setup_base);
        memset(setup_base, 0, sizeof(*setup_base));
        setup_base->hdr = params->hdr;
 
@@ -298,10 +298,13 @@ int setup_zimage(struct boot_params *setup_base, char *cmd_line, int auto_boot,
                hdr->type_of_loader = 0x80;     /* U-Boot version 0 */
                if (initrd_addr) {
                        printf("Initial RAM disk at linear address "
-                              "0x%08lx, size %ld bytes\n",
-                              initrd_addr, initrd_size);
+                              "%lx, size %lx (%ld bytes)\n",
+                              initrd_addr, initrd_size, initrd_size);
 
                        hdr->ramdisk_image = initrd_addr;
+                       setup_base->ext_ramdisk_image = 0;
+                       setup_base->ext_ramdisk_size = 0;
+                       setup_base->ext_cmd_line_ptr = 0;
                        hdr->ramdisk_size = initrd_size;
                }
        }
@@ -372,8 +375,7 @@ int zboot_load(struct bootm_info *bmi)
                struct boot_params *from = (struct boot_params *)bmi->base_ptr;
 
                base_ptr = (struct boot_params *)DEFAULT_SETUP_BASE;
-               log_debug("Building boot_params at 0x%8.8lx\n",
-                         (ulong)base_ptr);
+               log_debug("Building boot_params at %lx\n", (ulong)base_ptr);
                memset(base_ptr, '\0', sizeof(*base_ptr));
                base_ptr->hdr = from->hdr;
        } else {