From: wdenk Date: Tue, 23 Oct 2001 11:55:03 +0000 (+0000) Subject: Fixes for Eric Theisen patches X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=113acc24a95e81e71754a7cee4ac4172f53e8bf5;p=users%2Frw%2Fppcboot.git Fixes for Eric Theisen patches --- diff --git a/MAKEALL b/MAKEALL index 375a721..a46ec7b 100755 --- a/MAKEALL +++ b/MAKEALL @@ -14,7 +14,7 @@ LIST="" ## MPC8xx Systems ######################################################################### -LIST="$LIST \ +LIST_8xx=" \ ADS860 AMX860 CCM cogent_mpc8xx \ ESTEEM192E ETX094 FADS823 FADS850SAR \ FADS860T FLAGADM FPS850L GENIETV \ @@ -29,7 +29,7 @@ LIST="$LIST \ ## PPC4xx Systems ######################################################################### -LIST="$LIST \ +LIST_4xx=" \ ADCIOP AR405 \ CANBT CPCI405 \ CPCIISER4 CRAYL1 \ @@ -43,7 +43,7 @@ LIST="$LIST \ ## MPC8240 Systems ######################################################################### -LIST="$LIST \ +LIST_8240=" \ CU824 \ MOUSSE \ Sandpoint8240 \ @@ -53,7 +53,7 @@ LIST="$LIST \ ## MPC8260 Systems ######################################################################### -LIST="$LIST \ +LIST_8260=" \ cogent_mpc8260 \ hymod \ MPC8260ADS \ @@ -68,16 +68,37 @@ LIST="$LIST \ ## MPC74xx Systems ######################################################################### -LIST="$LIST \ - EVB64260 \ +LIST_74xx=" \ + EVB64260 \ " -[ $# = 0 ] && set $LIST +LIST_all="${LIST_8xx} ${LIST_8240} ${LIST_8260} ${LIST_4xx}" + +[ $# = 0 ] && set $LIST_all + +#----------------------------------------------------------------------- + +function build_target() { + target=$1 -for target in $@ -do ${MAKE} distclean >/dev/null ${MAKE} ${target}_config ${MAKE} all 2>&1 >LOG/$target.MAKELOG | tee LOG/$target.ERR ${CROSS_COMPILE:-powerpc-linux-}size ppcboot | tee -a LOG/$target.MAKELOG +} + +#----------------------------------------------------------------------- + + +for arg in $@ +do + case "$arg" in + 8xx|8240|8260|4xx|74xx) for target in `eval echo '$LIST_'${arg}` + do + build_target ${target} + done + ;; + *) build_target ${arg} + ;; + esac done diff --git a/Makefile b/Makefile index a33cfe7..850dfe7 100644 --- a/Makefile +++ b/Makefile @@ -132,7 +132,7 @@ unconfig: ADS860_config: unconfig @echo "Configuring for $(@:_config=) Board..." ; \ - cd include ; \ + cd ./include ; \ echo "ARCH = ppc" > config.mk ; \ echo "BOARD = fads" >>config.mk ; \ echo "CPU = mpc8xx" >>config.mk ; \ @@ -140,7 +140,7 @@ ADS860_config: unconfig AMX860_config : unconfig @echo "Configuring for $(@:_config=) Board..." ; \ - cd include ; \ + cd ./include ; \ echo "ARCH = ppc" > config.mk ; \ echo "BOARD = amx860" >>config.mk ; \ echo "CPU = mpc8xx" >>config.mk ; \ @@ -149,7 +149,7 @@ AMX860_config : unconfig CCM_config: unconfig @echo "Configuring for $(@:_config=) Board..." ; \ - cd include ; \ + cd ./include ; \ echo "ARCH = ppc" > config.mk ; \ echo "BOARD = CCM" >>config.mk ; \ echo "CPU = mpc8xx" >>config.mk ; \ @@ -158,7 +158,7 @@ CCM_config: unconfig cogent_mpc8xx_config: unconfig @echo "Configuring for $(@:_config=) Board..." ; \ - cd include ; \ + cd ./include ; \ echo "ARCH = ppc" > config.mk ; \ echo "BOARD = cogent" >>config.mk ; \ echo "CPU = mpc8xx" >>config.mk ; \ @@ -166,7 +166,7 @@ cogent_mpc8xx_config: unconfig ESTEEM192E_config: unconfig @echo "Configuring for $(@:_config=) Board..." ; \ - cd include ; \ + cd ./include ; \ echo "ARCH = ppc" > config.mk ; \ echo "BOARD = esteem192e" >>config.mk ; \ echo "CPU = mpc8xx" >>config.mk ; \ @@ -174,7 +174,7 @@ ESTEEM192E_config: unconfig ETX094_config : unconfig @echo "Configuring for $(@:_config=) Board..." ; \ - cd include ; \ + cd ./include ; \ echo "ARCH = ppc" > config.mk ; \ echo "BOARD = etx094" >>config.mk ; \ echo "CPU = mpc8xx" >>config.mk ; \ @@ -184,7 +184,7 @@ FADS823_config \ FADS850SAR_config \ FADS860T_config: unconfig @echo "Configuring for $(@:_config=) Board..." ; \ - cd include ; \ + cd ./include ; \ echo "ARCH = ppc" > config.mk ; \ echo "BOARD = fads" >>config.mk ; \ echo "CPU = mpc8xx" >>config.mk ; \ @@ -192,7 +192,7 @@ FADS860T_config: unconfig FLAGADM_config: unconfig @echo "Configuring for $(@:_config=) Board..." ; \ - cd include ; \ + cd ./include ; \ echo "ARCH = ppc" > config.mk ; \ echo "BOARD = flagadm" >>config.mk ; \ echo "CPU = mpc8xx" >>config.mk ; \ @@ -200,7 +200,7 @@ FLAGADM_config: unconfig GENIETV_config: unconfig @echo "Configuring for $(@:_config=) Board..." ; \ - cd include ; \ + cd ./include ; \ echo "ARCH = ppc" > config.mk ; \ echo "BOARD = genietv" >>config.mk ; \ echo "CPU = mpc8xx" >>config.mk ; \ @@ -208,7 +208,7 @@ GENIETV_config: unconfig GTH_config: unconfig @echo "Configuring for $(@:_config=) Board..." ; \ - cd include ; \ + cd ./include ; \ echo "ARCH = ppc" > config.mk ; \ echo "BOARD = gth" >>config.mk ; \ echo "CPU = mpc8xx" >>config.mk ; \ @@ -216,7 +216,7 @@ GTH_config: unconfig hermes_config : unconfig @echo "Configuring for $(@:_config=) Board..." ; \ - cd include ; \ + cd ./include ; \ echo "ARCH = ppc" > config.mk ; \ echo "BOARD = hermes" >>config.mk ; \ echo "CPU = mpc8xx" >>config.mk ; \ @@ -224,7 +224,7 @@ hermes_config : unconfig ICU862_config: unconfig @echo "Configuring for $(@:_config=) Board..." ; \ - cd include ; \ + cd ./include ; \ echo "ARCH = ppc" > config.mk ; \ echo "BOARD = icu862" >>config.mk ; \ echo "CPU = mpc8xx" >>config.mk ; \ @@ -232,7 +232,7 @@ ICU862_config: unconfig IP860_config : unconfig @echo "Configuring for $(@:_config=) Board..." ; \ - cd include ; \ + cd ./include ; \ echo "ARCH = ppc" > config.mk ; \ echo "BOARD = ip860" >>config.mk ; \ echo "CPU = mpc8xx" >>config.mk ; \ @@ -240,7 +240,7 @@ IP860_config : unconfig IVML24_config: unconfig @echo "Configuring for $(@:_config=) Board..." ; \ - cd include ; \ + cd ./include ; \ echo "ARCH = ppc" > config.mk ; \ echo "BOARD = ivms8" >>config.mk ; \ echo "CPU = mpc8xx" >>config.mk ; \ @@ -248,7 +248,7 @@ IVML24_config: unconfig IVMS8_config: unconfig @echo "Configuring for $(@:_config=) Board..." ; \ - cd include ; \ + cd ./include ; \ echo "ARCH = ppc" > config.mk ; \ echo "BOARD = ivms8" >>config.mk ; \ echo "CPU = mpc8xx" >>config.mk ; \ @@ -256,7 +256,7 @@ IVMS8_config: unconfig LANTEC_config : unconfig @echo "Configuring for $(@:_config=) Board..." ; \ - cd include ; \ + cd ./include ; \ echo "ARCH = ppc" > config.mk ; \ echo "BOARD = lantec" >>config.mk ; \ echo "CPU = mpc8xx" >>config.mk ; \ @@ -264,7 +264,7 @@ LANTEC_config : unconfig lwmon_config: unconfig @echo "Configuring for $(@:_config=) Board..." ; \ - cd include ; \ + cd ./include ; \ echo "ARCH = ppc" > config.mk ; \ echo "BOARD = lwmon" >>config.mk ; \ echo "CPU = mpc8xx" >>config.mk ; \ @@ -273,7 +273,7 @@ lwmon_config: unconfig MBX_config \ MBX860T_config: unconfig @echo "Configuring for $(@:_config=) Board..." ; \ - cd include ; \ + cd ./include ; \ echo "ARCH = ppc" > config.mk ; \ echo "BOARD = mbx8xx" >>config.mk ; \ echo "CPU = mpc8xx" >>config.mk ; \ @@ -281,7 +281,7 @@ MBX860T_config: unconfig NX823_config : unconfig @echo "Configuring for $(@:_config=) Board..." ; \ - cd include ; \ + cd ./include ; \ echo "ARCH = ppc" > config.mk ; \ echo "BOARD = nx823" >>config.mk ; \ echo "CPU = mpc8xx" >>config.mk ; \ @@ -289,7 +289,7 @@ NX823_config : unconfig pcu_e_config: unconfig @echo "Configuring for $(@:_config=) Board..." ; \ - cd include ; \ + cd ./include ; \ echo "ARCH = ppc" > config.mk ; \ echo "BOARD = pcu_e" >>config.mk ; \ echo "CPU = mpc8xx" >>config.mk ; \ @@ -298,7 +298,7 @@ pcu_e_config: unconfig RPXlite_config: unconfig @echo "Configuring for $(@:_config=) Board..." ; \ - cd include ; \ + cd ./include ; \ echo "ARCH = ppc" > config.mk ; \ echo "BOARD = RPXlite" >>config.mk ; \ echo "CPU = mpc8xx" >>config.mk ; \ @@ -306,7 +306,7 @@ RPXlite_config: unconfig SM850_config : unconfig @echo "Configuring for $(@:_config=) Board..." ; \ - cd include ; \ + cd ./include ; \ echo "ARCH = ppc" > config.mk ; \ echo "BOARD = tqm8xx" >>config.mk ; \ echo "CPU = mpc8xx" >>config.mk ; \ @@ -314,7 +314,7 @@ SM850_config : unconfig SPD823TS_config: unconfig @echo "Configuring for $(@:_config=) Board..." ; \ - cd include ; \ + cd ./include ; \ echo "ARCH = ppc" > config.mk ; \ echo "BOARD = spd8xx" >>config.mk ; \ echo "CPU = mpc8xx" >>config.mk ; \ @@ -322,7 +322,7 @@ SPD823TS_config: unconfig SXNI855T_config: unconfig @echo "Configuring for $(@:_config=) Board..." ; \ - cd include ; \ + cd ./include ; \ echo "ARCH = ppc" > config.mk ; \ echo "BOARD = sixnet" >>config.mk ; \ echo "CPU = mpc8xx" >>config.mk ; \ @@ -334,7 +334,7 @@ TQM850L_config \ TQM855L_config \ TQM860L_config : unconfig @echo "Configuring for $(@:_config=) Board..." ; \ - cd include ; \ + cd ./include ; \ echo "ARCH = ppc" > config.mk ; \ echo "BOARD = tqm8xx" >>config.mk ; \ echo "CPU = mpc8xx" >>config.mk ; \ @@ -346,7 +346,7 @@ TQM860L_config : unconfig ADCIOP_config: unconfig @echo "Configuring for $(@:_config=) Board..." ; \ - cd include ; \ + cd ./include ; \ echo "ARCH = ppc" > config.mk ; \ echo "BOARD = adciop" >>config.mk ; \ echo "CPU = ppc4xx" >>config.mk ; \ @@ -355,7 +355,7 @@ ADCIOP_config: unconfig AR405_config: unconfig @echo "Configuring for $(@:_config=) Board..." ; \ - cd include ; \ + cd ./include ; \ echo "ARCH = ppc" > config.mk ; \ echo "BOARD = ar405" >>config.mk ; \ echo "CPU = ppc4xx" >>config.mk ; \ @@ -364,7 +364,7 @@ AR405_config: unconfig CANBT_config: unconfig @echo "Configuring for $(@:_config=) Board..." ; \ - cd include ; \ + cd ./include ; \ echo "ARCH = ppc" > config.mk ; \ echo "BOARD = canbt" >>config.mk ; \ echo "CPU = ppc4xx" >>config.mk ; \ @@ -373,7 +373,7 @@ CANBT_config: unconfig CPCI405_config: unconfig @echo "Configuring for $(@:_config=) Board..." ; \ - cd include ; \ + cd ./include ; \ echo "ARCH = ppc" > config.mk ; \ echo "BOARD = cpci405" >>config.mk ; \ echo "CPU = ppc4xx" >>config.mk ; \ @@ -382,7 +382,7 @@ CPCI405_config: unconfig CPCIISER4_config: unconfig @echo "Configuring for $(@:_config=) Board..." ; \ - cd include ; \ + cd ./include ; \ echo "ARCH = ppc" > config.mk ; \ echo "BOARD = cpciiser4">>config.mk ; \ echo "CPU = ppc4xx" >>config.mk ; \ @@ -391,7 +391,7 @@ CPCIISER4_config: unconfig CRAYL1_config:unconfig @echo "Configuring for $(@:_config=) Board..(SV2 L1)." ; \ - cd include ; \ + cd ./include ; \ echo "ARCH = ppc" > config.mk ; \ echo "BOARD = L1" >>config.mk ; \ echo "CPU = ppc4xx" >>config.mk ; \ @@ -400,7 +400,7 @@ CRAYL1_config:unconfig DASA_SIM_config: unconfig @echo "Configuring for $(@:_config=) Board..." ; \ - cd include ; \ + cd ./include ; \ echo "ARCH = ppc" > config.mk ; \ echo "BOARD = dasa_sim" >>config.mk ; \ echo "CPU = ppc4xx" >>config.mk ; \ @@ -409,7 +409,7 @@ DASA_SIM_config: unconfig ERIC_config:unconfig @echo "Configuring for $(@:_config=) Board..." ; \ - cd include ; \ + cd ./include ; \ echo "ARCH = ppc" > config.mk ; \ echo "BOARD = eric" >>config.mk ; \ echo "CPU = ppc4xx" >>config.mk ; \ @@ -417,7 +417,7 @@ ERIC_config:unconfig OCRTC_config: unconfig @echo "Configuring for $(@:_config=) Board..." ; \ - cd include ; \ + cd ./include ; \ echo "ARCH = ppc" > config.mk ; \ echo "BOARD = ocrtc">>config.mk ; \ echo "CPU = ppc4xx" >>config.mk ; \ @@ -426,23 +426,16 @@ OCRTC_config: unconfig PIP405_config:unconfig @echo "Configuring for $(@:_config=) Board..." ; \ - cd include ; \ + cd ./include ; \ echo "ARCH = ppc" > config.mk ; \ echo "BOARD = pip405" >>config.mk ; \ echo "CPU = ppc4xx" >>config.mk ; \ echo "#include " >config.h +W7OLMC_config \ W7OLMG_config: unconfig @echo "Configuring for $(@:_config=) Board..." ; \ - cd include ; \ - echo "ARCH = ppc" > config.mk ; \ - echo "BOARD = w7o" >>config.mk ; \ - echo "CPU = ppc4xx" >>config.mk ; \ - echo "#include " >config.h - -W7OLMC_config: unconfig - @echo "Configuring for $(@:_config=) Board..." ; \ - cd include ; \ + cd ./include ; \ echo "ARCH = ppc" > config.mk ; \ echo "BOARD = w7o" >>config.mk ; \ echo "CPU = ppc4xx" >>config.mk ; \ @@ -450,7 +443,7 @@ W7OLMC_config: unconfig WALNUT405_config:unconfig @echo "Configuring for $(@:_config=) Board..." ; \ - cd include ; \ + cd ./include ; \ echo "ARCH = ppc" > config.mk ; \ echo "BOARD = walnut405">>config.mk ; \ echo "CPU = ppc4xx" >>config.mk ; \ @@ -462,7 +455,7 @@ WALNUT405_config:unconfig CU824_config: unconfig @echo "Configuring for $(@:_config=) Board..." ; \ - cd include ; \ + cd ./include ; \ echo "ARCH = ppc" > config.mk ; \ echo "BOARD = cu824" >>config.mk ; \ echo "CPU = mpc8240" >>config.mk ; \ @@ -470,7 +463,7 @@ CU824_config: unconfig MOUSSE_config: unconfig @echo "Configuring for $(@:_config=) Board..." ; \ - cd include ; \ + cd ./include ; \ echo "ARCH = ppc" > config.mk ; \ echo "BOARD = mousse" >>config.mk ; \ echo "CPU = mpc8240" >>config.mk ; \ @@ -478,7 +471,7 @@ MOUSSE_config: unconfig Sandpoint8240_config: unconfig @echo "Configuring for $(@:_config=) Board..." ; \ - cd include ; \ + cd ./include ; \ echo "ARCH = ppc" > config.mk ; \ echo "BOARD = sandpoint" >>config.mk ; \ echo "CPU = mpc8240" >>config.mk ; \ @@ -490,7 +483,7 @@ Sandpoint8240_config: unconfig cogent_mpc8260_config: unconfig @echo "Configuring for $(@:_config=) Board..." ; \ - cd include ; \ + cd ./include ; \ echo "ARCH = ppc" > config.mk ; \ echo "BOARD = cogent" >>config.mk ; \ echo "CPU = mpc8260" >>config.mk ; \ @@ -498,7 +491,7 @@ cogent_mpc8260_config: unconfig hymod_config: unconfig @echo "Configuring for $(@:_config=) Board..." ; \ - cd include ; \ + cd ./include ; \ echo "ARCH = ppc" > config.mk ; \ echo "BOARD = hymod" >>config.mk ; \ echo "CPU = mpc8260" >>config.mk ; \ @@ -506,7 +499,7 @@ hymod_config: unconfig MPC8260ADS_config: unconfig @echo "Configuring for $(@:_config=) Board..." ; \ - cd include ; \ + cd ./include ; \ echo "ARCH = ppc" > config.mk ; \ echo "BOARD = mpc8260ads" >>config.mk ; \ echo "CPU = mpc8260" >>config.mk ; \ @@ -514,7 +507,7 @@ MPC8260ADS_config: unconfig PM826_config: unconfig @echo "Configuring for $(@:_config=) Board..." ; \ - cd include ; \ + cd ./include ; \ echo "ARCH = ppc" > config.mk ; \ echo "BOARD = pm826" >>config.mk ; \ echo "CPU = mpc8260" >>config.mk ; \ @@ -522,7 +515,7 @@ PM826_config: unconfig RPXsuper_config: unconfig @echo "Configuring for $(@:_config=) Board..." ; \ - cd include ; \ + cd ./include ; \ echo "ARCH = ppc" > config.mk ; \ echo "BOARD = rpxsuper" >>config.mk ; \ echo "CPU = mpc8260" >>config.mk ; \ @@ -530,7 +523,7 @@ RPXsuper_config: unconfig rsdproto_config: unconfig @echo "Configuring for $(@:_config=) Board..." ; \ - cd include ; \ + cd ./include ; \ echo "ARCH = ppc" > config.mk ; \ echo "BOARD = rsdproto" >>config.mk ; \ echo "CPU = mpc8260" >>config.mk ; \ @@ -538,7 +531,7 @@ rsdproto_config: unconfig sbc8260_config: unconfig @echo "Configuring for $(@:_config=) Board..." ; \ - cd include ; \ + cd ./include ; \ echo "ARCH = ppc" > config.mk ; \ echo "BOARD = sbc8260" >>config.mk ; \ echo "CPU = mpc8260" >>config.mk ; \ @@ -546,7 +539,7 @@ sbc8260_config: unconfig TQM8260_config: unconfig @echo "Configuring for $(@:_config=) Board..." ; \ - cd include ; \ + cd ./include ; \ echo "ARCH = ppc" > config.mk ; \ echo "BOARD = tqm8260" >>config.mk ; \ echo "CPU = mpc8260" >>config.mk ; \ @@ -558,7 +551,7 @@ TQM8260_config: unconfig EVB64260_config: unconfig @echo "Configuring for $(@:_config=) Board..." ; \ - cd include ; \ + cd ./include ; \ echo "ARCH = ppc" > config.mk ; \ echo "BOARD = evb64260" >>config.mk ; \ echo "CPU = mpc74xx" >>config.mk ; \ @@ -586,6 +579,7 @@ clobber: clean rm -f ppcboot ppcboot.bin ppcboot.elf ppcboot.srec ppcboot.map rm -f tools/crc32.c tools/environment.S +mrproper \ distclean: clobber unconfig backup: diff --git a/board/w7o/flash.c b/board/w7o/flash.c index dcca543..6633382 100644 --- a/board/w7o/flash.c +++ b/board/w7o/flash.c @@ -762,7 +762,7 @@ static int _flash_protect(flash_info_t *info, long sector) if (get_timer(start) > 1) { /* 75us time out, wait 1ms */ printf("Protect %x sector TIMEOUT\n", (uint)sector); *addr = 0x00ff00ffL; /* restore read mode */ - return 0; + return 1; } } while ((*addr & 0x00800080L) != 0x00800080L); @@ -772,7 +772,7 @@ static int _flash_protect(flash_info_t *info, long sector) printf("Protect %x sector failed: %x\n", (uint)sector, (uint)status); *addr = 0x00ff00ffL; - return 0; + return 1; } *addr = 0x00ff00ffL; /* restore read mode */ break; @@ -788,7 +788,7 @@ static int _flash_protect(flash_info_t *info, long sector) } } - return 1; + return 0; } /* end _flash_protect() */ static int _flash_unprotect(flash_info_t *info, long sector) @@ -796,6 +796,7 @@ static int _flash_unprotect(flash_info_t *info, long sector) int i; ulong start; ulong status = 0; + int rcode = 0; volatile long *addr = (unsigned long *)sector; switch(info->flash_id & FLASH_TYPEMASK) { @@ -813,7 +814,7 @@ static int _flash_unprotect(flash_info_t *info, long sector) if (get_timer(start) > 800) {/* 700ms time out, wait 800 */ printf("Un-protect %x sector TIMEOUT\n", (uint)sector); *addr = 0x00ff00ffL; /* restore read mode */ - return 0; + return 1; } } while ((*addr & 0x00800080L) != 0x00800080L); @@ -824,7 +825,7 @@ static int _flash_unprotect(flash_info_t *info, long sector) printf("Un-protect %x sector failed: %x\n", (uint)sector, (uint)status); *addr = 0x00ff00ffL; - return 0; + return 1; } *addr = 0x00ff00ffL; /* restore read mode */ break; @@ -839,31 +840,30 @@ static int _flash_unprotect(flash_info_t *info, long sector) */ for (i = 0; i < info->sector_count; i++) { if (info->start[i] != sector) { - if (info->protect[i]) - _flash_protect(info, info->start[i]); + if (info->protect[i]) { + if (_flash_protect(info, info->start[i])) + rcode = 1; + } } else /* Turn protection off for this sector */ info->protect[i] = 0; } - return 1; + return rcode; } /* end _flash_unprotect() */ int flash_real_protect(flash_info_t *info, long sector, int prot) { - int retval; - + int rcode; if (prot) - retval = _flash_protect(info, sector); + rcode = _flash_protect(info, sector); else - retval = _flash_unprotect(info, sector); + rcode = _flash_unprotect(info, sector); - return retval; + return rcode; } - - /*----------------------------------------------------------------------- */ diff --git a/common/cmd_bedbug.c b/common/cmd_bedbug.c index 9a57024..9c6a610 100644 --- a/common/cmd_bedbug.c +++ b/common/cmd_bedbug.c @@ -11,7 +11,7 @@ #include #include #include -#include +#include #if (CONFIG_COMMANDS & CFG_CMD_BEDBUG) diff --git a/common/cmd_flash.c b/common/cmd_flash.c index 8d17504..2b621f7 100644 --- a/common/cmd_flash.c +++ b/common/cmd_flash.c @@ -271,11 +271,17 @@ int do_protect(cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]) #if defined(CFG_FLASH_PROTECTION) if (flash_real_protect(info, info->start[i], p)) rcode = 1; + putc ('.'); #else info->protect[i] = p; #endif /* CFG_FLASH_PROTECTION */ } } + +#if defined(CFG_FLASH_PROTECTION) + if (!rcode) puts (" done\n"); +#endif /* CFG_FLASH_PROTECTION */ + return rcode; } @@ -291,10 +297,16 @@ int do_protect(cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]) #if defined(CFG_FLASH_PROTECTION) if (flash_real_protect(info, info->start[i], p)) rcode = 1; + putc ('.'); #else info->protect[i] = p; #endif /* CFG_FLASH_PROTECTION */ } + +#if defined(CFG_FLASH_PROTECTION) + if (!rcode) puts (" done\n"); +#endif /* CFG_FLASH_PROTECTION */ + return rcode; } @@ -322,10 +334,16 @@ int do_protect(cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]) #if defined(CFG_FLASH_PROTECTION) if (flash_real_protect(info, info->start[i], p)) rcode = 1; + putc ('.'); #else info->protect[i] = p; #endif /* CFG_FLASH_PROTECTION */ } + +#if defined(CFG_FLASH_PROTECTION) + if (!rcode) puts (" done\n"); +#endif /* CFG_FLASH_PROTECTION */ + return rcode; } @@ -388,11 +406,16 @@ int flash_sect_protect (int p, ulong addr_first, ulong addr_last) #if defined(CFG_FLASH_PROTECTION) if (flash_real_protect(info, info->start[i], p)) rcode = 1; + putc ('.'); #else info->protect[i] = p; #endif /* CFG_FLASH_PROTECTION */ } } +#if defined(CFG_FLASH_PROTECTION) + if (!rcode) putc ('\n'); +#endif /* CFG_FLASH_PROTECTION */ + } if (protected) { printf ("%sProtected %d sectors\n", diff --git a/config.mk b/config.mk index 67ea278..3c7f9be 100644 --- a/config.mk +++ b/config.mk @@ -60,6 +60,7 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \ HOSTCC = gcc HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer +HOSTSTRIP = strip ######################################################################### @@ -82,6 +83,7 @@ DBGFLAGS= -g #-DDEBUG OPTFLAGS= -Os -fomit-frame-pointer #LDSCRIPT := board/$(BOARDDIR)/ppcboot.lds.debug LDSCRIPT := board/$(BOARDDIR)/ppcboot.lds +OBJCFLAGS := --gap-fill=0xff CPPFLAGS := $(DBGFLAGS) $(OPTFLAGS) $(RELFLAGS) \ -D__KERNEL__ -D__powerpc__ -DTEXT_BASE=$(TEXT_BASE) \ diff --git a/cpu/mpc8260/bedbug_603e.c b/cpu/mpc8260/bedbug_603e.c index 61fdaf0..20be210 100644 --- a/cpu/mpc8260/bedbug_603e.c +++ b/cpu/mpc8260/bedbug_603e.c @@ -49,8 +49,8 @@ void bedbug603e_init( void ) for( i = 1; i <= MAX_BREAK_POINTS; ++i ) (*bug_ctx.clear)( i ); - printf( "BEDBUG Ready\n" ); - + puts ("BEDBUG:ready\n"); + return; } /* bedbug_init_breakpoints */ diff --git a/cpu/mpc8xx/bedbug_860.c b/cpu/mpc8xx/bedbug_860.c index 677d632..300380e 100644 --- a/cpu/mpc8xx/bedbug_860.c +++ b/cpu/mpc8xx/bedbug_860.c @@ -49,7 +49,7 @@ void bedbug860_init( void ) for( i = 1; i <= MAX_BREAK_POINTS; ++i ) (*bug_ctx.clear)( i ); - printf( "BEDBUG Ready\n" ); + puts ("BEDBUG:ready\n"); return; } /* bedbug_init_breakpoints */ diff --git a/cpu/ppc4xx/bedbug_405.c b/cpu/ppc4xx/bedbug_405.c index f8d6903..0a783e4 100644 --- a/cpu/ppc4xx/bedbug_405.c +++ b/cpu/ppc4xx/bedbug_405.c @@ -49,7 +49,7 @@ void bedbug405_init( void ) for( i = 1; i <= MAX_BREAK_POINTS; ++i ) (*bug_ctx.clear)( i ); - printf( "BEDBUG Ready\n" ); + puts ("BEDBUG:ready\n"); return; } /* bedbug_init_breakpoints */ diff --git a/doc/README.bedbug b/doc/README.bedbug index 9ae409c..1f79b44 100644 --- a/doc/README.bedbug +++ b/doc/README.bedbug @@ -47,7 +47,7 @@ can be easily implemented. ./include/bedbug/ppc.h ./include/bedbug/regs.h ./include/bedbug/bedbug.h -./include/bedbug/elf.h +./include/bedbug/elf.h [obsoleted by new include/elf.h] ./include/bedbug/tables.h ./include/cmd_bedbug.h ./common/cmd_bedbug.c diff --git a/include/cmd_dcr.h b/include/cmd_dcr.h index 373cf3f..44b189c 100644 --- a/include/cmd_dcr.h +++ b/include/cmd_dcr.h @@ -30,12 +30,12 @@ #if defined(CONFIG_4xx) && defined(CFG_CMD_SETGETDCR) #define CMD_TBL_GETDCR MK_CMD_TBL_ENTRY( \ "getdcr", 6, 2, 1, do_getdcr, \ - "getdcr - Get an IBM PPC 4xx DCR's value\n", \ + "getdcr - Get an IBM PPC 4xx DCR's value\n", \ "dcrn - return a DCR's value.\n" \ ), #define CMD_TBL_SETDCR MK_CMD_TBL_ENTRY( \ "setdcr", 6, 2, 1, do_setdcr, \ - "setdcr - Set an IBM PPC 4xx DCR's value\n", \ + "setdcr - Set an IBM PPC 4xx DCR's value\n", \ "dcrn - set a DCR's value.\n" \ ), extern int do_getdcr (cmd_tbl_t *, bd_t *, int, int, char *[]); diff --git a/include/bedbug/elf.h b/include/elf.h similarity index 50% rename from include/bedbug/elf.h rename to include/elf.h index a6e3d20..7e11be1 100644 --- a/include/bedbug/elf.h +++ b/include/elf.h @@ -1,6 +1,5 @@ -/* $OpenBSD: exec_elf.h,v 1.27 2001/01/23 16:58:06 drahn Exp $ */ /* - * Copyright (c) 1995, 1996 Erik Theisen. All rights reserved. + * Copyright (c) 1995, 1996, 2001 Erik Theisen. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -30,27 +29,30 @@ * formerly known as "elf_abi.h". */ -#ifndef _SYS_EXEC_ELF_H_ -#define _SYS_EXEC_ELF_H_ +#ifndef _ELF_H +#define _ELF_H -/* #include */ -/* #include */ +#if defined(__BEOS__) || \ + defined(__NetBSD__) || \ + defined(__sun__) || \ + defined(__APPLE__) +#include +#elif defined(__linux__) && defined(USE_HOSTCC) +#include +#endif -typedef u_int8_t Elf_Byte; +/* + * This version doesn't work for 64-bit ABIs - Erik. + */ -typedef u_int32_t Elf32_Addr; /* Unsigned program address */ -typedef u_int32_t Elf32_Off; /* Unsigned file offset */ +/* + * These typedefs need to be handled better. + */ +typedef uint32_t Elf32_Addr; /* Unsigned program address */ +typedef uint32_t Elf32_Off; /* Unsigned file offset */ typedef int32_t Elf32_Sword; /* Signed large integer */ -typedef u_int32_t Elf32_Word; /* Unsigned large integer */ -typedef u_int16_t Elf32_Half; /* Unsigned medium integer */ - -typedef u_int64_t Elf64_Addr; -typedef u_int64_t Elf64_Off; -typedef int64_t Elf64_Sword; -typedef int32_t Elf64_Shalf; -typedef u_int64_t Elf64_Word; -typedef u_int32_t Elf64_Half; -typedef u_int16_t Elf64_Quarter; +typedef uint32_t Elf32_Word; /* Unsigned large integer */ +typedef uint16_t Elf32_Half; /* Unsigned medium integer */ /* e_ident[] identification indexes */ #define EI_MAG0 0 /* file ID */ @@ -60,8 +62,9 @@ typedef u_int16_t Elf64_Quarter; #define EI_CLASS 4 /* file class */ #define EI_DATA 5 /* data encoding */ #define EI_VERSION 6 /* ELF header version */ -#define EI_PAD 7 /* start of pad bytes */ -#define EI_BRAND 8 /* brand */ +#define EI_OSABI 7 /* OS/ABI specific ELF extensions */ +#define EI_ABIVERSION 8 /* ABI target version */ +#define EI_PAD 9 /* start of pad bytes */ #define EI_NIDENT 16 /* Size of e_ident[] */ /* e_ident[] magic number */ @@ -84,6 +87,23 @@ typedef u_int16_t Elf64_Quarter; #define ELFDATA2MSB 2 /* Big-Endian */ #define ELFDATANUM 3 /* number of data encode defines */ +/* e_ident[] OS/ABI specific ELF extensions */ +#define ELFOSABI_NONE 0 /* No extension specified */ +#define ELFOSABI_HPUX 1 /* Hewlett-Packard HP-UX */ +#define ELFOSABI_NETBSD 2 /* NetBSD */ +#define ELFOSABI_LINUX 3 /* Linux */ +#define ELFOSABI_SOLARIS 6 /* Sun Solaris */ +#define ELFOSABI_AIX 7 /* AIX */ +#define ELFOSABI_IRIX 8 /* IRIX */ +#define ELFOSABI_FREEBSD 9 /* FreeBSD */ +#define ELFOSABI_TRU64 10 /* Compaq TRU64 UNIX */ +#define ELFOSABI_MODESTO 11 /* Novell Modesto */ +#define ELFOSABI_OPENBSD 12 /* OpenBSD */ +/* 64-255 Architecture-specific value range */ + +/* e_ident[] ABI Version */ +#define ELFABIVERSION 0 + /* e_ident */ #define IS_ELF(ehdr) ((ehdr).e_ident[EI_MAG0] == ELFMAG0 && \ (ehdr).e_ident[EI_MAG1] == ELFMAG1 && \ @@ -109,23 +129,6 @@ typedef struct elfhdr{ header string table" entry offset */ } Elf32_Ehdr; -typedef struct { - unsigned char e_ident[EI_NIDENT]; /* Id bytes */ - Elf64_Quarter e_type; /* file type */ - Elf64_Quarter e_machine; /* machine type */ - Elf64_Half e_version; /* version number */ - Elf64_Addr e_entry; /* entry point */ - Elf64_Off e_phoff; /* Program hdr offset */ - Elf64_Off e_shoff; /* Section hdr offset */ - Elf64_Half e_flags; /* Processor flags */ - Elf64_Quarter e_ehsize; /* sizeof ehdr */ - Elf64_Quarter e_phentsize; /* Program header entry size */ - Elf64_Quarter e_phnum; /* Number of program headers */ - Elf64_Quarter e_shentsize; /* Section header entry size */ - Elf64_Quarter e_shnum; /* Number of section headers */ - Elf64_Quarter e_shstrndx; /* String table index */ -} Elf64_Ehdr; - /* e_type */ #define ET_NONE 0 /* No file type */ #define ET_REL 1 /* relocatable file */ @@ -133,6 +136,8 @@ typedef struct { #define ET_DYN 3 /* shared object file */ #define ET_CORE 4 /* core file */ #define ET_NUM 5 /* number of types */ +#define ET_LOOS 0xfe00 /* reserved range for operating */ +#define ET_HIOS 0xfeff /* system specific e_type */ #define ET_LOPROC 0xff00 /* reserved range for processor */ #define ET_HIPROC 0xffff /* specific e_type */ @@ -143,22 +148,83 @@ typedef struct { #define EM_386 3 /* Intel 80386 */ #define EM_68K 4 /* Motorola 68000 */ #define EM_88K 5 /* Motorola 88000 */ -#define EM_486 6 /* Intel 80486 - unused? */ +#if 0 +#define EM_486 6 /* RESERVED - was Intel 80486 */ +#endif #define EM_860 7 /* Intel 80860 */ #define EM_MIPS 8 /* MIPS R3000 Big-Endian only */ - -/* - * Don't know if EM_MIPS_RS4_BE, - * EM_SPARC64, EM_PARISC, - * or EM_PPC are ABI compliant - */ +#define EM_S370 9 /* IBM System/370 Processor */ #define EM_MIPS_RS4_BE 10 /* MIPS R4000 Big-Endian */ -#define EM_SPARC64 11 /* SPARC v9 64-bit unoffical */ +#if 0 +#define EM_SPARC64 11 /* RESERVED - was SPARC v9 + 64-bit unoffical */ +#endif +/* RESERVED 11-14 for future use */ #define EM_PARISC 15 /* HPPA */ +/* RESERVED 16 for future use */ +#define EM_VPP500 17 /* Fujitsu VPP500 */ +#define EM_SPARC32PLUS 18 /* Enhanced instruction set SPARC */ +#define EM_960 19 /* Intel 80960 */ #define EM_PPC 20 /* PowerPC */ -#define EM_ALPHA 41 /* DEC ALPHA */ -#define EM_ALPHA_EXP 0x9026 /* DEC ALPHA */ -#define EM_NUM 15 /* number of machine types */ +#define EM_PPC64 21 /* 64-bit PowerPC */ +#define EM_S390 22 /* IBM System/390 Processor */ +/* RESERVED 23-35 for future use */ +#define EM_V800 36 /* NEC V800 */ +#define EM_FR20 37 /* Fujitsu FR20 */ +#define EM_RH32 38 /* TRW RH-32 */ +#define EM_RCE 39 /* Motorola RCE */ +#define EM_ARM 40 /* Advanced Risc Machines ARM */ +#define EM_ALPHA 41 /* Digital Alpha */ +#define EM_SH 42 /* Hitachi SH */ +#define EM_SPARCV9 43 /* SPARC Version 9 */ +#define EM_TRICORE 44 /* Siemens TriCore embedded processor */ +#define EM_ARC 45 /* Argonaut RISC Core */ +#define EM_H8_300 46 /* Hitachi H8/300 */ +#define EM_H8_300H 47 /* Hitachi H8/300H */ +#define EM_H8S 48 /* Hitachi H8S */ +#define EM_H8_500 49 /* Hitachi H8/500 */ +#define EM_IA_64 50 /* Intel Merced */ +#define EM_MIPS_X 51 /* Stanford MIPS-X */ +#define EM_COLDFIRE 52 /* Motorola Coldfire */ +#define EM_68HC12 53 /* Motorola M68HC12 */ +#define EM_MMA 54 /* Fujitsu MMA Multimedia Accelerator*/ +#define EM_PCP 55 /* Siemens PCP */ +#define EM_NCPU 56 /* Sony nCPU embeeded RISC */ +#define EM_NDR1 57 /* Denso NDR1 microprocessor */ +#define EM_STARCORE 58 /* Motorola Start*Core processor */ +#define EM_ME16 59 /* Toyota ME16 processor */ +#define EM_ST100 60 /* STMicroelectronic ST100 processor */ +#define EM_TINYJ 61 /* Advanced Logic Corp. Tinyj emb.fam*/ +#define EM_X86_64 62 /* AMD x86-64 */ +#define EM_PDSP 63 /* Sony DSP Processor */ +/* RESERVED 64,65 for future use */ +#define EM_FX66 66 /* Siemens FX66 microcontroller */ +#define EM_ST9PLUS 67 /* STMicroelectronics ST9+ 8/16 mc */ +#define EM_ST7 68 /* STmicroelectronics ST7 8 bit mc */ +#define EM_68HC16 69 /* Motorola MC68HC16 microcontroller */ +#define EM_68HC11 70 /* Motorola MC68HC11 microcontroller */ +#define EM_68HC08 71 /* Motorola MC68HC08 microcontroller */ +#define EM_68HC05 72 /* Motorola MC68HC05 microcontroller */ +#define EM_SVX 73 /* Silicon Graphics SVx */ +#define EM_ST19 74 /* STMicroelectronics ST19 8 bit mc */ +#define EM_VAX 75 /* Digital VAX */ +#define EM_CHRIS 76 /* Axis Communications embedded proc. */ +#define EM_JAVELIN 77 /* Infineon Technologies emb. proc. */ +#define EM_FIREPATH 78 /* Element 14 64-bit DSP Processor */ +#define EM_ZSP 79 /* LSI Logic 16-bit DSP Processor */ +#define EM_MMIX 80 /* Donald Knuth's edu 64-bit proc. */ +#define EM_HUANY 81 /* Harvard University mach-indep objs */ +#define EM_PRISM 82 /* SiTera Prism */ +#define EM_AVR 83 /* Atmel AVR 8-bit microcontroller */ +#define EM_FR30 84 /* Fujitsu FR30 */ +#define EM_D10V 85 /* Mitsubishi DV10V */ +#define EM_D30V 86 /* Mitsubishi DV30V */ +#define EM_V850 87 /* NEC v850 */ +#define EM_M32R 88 /* Mitsubishi M32R */ +#define EM_MN10300 89 /* Matsushita MN10200 */ +#define EM_MN10200 90 /* Matsushita MN10200 */ +#define EM_PJ 91 /* picoJava */ +#define EM_NUM 92 /* number of machine types */ /* Version */ #define EV_NONE 0 /* Invalid */ @@ -180,26 +246,16 @@ typedef struct { Elf32_Word sh_entsize; /* section entry size */ } Elf32_Shdr; -typedef struct { - Elf64_Half sh_name; /* section name */ - Elf64_Half sh_type; /* section type */ - Elf64_Word sh_flags; /* section flags */ - Elf64_Addr sh_addr; /* virtual address */ - Elf64_Off sh_offset; /* file offset */ - Elf64_Word sh_size; /* section size */ - Elf64_Half sh_link; /* link to another */ - Elf64_Half sh_info; /* misc info */ - Elf64_Word sh_addralign; /* memory alignment */ - Elf64_Word sh_entsize; /* table entry size */ -} Elf64_Shdr; - /* Special Section Indexes */ #define SHN_UNDEF 0 /* undefined */ #define SHN_LORESERVE 0xff00 /* lower bounds of reserved indexes */ #define SHN_LOPROC 0xff00 /* reserved range for processor */ #define SHN_HIPROC 0xff1f /* specific section indexes */ +#define SHN_LOOS 0xff20 /* reserved range for operating */ +#define SHN_HIOS 0xff3f /* specific semantics */ #define SHN_ABS 0xfff1 /* absolute value */ #define SHN_COMMON 0xfff2 /* common symbol */ +#define SHN_XINDEX 0xffff /* Index is an extra table */ #define SHN_HIRESERVE 0xffff /* upper bounds of reserved indexes */ /* sh_type */ @@ -215,7 +271,14 @@ typedef struct { #define SHT_REL 9 /* relation section without addends */ #define SHT_SHLIB 10 /* reserved - purpose unknown */ #define SHT_DYNSYM 11 /* dynamic symbol table section */ -#define SHT_NUM 12 /* number of section types */ +#define SHT_INIT_ARRAY 14 /* Array of constructors */ +#define SHT_FINI_ARRAY 15 /* Array of destructors */ +#define SHT_PREINIT_ARRAY 16 /* Array of pre-constructors */ +#define SHT_GROUP 17 /* Section group */ +#define SHT_SYMTAB_SHNDX 18 /* Extended section indeces */ +#define SHT_NUM 19 /* number of section types */ +#define SHT_LOOS 0x60000000 /* Start OS-specific */ +#define SHT_HIOS 0x6fffffff /* End OS-specific */ #define SHT_LOPROC 0x70000000 /* reserved range for processor */ #define SHT_HIPROC 0x7fffffff /* specific section header types */ #define SHT_LOUSER 0x80000000 /* reserved range for application */ @@ -223,15 +286,24 @@ typedef struct { /* Section names */ #define ELF_BSS ".bss" /* uninitialized data */ +#define ELF_COMMENT ".comment" /* version control information */ #define ELF_DATA ".data" /* initialized data */ +#define ELF_DATA1 ".data1" /* initialized data */ #define ELF_DEBUG ".debug" /* debug */ #define ELF_DYNAMIC ".dynamic" /* dynamic linking information */ #define ELF_DYNSTR ".dynstr" /* dynamic string table */ #define ELF_DYNSYM ".dynsym" /* dynamic symbol table */ #define ELF_FINI ".fini" /* termination code */ +#define ELF_FINI_ARRAY ".fini_array" /* Array of destructors */ #define ELF_GOT ".got" /* global offset table */ #define ELF_HASH ".hash" /* symbol hash table */ #define ELF_INIT ".init" /* initialization code */ +#define ELF_INIT_ARRAY ".init_array" /* Array of constuctors */ +#define ELF_INTERP ".interp" /* Pathname of program interpreter */ +#define ELF_LINE ".line" /* Symbolic line numnber information */ +#define ELF_NOTE ".note" /* Contains note section */ +#define ELF_PLT ".plt" /* Procedure linkage table */ +#define ELF_PREINIT_ARRAY ".preinit_array" /* Array of pre-constructors */ #define ELF_REL_DATA ".rel.data" /* relocation data */ #define ELF_REL_FINI ".rel.fini" /* relocation termination code */ #define ELF_REL_INIT ".rel.init" /* relocation initialization code */ @@ -239,19 +311,36 @@ typedef struct { #define ELF_REL_RODATA ".rel.rodata" /* relocation read-only data */ #define ELF_REL_TEXT ".rel.text" /* relocation code */ #define ELF_RODATA ".rodata" /* read-only data */ +#define ELF_RODATA1 ".rodata1" /* read-only data */ #define ELF_SHSTRTAB ".shstrtab" /* section header string table */ #define ELF_STRTAB ".strtab" /* string table */ #define ELF_SYMTAB ".symtab" /* symbol table */ +#define ELF_SYMTAB_SHNDX ".symtab_shndx"/* symbol table section index */ +#define ELF_TBSS ".tbss" /* thread local uninit data */ +#define ELF_TDATA ".tdata" /* thread local init data */ +#define ELF_TDATA1 ".tdata1" /* thread local init data */ #define ELF_TEXT ".text" /* code */ - /* Section Attribute Flags - sh_flags */ #define SHF_WRITE 0x1 /* Writable */ #define SHF_ALLOC 0x2 /* occupies memory */ #define SHF_EXECINSTR 0x4 /* executable */ +#define SHF_MERGE 0x10 /* Might be merged */ +#define SHF_STRINGS 0x20 /* Contains NULL terminated strings */ +#define SHF_INFO_LINK 0x40 /* sh_info contains SHT index */ +#define SHF_LINK_ORDER 0x80 /* Preserve order after combining*/ +#define SHF_OS_NONCONFORMING 0x100 /* Non-standard OS specific handling */ +#define SHF_GROUP 0x200 /* Member of section group */ +#define SHF_TLS 0x400 /* Thread local storage */ +#define SHF_MASKOS 0x0ff00000 /* OS specific */ #define SHF_MASKPROC 0xf0000000 /* reserved bits for processor */ /* specific section attributes */ +/* Section Group Flags */ +#define GRP_COMDAT 0x1 /* COMDAT group */ +#define GRP_MASKOS 0x0ff00000 /* Mask OS specific flags */ +#define GRP_MASKPROC 0xf0000000 /* Mask processor specific flags */ + /* Symbol Table Entry */ typedef struct elf32_sym { Elf32_Word st_name; /* name - index into string table */ @@ -262,15 +351,6 @@ typedef struct elf32_sym { Elf32_Half st_shndx; /* section header index */ } Elf32_Sym; -typedef struct { - Elf64_Half st_name; /* Symbol name index in str table */ - Elf_Byte st_info; /* type / binding attrs */ - Elf_Byte st_other; /* unused */ - Elf64_Quarter st_shndx; /* section index of symbol */ - Elf64_Word st_value; /* value of symbol */ - Elf64_Word st_size; /* size of symbol */ -} Elf64_Sym; - /* Symbol table index */ #define STN_UNDEF 0 /* undefined */ @@ -278,16 +358,15 @@ typedef struct { #define ELF32_ST_BIND(x) ((x) >> 4) #define ELF32_ST_TYPE(x) (((unsigned int) x) & 0xf) #define ELF32_ST_INFO(b,t) (((b) << 4) + ((t) & 0xf)) - -#define ELF64_ST_BIND(x) ((x) >> 4) -#define ELF64_ST_TYPE(x) (((unsigned int) x) & 0xf) -#define ELF64_ST_INFO(b,t) (((b) << 4) + ((t) & 0xf)) +#define ELF32_ST_VISIBILITY(x) ((x) & 0x3) /* Symbol Binding - ELF32_ST_BIND - st_info */ #define STB_LOCAL 0 /* Local symbol */ #define STB_GLOBAL 1 /* Global symbol */ #define STB_WEAK 2 /* like global - lower precedence */ #define STB_NUM 3 /* number of symbol bindings */ +#define STB_LOOS 10 /* reserved range for operating */ +#define STB_HIOS 12 /* system specific symbol bindings */ #define STB_LOPROC 13 /* reserved range for processor */ #define STB_HIPROC 15 /* specific symbol bindings */ @@ -298,9 +377,19 @@ typedef struct { #define STT_SECTION 3 /* section */ #define STT_FILE 4 /* file */ #define STT_NUM 5 /* number of symbol types */ +#define STT_TLS 6 /* Thread local storage symbol */ +#define STT_LOOS 10 /* reserved range for operating */ +#define STT_HIOS 12 /* system specific symbol types */ #define STT_LOPROC 13 /* reserved range for processor */ #define STT_HIPROC 15 /* specific symbol types */ +/* Symbol visibility - ELF32_ST_VISIBILITY - st_other */ +#define STV_DEFAULT 0 /* Normal visibility rules */ +#define STV_INTERNAL 1 /* Processor specific hidden class */ +#define STV_HIDDEN 2 /* Symbol unavailable in other mods */ +#define STV_PROTECTED 3 /* Not preemptible, not exported */ + + /* Relocation entry with implicit addend */ typedef struct { @@ -321,21 +410,6 @@ typedef struct #define ELF32_R_TYPE(i) ((unsigned char) (i)) #define ELF32_R_INFO(s,t) (((s) << 8) + (unsigned char)(t)) -typedef struct { - Elf64_Word r_offset; /* where to do it */ - Elf64_Word r_info; /* index & type of relocation */ -} Elf64_Rel; - -typedef struct { - Elf64_Word r_offset; /* where to do it */ - Elf64_Word r_info; /* index & type of relocation */ - Elf64_Word r_addend; /* adjustment value */ -} Elf64_Rela; - -#define ELF64_R_SYM(info) ((info) >> 32) -#define ELF64_R_TYPE(info) ((info) & 0xFFFFFFFF) -#define ELF64_R_INFO(s,t) (((s) << 32) + (u_int32_t)(t)) - /* Program Header */ typedef struct { Elf32_Word p_type; /* segment type */ @@ -348,17 +422,6 @@ typedef struct { Elf32_Word p_align; /* memory alignment */ } Elf32_Phdr; -typedef struct { - Elf64_Half p_type; /* entry type */ - Elf64_Half p_flags; /* flags */ - Elf64_Off p_offset; /* offset */ - Elf64_Addr p_vaddr; /* virtual address */ - Elf64_Addr p_paddr; /* physical address */ - Elf64_Word p_filesz; /* file size */ - Elf64_Word p_memsz; /* memory size */ - Elf64_Word p_align; /* memory & file alignment */ -} Elf64_Phdr; - /* Segment types - p_type */ #define PT_NULL 0 /* unused */ #define PT_LOAD 1 /* loadable segment */ @@ -367,7 +430,10 @@ typedef struct { #define PT_NOTE 4 /* auxiliary information */ #define PT_SHLIB 5 /* reserved - purpose undefined */ #define PT_PHDR 6 /* program header */ -#define PT_NUM 7 /* Number of segment types */ +#define PT_TLS 7 /* Thread local storage template */ +#define PT_NUM 8 /* Number of segment types */ +#define PT_LOOS 0x60000000 /* reserved range for operating */ +#define PT_HIOS 0x6fffffff /* system specific segment types */ #define PT_LOPROC 0x70000000 /* reserved range for processor */ #define PT_HIPROC 0x7fffffff /* specific segment types */ @@ -375,27 +441,21 @@ typedef struct { #define PF_X 0x1 /* Executable */ #define PF_W 0x2 /* Writable */ #define PF_R 0x4 /* Readable */ +#define PF_MASKOS 0x0ff00000 /* OS specific segment flags */ #define PF_MASKPROC 0xf0000000 /* reserved bits for processor */ /* specific segment flags */ - /* Dynamic structure */ -typedef struct { +typedef struct +{ Elf32_Sword d_tag; /* controls meaning of d_val */ - union { + union + { Elf32_Word d_val; /* Multiple meanings - see d_tag */ Elf32_Addr d_ptr; /* program virtual address */ } d_un; } Elf32_Dyn; -extern Elf32_Dyn _DYNAMIC[]; /* XXX not 64-bit clean */ - -typedef struct { - Elf64_Word d_tag; /* controls meaning of d_val */ - union { - Elf64_Addr d_ptr; - Elf64_Word d_val; - } d_un; -} Elf64_Dyn; +extern Elf32_Dyn _DYNAMIC[]; /* Dynamic Array Tags - d_tag */ #define DT_NULL 0 /* marks end of _DYNAMIC array */ @@ -423,160 +483,118 @@ typedef struct { #define DT_DEBUG 21 /* bugger */ #define DT_TEXTREL 22 /* Allow rel. mod. to unwritable seg */ #define DT_JMPREL 23 /* add. of PLT's relocation entries */ -#define DT_BIND_NOW 24 /* Bind now regardless of env setting */ -#define DT_NUM 25 /* Number used. */ +#define DT_BIND_NOW 24 /* Process relocations of object */ +#define DT_INIT_ARRAY 25 /* Array with addresses of init fct */ +#define DT_FINI_ARRAY 26 /* Array with addresses of fini fct */ +#define DT_INIT_ARRAYSZ 27 /* Size in bytes of DT_INIT_ARRAY */ +#define DT_FINI_ARRAYSZ 28 /* Size in bytes of DT_FINI_ARRAY */ +#define DT_RUNPATH 29 /* Library search path */ +#define DT_FLAGS 30 /* Flags for the object being loaded */ +#define DT_ENCODING 32 /* Start of encoded range */ +#define DT_PREINIT_ARRAY 32 /* Array with addresses of preinit fct*/ +#define DT_PREINIT_ARRAYSZ 33 /* size in bytes of DT_PREINIT_ARRAY */ +#define DT_NUM 34 /* Number used. */ +#define DT_LOOS 0x60000000 /* reserved range for OS */ +#define DT_HIOS 0x6fffffff /* specific dynamic array tags */ #define DT_LOPROC 0x70000000 /* reserved range for processor */ #define DT_HIPROC 0x7fffffff /* specific dynamic array tags */ + +/* Dynamic Tag Flags - d_un.d_val */ +#define DF_ORIGIN 0x01 /* Object may use DF_ORIGIN */ +#define DF_SYMBOLIC 0x02 /* Symbol resolutions starts here */ +#define DF_TEXTREL 0x04 /* Object contains text relocations */ +#define DF_BIND_NOW 0x08 /* No lazy binding for this object */ +#define DF_STATIC_TLS 0x10 /* Static thread local storage */ /* Standard ELF hashing function */ -unsigned int elf_hash(const unsigned char *name); - -/* - * Note Definitions - */ -typedef struct { - Elf32_Word namesz; - Elf32_Word descsz; - Elf32_Word type; -} Elf32_Note; +unsigned long elf_hash(const unsigned char *name); -typedef struct { - Elf64_Half namesz; - Elf64_Half descsz; - Elf64_Half type; -} Elf64_Note; +#define ELF_TARG_VER 1 /* The ver for which this code is intended */ /* - * XXX - these _KERNEL items aren't part of the ABI! + * XXX - PowerPC defines really don't belong in here, + * but we'll put them in for simplicity. */ -#if defined(_KERNEL) || defined(_DYN_LOADER) - -#define ELF32_NO_ADDR ((u_long) ~0) /* Indicates addr. not yet filled in */ -#define ELF_AUX_ENTRIES 8 /* Size of aux array passed to loader */ - -typedef struct { - Elf32_Sword au_id; /* 32-bit id */ - Elf32_Word au_v; /* 32-bit value */ -} Aux32Info; - -#define ELF64_NO_ADDR ((u_int64_t) ~0)/* Indicates addr. not yet filled in */ -#define ELF64_AUX_ENTRIES 8 /* Size of aux array passed to loader */ -typedef struct { - Elf64_Shalf au_id; /* 32-bit id */ - Elf64_Word au_v; /* 64-bit id */ -} Aux64Info; - -enum AuxID { - AUX_null = 0, - AUX_ignore = 1, - AUX_execfd = 2, - AUX_phdr = 3, /* &phdr[0] */ - AUX_phent = 4, /* sizeof(phdr[0]) */ - AUX_phnum = 5, /* # phdr entries */ - AUX_pagesz = 6, /* PAGESIZE */ - AUX_base = 7, /* ld.so base addr */ - AUX_flags = 8, /* processor flags */ - AUX_entry = 9, /* a.out entry */ - AUX_sun_uid = 2000, /* euid */ - AUX_sun_ruid = 2001, /* ruid */ - AUX_sun_gid = 2002, /* egid */ - AUX_sun_rgid = 2003 /* rgid */ -}; - -struct elf_args { - u_long arg_entry; /* progran entry point */ - u_long arg_interp; /* Interpreter load address */ - u_long arg_phaddr; /* program header address */ - u_long arg_phentsize; /* Size of program header */ - u_long arg_phnum; /* Number of program headers */ - u_long arg_os; /* OS tag */ -}; - -#endif - -#if !defined(ELFSIZE) && defined(ARCH_ELFSIZE) -#define ELFSIZE ARCH_ELFSIZE -#endif - -#if defined(ELFSIZE) -#define CONCAT(x,y) __CONCAT(x,y) -#define ELFNAME(x) CONCAT(elf,CONCAT(ELFSIZE,CONCAT(_,x))) -#define ELFNAME2(x,y) CONCAT(x,CONCAT(_elf,CONCAT(ELFSIZE,CONCAT(_,y)))) -#define ELFNAMEEND(x) CONCAT(x,CONCAT(_elf,ELFSIZE)) -#define ELFDEFNNAME(x) CONCAT(ELF,CONCAT(ELFSIZE,CONCAT(_,x))) -#endif - -#if defined(ELFSIZE) && (ELFSIZE == 32) -#define Elf_Ehdr Elf32_Ehdr -#define Elf_Phdr Elf32_Phdr -#define Elf_Shdr Elf32_Shdr -#define Elf_Sym Elf32_Sym -#define Elf_Rel Elf32_Rel -#define Elf_RelA Elf32_Rela -#define Elf_Dyn Elf32_Dyn -#define Elf_Word Elf32_Word -#define Elf_Sword Elf32_Sword -#define Elf_Addr Elf32_Addr -#define Elf_Off Elf32_Off -#define Elf_Nhdr Elf32_Nhdr - -#define ELF_R_SYM ELF32_R_SYM -#define ELF_R_TYPE ELF32_R_TYPE -#define ELF_R_INFO ELF32_R_INFO -#define ELFCLASS ELFCLASS32 - -#define ELF_ST_BIND ELF32_ST_BIND -#define ELF_ST_TYPE ELF32_ST_TYPE -#define ELF_ST_INFO ELF32_ST_INFO - -#define AuxInfo Aux32Info -#elif defined(ELFSIZE) && (ELFSIZE == 64) -#define Elf_Ehdr Elf64_Ehdr -#define Elf_Phdr Elf64_Phdr -#define Elf_Shdr Elf64_Shdr -#define Elf_Sym Elf64_Sym -#define Elf_Rel Elf64_Rel -#define Elf_RelA Elf64_Rela -#define Elf_Dyn Elf64_Dyn -#define Elf_Word Elf64_Word -#define Elf_Sword Elf64_Sword -#define Elf_Addr Elf64_Addr -#define Elf_Off Elf64_Off -#define Elf_Nhdr Elf64_Nhdr - -#define ELF_R_SYM ELF64_R_SYM -#define ELF_R_TYPE ELF64_R_TYPE -#define ELF_R_INFO ELF64_R_INFO -#define ELFCLASS ELFCLASS64 - -#define ELF_ST_BIND ELF64_ST_BIND -#define ELF_ST_TYPE ELF64_ST_TYPE -#define ELF_ST_INFO ELF64_ST_INFO - -#define AuxInfo Aux64Info -#endif - -#ifdef _KERNEL -#ifdef _KERN_DO_ELF64 -int exec_elf64_makecmds __P((struct proc *, struct exec_package *)); -void *elf64_copyargs __P((struct exec_package *, struct ps_strings *, - void *, void *)); -int exec_elf64_fixup __P((struct proc *, struct exec_package *)); -char *elf64_check_brand __P((Elf64_Ehdr *)); -int elf64_os_pt_note __P((struct proc *, struct exec_package *, Elf64_Ehdr *, - char *, size_t, size_t)); -#endif -#ifdef _KERN_DO_ELF -int exec_elf_makecmds __P((struct proc *, struct exec_package *)); -void *elf_copyargs __P((struct exec_package *, struct ps_strings *, - void *, void *)); -int exec_elf_fixup __P((struct proc *, struct exec_package *)); -char *elf_check_brand __P((Elf32_Ehdr *)); -#endif - -#endif /* _KERNEL */ - -#define ELF_TARG_VER 1 /* The ver for which this code is intended */ +/* Values for Elf32/64_Ehdr.e_flags. */ +#define EF_PPC_EMB 0x80000000 /* PowerPC embedded flag */ + +/* Cygnus local bits below */ +#define EF_PPC_RELOCATABLE 0x00010000 /* PowerPC -mrelocatable flag*/ +#define EF_PPC_RELOCATABLE_LIB 0x00008000 /* PowerPC -mrelocatable-lib + flag */ + +/* PowerPC relocations defined by the ABIs */ +#define R_PPC_NONE 0 +#define R_PPC_ADDR32 1 /* 32bit absolute address */ +#define R_PPC_ADDR24 2 /* 26bit address, 2 bits ignored. */ +#define R_PPC_ADDR16 3 /* 16bit absolute address */ +#define R_PPC_ADDR16_LO 4 /* lower 16bit of absolute address */ +#define R_PPC_ADDR16_HI 5 /* high 16bit of absolute address */ +#define R_PPC_ADDR16_HA 6 /* adjusted high 16bit */ +#define R_PPC_ADDR14 7 /* 16bit address, 2 bits ignored */ +#define R_PPC_ADDR14_BRTAKEN 8 +#define R_PPC_ADDR14_BRNTAKEN 9 +#define R_PPC_REL24 10 /* PC relative 26 bit */ +#define R_PPC_REL14 11 /* PC relative 16 bit */ +#define R_PPC_REL14_BRTAKEN 12 +#define R_PPC_REL14_BRNTAKEN 13 +#define R_PPC_GOT16 14 +#define R_PPC_GOT16_LO 15 +#define R_PPC_GOT16_HI 16 +#define R_PPC_GOT16_HA 17 +#define R_PPC_PLTREL24 18 +#define R_PPC_COPY 19 +#define R_PPC_GLOB_DAT 20 +#define R_PPC_JMP_SLOT 21 +#define R_PPC_RELATIVE 22 +#define R_PPC_LOCAL24PC 23 +#define R_PPC_UADDR32 24 +#define R_PPC_UADDR16 25 +#define R_PPC_REL32 26 +#define R_PPC_PLT32 27 +#define R_PPC_PLTREL32 28 +#define R_PPC_PLT16_LO 29 +#define R_PPC_PLT16_HI 30 +#define R_PPC_PLT16_HA 31 +#define R_PPC_SDAREL16 32 +#define R_PPC_SECTOFF 33 +#define R_PPC_SECTOFF_LO 34 +#define R_PPC_SECTOFF_HI 35 +#define R_PPC_SECTOFF_HA 36 +/* Keep this the last entry. */ +#define R_PPC_NUM 37 + +/* The remaining relocs are from the Embedded ELF ABI, and are not + in the SVR4 ELF ABI. */ +#define R_PPC_EMB_NADDR32 101 +#define R_PPC_EMB_NADDR16 102 +#define R_PPC_EMB_NADDR16_LO 103 +#define R_PPC_EMB_NADDR16_HI 104 +#define R_PPC_EMB_NADDR16_HA 105 +#define R_PPC_EMB_SDAI16 106 +#define R_PPC_EMB_SDA2I16 107 +#define R_PPC_EMB_SDA2REL 108 +#define R_PPC_EMB_SDA21 109 /* 16 bit offset in SDA */ +#define R_PPC_EMB_MRKREF 110 +#define R_PPC_EMB_RELSEC16 111 +#define R_PPC_EMB_RELST_LO 112 +#define R_PPC_EMB_RELST_HI 113 +#define R_PPC_EMB_RELST_HA 114 +#define R_PPC_EMB_BIT_FLD 115 +#define R_PPC_EMB_RELSDA 116 /* 16 bit relative offset in SDA */ + +/* Diab tool relocations. */ +#define R_PPC_DIAB_SDA21_LO 180 /* like EMB_SDA21, but lower 16 bit */ +#define R_PPC_DIAB_SDA21_HI 181 /* like EMB_SDA21, but high 16 bit */ +#define R_PPC_DIAB_SDA21_HA 182 /* like EMB_SDA21, adjusted high 16 */ +#define R_PPC_DIAB_RELSDA_LO 183 /* like EMB_RELSDA, but lower 16 bit */ +#define R_PPC_DIAB_RELSDA_HI 184 /* like EMB_RELSDA, but high 16 bit */ +#define R_PPC_DIAB_RELSDA_HA 185 /* like EMB_RELSDA, adjusted high 16 */ + +/* This is a phony reloc to handle any old fashioned TOC16 references + that may still be in object files. */ +#define R_PPC_TOC16 255 + +#endif /* _ELF_H */ -#endif /* _SYS_EXEC_ELF_H_ */ diff --git a/include/ppcboot.h b/include/ppcboot.h index e971f2f..5a32b93 100644 --- a/include/ppcboot.h +++ b/include/ppcboot.h @@ -222,33 +222,34 @@ int misc_init_f (void); void misc_init_r (bd_t *); #endif -#if defined(CONFIG_SPD823TS) || \ - defined(CONFIG_IVMS8) || \ - defined(CONFIG_IVML24) || \ +#if defined(CONFIG_CCM) || \ defined(CONFIG_IP860) || \ + defined(CONFIG_IVML24) || \ + defined(CONFIG_IVMS8) || \ defined(CONFIG_LWMON) || \ defined(CONFIG_MPC8260ADS) || \ - defined(CONFIG_RPXSUPER) || \ defined(CONFIG_PCU_E) || \ - defined(CONFIG_CCM) + defined(CONFIG_RPXSUPER) || \ + defined(CONFIG_SPD823TS) /* $(BOARD)/$(BOARD).c */ void reset_phy (void); #endif -#if defined(CONFIG_IP860) || \ - defined(CONFIG_SXNI855T) || \ +#if defined(CONFIG_CANBT) || \ + defined(CONFIG_CCM) || \ defined(CONFIG_CPCI405) || \ - defined(CONFIG_CANBT) || \ - defined(CONFIG_WALNUT405) || \ - defined(CONFIG_PIP405) || \ defined(CONFIG_CPCIISER4) || \ - defined(CONFIG_OCRTC) || \ + defined(CONFIG_HYMOD) || \ + defined(CONFIG_IP860) || \ defined(CONFIG_LWMON) || \ - defined(CONFIG_TQM8260) || \ - defined(CONFIG_PM826) || \ + defined(CONFIG_OCRTC) || \ defined(CONFIG_PCU_E) || \ - defined(CONFIG_CCM) || \ - defined(CONFIG_HYMOD) + defined(CONFIG_PIP405) || \ + defined(CONFIG_PM826) || \ + defined(CONFIG_SXNI855T) || \ + defined(CONFIG_TQM8260) || \ + defined(CONFIG_W7O) || \ + defined(CONFIG_WALNUT405) /* $(BOARD)/eeprom.c */ void eeprom_init (void); int eeprom_read (unsigned offset, uchar *buffer, unsigned cnt); diff --git a/tools/Makefile b/tools/Makefile index d36ee35..153eaf9 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -48,10 +48,11 @@ endif # # Use native tools and options # -CPPFLAGS = -I../include -I.. -DTEXT_BASE=$(TEXT_BASE) +CPPFLAGS = -I../include -I.. -DTEXT_BASE=$(TEXT_BASE) -DUSE_HOSTCC CFLAGS = -Wall -pedantic $(CPPFLAGS) -O AFLAGS = -D__ASSEMBLY__ $(CPPFLAGS) CC = $(HOSTCC) +STRIP = $(HOSTSTRIP) MAKEDEPEND = makedepend all: .depend $(BINS) subdirs @@ -63,7 +64,8 @@ environment.S: ../common/environment.S ln -sf $^ $@ img2srec: img2srec.o - $(CC) $(CFLAGS) -s -o $@ $^ + $(CC) $(CFLAGS) -o $@ $^ + $(STRIP) $@ mkimage: mkimage.o crc32.o $(CC) -g $(CFLAGS) -o $@ $^ diff --git a/tools/gdb/astest.c b/tools/gdb/astest.c index 4921940..8c8ed28 100644 --- a/tools/gdb/astest.c +++ b/tools/gdb/astest.c @@ -24,10 +24,12 @@ process_section(bfd *abfd, asection *sect, PTR obj) (unsigned int)sect->user_set_vma, (unsigned int)sect->reloc_done); #endif - printf("\tvma=%08lx, lma=%08lx\n", sect->vma, sect->lma); + printf("\tvma=%08lx, lma=%08lx\n", + (unsigned long)sect->vma, (unsigned long)sect->lma); printf("\tcooked_size=%ld, raw_size=%ld, output_offset=%ld\n", - sect->_cooked_size, sect->_raw_size, sect->output_offset); + (long)sect->_cooked_size, (long)sect->_raw_size, + (long)sect->output_offset); printf("\talignment_power=%d, reloc_count=%d, filepos=%ld\n", sect->alignment_power, sect->reloc_count, sect->filepos); diff --git a/tools/img2srec.c b/tools/img2srec.c index 084ea24..330ae02 100644 --- a/tools/img2srec.c +++ b/tools/img2srec.c @@ -61,10 +61,6 @@ #include #include -#if defined(__BEOS__) || defined(__NetBSD__) -#include -#endif - extern int errno; /*************************************************************************