📄 bootconfig.c
字号:
/* bootConfig.c - system configuration module for boot ROMs *//* Copyright 1984 - 1999 Wind River Systems, Inc. */#include "copyright_wrs.h"/*modification history--------------------10y,19mar99,dat removed bp driver interface SPR 25877, fixed bug in ver 10x.10x,17mar99,spm added support for identical unit numbers (SPR #20913)10w,16mar99,dat SPR 25790, fixed startup of END and BSD drivers10v,16mar99,spm recovered orphaned code from tor1_0_1.sens1_1 (SPR #25770)10u,01mar99,spm bypassed incorrect cleanup after successful TFTP file transfer (SPR #24618)10t,26feb99,dat added FEI support (23818)10s,19feb99,spm fixed construction of device name for pcmcia (SPR #21676)10r,28jan99,jmp added TSFS_BOOT facility (SPR# 24466).10q,20jan99,scb usrBpInit() modified to use "sm=" before SM_ANCHOR_ADRS (23035)10p,26jan99,jkf removed x86 specific memAddToPool's from ataLoad, ideLoad, pcmciaLoad, & tffsLoad. Replaced with BSP specific memAddToPool in sysHwInit2() (SPR#21338).10o,13nov98,n_s added call to muxDevStopAll in go. spr #2322910n,11sep98,spm corrected documentation for bootpGet and dhcpGet (SPR #20629)10m,04sep98,ham set subnetmask through ntohl() in bootpGet(),SPR#21909.10l,03jun98,hdn disabled system clock just before jumping to the entry point for PentiumPro's Local APIC Timer.10k,23apr98,yp merged TrueFFS support10j,01apr98,hdn moved tffsLoad from usrTffs.c.10i,04feb98,jpd updated copyright date.10h,19mar98,spm corrected prototype for mEnet() routine (SPR #20174); changed parameter name to match coding standards10g,02feb98,spm replaced invalid logMsg calls with printf statements10f,06jan98,hdn added support for TFFS.10e,30nov97,vin added network system pool10d,20nov97,gnn fixed spr#7265 to deal with devices with no attach routine.10c,27oct97,vin fixed call to endLoadFunc(..).10b,03oct97,gnn removed references to endDriver global10b,23oct97,tam fixed compilation warnings.10a,26sep97,gnn added muxAddrResFuncAdd call for ipAttach09z,26sep97,vin used NUM_XXX_MIN macros for system pool configuration.09y,25sep97,gnn SENS beta feedback fixes09x,26aug97,vin fixed warnings in muxIoctl09w,26aug97,spm major overhaul of DHCP client: reorganized code and changed user interface to support multiple leases at runtime, improved handling of address information, and allowed selection of UDP ports; also fixed incorrect treatment of gateway field by BOOTP/DHCP (SPR #9137)09v,12aug97,gnn changes necessitated by MUX/END update.09u,15jul97,spm fixed byte ordering of netmask from DHCP client (SPR #8739)09t,01jul97,jag removed stale code for RESOLVER (SPR #8868)09j,15aug97,cdp add casts etc. to stop compiler warnings.09i,05feb97,cdp remove ARM test hook (_func_armStartup).09h,21jan97,jpd Added support for Olicom and lnEbsa Ethernet drivers, made cacheLib calls dependent upon INCLUDE_CACHE_SUPPORT being defined.09g,12dec96,cdp added _func_armStartup for ARM platforms.09s,02jun97,spm changed DHCP option tags to prevent name conflicts (SPR #8667)09r,20may97,gnn fixed SPR 8627 so that multiple gn devices are supported.09q,19may97,spm included rngLib.h to fix DHCP client build error (SPR #8606)09p,30apr97,spm moved usrNetIfConfig for "gn" device to prevent DHCP error09o,25apr97,gnn changed INCLUDE_GN to INCLUDE_END09n,18apr97,spm corrected structure element name in BOOTP interface09m,17apr97,gnn added support for configNet style configuration of ENDs.09l,07apr97,spm changed BOOTP interface to DHCP style: all options supported09k,29jan97,spm made global variables for DHCP client unique09j,29jan97,spm removed parameters from dhcpBootBind()09i,21jan97,gnn added the new argument to muxDevLoad().09h,20dec96,vin fixed warnings muxDevLoad(). added AF_ROUTE.09g,06mar97,mas deleted unused variable 'char gateway[INET_ADDR_LEN];' from bootLoad() (SPR 8113).09g,18dec96,spm fixed bug in unit number support and restored lost DHCP code09f,17dec96,gnn added stuff for new etherHooks.09e,27nov96,spm added support for DHCP client and network device unit numbers09d,25nov96,vin added new cluster configuration.09c,01oct96,spm added bzero() call to checkInetAddrField (SPR 6326)09b,22sep96,spm Fixed SPR 7120: added support for gateways to BOOTP startup09a,24jul96,vin fetching netmask after usrNetIfConfig() mods for bsd4.4.08z,21jun96,jmb long modhist -- deleted entries prior to 1994. SPR #652808y,19jun96,hdn defined IDE_MEM_DOSFS to 0x200000.08x,13jun96,hdn added INCLUDE_ESMC for SMC91c9x Ethernet driver.08w,05jun96,kkk update copyright year from 1995 to 1996.08v,05jun96,ism bumped copyright date to 1996.19v,19apr96,jds changed the include of scsiLib.h to be done after config.h; also added setting to asynchronous mode all target devices08u,20mar96,hdn made inclusion of pppLib.h and strmLib.h conditional.09t,07mar96,gnn added SLIP_MTU to slipInit so that we could configure the MTU. (SPR #4652)08s,06mar96,tpr added #include "bootElfLib.h".08r,06mar96,dat removed __DATE__ from printBootLogo08q,06mar96,tpr Enabled the Instruction Cache for PowerPC.08p,06dec95,vin fixed usrStrmInit warning.08o,29nov95,vin added baudrate processing of boot string.08n,06sep95,jag deleted call to fattachInit (), changed sadInit to autopushInit (), and changed iosStrmInit to strmInit (). 08m,01aug95,dzb changed STREAMS options to go through iosStrmInit (). added usrStrmInit (). PPP initialization failure message (SPR #4505).08l,25jul95,dzb tweaked socket library initialization.08k,25jul95,dzb added socket library init for BSD vs. STREAMS.08j,18jul95,dzb wait for PPP interface to come up in usrPPPInit().08i,17jul95,dzb fixed ordering of boot params search.08h,26jun95,dzb removed PPP_S_USEHOSTNAME option.08g,21jun95,dzb Added INCLUDE_PPP_CRYPT for unbundled crypt() support.08f,20jun95,dzb Added PPP support.09b,28nov95,tpr re-ordered history following PPC merge.09a,11oct95,dat new BSP revision id, modified signon banner printing08z,29jun95,caf added nicEvb driver entry.08y,28jun95,caf for PPC, called cacheTextUpdate() instead of cacheClear().08x,26jun95,kvk Removed references to _edata and _end for a clean bootrom_uncmp build.08w,06jun95,caf fixed edata and end for Green Hills/PowerPC.08v,26jun95,ms updated for new serial drivers, removed WDB support.08u,21jun95,ms changed copywrite to 199508t,01jun95,caf added support for "ilac" driver.08s,22may95,yao adjust reference to edata, end to SVR4 ABI standard for PowerPC.08r,22may95,p_m added WDB agent support. + ms08q,05apr95,kkk changed edata & end to char arrays (spr# 3917)08p,28mar95,kkk made baud rate a macro in configAll.h08o,19mar95,dvs removed TRON references.08n,08dec94,hdn swapped 1st and 2nd parameters of fdDevCreate(). fixed bootHelp message; fd=... and ide=...08m,21nov94,hdn fixed a problem by swapping 1st and 2nd parameters of sscanf.08l,20nov94,kdl added hashLibInit() call if using dosFs.08k,11nov94,dzb added QU network interface.08j,09nov94,jds additions for scsi backward compatability ; scsi[12]IfInit()08i,20oct94,hdn used ideRawio() instead of using raw file system. swapped 1st and 2nd parameter of ideLoad() and fdLoad().08h,17aug94,dzb fixed setting the gateway for a slip connection (SPR #2353). added INCLUDE_NETWORK macros for scalability (SPR #1147). added CSLIP support.08g,14jun94,caf updated copyright notices.08f,29may94,hdn fixed more FTP bootrom bug in netLoad(). updated the copyright year 93 to 94. disabled cache for i486 and Pentium.08e,26may94,kdl changed netLoad() to properly close FTP connections (SPR 3231).08d,10may94,hdn fixed the FTP bootrom bug (John's patch)08c,09feb94,hdn added support for if_elt 3COM EtherLink III driver. added support for if_ene Eagle NE2000 driver.*//*DESCRIPTIONThis is the WRS-supplied configuration module for the VxWorks boot ROM.It is a stripped-down version of usrConfig.c, having no VxWorks shell ordebugging facilities. Its primary function is to load an object moduleover the network with either RSH or FTP. Additionally, a simple set ofsingle letter commands is provided for displaying and modifying memorycontents. Use this module as a starting point for placing applications in ROM.*/#include "vxWorks.h"#include "bootEcoffLib.h"#include "bootElfLib.h"#include "bootLib.h"#include "bootLoadLib.h"#include "bootpLib.h"#include "bsdSockLib.h"#include "cacheLib.h"#include "ctype.h"#include "dosFsLib.h"#include "errno.h"#include "errnoLib.h"#include "fcntl.h"#include "fioLib.h"#include "ftpLib.h"#include "hostLib.h"#include "icmpLib.h"#include "ifLib.h"#include "if_sl.h"#include "inetLib.h"#include "intLib.h"#include "ioLib.h"#include "iosLib.h"#include "loadAoutLib.h"#include "loadCoffLib.h"#include "loadLib.h"#include "logLib.h"#include "memLib.h"#include "msgQLib.h"#include "netLib.h"#include "pipeDrv.h"#include "proxyLib.h"#include "qLib.h"#include "qPriBMapLib.h"#include "rebootLib.h"#include "remLib.h"#include "rngLib.h"#include "routeLib.h"#include "semLib.h"#include "sockLib.h"#include "stdio.h"#include "string.h"#include "sysLib.h"#include "sysSymTbl.h"#include "taskHookLib.h"#include "taskLib.h"#include "tftpLib.h"#include "tickLib.h"#include "trcLib.h"#include "unistd.h"#include "version.h"#include "wdLib.h"#include "net/if.h"#include "net/mbuf.h"#include "netinet/if_ether.h"#include "drv/netif/smNetLib.h"#include "ipProto.h"#include "private/kernelLibP.h"#include "private/workQLibP.h"#include "config.h"#include "scsiLib.h"#ifdef INCLUDE_PPP#include "pppLib.h"#endif /* INCLUDE_PPP */#ifdef INCLUDE_DHCPC#include "dhcpcBootLib.h"#endif#if defined(INCLUDE_STREAMS) || defined(INCLUDE_STREAMS_ALL)#include "strmLib.h"#endif /* INCLUDE_STREAMS */
/**********kongfq*************/void selfTest(void);
/**********kongfq*************/
#ifndef SYS_INT_CONNECT
#define SYS_INT_CONNECT(ivec,rtn,arg,pResult) \
{ \
IMPORT STATUS intConnect(); \
*pResult = intConnect ((VOIDFUNCPTR *)INUM_TO_IVEC (ivec),\
(rtn), (int)(arg)); \
}
#endif /*SYS_INT_CONNECT*//* defines */#define TIMEOUT 7 /* number of seconds before auto-boot */#define MAX_LINE 160 /* max line length for input to 'm' routine */#define RSHD 514 /* rshd service */#define DEC FALSE /* getArg parameters */#define HEX TRUE#define OPT TRUE#define MAX_ADR_SIZE 6 #define DOS_ID_OFFSET 3#define FIRST_PARTITION_SECTOR_OFFSET (0x1be + 8)#define VXDOS "VXDOS"#define VXEXT "VXEXT"/* DO NOT ADD ANYTHING BEFORE THE FIRST ROUTINE compressedEntry() */void usrInit ();IMPORT void sysInitAlt ();IMPORT STATUS pciDeviceShow (int busNo); /* add by zoutl 2003-5-24 10:49 */IMPORT void PciBusTest(void);IMPORT void sysDebugMsg(char * str, UINT32 recovery); /* add by zoutl 2003-5-24 10:49 */#if (CPU_FAMILY==MIPS)IMPORT void sysGpInit ();#endif /* (CPU_FAMILY==MIPS) */#ifdef INCLUDE_NETWORK#ifdef ETHERNET_ADR_SETvoid mEnet (char *);void sysEnetAddrGet ();void sysEnetAddrSet ();#endif /* ETHERNET_ADR_SET */#endif /* INCLUDE_NETWORK *//********************************************************************************* compressedEntry - compressed entry point after decompression ** This routine is the entry point after the bootroms decompress, if* compression is utilized. This routine must be the first item of the* text segment of this file. With ANSI C, strings will appear in text* segment so one should avoid entering strings, routines, or anything* else that might displace this routine from base of the text segment.** It is unwise to add functionality to this routine without due cause.* We are in the prehistoric period of system initialization. ** NOMANUAL*/void compressedEntry ( int startType ) {#if (CPU_FAMILY==MIPS)#if __GNUC__ __asm volatile (".extern _gp,0; la $gp,_gp");#endif#endif#if (CPU_FAMILY==I960) sysInitAlt (startType); /* jump to the i960 entry point */#else usrInit (startType); /* all others procede below */#endif }#ifdef INCLUDE_END#include "end.h"#include "muxLib.h"#include "configNet.h"#include "m2Lib.h"IMPORT int ipAttach ();IMPORT END_TBL_ENTRY endDevTbl[];void* cookieTbl[32];#ifndef IP_MAX_UNITS #define IP_MAX_UNITS 1#endifIP_DRV_CTRL ipDrvCtrl [IP_MAX_UNITS];int ipMaxUnits = IP_MAX_UNITS;END_OBJ* pEnd;M2_INTERFACETBL endM2Tbl;#else /* INCLUDE_END not defined */IP_DRV_CTRL ipDrvCtrl[1];#endif /* INCLUDE_END *//* Wind kernel configuration facility */#undef INCLUDE_SHOW_ROUTINES /* keep out kernel show routines */#include "usrKernel.c" /* kernel configuration facility *//* imports */IMPORT char edata []; /* defined by the loader */IMPORT char end []; /* defined by the loader */#ifdef INCLUDE_TSFS_BOOT /* boot via Target Server File System */#if ((WDB_COMM_TYPE == WDB_COMM_SERIAL) && \ (CONSOLE_TTY == NONE || CONSOLE_TTY == WDB_TTY_CHANNEL))#define INCLUDE_TSFS_BOOT_VIO_CONSOLE /* needed for Target Server Console */#endif#define INCLUDE_WDB /* WDB agent needed for TSFS Boot */#define INCLUDE_WDB_TSFS /* target-server file system */#undef INCLUDE_WDB_BANNER /* print banner after agent starts */#undef INCLUDE_WDB_TTY_TEST /* test serial line communcation */#undef INCLUDE_WDB_START_NOTIFY /* notify the host of task creation */#undef INCLUDE_WDB_USER_EVENT /* user events handling */#undef INCLUDE_WDB_CTXT /* context control */#undef INCLUDE_WDB_FUNC_CALL /* spawn function as separate task */#undef INCLUDE_WDB_GOPHER /* gopher info gathering */#undef INCLUDE_WDB_EXIT_NOTIFY /* notify the host of task exit */#undef INCLUDE_WDB_REG /* get/set hardware registers */#undef INCLUDE_WDB_EVENTPOINTS /* eventpoints handling */#undef INCLUDE_WDB_MEM /* optional memory services */#undef INCLUDE_WDB_BP /* breakpoint support */#include "wdb/wdbEvtLib.h"#include "../../src/config/usrWdb.c" /* WDB agent configuration */#else /* INCLUDE_TSFS_BOOT not defined */#undef INCLUDE_WDB#endif /* INCLUDE_TSFS_BOOT */#ifdef INCLUDE_NETWORK/* forward declarations */LOCAL STATUS usrNetProtoInit (void);IMPORT int lnEbsaattach ();IMPORT int oliattach ();IMPORT int dcattach ();IMPORT int eglattach ();IMPORT int eiattach ();IMPORT int feiattach ();IMPORT int exattach ();IMPORT int enpattach ();IMPORT int ieattach ();IMPORT int ilacattach ();IMPORT int lnattach ();IMPORT int lnsgiattach ();IMPORT int nicattach ();IMPORT int nicEvbattach ();IMPORT int medattach ();IMPORT int elcattach ();IMPORT int ultraattach ();IMPORT int eexattach ();IMPORT int eltattach ();IMPORT int eneattach ();IMPORT int esmcattach ();IMPORT int quattach ();IMPORT int loattach ();IMPORT int snattach ();IMPORT int fnattach ();IMPORT STATUS slipInit ();IMPORT int ifreset ();IMPORT void if_dettach ();IMPORT u_long in_netof ();IMPORT struct ifnet * ifunit ();IMPORT int pcmciaattach ();#ifdef NETIF_USR_DECL NETIF_USR_DECL /* additional declarations, from BSP */#endif#ifdef INCLUDE_IF_USRIMPORT int IF_USR_ATTACH ();#endif /* INCLUDE_IF_USR */LOCAL NETIF netIf [] = {#ifdef NETIF_USR_ENTRIES NETIF_USR_ENTRIES /* additional entries, from BSP */#endif#ifdef INCLUDE_IF_USR { IF_USR_NAME, IF_USR_ATTACH, IF_USR_ARG1, IF_USR_ARG2, IF_USR_ARG3, IF_USR_ARG4, IF_USR_ARG5, IF_USR_ARG6, IF_USR_ARG7, IF_USR_ARG8 },#endif /* INCLUDE_IF_USR */#ifdef INCLUDE_LNEBSA { "lnEbsa", lnEbsaattach, (char*)IO_ADRS_LNEBSA, INT_VEC_LNEBSA, INT_LVL_LNEBSA, LNEBSA_POOL_ADRS, LNEBSA_POOL_SIZE, LNEBSA_DATA_WIDTH, LNEBSA_MODE, LNEBSA_DMA_CHAN },#endif /* INCLUDE_LNEBSA */#ifdef INCLUDE_OLI { "oli", oliattach, (char*)IO_ADRS_NISA_BASE,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -