Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 30c82645 authored by H. Peter Anvin's avatar H. Peter Anvin
Browse files

[x86] remove uses of magic macros for boot_params access



Instead of using magic macros for boot_params access, simply use the
boot_params structure.

Signed-off-by: default avatarH. Peter Anvin <hpa@zytor.com>
parent 2b0460b5
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -39,6 +39,7 @@ setup-y += printf.o string.o tty.o video.o version.o voyager.o
setup-y		+= video-vga.o
setup-y		+= video-vga.o
setup-y		+= video-vesa.o
setup-y		+= video-vesa.o
setup-y		+= video-bios.o
setup-y		+= video-bios.o

targets		+= $(setup-y)
targets		+= $(setup-y)
hostprogs-y	:= tools/build
hostprogs-y	:= tools/build


+12 −7
Original line number Original line Diff line number Diff line
@@ -24,7 +24,7 @@
#include <asm/page.h>
#include <asm/page.h>
#include <asm/e820.h>
#include <asm/e820.h>
#include <asm/proto.h>
#include <asm/proto.h>
#include <asm/bootsetup.h>
#include <asm/setup.h>
#include <asm/sections.h>
#include <asm/sections.h>


struct e820map e820;
struct e820map e820;
@@ -68,11 +68,16 @@ static inline int bad_addr(unsigned long *addrp, unsigned long size)


	/* initrd */ 
	/* initrd */ 
#ifdef CONFIG_BLK_DEV_INITRD
#ifdef CONFIG_BLK_DEV_INITRD
	if (LOADER_TYPE && INITRD_START && last >= INITRD_START && 
	if (boot_params.hdr.type_of_loader && boot_params.hdr.ramdisk_image) {
	    addr < INITRD_START+INITRD_SIZE) { 
		unsigned long ramdisk_image = boot_params.hdr.ramdisk_image;
		*addrp = PAGE_ALIGN(INITRD_START + INITRD_SIZE);
		unsigned long ramdisk_size  = boot_params.hdr.ramdisk_size;
		unsigned long ramdisk_end   = ramdisk_image+ramdisk_size;

		if (last >= ramdisk_image && addr < ramdisk_end) {
			*addrp = PAGE_ALIGN(ramdisk_end);
			return 1;
			return 1;
		}
		}
	} 
#endif
#endif
	/* kernel code */
	/* kernel code */
	if (last >= __pa_symbol(&_text) && addr < __pa_symbol(&_end)) {
	if (last >= __pa_symbol(&_text) && addr < __pa_symbol(&_end)) {
@@ -594,8 +599,8 @@ void __init setup_memory_region(void)
	 * Otherwise fake a memory map; one section from 0k->640k,
	 * Otherwise fake a memory map; one section from 0k->640k,
	 * the next section from 1mb->appropriate_mem_k
	 * the next section from 1mb->appropriate_mem_k
	 */
	 */
	sanitize_e820_map(E820_MAP, &E820_MAP_NR);
	sanitize_e820_map(boot_params.e820_map, &boot_params.e820_entries);
	if (copy_e820_map(E820_MAP, E820_MAP_NR) < 0)
	if (copy_e820_map(boot_params.e820_map, boot_params.e820_entries) < 0)
		early_panic("Cannot find a valid memory map");
		early_panic("Cannot find a valid memory map");
	printk(KERN_INFO "BIOS-provided physical RAM map:\n");
	printk(KERN_INFO "BIOS-provided physical RAM map:\n");
	e820_print_map("BIOS-e820");
	e820_print_map("BIOS-e820");
+5 −10
Original line number Original line Diff line number Diff line
@@ -6,15 +6,10 @@
#include <asm/io.h>
#include <asm/io.h>
#include <asm/processor.h>
#include <asm/processor.h>
#include <asm/fcntl.h>
#include <asm/fcntl.h>
#include <asm/setup.h>
#include <xen/hvc-console.h>
#include <xen/hvc-console.h>


/* Simple VGA output */
/* Simple VGA output */

#ifdef __i386__
#include <asm/setup.h>
#else
#include <asm/bootsetup.h>
#endif
#define VGABASE		(__ISA_IO_base + 0xb8000)
#define VGABASE		(__ISA_IO_base + 0xb8000)


static int max_ypos = 25, max_xpos = 80;
static int max_ypos = 25, max_xpos = 80;
@@ -234,10 +229,10 @@ static int __init setup_early_printk(char *buf)
		early_serial_init(buf);
		early_serial_init(buf);
		early_console = &early_serial_console;
		early_console = &early_serial_console;
	} else if (!strncmp(buf, "vga", 3)
	} else if (!strncmp(buf, "vga", 3)
	           && SCREEN_INFO.orig_video_isVGA == 1) {
	           && boot_params.screen_info.orig_video_isVGA == 1) {
		max_xpos = SCREEN_INFO.orig_video_cols;
		max_xpos = boot_params.screen_info.orig_video_cols;
		max_ypos = SCREEN_INFO.orig_video_lines;
		max_ypos = boot_params.screen_info.orig_video_lines;
		current_ypos = SCREEN_INFO.orig_y;
		current_ypos = boot_params.screen_info.orig_y;
		early_console = &early_vga_console;
		early_console = &early_vga_console;
 	} else if (!strncmp(buf, "simnow", 6)) {
 	} else if (!strncmp(buf, "simnow", 6)) {
 		simnow_init(buf + 6);
 		simnow_init(buf + 6);
+9 −6
Original line number Original line Diff line number Diff line
@@ -331,11 +331,13 @@ void __init efi_init(void)
	memset(&efi, 0, sizeof(efi) );
	memset(&efi, 0, sizeof(efi) );
	memset(&efi_phys, 0, sizeof(efi_phys));
	memset(&efi_phys, 0, sizeof(efi_phys));


	efi_phys.systab = EFI_SYSTAB;
	efi_phys.systab =
	memmap.phys_map = EFI_MEMMAP;
		(efi_system_table_t *)boot_params.efi_info.efi_systab;
	memmap.nr_map = EFI_MEMMAP_SIZE/EFI_MEMDESC_SIZE;
	memmap.phys_map = (void *)boot_params.efi_info.efi_memmap;
	memmap.desc_version = EFI_MEMDESC_VERSION;
	memmap.nr_map = boot_params.efi_info.efi_memmap_size/
	memmap.desc_size = EFI_MEMDESC_SIZE;
		boot_params.efi_info.efi_memdesc_size;
	memmap.desc_version = boot_params.efi_info.efi_memdesc_version;
	memmap.desc_size = boot_params.efi_info.efi_memdesc_size;


	efi.systab = (efi_system_table_t *)
	efi.systab = (efi_system_table_t *)
		boot_ioremap((unsigned long) efi_phys.systab,
		boot_ioremap((unsigned long) efi_phys.systab,
@@ -446,7 +448,8 @@ void __init efi_init(void)
		printk(KERN_ERR PFX "Could not map the runtime service table!\n");
		printk(KERN_ERR PFX "Could not map the runtime service table!\n");


	/* Map the EFI memory map for use until paging_init() */
	/* Map the EFI memory map for use until paging_init() */
	memmap.map = boot_ioremap((unsigned long) EFI_MEMMAP, EFI_MEMMAP_SIZE);
	memmap.map = boot_ioremap(boot_params.efi_info.efi_memmap,
				  boot_params.efi_info.efi_memmap_size);
	if (memmap.map == NULL)
	if (memmap.map == NULL)
		printk(KERN_ERR PFX "Could not map the EFI memory map!\n");
		printk(KERN_ERR PFX "Could not map the EFI memory map!\n");


+4 −16
Original line number Original line Diff line number Diff line
@@ -14,7 +14,6 @@
#include <asm/processor.h>
#include <asm/processor.h>
#include <asm/proto.h>
#include <asm/proto.h>
#include <asm/smp.h>
#include <asm/smp.h>
#include <asm/bootsetup.h>
#include <asm/setup.h>
#include <asm/setup.h>
#include <asm/desc.h>
#include <asm/desc.h>
#include <asm/pgtable.h>
#include <asm/pgtable.h>
@@ -36,27 +35,16 @@ static void __init clear_bss(void)
	       (unsigned long) __bss_stop - (unsigned long) __bss_start);
	       (unsigned long) __bss_stop - (unsigned long) __bss_start);
}
}


#define NEW_CL_POINTER		0x228	/* Relative to real mode data */
#define OLD_CL_MAGIC_ADDR	0x20
#define OLD_CL_MAGIC            0xA33F
#define OLD_CL_OFFSET           0x22

static void __init copy_bootdata(char *real_mode_data)
static void __init copy_bootdata(char *real_mode_data)
{
{
	unsigned long new_data;
	char * command_line;
	char * command_line;


	memcpy(x86_boot_params, real_mode_data, BOOT_PARAM_SIZE);
	memcpy(&boot_params, real_mode_data, sizeof boot_params);
	new_data = *(u32 *) (x86_boot_params + NEW_CL_POINTER);
	if (boot_params.hdr.cmd_line_ptr) {
	if (!new_data) {
		command_line = __va(boot_params.hdr.cmd_line_ptr);
		if (OLD_CL_MAGIC != *(u16 *)(real_mode_data + OLD_CL_MAGIC_ADDR)) {
			return;
		}
		new_data = __pa(real_mode_data) + *(u16 *)(real_mode_data + OLD_CL_OFFSET);
	}
	command_line = __va(new_data);
		memcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
		memcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
	}
	}
}


void __init x86_64_start_kernel(char * real_mode_data)
void __init x86_64_start_kernel(char * real_mode_data)
{
{
Loading