Re: [RFC -mm 1/2] i386/x86_64 boot: setup data

2007-09-17 Thread Huang, Ying
On Mon, 2007-09-17 at 08:30 -0700, H. Peter Anvin wrote:
> Huang, Ying wrote:
> > This patch add a field of 64-bit physical pointer to NULL terminated
> > single linked list of struct setup_data to real-mode kernel
> > header. This is used to define a more extensible boot parameters
> > passing mechanism.
> 
> You MUST NOT add a field like this without changing the version number,
> and, since you expect to enter the kernel at the PM entrypoint, you
> better *CHECK* that version number before ever descending down the chain.
> 

I forgot changing the version number in boot/head.S. I will add it. And
I will add version number checking before descending down the chain.

Best Regards,
Huang Ying
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC -mm 1/2] i386/x86_64 boot: setup data

2007-09-17 Thread H. Peter Anvin
Huang, Ying wrote:
> This patch add a field of 64-bit physical pointer to NULL terminated
> single linked list of struct setup_data to real-mode kernel
> header. This is used to define a more extensible boot parameters
> passing mechanism.

You MUST NOT add a field like this without changing the version number,
and, since you expect to enter the kernel at the PM entrypoint, you
better *CHECK* that version number before ever descending down the chain.

-hpa
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[RFC -mm 1/2] i386/x86_64 boot: setup data

2007-09-17 Thread Huang, Ying
This patch add a field of 64-bit physical pointer to NULL terminated
single linked list of struct setup_data to real-mode kernel
header. This is used to define a more extensible boot parameters
passing mechanism.

Signed-off-by: Huang Ying <[EMAIL PROTECTED]>

---

 arch/i386/Kconfig|3 ---
 arch/i386/boot/header.S  |6 ++
 arch/i386/kernel/setup.c |   20 
 arch/x86_64/kernel/setup.c   |   19 +++
 include/asm-i386/bootparam.h |   15 +++
 include/asm-i386/io.h|7 +++
 6 files changed, 67 insertions(+), 3 deletions(-)

Index: linux-2.6.23-rc4/include/asm-i386/bootparam.h
===
--- linux-2.6.23-rc4.orig/include/asm-i386/bootparam.h  2007-09-17 
14:18:24.0 +0800
+++ linux-2.6.23-rc4/include/asm-i386/bootparam.h   2007-09-17 
15:02:33.0 +0800
@@ -9,6 +9,17 @@
 #include 
 #include 
 
+/* setup data types */
+#define SETUP_NONE 0
+
+/* extensible setup data list node */
+struct setup_data {
+   u64 next;
+   u32 type;
+   u32 len;
+   u8 data[0];
+} __attribute__((packed));
+
 struct setup_header {
u8  setup_sects;
u16 root_flags;
@@ -41,6 +52,10 @@
u32 initrd_addr_max;
u32 kernel_alignment;
u8  relocatable_kernel;
+   u8  _pad2[3];
+   u32 cmdline_size;
+   u32 _pad3;
+   u64 setup_data;
 } __attribute__((packed));
 
 struct sys_desc_table {
Index: linux-2.6.23-rc4/arch/i386/boot/header.S
===
--- linux-2.6.23-rc4.orig/arch/i386/boot/header.S   2007-09-17 
14:17:32.0 +0800
+++ linux-2.6.23-rc4/arch/i386/boot/header.S2007-09-17 14:18:32.0 
+0800
@@ -214,6 +214,12 @@
 #added with boot protocol
 #version 2.06
 
+pad4:  .long 0
+
+setup_data:.quad 0 # 64-bit physical pointer to
+   # single linked list of
+   # struct setup_data
+
 # End of setup header #
 
.section ".inittext", "ax"
Index: linux-2.6.23-rc4/arch/x86_64/kernel/setup.c
===
--- linux-2.6.23-rc4.orig/arch/x86_64/kernel/setup.c2007-09-17 
14:18:23.0 +0800
+++ linux-2.6.23-rc4/arch/x86_64/kernel/setup.c 2007-09-17 15:02:33.0 
+0800
@@ -221,6 +221,23 @@
ebda_size = 64*1024;
 }
 
+void __init parse_setup_data(void)
+{
+   struct setup_data *setup_data;
+   unsigned long pa_setup_data;
+
+   pa_setup_data = boot_params.hdr.setup_data;
+   while (pa_setup_data) {
+   setup_data = early_ioremap(pa_setup_data, PAGE_SIZE);
+   switch (setup_data->type) {
+   default:
+   break;
+   }
+   pa_setup_data = setup_data->next;
+   early_iounmap(setup_data, PAGE_SIZE);
+   }
+}
+
 void __init setup_arch(char **cmdline_p)
 {
printk(KERN_INFO "Command line: %s\n", boot_command_line);
@@ -256,6 +273,8 @@
strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE);
*cmdline_p = command_line;
 
+   parse_setup_data();
+
parse_early_param();
 
finish_e820_parsing();
Index: linux-2.6.23-rc4/arch/i386/kernel/setup.c
===
--- linux-2.6.23-rc4.orig/arch/i386/kernel/setup.c  2007-09-17 
14:18:23.0 +0800
+++ linux-2.6.23-rc4/arch/i386/kernel/setup.c   2007-09-17 14:18:32.0 
+0800
@@ -496,6 +496,23 @@
return machine_specific_memory_setup();
 }
 
+void __init parse_setup_data(void)
+{
+   struct setup_data *setup_data;
+   unsigned long pa_setup_data, pa_next;
+
+   pa_setup_data = boot_params.hdr.setup_data;
+   while (pa_setup_data) {
+   setup_data = boot_ioremap(pa_setup_data, PAGE_SIZE);
+   pa_next = setup_data->next;
+   switch (setup_data->type) {
+   default:
+   break;
+   }
+   pa_setup_data = pa_next;
+   }
+}
+
 /*
  * Determine if we were loaded by an EFI loader.  If so, then we have also been
  * passed the efi memmap, systab, etc., so we should use these data structures
@@ -544,6 +561,9 @@
rd_prompt = ((boot_params.hdr.ram_size & RAMDISK_PROMPT_FLAG) != 0);
rd_doload = ((boot_params.hdr.ram_size & RAMDISK_LOAD_FLAG) != 0);
 #endif
+
+   parse_setup_data();
+
ARCH_SETUP
if (efi_enabled)
efi_init();
Index: linux-2.6.23-rc4/include/asm-i386/io.h

[RFC -mm 1/2] i386/x86_64 boot: setup data

2007-09-17 Thread Huang, Ying
This patch add a field of 64-bit physical pointer to NULL terminated
single linked list of struct setup_data to real-mode kernel
header. This is used to define a more extensible boot parameters
passing mechanism.

Signed-off-by: Huang Ying [EMAIL PROTECTED]

---

 arch/i386/Kconfig|3 ---
 arch/i386/boot/header.S  |6 ++
 arch/i386/kernel/setup.c |   20 
 arch/x86_64/kernel/setup.c   |   19 +++
 include/asm-i386/bootparam.h |   15 +++
 include/asm-i386/io.h|7 +++
 6 files changed, 67 insertions(+), 3 deletions(-)

Index: linux-2.6.23-rc4/include/asm-i386/bootparam.h
===
--- linux-2.6.23-rc4.orig/include/asm-i386/bootparam.h  2007-09-17 
14:18:24.0 +0800
+++ linux-2.6.23-rc4/include/asm-i386/bootparam.h   2007-09-17 
15:02:33.0 +0800
@@ -9,6 +9,17 @@
 #include asm/ist.h
 #include video/edid.h
 
+/* setup data types */
+#define SETUP_NONE 0
+
+/* extensible setup data list node */
+struct setup_data {
+   u64 next;
+   u32 type;
+   u32 len;
+   u8 data[0];
+} __attribute__((packed));
+
 struct setup_header {
u8  setup_sects;
u16 root_flags;
@@ -41,6 +52,10 @@
u32 initrd_addr_max;
u32 kernel_alignment;
u8  relocatable_kernel;
+   u8  _pad2[3];
+   u32 cmdline_size;
+   u32 _pad3;
+   u64 setup_data;
 } __attribute__((packed));
 
 struct sys_desc_table {
Index: linux-2.6.23-rc4/arch/i386/boot/header.S
===
--- linux-2.6.23-rc4.orig/arch/i386/boot/header.S   2007-09-17 
14:17:32.0 +0800
+++ linux-2.6.23-rc4/arch/i386/boot/header.S2007-09-17 14:18:32.0 
+0800
@@ -214,6 +214,12 @@
 #added with boot protocol
 #version 2.06
 
+pad4:  .long 0
+
+setup_data:.quad 0 # 64-bit physical pointer to
+   # single linked list of
+   # struct setup_data
+
 # End of setup header #
 
.section .inittext, ax
Index: linux-2.6.23-rc4/arch/x86_64/kernel/setup.c
===
--- linux-2.6.23-rc4.orig/arch/x86_64/kernel/setup.c2007-09-17 
14:18:23.0 +0800
+++ linux-2.6.23-rc4/arch/x86_64/kernel/setup.c 2007-09-17 15:02:33.0 
+0800
@@ -221,6 +221,23 @@
ebda_size = 64*1024;
 }
 
+void __init parse_setup_data(void)
+{
+   struct setup_data *setup_data;
+   unsigned long pa_setup_data;
+
+   pa_setup_data = boot_params.hdr.setup_data;
+   while (pa_setup_data) {
+   setup_data = early_ioremap(pa_setup_data, PAGE_SIZE);
+   switch (setup_data-type) {
+   default:
+   break;
+   }
+   pa_setup_data = setup_data-next;
+   early_iounmap(setup_data, PAGE_SIZE);
+   }
+}
+
 void __init setup_arch(char **cmdline_p)
 {
printk(KERN_INFO Command line: %s\n, boot_command_line);
@@ -256,6 +273,8 @@
strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE);
*cmdline_p = command_line;
 
+   parse_setup_data();
+
parse_early_param();
 
finish_e820_parsing();
Index: linux-2.6.23-rc4/arch/i386/kernel/setup.c
===
--- linux-2.6.23-rc4.orig/arch/i386/kernel/setup.c  2007-09-17 
14:18:23.0 +0800
+++ linux-2.6.23-rc4/arch/i386/kernel/setup.c   2007-09-17 14:18:32.0 
+0800
@@ -496,6 +496,23 @@
return machine_specific_memory_setup();
 }
 
+void __init parse_setup_data(void)
+{
+   struct setup_data *setup_data;
+   unsigned long pa_setup_data, pa_next;
+
+   pa_setup_data = boot_params.hdr.setup_data;
+   while (pa_setup_data) {
+   setup_data = boot_ioremap(pa_setup_data, PAGE_SIZE);
+   pa_next = setup_data-next;
+   switch (setup_data-type) {
+   default:
+   break;
+   }
+   pa_setup_data = pa_next;
+   }
+}
+
 /*
  * Determine if we were loaded by an EFI loader.  If so, then we have also been
  * passed the efi memmap, systab, etc., so we should use these data structures
@@ -544,6 +561,9 @@
rd_prompt = ((boot_params.hdr.ram_size  RAMDISK_PROMPT_FLAG) != 0);
rd_doload = ((boot_params.hdr.ram_size  RAMDISK_LOAD_FLAG) != 0);
 #endif
+
+   parse_setup_data();
+
ARCH_SETUP
if (efi_enabled)
efi_init();
Index: linux-2.6.23-rc4/include/asm-i386/io.h

Re: [RFC -mm 1/2] i386/x86_64 boot: setup data

2007-09-17 Thread H. Peter Anvin
Huang, Ying wrote:
 This patch add a field of 64-bit physical pointer to NULL terminated
 single linked list of struct setup_data to real-mode kernel
 header. This is used to define a more extensible boot parameters
 passing mechanism.

You MUST NOT add a field like this without changing the version number,
and, since you expect to enter the kernel at the PM entrypoint, you
better *CHECK* that version number before ever descending down the chain.

-hpa
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC -mm 1/2] i386/x86_64 boot: setup data

2007-09-17 Thread Huang, Ying
On Mon, 2007-09-17 at 08:30 -0700, H. Peter Anvin wrote:
 Huang, Ying wrote:
  This patch add a field of 64-bit physical pointer to NULL terminated
  single linked list of struct setup_data to real-mode kernel
  header. This is used to define a more extensible boot parameters
  passing mechanism.
 
 You MUST NOT add a field like this without changing the version number,
 and, since you expect to enter the kernel at the PM entrypoint, you
 better *CHECK* that version number before ever descending down the chain.
 

I forgot changing the version number in boot/head.S. I will add it. And
I will add version number checking before descending down the chain.

Best Regards,
Huang Ying
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/