diff --git a/src/arch/arm/include/endian.h b/src/arch/arm/include/endian.h new file mode 100644 index 0000000000..371f42ebe7 --- /dev/null +++ b/src/arch/arm/include/endian.h @@ -0,0 +1,28 @@ +#ifndef __ARM_ENDIAN_H__ +#define __ARM_ENDIAN_H__ + +#define __LITTLE_ENDIAN + +#if defined(__LITTLE_ENDIAN) +# undef __LITTLE_ENDIAN +# define __LITTLE_ENDIAN 1234 +# define __BIG_ENDIAN 4321 +# define __PDP_ENDIAN 3412 +# define __BYTE_ORDER __LITTLE_ENDIAN +#elif defined(__BIG_ENDIAN) +# undef __BIG_ENDIAN +# define __LITTLE_ENDIAN 1234 +# define __BIG_ENDIAN 4321 +# define __PDP_ENDIAN 3412 +# define __BYTE_ORDER __BIG_ENDIAN +#elif defined(__PDP_ENDIAN) +# undef __PDP_ENDIAN +# define __LITTLE_ENDIAN 1234 +# define __BIG_ENDIAN 4321 +# define __PDP_ENDIAN 3412 +# define __BYTE_ORDER __PDP_ENDIAN +#else +# error "Unknown byte order!" +#endif + +#endif /* __ARM_ENDIAN_H__ */ diff --git a/src/arch/arm/mach-mid560/include/configs.h b/src/arch/arm/mach-mid560/include/configs.h index e591fd3d89..a155d82322 100644 --- a/src/arch/arm/mach-mid560/include/configs.h +++ b/src/arch/arm/mach-mid560/include/configs.h @@ -1,22 +1,9 @@ #ifndef __CONFIGS_H__ #define __CONFIGS_H__ -/* - * define the format of endian, little endian or big endian. - */ -#define __LITTLE_ENDIAN -#undef __BIG_ENDIAN - -/* - * define the bits of system, 32bits or 64bits. - */ -#define __SYS_32BIT -#undef __SYS_64BIT - /* * malloc heap size */ #define CONFIG_HEAP_SIZE (SZ_1M * 16) - #endif /* __CONFIGS_H__ */ diff --git a/src/arch/arm/mach-mid560/mach-mid560.c b/src/arch/arm/mach-mid560/mach-mid560.c index 0b68934b03..2d8ca1d354 100644 --- a/src/arch/arm/mach-mid560/mach-mid560.c +++ b/src/arch/arm/mach-mid560/mach-mid560.c @@ -172,8 +172,8 @@ static struct machine mid560 = { .res = { .mem_banks = { [0] = { - .start = (const void *)(0x50000000), - .end = (const void *)(0x50000000 + SZ_128M - 1), + .start = 0x50000000, + .end = 0x50000000 + SZ_128M - 1, }, [1] = { @@ -186,26 +186,26 @@ static struct machine mid560 = { }, .link = { - .text_start = (const void *)__text_start, - .text_end = (const void *)__text_end, + .text_start = (const ptrdiff_t)__text_start, + .text_end = (const ptrdiff_t)__text_end, - .ramdisk_start = (const void *)__ramdisk_start, - .ramdisk_end = (const void *)__ramdisk_end, + .ramdisk_start = (const ptrdiff_t)__ramdisk_start, + .ramdisk_end = (const ptrdiff_t)__ramdisk_end, - .data_shadow_start = (const void *)__data_shadow_start, - .data_shadow_end = (const void *)__data_shadow_end, + .data_shadow_start = (const ptrdiff_t)__data_shadow_start, + .data_shadow_end = (const ptrdiff_t)__data_shadow_end, - .data_start = (const void *)__data_start, - .data_end = (const void *)__data_end, + .data_start = (const ptrdiff_t)__data_start, + .data_end = (const ptrdiff_t)__data_end, - .bss_start = (const void *)__bss_start, - .bss_end = (const void *)__bss_end, + .bss_start = (const ptrdiff_t)__bss_start, + .bss_end = (const ptrdiff_t)__bss_end, - .heap_start = (const void *)__heap_start, - .heap_end = (const void *)__heap_end, + .heap_start = (const ptrdiff_t)__heap_start, + .heap_end = (const ptrdiff_t)__heap_end, - .stack_start = (const void *)__stack_start, - .stack_end = (const void *)__stack_end, + .stack_start = (const ptrdiff_t)__stack_start, + .stack_end = (const ptrdiff_t)__stack_end, }, .pm = { diff --git a/src/arch/arm/mach-mpad/include/configs.h b/src/arch/arm/mach-mpad/include/configs.h index 54e3ce49b5..ddcb78c0b4 100644 --- a/src/arch/arm/mach-mpad/include/configs.h +++ b/src/arch/arm/mach-mpad/include/configs.h @@ -1,22 +1,9 @@ #ifndef __CONFIGS_H__ #define __CONFIGS_H__ -/* - * define the format of endian, little endian or big endian. - */ -#define __LITTLE_ENDIAN -#undef __BIG_ENDIAN - -/* - * define the bits of system, 32bits or 64bits. - */ -#define __SYS_32BIT -#undef __SYS_64BIT - /* * define heap size */ #define CONFIG_HEAP_SIZE (SZ_128M) - #endif /* __CONFIGS_H__ */ diff --git a/src/arch/arm/mach-mpad/mach-mpad.c b/src/arch/arm/mach-mpad/mach-mpad.c index c597f8a165..3afe68b7e2 100644 --- a/src/arch/arm/mach-mpad/mach-mpad.c +++ b/src/arch/arm/mach-mpad/mach-mpad.c @@ -171,13 +171,13 @@ static struct machine mpad = { .res = { .mem_banks = { [0] = { - .start = (void *)(0x30000000), - .end = (void *)(0x30000000 + SZ_256M - 1), + .start = 0x30000000, + .end = 0x30000000 + SZ_256M - 1, }, [1] = { - .start = (void *)(0x40000000), - .end = (void *)(0x40000000 + SZ_256M - 1), + .start = 0x40000000, + .end = 0x40000000 + SZ_256M - 1, }, [2] = { @@ -190,26 +190,26 @@ static struct machine mpad = { }, .link = { - .text_start = (const void *)__text_start, - .text_end = (const void *)__text_end, + .text_start = (const ptrdiff_t)__text_start, + .text_end = (const ptrdiff_t)__text_end, - .ramdisk_start = (const void *)__ramdisk_start, - .ramdisk_end = (const void *)__ramdisk_end, + .ramdisk_start = (const ptrdiff_t)__ramdisk_start, + .ramdisk_end = (const ptrdiff_t)__ramdisk_end, - .data_shadow_start = (const void *)__data_shadow_start, - .data_shadow_end = (const void *)__data_shadow_end, + .data_shadow_start = (const ptrdiff_t)__data_shadow_start, + .data_shadow_end = (const ptrdiff_t)__data_shadow_end, - .data_start = (const void *)__data_start, - .data_end = (const void *)__data_end, + .data_start = (const ptrdiff_t)__data_start, + .data_end = (const ptrdiff_t)__data_end, - .bss_start = (const void *)__bss_start, - .bss_end = (const void *)__bss_end, + .bss_start = (const ptrdiff_t)__bss_start, + .bss_end = (const ptrdiff_t)__bss_end, - .heap_start = (const void *)__heap_start, - .heap_end = (const void *)__heap_end, + .heap_start = (const ptrdiff_t)__heap_start, + .heap_end = (const ptrdiff_t)__heap_end, - .stack_start = (const void *)__stack_start, - .stack_end = (const void *)__stack_end, + .stack_start = (const ptrdiff_t)__stack_start, + .stack_end = (const ptrdiff_t)__stack_end, }, .pm = { diff --git a/src/arch/arm/mach-realview/include/configs.h b/src/arch/arm/mach-realview/include/configs.h index fd9889a671..dc7f2b4141 100644 --- a/src/arch/arm/mach-realview/include/configs.h +++ b/src/arch/arm/mach-realview/include/configs.h @@ -1,22 +1,9 @@ #ifndef __CONFIGS_H__ #define __CONFIGS_H__ -/* - * define the format of endian, little endian or big endian. - */ -#define __LITTLE_ENDIAN -#undef __BIG_ENDIAN - -/* - * define the bits of system, 32bits or 64bits. - */ -#define __SYS_32BIT -#undef __SYS_64BIT - /* * malloc heap size */ -#define CONFIG_HEAP_SIZE (SZ_32M) - +#define CONFIG_HEAP_SIZE (SZ_32M) #endif /* __CONFIGS_H__ */ diff --git a/src/arch/arm/mach-realview/mach-realview.c b/src/arch/arm/mach-realview/mach-realview.c index 88a490e4df..9746ecd19a 100644 --- a/src/arch/arm/mach-realview/mach-realview.c +++ b/src/arch/arm/mach-realview/mach-realview.c @@ -129,8 +129,8 @@ static struct machine realview = { .res = { .mem_banks = { [0] = { - .start = (void *)(0x00000000), - .end = (void *)(0x00000000 + SZ_128M - 1), + .start = 0x00000000, + .end = 0x00000000 + SZ_128M - 1, }, [1] = { @@ -143,26 +143,26 @@ static struct machine realview = { }, .link = { - .text_start = (const void *)__text_start, - .text_end = (const void *)__text_end, + .text_start = (const ptrdiff_t)__text_start, + .text_end = (const ptrdiff_t)__text_end, - .ramdisk_start = (const void *)__ramdisk_start, - .ramdisk_end = (const void *)__ramdisk_end, + .ramdisk_start = (const ptrdiff_t)__ramdisk_start, + .ramdisk_end = (const ptrdiff_t)__ramdisk_end, - .data_shadow_start = (const void *)__data_shadow_start, - .data_shadow_end = (const void *)__data_shadow_end, + .data_shadow_start = (const ptrdiff_t)__data_shadow_start, + .data_shadow_end = (const ptrdiff_t)__data_shadow_end, - .data_start = (const void *)__data_start, - .data_end = (const void *)__data_end, + .data_start = (const ptrdiff_t)__data_start, + .data_end = (const ptrdiff_t)__data_end, - .bss_start = (const void *)__bss_start, - .bss_end = (const void *)__bss_end, + .bss_start = (const ptrdiff_t)__bss_start, + .bss_end = (const ptrdiff_t)__bss_end, - .heap_start = (const void *)__heap_start, - .heap_end = (const void *)__heap_end, + .heap_start = (const ptrdiff_t)__heap_start, + .heap_end = (const ptrdiff_t)__heap_end, - .stack_start = (const void *)__stack_start, - .stack_end = (const void *)__stack_end, + .stack_start = (const ptrdiff_t)__stack_start, + .stack_end = (const ptrdiff_t)__stack_end, }, .pm = { diff --git a/src/arch/arm/mach-sbc2410x/include/configs.h b/src/arch/arm/mach-sbc2410x/include/configs.h index 9e5bac2fc8..b1a4213f98 100644 --- a/src/arch/arm/mach-sbc2410x/include/configs.h +++ b/src/arch/arm/mach-sbc2410x/include/configs.h @@ -1,17 +1,5 @@ #ifndef __CONFIGS_H__ #define __CONFIGS_H__ -/* - * define the format of endian, little endian or big endian. - */ -#define __LITTLE_ENDIAN -#undef __BIG_ENDIAN - -/* - * define the bits of system, 32bits or 64bits. - */ -#define __SYS_32BIT -#undef __SYS_64BIT - #endif /* __CONFIGS_H__ */ diff --git a/src/arch/arm/mach-sbc2410x/include/s3c2410/reg-iis.h b/src/arch/arm/mach-sbc2410x/include/s3c2410/reg-iis.h index c0c4d52921..5908587dec 100644 --- a/src/arch/arm/mach-sbc2410x/include/s3c2410/reg-iis.h +++ b/src/arch/arm/mach-sbc2410x/include/s3c2410/reg-iis.h @@ -8,11 +8,10 @@ #define S3C2410_IISPSR (0x55000008) #define S3C2410_IISFCON (0x5500000c) -#if defined(__LITTLE_ENDIAN) -#define S3C2410_IISFIFO (0x55000010) -#elif defined(__BIG_ENDIAN) +#if (__BYTE_ORDER == __BIG_ENDIAN) #define S3C2410_IISFIFO (0x55000012) +#else +#define S3C2410_IISFIFO (0x55000010) #endif - #endif /* __S3C2410_REG_IIS_H__ */ diff --git a/src/arch/arm/mach-sbc2410x/include/s3c2410/reg-rtc.h b/src/arch/arm/mach-sbc2410x/include/s3c2410/reg-rtc.h index e82699d733..d1e3165e5b 100644 --- a/src/arch/arm/mach-sbc2410x/include/s3c2410/reg-rtc.h +++ b/src/arch/arm/mach-sbc2410x/include/s3c2410/reg-rtc.h @@ -3,28 +3,7 @@ #include -#if defined(__LITTLE_ENDIAN) /* little endian */ - -#define S3C2410_RTCCON (0x57000040) -#define S3C2410_TICNT (0x57000044) -#define S3C2410_RTCALM (0x57000050) -#define S3C2410_ALMSEC (0x57000054) -#define S3C2410_ALMMIN (0x57000058) -#define S3C2410_ALMHOUR (0x5700005c) -#define S3C2410_ALMDATE (0x57000060) -#define S3C2410_ALMMON (0x57000064) -#define S3C2410_ALMYEAR (0x57000068) -#define S3C2410_RTCRST (0x5700006c) -#define S3C2410_BCDSEC (0x57000070) -#define S3C2410_BCDMIN (0x57000074) -#define S3C2410_BCDHOUR (0x57000078) -#define S3C2410_BCDDATE (0x5700007c) -#define S3C2410_BCDDAY (0x57000080) -#define S3C2410_BCDMON (0x57000084) -#define S3C2410_BCDYEAR (0x57000088) - -#elif defined(__BIG_ENDIAN) /* big endian */ - +#if (__BYTE_ORDER == __BIG_ENDIAN) #define S3C2410_RTCCON (0x57000043) #define S3C2410_TICNT (0x57000047) #define S3C2410_RTCALM (0x57000053) @@ -42,7 +21,24 @@ #define S3C2410_BCDDAY (0x57000083) #define S3C2410_BCDMON (0x57000087) #define S3C2410_BCDYEAR (0x5700008b) - +#else +#define S3C2410_RTCCON (0x57000040) +#define S3C2410_TICNT (0x57000044) +#define S3C2410_RTCALM (0x57000050) +#define S3C2410_ALMSEC (0x57000054) +#define S3C2410_ALMMIN (0x57000058) +#define S3C2410_ALMHOUR (0x5700005c) +#define S3C2410_ALMDATE (0x57000060) +#define S3C2410_ALMMON (0x57000064) +#define S3C2410_ALMYEAR (0x57000068) +#define S3C2410_RTCRST (0x5700006c) +#define S3C2410_BCDSEC (0x57000070) +#define S3C2410_BCDMIN (0x57000074) +#define S3C2410_BCDHOUR (0x57000078) +#define S3C2410_BCDDATE (0x5700007c) +#define S3C2410_BCDDAY (0x57000080) +#define S3C2410_BCDMON (0x57000084) +#define S3C2410_BCDYEAR (0x57000088) #endif #endif /* __S3C2410_REG_RTC_H__ */ diff --git a/src/arch/arm/mach-sbc2410x/include/s3c2410/reg-sd.h b/src/arch/arm/mach-sbc2410x/include/s3c2410/reg-sd.h index bfac2f36a1..80ddef4e36 100644 --- a/src/arch/arm/mach-sbc2410x/include/s3c2410/reg-sd.h +++ b/src/arch/arm/mach-sbc2410x/include/s3c2410/reg-sd.h @@ -22,10 +22,10 @@ #define S3C2410_SDIFSTA (0x5a000038) #define S3C2410_SDIIMSK (0x5a000040) -#if defined(__LITTLE_ENDIAN) -#define S3C2410_SDIDAT (0x5a00003c) -#elif defined(__BIG_ENDIAN) +#if (__BYTE_ORDER == __BIG_ENDIAN) #define S3C2410_SDIDAT (0x5a00003f) +#else +#define S3C2410_SDIDAT (0x5a00003c) #endif diff --git a/src/arch/arm/mach-sbc2410x/include/s3c2410/reg-serial.h b/src/arch/arm/mach-sbc2410x/include/s3c2410/reg-serial.h index 08a62f5146..ba1679835c 100644 --- a/src/arch/arm/mach-sbc2410x/include/s3c2410/reg-serial.h +++ b/src/arch/arm/mach-sbc2410x/include/s3c2410/reg-serial.h @@ -13,12 +13,12 @@ #define S3C2410_UFSTAT0 (0x50000018) #define S3C2410_UMSTAT0 (0x5000001C) -#if defined(__LITTLE_ENDIAN) -#define S3C2410_UTXH0 (0x50000020) -#define S3C2410_URXH0 (0x50000024) -#elif defined(__BIG_ENDIAN) +#if (__BYTE_ORDER == __BIG_ENDIAN) #define S3C2410_UTXH0 (0x50000023) #define S3C2410_URXH0 (0x50000027) +#else +#define S3C2410_UTXH0 (0x50000020) +#define S3C2410_URXH0 (0x50000024) #endif #define S3C2410_UBRDIV0 (0x50000028) @@ -33,12 +33,12 @@ #define S3C2410_UFSTAT1 (0x50004018) #define S3C2410_UMSTAT1 (0x5000401C) -#if defined(__LITTLE_ENDIAN) -#define S3C2410_UTXH1 (0x50004020) -#define S3C2410_URXH1 (0x50004024) -#elif defined(__BIG_ENDIAN) +#if (__BYTE_ORDER == __BIG_ENDIAN) #define S3C2410_UTXH1 (0x50004023) #define S3C2410_URXH1 (0x50004027) +#else +#define S3C2410_UTXH1 (0x50004020) +#define S3C2410_URXH1 (0x50004024) #endif #define S3C2410_UBRDIV1 (0x50004028) @@ -53,12 +53,12 @@ #define S3C2410_UFSTAT2 (0x50008018) #define S3C2410_UMSTAT2 (0x5000801C) -#if defined(__LITTLE_ENDIAN) -#define S3C2410_UTXH2 (0x50008020) -#define S3C2410_URXH2 (0x50008024) -#elif defined(__BIG_ENDIAN) +#if (__BYTE_ORDER == __BIG_ENDIAN) #define S3C2410_UTXH2 (0x50008023) #define S3C2410_URXH2 (0x50008027) +#else +#define S3C2410_UTXH2 (0x50008020) +#define S3C2410_URXH2 (0x50008024) #endif #define S3C2410_UBRDIV2 (0x50008028) diff --git a/src/arch/arm/mach-sbc2410x/mach-sbc2410x.c b/src/arch/arm/mach-sbc2410x/mach-sbc2410x.c index b91a435ef1..f1628824be 100644 --- a/src/arch/arm/mach-sbc2410x/mach-sbc2410x.c +++ b/src/arch/arm/mach-sbc2410x/mach-sbc2410x.c @@ -139,8 +139,8 @@ static struct machine sbc2410x = { .res = { .mem_banks = { [0] = { - .start = (void *)(0x30000000), - .end = (void *)(0x30000000 + SZ_64M - 1), + .start = 0x30000000, + .end = 0x30000000 + SZ_64M - 1, }, [1] = { @@ -153,26 +153,26 @@ static struct machine sbc2410x = { }, .link = { - .text_start = (const void *)__text_start, - .text_end = (const void *)__text_end, + .text_start = (const ptrdiff_t)__text_start, + .text_end = (const ptrdiff_t)__text_end, - .ramdisk_start = (const void *)__ramdisk_start, - .ramdisk_end = (const void *)__ramdisk_end, + .ramdisk_start = (const ptrdiff_t)__ramdisk_start, + .ramdisk_end = (const ptrdiff_t)__ramdisk_end, - .data_shadow_start = (const void *)__data_shadow_start, - .data_shadow_end = (const void *)__data_shadow_end, + .data_shadow_start = (const ptrdiff_t)__data_shadow_start, + .data_shadow_end = (const ptrdiff_t)__data_shadow_end, - .data_start = (const void *)__data_start, - .data_end = (const void *)__data_end, + .data_start = (const ptrdiff_t)__data_start, + .data_end = (const ptrdiff_t)__data_end, - .bss_start = (const void *)__bss_start, - .bss_end = (const void *)__bss_end, + .bss_start = (const ptrdiff_t)__bss_start, + .bss_end = (const ptrdiff_t)__bss_end, - .heap_start = (const void *)__heap_start, - .heap_end = (const void *)__heap_end, + .heap_start = (const ptrdiff_t)__heap_start, + .heap_end = (const ptrdiff_t)__heap_end, - .stack_start = (const void *)__stack_start, - .stack_end = (const void *)__stack_end, + .stack_start = (const ptrdiff_t)__stack_start, + .stack_end = (const ptrdiff_t)__stack_end, }, .pm = { diff --git a/src/arch/arm/mach-smdk6410/include/configs.h b/src/arch/arm/mach-smdk6410/include/configs.h index e591fd3d89..bc1d7effbf 100644 --- a/src/arch/arm/mach-smdk6410/include/configs.h +++ b/src/arch/arm/mach-smdk6410/include/configs.h @@ -1,22 +1,9 @@ #ifndef __CONFIGS_H__ #define __CONFIGS_H__ -/* - * define the format of endian, little endian or big endian. - */ -#define __LITTLE_ENDIAN -#undef __BIG_ENDIAN - -/* - * define the bits of system, 32bits or 64bits. - */ -#define __SYS_32BIT -#undef __SYS_64BIT - /* * malloc heap size */ -#define CONFIG_HEAP_SIZE (SZ_1M * 16) - +#define CONFIG_HEAP_SIZE (SZ_1M * 16) #endif /* __CONFIGS_H__ */ diff --git a/src/arch/arm/mach-smdk6410/mach-smdk6410.c b/src/arch/arm/mach-smdk6410/mach-smdk6410.c index fdeb3ef1e3..b56ea4c2ba 100644 --- a/src/arch/arm/mach-smdk6410/mach-smdk6410.c +++ b/src/arch/arm/mach-smdk6410/mach-smdk6410.c @@ -147,8 +147,8 @@ static struct machine smdk6410 = { .res = { .mem_banks = { [0] = { - .start = (void *)(0x50000000), - .end = (void *)(0x50000000 + SZ_128M - 1), + .start = 0x50000000, + .end = 0x50000000 + SZ_128M - 1, }, [1] = { @@ -161,26 +161,26 @@ static struct machine smdk6410 = { }, .link = { - .text_start = (const void *)__text_start, - .text_end = (const void *)__text_end, + .text_start = (const ptrdiff_t)__text_start, + .text_end = (const ptrdiff_t)__text_end, - .ramdisk_start = (const void *)__ramdisk_start, - .ramdisk_end = (const void *)__ramdisk_end, + .ramdisk_start = (const ptrdiff_t)__ramdisk_start, + .ramdisk_end = (const ptrdiff_t)__ramdisk_end, - .data_shadow_start = (const void *)__data_shadow_start, - .data_shadow_end = (const void *)__data_shadow_end, + .data_shadow_start = (const ptrdiff_t)__data_shadow_start, + .data_shadow_end = (const ptrdiff_t)__data_shadow_end, - .data_start = (const void *)__data_start, - .data_end = (const void *)__data_end, + .data_start = (const ptrdiff_t)__data_start, + .data_end = (const ptrdiff_t)__data_end, - .bss_start = (const void *)__bss_start, - .bss_end = (const void *)__bss_end, + .bss_start = (const ptrdiff_t)__bss_start, + .bss_end = (const ptrdiff_t)__bss_end, - .heap_start = (const void *)__heap_start, - .heap_end = (const void *)__heap_end, + .heap_start = (const ptrdiff_t)__heap_start, + .heap_end = (const ptrdiff_t)__heap_end, - .stack_start = (const void *)__stack_start, - .stack_end = (const void *)__stack_end, + .stack_start = (const ptrdiff_t)__stack_start, + .stack_end = (const ptrdiff_t)__stack_end, }, .pm = { diff --git a/src/arch/arm/mach-smdkc100/include/configs.h b/src/arch/arm/mach-smdkc100/include/configs.h index 9e5bac2fc8..b1a4213f98 100644 --- a/src/arch/arm/mach-smdkc100/include/configs.h +++ b/src/arch/arm/mach-smdkc100/include/configs.h @@ -1,17 +1,5 @@ #ifndef __CONFIGS_H__ #define __CONFIGS_H__ -/* - * define the format of endian, little endian or big endian. - */ -#define __LITTLE_ENDIAN -#undef __BIG_ENDIAN - -/* - * define the bits of system, 32bits or 64bits. - */ -#define __SYS_32BIT -#undef __SYS_64BIT - #endif /* __CONFIGS_H__ */ diff --git a/src/arch/arm/mach-smdkc100/mach-smdkc100.c b/src/arch/arm/mach-smdkc100/mach-smdkc100.c index 3d655b01de..4fc66a29bb 100644 --- a/src/arch/arm/mach-smdkc100/mach-smdkc100.c +++ b/src/arch/arm/mach-smdkc100/mach-smdkc100.c @@ -141,8 +141,8 @@ static struct machine smdkc100 = { .res = { .mem_banks = { [0] = { - .start = (void *)(0x20000000), - .end = (void *)(0x20000000 + SZ_256M - 1), + .start = 0x20000000, + .end = 0x20000000 + SZ_256M - 1, }, [1] = { @@ -155,26 +155,26 @@ static struct machine smdkc100 = { }, .link = { - .text_start = (const void *)__text_start, - .text_end = (const void *)__text_end, + .text_start = (const ptrdiff_t)__text_start, + .text_end = (const ptrdiff_t)__text_end, - .ramdisk_start = (const void *)__ramdisk_start, - .ramdisk_end = (const void *)__ramdisk_end, + .ramdisk_start = (const ptrdiff_t)__ramdisk_start, + .ramdisk_end = (const ptrdiff_t)__ramdisk_end, - .data_shadow_start = (const void *)__data_shadow_start, - .data_shadow_end = (const void *)__data_shadow_end, + .data_shadow_start = (const ptrdiff_t)__data_shadow_start, + .data_shadow_end = (const ptrdiff_t)__data_shadow_end, - .data_start = (const void *)__data_start, - .data_end = (const void *)__data_end, + .data_start = (const ptrdiff_t)__data_start, + .data_end = (const ptrdiff_t)__data_end, - .bss_start = (const void *)__bss_start, - .bss_end = (const void *)__bss_end, + .bss_start = (const ptrdiff_t)__bss_start, + .bss_end = (const ptrdiff_t)__bss_end, - .heap_start = (const void *)__heap_start, - .heap_end = (const void *)__heap_end, + .heap_start = (const ptrdiff_t)__heap_start, + .heap_end = (const ptrdiff_t)__heap_end, - .stack_start = (const void *)__stack_start, - .stack_end = (const void *)__stack_end, + .stack_start = (const ptrdiff_t)__stack_start, + .stack_end = (const ptrdiff_t)__stack_end, }, .pm = { diff --git a/src/arch/arm/mach-smdkv210/include/configs.h b/src/arch/arm/mach-smdkv210/include/configs.h index 54e3ce49b5..ddcb78c0b4 100644 --- a/src/arch/arm/mach-smdkv210/include/configs.h +++ b/src/arch/arm/mach-smdkv210/include/configs.h @@ -1,22 +1,9 @@ #ifndef __CONFIGS_H__ #define __CONFIGS_H__ -/* - * define the format of endian, little endian or big endian. - */ -#define __LITTLE_ENDIAN -#undef __BIG_ENDIAN - -/* - * define the bits of system, 32bits or 64bits. - */ -#define __SYS_32BIT -#undef __SYS_64BIT - /* * define heap size */ #define CONFIG_HEAP_SIZE (SZ_128M) - #endif /* __CONFIGS_H__ */ diff --git a/src/arch/arm/mach-smdkv210/mach-smdkv210.c b/src/arch/arm/mach-smdkv210/mach-smdkv210.c index ce90d7fc87..6407da5c39 100644 --- a/src/arch/arm/mach-smdkv210/mach-smdkv210.c +++ b/src/arch/arm/mach-smdkv210/mach-smdkv210.c @@ -148,13 +148,13 @@ static struct machine smdkv210 = { .res = { .mem_banks = { [0] = { - .start = (void *)(0x20000000), - .end = (void *)(0x20000000 + SZ_512M - 1), + .start = 0x20000000, + .end = 0x20000000 + SZ_512M - 1, }, [1] = { - .start = (void *)(0x40000000), - .end = (void *)(0x40000000 + SZ_512M - 1), + .start = 0x40000000, + .end = 0x40000000 + SZ_512M - 1, }, [2] = { @@ -167,26 +167,26 @@ static struct machine smdkv210 = { }, .link = { - .text_start = (const void *)__text_start, - .text_end = (const void *)__text_end, + .text_start = (const ptrdiff_t)__text_start, + .text_end = (const ptrdiff_t)__text_end, - .ramdisk_start = (const void *)__ramdisk_start, - .ramdisk_end = (const void *)__ramdisk_end, + .ramdisk_start = (const ptrdiff_t)__ramdisk_start, + .ramdisk_end = (const ptrdiff_t)__ramdisk_end, - .data_shadow_start = (const void *)__data_shadow_start, - .data_shadow_end = (const void *)__data_shadow_end, + .data_shadow_start = (const ptrdiff_t)__data_shadow_start, + .data_shadow_end = (const ptrdiff_t)__data_shadow_end, - .data_start = (const void *)__data_start, - .data_end = (const void *)__data_end, + .data_start = (const ptrdiff_t)__data_start, + .data_end = (const ptrdiff_t)__data_end, - .bss_start = (const void *)__bss_start, - .bss_end = (const void *)__bss_end, + .bss_start = (const ptrdiff_t)__bss_start, + .bss_end = (const ptrdiff_t)__bss_end, - .heap_start = (const void *)__heap_start, - .heap_end = (const void *)__heap_end, + .heap_start = (const ptrdiff_t)__heap_start, + .heap_end = (const ptrdiff_t)__heap_end, - .stack_start = (const void *)__stack_start, - .stack_end = (const void *)__stack_end, + .stack_start = (const ptrdiff_t)__stack_start, + .stack_end = (const ptrdiff_t)__stack_end, }, .pm = { diff --git a/src/include/byteorder.h b/src/include/byteorder.h index 407d648f22..687d5090ae 100644 --- a/src/include/byteorder.h +++ b/src/include/byteorder.h @@ -44,20 +44,7 @@ static inline u32_t __swahb32(u32_t x) return ( ((x & (u32_t)0x00ff00ffUL)<<8) | ((x & (u32_t)0xff00ff00UL)>>8) ); } -#if defined(__LITTLE_ENDIAN) -#define cpu_to_le64(x) ((u64_t)(x)) -#define le64_to_cpu(x) ((u64_t)(x)) -#define cpu_to_le32(x) ((u32_t)(x)) -#define le32_to_cpu(x) ((u32_t)(x)) -#define cpu_to_le16(x) ((u16_t)(x)) -#define le16_to_cpu(x) ((u16_t)(x)) -#define cpu_to_be64(x) (__swab64((u64_t)(x))) -#define be64_to_cpu(x) (__swab64((u64_t)(x))) -#define cpu_to_be32(x) (__swab32((u32_t)(x))) -#define be32_to_cpu(x) (__swab32((u32_t)(x))) -#define cpu_to_be16(x) (__swab16((u16_t)(x))) -#define be16_to_cpu(x) (__swab16((u16_t)(x))) -#elif defined(__BIG_ENDIAN) +#if (__BYTE_ORDER == __BIG_ENDIAN) #define cpu_to_le64(x) (__swab64((u64_t)(x))) #define le64_to_cpu(x) (__swab64((u64_t)(x))) #define cpu_to_le32(x) (__swab32((u32_t)(x))) @@ -70,6 +57,19 @@ static inline u32_t __swahb32(u32_t x) #define be32_to_cpu(x) ((u32_t)(x)) #define cpu_to_be16(x) ((u32_t)(x)) #define be16_to_cpu(x) ((u32_t)(x)) +#else +#define cpu_to_le64(x) ((u64_t)(x)) +#define le64_to_cpu(x) ((u64_t)(x)) +#define cpu_to_le32(x) ((u32_t)(x)) +#define le32_to_cpu(x) ((u32_t)(x)) +#define cpu_to_le16(x) ((u16_t)(x)) +#define le16_to_cpu(x) ((u16_t)(x)) +#define cpu_to_be64(x) (__swab64((u64_t)(x))) +#define be64_to_cpu(x) (__swab64((u64_t)(x))) +#define cpu_to_be32(x) (__swab32((u32_t)(x))) +#define be32_to_cpu(x) (__swab32((u32_t)(x))) +#define cpu_to_be16(x) (__swab16((u16_t)(x))) +#define be16_to_cpu(x) (__swab16((u16_t)(x))) #endif #endif /* __BYTEORDER_H__ */ diff --git a/src/include/xboot.h b/src/include/xboot.h index dada6e7316..1256541c93 100644 --- a/src/include/xboot.h +++ b/src/include/xboot.h @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -372,22 +373,4 @@ #define CONFIG_MTD_NAND_ECC_SMC (0) #endif -/* - * check the define of __LITTLE_ENDIAN and __BIG_ENDIAN - */ -#if ( defined(__LITTLE_ENDIAN) && defined(__BIG_ENDIAN) ) -#error "please don't define __LITTLE_ENDIAN and __BIG_ENDIAN at the same time"; -#elif ( !defined(__LITTLE_ENDIAN) && !defined(__BIG_ENDIAN) ) -#error "you must define __LITTLE_ENDIAN or __BIG_ENDIAN before continue"; -#endif - -/* - * check the define of __SYS_32BIT and __SYS_64BIT - */ -#if ( defined(__SYS_32BIT) && defined(__SYS_64BIT) ) -#error "please don't define __SYS_32BIT and __SYS_64BIT at the same time"; -#elif ( !defined(__SYS_32BIT) && !defined(__SYS_64BIT) ) -#error "you must define __SYS_32BIT or __SYS_32BIT before continue"; -#endif - #endif /* __XBOOT_H__ */ diff --git a/src/include/xboot/machine.h b/src/include/xboot/machine.h index 3846724ad7..bf3e64705f 100644 --- a/src/include/xboot/machine.h +++ b/src/include/xboot/machine.h @@ -27,8 +27,8 @@ struct machine { */ struct { struct { - const void * start; - const void * end; + const ptrdiff_t start; + const ptrdiff_t end; } mem_banks[8]; /* extern crystal */ @@ -39,26 +39,26 @@ struct machine { * link information */ struct { - const void * text_start; - const void * text_end; + const ptrdiff_t text_start; + const ptrdiff_t text_end; - const void * ramdisk_start; - const void * ramdisk_end; + const ptrdiff_t ramdisk_start; + const ptrdiff_t ramdisk_end; - const void * data_shadow_start; - const void * data_shadow_end; + const ptrdiff_t data_shadow_start; + const ptrdiff_t data_shadow_end; - const void * data_start; - const void * data_end; + const ptrdiff_t data_start; + const ptrdiff_t data_end; - const void * bss_start; - const void * bss_end; + const ptrdiff_t bss_start; + const ptrdiff_t bss_end; - const void * heap_start; - const void * heap_end; + const ptrdiff_t heap_start; + const ptrdiff_t heap_end; - const void * stack_start; - const void * stack_end; + const ptrdiff_t stack_start; + const ptrdiff_t stack_end; }link; /* diff --git a/src/kernel/core/machine.c b/src/kernel/core/machine.c index b6ae2c7e95..7e10010096 100644 --- a/src/kernel/core/machine.c +++ b/src/kernel/core/machine.c @@ -201,40 +201,16 @@ static s32_t machine_proc_read(u8_t * buf, s32_t offset, s32_t count) len += sprintf((char *)(p + len), (const char *)" cpu desc : %s\r\n", __machine->info.cpu_desc); len += sprintf((char *)(p + len), (const char *)" cpu id : %s\r\n", __machine->info.cpu_id); -#if defined(__SYS_32BIT) for(i = 0; i < ARRAY_SIZE(get_machine()->res.mem_banks); i++) { if( (__machine->res.mem_banks[i].start == 0) && (__machine->res.mem_banks[i].end == 0) ) break; - len += sprintf((char *)(p + len), (const char *)" memory bank%ld start : 0x%08lx\r\n", i, (u32_t)__machine->res.mem_banks[i].start); - len += sprintf((char *)(p + len), (const char *)" memory bank%ld end : 0x%08lx\r\n", i, (u32_t)__machine->res.mem_banks[i].end); + len += sprintf((char *)(p + len), (const char *)" memory bank%ld start : %p\r\n", i, (void *)__machine->res.mem_banks[i].start); + len += sprintf((char *)(p + len), (const char *)" memory bank%ld end : %p\r\n", i, (void *)__machine->res.mem_banks[i].end); ssize(size, (u64_t)(__machine->res.mem_banks[i].end - __machine->res.mem_banks[i].start + 1)); len += sprintf((char *)(p + len), (const char *)" memory bank%ld size : %s\r\n", i, size); } -#elif defined(__SYS_64BIT) - for(i = 0; i < ARRAY_SIZE(get_machine()->res.mem_banks); i++) - { - if( (__machine->res.mem_banks[i].start == 0) && (__machine->res.mem_banks[i].end == 0) ) - break; - - len += sprintf((char *)(p + len), (const char *)" memory bank%ld start : 0x%016Lx\r\n", i, (u64_t)__machine->res.mem_banks[i].start); - len += sprintf((char *)(p + len), (const char *)" memory bank%ld end : 0x%016Lx\r\n", i, (u64_t)__machine->res.mem_banks[i].end); - ssize(size, (u64_t)(__machine->res.mem_banks[i].end - __machine->res.mem_banks[i].start + 1)); - len += sprintf((char *)(p + len), (const char *)" memory bank%ld size : %s\r\n", i, size); - } -#endif - -#if defined(__LITTLE_ENDIAN) - len += sprintf((char *)(p + len), (const char *)" endian format : little endian\r\n"); -#elif defined(__BIG_ENDIAN) - len += sprintf((char *)(p + len), (const char *)" endian format : big endian\r\n"); -#endif -#if defined(__SYS_32BIT) - len += sprintf((char *)(p + len), (const char *)" system width : 32bits"); -#elif defined(__SYS_64BIT) - len += sprintf((char *)(p + len), (const char *)" system width : 64bits"); -#endif len -= offset; @@ -270,77 +246,40 @@ static s32_t link_proc_read(u8_t * buf, s32_t offset, s32_t count) if((p = malloc(SZ_4K)) == NULL) return 0; -#if defined(__SYS_32BIT) - len += sprintf((char *)(p + len), (const char *)" text start : 0x%08lx\r\n", (u32_t)__machine->link.text_start); - len += sprintf((char *)(p + len), (const char *)" text end : 0x%08lx\r\n", (u32_t)__machine->link.text_end); + len += sprintf((char *)(p + len), (const char *)" text start : %p\r\n", (void *)__machine->link.text_start); + len += sprintf((char *)(p + len), (const char *)" text end : %p\r\n", (void *)__machine->link.text_end); ssize(size, (u64_t)(__machine->link.text_end - __machine->link.text_start + 1)); len += sprintf((char *)(p + len), (const char *)" text size : %s\r\n", size); - len += sprintf((char *)(p + len), (const char *)" ramdisk start: 0x%08lx\r\n", (u32_t)__machine->link.ramdisk_start); - len += sprintf((char *)(p + len), (const char *)" ramdisk end : 0x%08lx\r\n", (u32_t)__machine->link.ramdisk_end); + len += sprintf((char *)(p + len), (const char *)" ramdisk start: %p\r\n", (void *)__machine->link.ramdisk_start); + len += sprintf((char *)(p + len), (const char *)" ramdisk end : %p\r\n", (void *)__machine->link.ramdisk_end); ssize(size, (u64_t)(__machine->link.ramdisk_end - __machine->link.ramdisk_start + 1)); len += sprintf((char *)(p + len), (const char *)" ramdisk size : %s\r\n", size); - len += sprintf((char *)(p + len), (const char *)" data' start : 0x%08lx\r\n", (u32_t)__machine->link.data_shadow_start); - len += sprintf((char *)(p + len), (const char *)" data' end : 0x%08lx\r\n", (u32_t)__machine->link.data_shadow_end); - ssize(size, (u64_t)(__machine->link.data_shadow_end - __machine->link.data_shadow_start + 1)); - len += sprintf((char *)(p + len), (const char *)" data' size : %s\r\n", size); - - len += sprintf((char *)(p + len), (const char *)" data start : 0x%08lx\r\n", (u32_t)__machine->link.data_start); - len += sprintf((char *)(p + len), (const char *)" data end : 0x%08lx\r\n", (u32_t)__machine->link.data_end); - ssize(size, (u64_t)(__machine->link.data_end - __machine->link.data_start + 1)); - len += sprintf((char *)(p + len), (const char *)" data size : %s\r\n", size); - - len += sprintf((char *)(p + len), (const char *)" bss start : 0x%08lx\r\n", (u32_t)__machine->link.bss_start); - len += sprintf((char *)(p + len), (const char *)" bss end : 0x%08lx\r\n", (u32_t)__machine->link.bss_end); - ssize(size, (u64_t)(__machine->link.bss_end - __machine->link.bss_start + 1)); - len += sprintf((char *)(p + len), (const char *)" bss size : %s\r\n", size); - - len += sprintf((char *)(p + len), (const char *)" heap start : 0x%08lx\r\n", (u32_t)__machine->link.heap_start); - len += sprintf((char *)(p + len), (const char *)" heap end : 0x%08lx\r\n", (u32_t)__machine->link.heap_end); - ssize(size, (u64_t)(__machine->link.heap_end - __machine->link.heap_start + 1)); - len += sprintf((char *)(p + len), (const char *)" heap size : %s\r\n", size); - - len += sprintf((char *)(p + len), (const char *)" stack start : 0x%08lx\r\n", (u32_t)__machine->link.stack_start); - len += sprintf((char *)(p + len), (const char *)" stack end : 0x%08lx\r\n", (u32_t)__machine->link.stack_end); - ssize(size, (u64_t)(__machine->link.stack_end - __machine->link.stack_start + 1)); - len += sprintf((char *)(p + len), (const char *)" stack size : %s", size); -#elif defined(__SYS_64BIT) - len += sprintf((char *)(p + len), (const char *)" text start : 0x%016Lx\r\n", (u64_t)__machine->link.text_start); - len += sprintf((char *)(p + len), (const char *)" text end : 0x%016Lx\r\n", (u64_t)__machine->link.text_end); - ssize(size, (u64_t)(__machine->link.text_end - __machine->link.text_start + 1)); - len += sprintf((char *)(p + len), (const char *)" text size : %s\r\n", size); - - len += sprintf((char *)(p + len), (const char *)" ramdisk start: 0x%016Lx\r\n", (u64_t)__machine->link.ramdisk_start); - len += sprintf((char *)(p + len), (const char *)" ramdisk end : 0x%016Lx\r\n", (u64_t)__machine->link.ramdisk_end); - ssize(size, (u64_t)(__machine->link.ramdisk_end - __machine->link.ramdisk_start + 1)); - len += sprintf((char *)(p + len), (const char *)" ramdisk size : %s\r\n", size); - - len += sprintf((char *)(p + len), (const char *)" data' start : 0x%016Lx\r\n", (u64_t)__machine->link.data_shadow_start); - len += sprintf((char *)(p + len), (const char *)" data' end : 0x%016Lx\r\n", (u64_t)__machine->link.data_shadow_end); + len += sprintf((char *)(p + len), (const char *)" data' start : %p\r\n", (void *)__machine->link.data_shadow_start); + len += sprintf((char *)(p + len), (const char *)" data' end : %p\r\n", (void *)__machine->link.data_shadow_end); ssize(size, (u64_t)(__machine->link.data_shadow_end - __machine->link.data_shadow_start + 1)); len += sprintf((char *)(p + len), (const char *)" data' size : %s\r\n", size); - len += sprintf((char *)(p + len), (const char *)" data start : 0x%016Lx\r\n", (u64_t)__machine->link.data_start); - len += sprintf((char *)(p + len), (const char *)" data end : 0x%016Lx\r\n", (u64_t)__machine->link.data_end); + len += sprintf((char *)(p + len), (const char *)" data start : %p\r\n", (void *)__machine->link.data_start); + len += sprintf((char *)(p + len), (const char *)" data end : %p\r\n", (void *)__machine->link.data_end); ssize(size, (u64_t)(__machine->link.data_end - __machine->link.data_start + 1)); len += sprintf((char *)(p + len), (const char *)" data size : %s\r\n", size); - len += sprintf((char *)(p + len), (const char *)" bss start : 0x%016Lx\r\n", (u64_t)__machine->link.bss_start); - len += sprintf((char *)(p + len), (const char *)" bss end : 0x%016Lx\r\n", (u64_t)__machine->link.bss_end); + len += sprintf((char *)(p + len), (const char *)" bss start : %p\r\n", (void *)__machine->link.bss_start); + len += sprintf((char *)(p + len), (const char *)" bss end : %p\r\n", (void *)__machine->link.bss_end); ssize(size, (u64_t)(__machine->link.bss_end - __machine->link.bss_start + 1)); len += sprintf((char *)(p + len), (const char *)" bss size : %s\r\n", size); - len += sprintf((char *)(p + len), (const char *)" heap start : 0x%016Lx\r\n", (u64_t)__machine->link.heap_start); - len += sprintf((char *)(p + len), (const char *)" heap end : 0x%016Lx\r\n", (u64_t)__machine->link.heap_end); + len += sprintf((char *)(p + len), (const char *)" heap start : %p\r\n", (void *)__machine->link.heap_start); + len += sprintf((char *)(p + len), (const char *)" heap end : %p\r\n", (void *)__machine->link.heap_end); ssize(size, (u64_t)(__machine->link.heap_end - __machine->link.heap_start + 1)); len += sprintf((char *)(p + len), (const char *)" heap size : %s\r\n", size); - len += sprintf((char *)(p + len), (const char *)" stack start : 0x%016Lx\r\n", (u64_t)__machine->link.stack_start); - len += sprintf((char *)(p + len), (const char *)" stack end : 0x%016Lx\r\n", (u64_t)__machine->link.stack_end); + len += sprintf((char *)(p + len), (const char *)" stack start : %p\r\n", (void *)__machine->link.stack_start); + len += sprintf((char *)(p + len), (const char *)" stack end : %p\r\n", (void *)__machine->link.stack_end); ssize(size, (u64_t)(__machine->link.stack_end - __machine->link.stack_start + 1)); len += sprintf((char *)(p + len), (const char *)" stack size : %s", size); -#endif len -= offset;