diff mbox

[U-Boot,03/17] x86: Remove GDR related magic numbers

Message ID 1325477374-6417-4-git-send-email-graeme.russ@gmail.com
State Superseded
Headers show

Commit Message

Graeme Russ Jan. 2, 2012, 4:09 a.m. UTC
Signed-off-by: Graeme Russ <graeme.russ@gmail.com>
---
 arch/x86/cpu/start.S             |    3 ++-
 arch/x86/include/asm/processor.h |    6 +++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

Comments

Simon Glass Jan. 4, 2012, 5:23 a.m. UTC | #1
Hi Graeme,

On Sun, Jan 1, 2012 at 8:09 PM, Graeme Russ <graeme.russ@gmail.com> wrote:
>
> Signed-off-by: Graeme Russ <graeme.russ@gmail.com>
> ---
>  arch/x86/cpu/start.S             |    3 ++-
>  arch/x86/include/asm/processor.h |    6 +++++-
>  2 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/cpu/start.S b/arch/x86/cpu/start.S
> index f87633b..7f9b6a7 100644
> --- a/arch/x86/cpu/start.S
> +++ b/arch/x86/cpu/start.S
> @@ -29,6 +29,7 @@
>  #include <config.h>
>  #include <version.h>
>  #include <asm/global_data.h>
> +#include <asm/processor.h>
>  #include <asm/processor-flags.h>
>  #include <generated/asm-offsets.h>
>
> @@ -58,7 +59,7 @@ _start:
>        /* This is the 32-bit cold-reset entry point */
>
>        /* Load the segement registes to match the gdt loaded in start16.S */
> -       movl    $0x18, %eax
> +       movl    $(GDT_ENTRY_32BIT_DS * 8), %eax
>        movw    %ax, %fs
>        movw    %ax, %ds
>        movw    %ax, %gs
> diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
> index 1e5dccd..203c63a 100644
> --- a/arch/x86/include/asm/processor.h
> +++ b/arch/x86/include/asm/processor.h
> @@ -24,9 +24,13 @@
>  #ifndef __ASM_PROCESSOR_H_
>  #define __ASM_PROCESSOR_H_ 1
>
> -#define GDT_ENTRY_32BIT_CS     2
> +#define GDT_ENTRY_NULL         0
> +#define GDT_ENTRY_UNUSED       (GDT_ENTRY_NULL + 1)
> +#define GDT_ENTRY_32BIT_CS     (GDT_ENTRY_UNUSED + 1)
>  #define GDT_ENTRY_32BIT_DS     (GDT_ENTRY_32BIT_CS + 1)
>  #define GDT_ENTRY_16BIT_CS     (GDT_ENTRY_32BIT_DS + 1)
>  #define GDT_ENTRY_16BIT_DS     (GDT_ENTRY_16BIT_CS + 1)

>
> +#define GDT_NUM_ENTRIES                (GDT_ENTRY_16BIT_DS + 1)
> +

Ick - any reason not to use an enum here?

Regards,
Simon

>  #endif
> --
> 1.7.5.2.317.g391b14
>
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
Graeme Russ Jan. 4, 2012, 10:20 a.m. UTC | #2
On 04/01/12 16:23, Simon Glass wrote:
> Hi Graeme,
> 
> On Sun, Jan 1, 2012 at 8:09 PM, Graeme Russ <graeme.russ@gmail.com> wrote:
>>
>> Signed-off-by: Graeme Russ <graeme.russ@gmail.com>
>> ---
>>  arch/x86/cpu/start.S             |    3 ++-
>>  arch/x86/include/asm/processor.h |    6 +++++-
>>  2 files changed, 7 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/x86/cpu/start.S b/arch/x86/cpu/start.S
>> index f87633b..7f9b6a7 100644
>> --- a/arch/x86/cpu/start.S
>> +++ b/arch/x86/cpu/start.S
>> @@ -29,6 +29,7 @@
>>  #include <config.h>
>>  #include <version.h>
>>  #include <asm/global_data.h>
>> +#include <asm/processor.h>
>>  #include <asm/processor-flags.h>
>>  #include <generated/asm-offsets.h>
>>
>> @@ -58,7 +59,7 @@ _start:
>>        /* This is the 32-bit cold-reset entry point */
>>
>>        /* Load the segement registes to match the gdt loaded in start16.S */
>> -       movl    $0x18, %eax
>> +       movl    $(GDT_ENTRY_32BIT_DS * 8), %eax
>>        movw    %ax, %fs
>>        movw    %ax, %ds
>>        movw    %ax, %gs
>> diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
>> index 1e5dccd..203c63a 100644
>> --- a/arch/x86/include/asm/processor.h
>> +++ b/arch/x86/include/asm/processor.h
>> @@ -24,9 +24,13 @@
>>  #ifndef __ASM_PROCESSOR_H_
>>  #define __ASM_PROCESSOR_H_ 1
>>
>> -#define GDT_ENTRY_32BIT_CS     2
>> +#define GDT_ENTRY_NULL         0
>> +#define GDT_ENTRY_UNUSED       (GDT_ENTRY_NULL + 1)
>> +#define GDT_ENTRY_32BIT_CS     (GDT_ENTRY_UNUSED + 1)
>>  #define GDT_ENTRY_32BIT_DS     (GDT_ENTRY_32BIT_CS + 1)
>>  #define GDT_ENTRY_16BIT_CS     (GDT_ENTRY_32BIT_DS + 1)
>>  #define GDT_ENTRY_16BIT_DS     (GDT_ENTRY_16BIT_CS + 1)
> 
>>
>> +#define GDT_NUM_ENTRIES                (GDT_ENTRY_16BIT_DS + 1)
>> +
> 
> Ick - any reason not to use an enum here?

Done, but I still need a rouge #define for the assembler case above

Also, I added an X86_ prefix as per Linux headers and moved the size define
up from patch 7

Regards

Graeme
diff mbox

Patch

diff --git a/arch/x86/cpu/start.S b/arch/x86/cpu/start.S
index f87633b..7f9b6a7 100644
--- a/arch/x86/cpu/start.S
+++ b/arch/x86/cpu/start.S
@@ -29,6 +29,7 @@ 
 #include <config.h>
 #include <version.h>
 #include <asm/global_data.h>
+#include <asm/processor.h>
 #include <asm/processor-flags.h>
 #include <generated/asm-offsets.h>
 
@@ -58,7 +59,7 @@  _start:
 	/* This is the 32-bit cold-reset entry point */
 
 	/* Load the segement registes to match the gdt loaded in start16.S */
-	movl	$0x18, %eax
+	movl	$(GDT_ENTRY_32BIT_DS * 8), %eax
 	movw	%ax, %fs
 	movw	%ax, %ds
 	movw	%ax, %gs
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index 1e5dccd..203c63a 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -24,9 +24,13 @@ 
 #ifndef __ASM_PROCESSOR_H_
 #define __ASM_PROCESSOR_H_ 1
 
-#define GDT_ENTRY_32BIT_CS	2
+#define GDT_ENTRY_NULL		0
+#define GDT_ENTRY_UNUSED	(GDT_ENTRY_NULL + 1)
+#define GDT_ENTRY_32BIT_CS	(GDT_ENTRY_UNUSED + 1)
 #define GDT_ENTRY_32BIT_DS	(GDT_ENTRY_32BIT_CS + 1)
 #define GDT_ENTRY_16BIT_CS	(GDT_ENTRY_32BIT_DS + 1)
 #define GDT_ENTRY_16BIT_DS	(GDT_ENTRY_16BIT_CS + 1)
 
+#define GDT_NUM_ENTRIES		(GDT_ENTRY_16BIT_DS + 1)
+
 #endif