Clean up network configuration.
This commit is contained in:
@@ -15,7 +15,10 @@ SRCS += rtems_config.c
|
||||
SRCS += rtems_netconfig.c
|
||||
SRCS += rtems_util.c
|
||||
SRCS += rtems_dummyreg.c
|
||||
SRCS += setBootConfigFromPPCBUGNVRAM.c
|
||||
|
||||
SRCS_RTEMS-mvme2100 += setBootConfigFromPPCBUGNVRAM.c
|
||||
SRCS_RTEMS-mvme5500 += setBootConfigFromMOTLOADNVRAM.c
|
||||
SRCS += $(SRCS_$(T_A))
|
||||
|
||||
LIBRARY_RTEMS = rtemsCom
|
||||
LIBRARY_SRCS = $(SRCS) $(BUILD_ARCHS)
|
||||
|
||||
@@ -48,6 +48,8 @@ rtems_task Init (rtems_task_argument argument);
|
||||
|
||||
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
|
||||
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
|
||||
# define CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER
|
||||
#ifndef mpc7455
|
||||
#define CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER
|
||||
#endif
|
||||
|
||||
#include <confdefs.h>
|
||||
|
||||
@@ -376,13 +376,22 @@ Init (rtems_task_argument ignored)
|
||||
*/
|
||||
#if defined(__i386__)
|
||||
initRemoteGdb(ticksPerSecond);
|
||||
rtems_bsdnet_bootp_server_name = "164.54.8.131";
|
||||
rtems_bsdnet_bootp_cmdline = "epics/vlinac/st.cmd";
|
||||
rtems_bsdnet_bootp_cmdline = "epics/test/iocrtems/st.cmd";
|
||||
#endif
|
||||
#if defined(__PPC) && defined(HAVE_PPCBUG)
|
||||
#if defined(HAVE_PPCBUG)
|
||||
{
|
||||
extern void setBootConfigFromPPCBUGNVRAM(void);
|
||||
setBootConfigFromPPCBUGNVRAM();
|
||||
}
|
||||
#endif
|
||||
#if defined(HAVE_MOTLOAD)
|
||||
{
|
||||
extern void setBootConfigFromMOTLOADNVRAM(void);
|
||||
setBootConfigFromMOTLOADNVRAM();
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Override RTEMS configuration
|
||||
|
||||
@@ -66,9 +66,6 @@ static struct rtems_bsdnet_ifconfig e3c509_driver_config = {
|
||||
extern int rtems_dec21140_driver_attach();
|
||||
# endif
|
||||
# endif
|
||||
# if defined(HAVE_PPCBUG)
|
||||
# define MY_DO_BOOTP NULL
|
||||
# endif
|
||||
# endif
|
||||
|
||||
static struct rtems_bsdnet_ifconfig bsp_driver_config = {
|
||||
|
||||
67
src/RTEMS/base/setBootConfigFromMOTLOADNVRAM.c
Normal file
67
src/RTEMS/base/setBootConfigFromMOTLOADNVRAM.c
Normal file
@@ -0,0 +1,67 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netinet/in.h>
|
||||
#include <rtems/rtems_bsdnet.h>
|
||||
#include <bsp.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
static char *
|
||||
gev(const char *parm)
|
||||
{
|
||||
volatile char *nvp = (volatile unsigned char *)(GT64260_DEV1_BASE + 0x10000 + 0x70F8);
|
||||
char *val;
|
||||
char *ret;
|
||||
const char *name;
|
||||
char c;
|
||||
|
||||
for (;;) {
|
||||
if (*nvp == '\0')
|
||||
return NULL;
|
||||
name = parm;
|
||||
while ((c = *nvp++) != '\0') {
|
||||
if ((c == '=') && (*name == '\0')) {
|
||||
val = (char *)nvp;
|
||||
while (*nvp++ != '\0')
|
||||
continue;
|
||||
ret = malloc(nvp - val);
|
||||
if (ret == NULL)
|
||||
return NULL;
|
||||
nvp = val;
|
||||
val = ret;
|
||||
while ((*val++ = *nvp++) != '\0')
|
||||
continue;
|
||||
return ret;
|
||||
}
|
||||
if (c != *name++) {
|
||||
while (*nvp++ != '\0')
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
setBootConfigFromMOTLOADNVRAM(void)
|
||||
{
|
||||
if (rtems_bsdnet_config.bootp != NULL)
|
||||
return;
|
||||
rtems_bsdnet_bootp_server_name = gev("mot-/dev/enet0-sipa");
|
||||
rtems_bsdnet_config.gateway = gev("mot-/dev/enet0-gipa");
|
||||
rtems_bsdnet_config.ifconfig->ip_netmask = gev("mot-/dev/enet0-snma");
|
||||
|
||||
rtems_bsdnet_config.name_server[0] = gev("rtems-dns-server");
|
||||
if (rtems_bsdnet_config.name_server[0] == NULL)
|
||||
rtems_bsdnet_config.name_server[0] = rtems_bsdnet_bootp_server_name;
|
||||
rtems_bsdnet_config.log_host = rtems_bsdnet_bootp_server_name;
|
||||
|
||||
rtems_bsdnet_config.ifconfig->ip_address = gev("mot-/dev/enet0-cipa");
|
||||
rtems_bsdnet_config.hostname = gev("rtems-client-name");
|
||||
if (rtems_bsdnet_config.hostname == NULL)
|
||||
rtems_bsdnet_config.hostname = rtems_bsdnet_config.ifconfig->ip_address;
|
||||
|
||||
rtems_bsdnet_bootp_boot_file_name = gev("mot-/dev/enet0-file");
|
||||
rtems_bsdnet_bootp_cmdline = gev("epics-script");
|
||||
}
|
||||
@@ -4,8 +4,6 @@
|
||||
#include <netinet/in.h>
|
||||
#include <rtems/rtems_bsdnet.h>
|
||||
|
||||
#if defined(__PPC)
|
||||
|
||||
struct ppcbug_nvram {
|
||||
rtems_unsigned32 PacketVersionIdentifier;
|
||||
rtems_unsigned32 NodeControlMemoryAddress;
|
||||
@@ -45,6 +43,9 @@ setBootConfigFromPPCBUGNVRAM(void)
|
||||
static char server[INET_ADDRSTRLEN];
|
||||
static char gateway[INET_ADDRSTRLEN];
|
||||
|
||||
if (rtems_bsdnet_config.bootp != NULL)
|
||||
return;
|
||||
|
||||
/*
|
||||
* Get network configuation from PPCBUG.
|
||||
* The 'correct' way to do this would be to issue a .NETCFIG PPCBUG
|
||||
@@ -80,5 +81,3 @@ setBootConfigFromPPCBUGNVRAM(void)
|
||||
rtems_bsdnet_bootp_boot_file_name = nvram.BootFilenameString;
|
||||
rtems_bsdnet_bootp_cmdline = nvram.ArgumentFilenameString;
|
||||
}
|
||||
|
||||
#endif /* defined(__PPC) */
|
||||
|
||||
Reference in New Issue
Block a user