📄 bootconfig.c
字号:
/************************************************************************
Copyright 2003 - 2004 UPTI, Inc.
filename : bootconfig.c
description : Motorola board system-dependent library
author : Liuxu
modification : lx create 2003-01-01
************************************************************************/
#include "copyright_wrs.h"
/*
DESCRIPTION
This is the WRS-supplied configuration module for the VxWorks boot ROM.
It is a stripped-down version of usrConfig.c, having no VxWorks shell or
debugging facilities. Its primary function is to load an object module
over the network with either RSH or FTP. Additionally, a simple set of
single letter commands is provided for displaying and modifying memory
contents. 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"
#include "dhcp/dhcpc.h"
#include "dhcp/dhcpcCommonLib.h"
#endif
#if defined(INCLUDE_STREAMS) || defined(INCLUDE_STREAMS_ALL)
#include "strmLib.h"
#endif /* INCLUDE_STREAMS */
/*for test timer*/
#include "kzCpmTimer.h"
#include "Drv_852Smc.h"
#include "drv/multi/ppc860cpm.h"
#include "drv/multi/ppc860Siu.h"
#include "bsp.h"
#define PC15 0x0001
#define PC13 0x0004
/* defines */
/* defines */
#define STREQ(A, B) (strcmp(A, B) == 0 ? 1 : 0)
#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 ();
#if (CPU_FAMILY==MIPS)
IMPORT void sysGpInit ();
#endif /* (CPU_FAMILY==MIPS) */
#ifdef INCLUDE_NETWORK
#ifdef ETHERNET_ADR_SET
void mEnet (char *);
void sysEnetAddrGet ();
void sysEnetAddrSet ();
#endif /* ETHERNET_ADR_SET */
#endif /* INCLUDE_NETWORK */
#ifdef INCLUDE_END
LOCAL void* findCookie(int unitNo, char* devName);
#endif /* INCLUDE_END */
extern BootInfoString ParamInfo;
extern BootInfo gBootInfo;
extern void InChar ( unsigned char *szString, unsigned long *ret );
extern _U32 LoadCtrl_GetBootParam(void);
extern void LoadCtrl_SetParam(void);
extern _U32 LoadCtrl_BootInfoIOCtrl(_U16 u16Cmd, _U32 pData);
extern void LoadCtrl_DisplayBootParam(BootInfoString *pParamInfo);
extern _U32 LoadCtrl_SetDefaultParam();
extern void Drv_LedCtrl(_U32 LedNum, _U32 LedOnOff);
extern _U32 sysStrToMac(char *strmac, char *pmac);
/*******************************************************************************
*
* compressedEntry - compressed entry point after decompression
*
* Description:
* 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.
*
* Calls: sysInitAlt(), usrInit
* Called by: None
* Input: startType 启动参数
* Output: None
* Return: None
*******************************************************************************/
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 "muxTkLib.h"
#include "configNet.h"
#include "m2Lib.h"
IMPORT int ipAttach ();
END_TBL_ENTRY endDevTbl [] =
{
{ 0, FEC_LOAD_FUNC, FEC_LOAD_STRING, 1, NULL, FALSE},
#ifdef INCLUDE_CPM
{ 1, CPM_LOAD_FUNC, CPM_LOAD_STRING, 1, NULL, FALSE},
#endif /* INCLUDE_CPM */
{ 0, END_TBL_END, NULL, 0, NULL, FALSE},
};
typedef struct cookie_tbl
{
int unitNo;
char devName[END_NAME_MAX];
void* pCookie;
}COOKIE_TBL;
COOKIE_TBL cookieTbl[32];
#ifndef IP_MAX_UNITS
#define IP_MAX_UNITS 1
#endif
#ifndef MUX_MAX_BINDS
#define MUX_MAX_BINDS 8
#endif
IP_DRV_CTRL ipDrvCtrl[IP_MAX_UNITS];
int ipMaxUnits = IP_MAX_UNITS;
void* pCookie;
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_USR /* 定义 */
IMPORT int IF_USR_ATTACH ();
#endif /* INCLUDE_IF_USR */
/* Net interface table */
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,
IO_ADRS_NISA_PCMCIA, IO_ADRS_NISA_PCMEM,
INT_VEC_PCMCIA_A, INT_LVL_PCMCIA_A,
INT_VEC_PCMCIA_B, INT_LVL_PCMCIA_B
},
#endif /* INCLUDE_OLI */
#ifdef INCLUDE_DC
{ "dc", dcattach, (char*)IO_ADRS_DC, INT_VEC_DC, INT_LVL_DC,
DC_POOL_ADRS, DC_POOL_SIZE, DC_DATA_WIDTH, DC_RAM_PCI_ADRS,
DC_MODE
},
#endif /* INCLUDE_DC */
#ifdef INCLUDE_EGL
{ "egl", eglattach, (char*)IO_ADRS_EGL, INT_VEC_EGL, INT_LVL_EGL
},
#endif /* INCLUDE_EGL */
#ifdef INCLUDE_EI
{ "ei", eiattach, (char*)INT_VEC_EI, EI_SYSBUS, EI_POOL_ADRS, 0, 0
},
#endif /* INCLUDE_EI */
#ifdef INCLUDE_FEI
{ "fei", feiattach, (char*)FEI_POOL_ADRS, 0, 0, 0, 0
},
#endif /* INCLUDE_FEI */
#ifdef INCLUDE_EX
{ "ex", exattach, (char*)IO_ADRS_EX, INT_VEC_EX, INT_LVL_EX,
IO_AM_EX_MASTER, IO_AM_EX
},
#endif /* INCLUDE_EX */
#ifdef INCLUDE_ENP
{ "enp", enpattach, (char*)IO_ADRS_ENP, INT_VEC_ENP, INT_LVL_ENP,
IO_AM_ENP
},
#endif /* INCLUDE_ENP */
#ifdef INCLUDE_IE
{ "ie", ieattach, (char*)IO_ADRS_IE, INT_VEC_IE, INT_LVL_IE
},
#endif /* INCLUDE_IE */
#ifdef INCLUDE_ILAC
{ "ilac", ilacattach, (char*)IO_ADRS_ILAC, INT_VEC_ILAC
},
#endif /* INCLUDE_ILAC */
#ifdef INCLUDE_LN
{ "ln", lnattach, (char*)IO_ADRS_LN, INT_VEC_LN, INT_LVL_LN,
LN_POOL_ADRS, LN_POOL_SIZE, LN_DATA_WIDTH, LN_PADDING,
LN_RING_BUF_SIZE
},
#endif /* INCLUDE_LN */
#ifdef INCLUDE_LNSGI
{ "lnsgi", lnsgiattach, (char*)IO_ADRS_LNSGI, INT_VEC_LNSGI,
INT_LVL_LNSGI, LNSGI_POOL_ADRS, LNSGI_POOL_SIZE, LNSGI_DATA_WIDTH,
LNSGI_PADDING, LNSGI_RING_BUF_SIZE
},
#endif /* INCLUDE_LNSGI */
#ifdef INCLUDE_NIC
{ "nic", nicattach, (char*)IO_ADRS_NIC, INT_VEC_NIC, INT_LVL_NIC
},
#endif /* INCLUDE_NIC */
#ifdef INCLUDE_NIC_EVB
{ "nicEvb", nicEvbattach, (char*)IO_ADRS_NIC,INT_VEC_NIC,INT_LVL_NIC
},
#endif /* INCLUDE_NIC_EVB */
#ifdef INCLUDE_MED
{ "med", medattach, (char*)IO_ADRS_DBETH, INT_VEC_DBETH, INT_LVL_DBETH
},
#endif /* INCLUDE_MED */
#ifdef INCLUDE_ELC
{ "elc", elcattach, (char*)IO_ADRS_ELC, INT_VEC_ELC, INT_LVL_ELC,
MEM_ADRS_ELC, MEM_SIZE_ELC, CONFIG_ELC
},
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -