Commit cbd8a35c authored by wdenk's avatar wdenk

* Patch by Masami Komiy, 22 Feb 2004:

  Add support for NFS for file download

* Minor code cleanup
parent 074cff0d
......@@ -2,6 +2,9 @@
Changes for U-Boot 1.0.2:
======================================================================
* Patch by Masami Komiy, 22 Feb 2004:
Add support for NFS for file download
* Patch by Andrea Scian, 17 Feb 2004:
Add support for S3C44B0 processor and DAVE B2 board
......
......@@ -575,10 +575,10 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
kbd->bi_sccfreq /= 1000000L;
kbd->bi_vco /= 1000000L;
#endif /* CONFIG_8260 */
#if defined(CONFIG_MPC5XXX)
#if defined(CONFIG_MPC5xxx)
kbd->bi_ipbfreq /= 1000000L;
kbd->bi_pcifreq /= 1000000L;
#endif /* CONFIG_MPC5XXX */
#endif /* CONFIG_MPC5xxx */
}
kernel = (void (*)(bd_t *, ulong, ulong, ulong, ulong))hdr->ih_ep;
......
......@@ -32,6 +32,8 @@
#include <config.h>
#include <command.h>
#if (CONFIG_COMMANDS & CFG_CMD_ITEST)
#define EQ 0
#define NE 1
#define LT 2
......@@ -195,3 +197,4 @@ U_BOOT_CMD(
"itest - return true/false on integer compare\n",
"[.b, .w, .l, .s] [*]value1 <op> [*]value2\n"
);
#endif /* CONFIG_COMMANDS & CFG_CMD_ITEST */
......@@ -38,6 +38,7 @@
#if (CONFIG_COMMANDS & (CFG_CMD_MEMORY | \
CFG_CMD_I2C | \
CFG_CMD_ITEST | \
CFG_CMD_PCI | \
CMD_CMD_PORTIO ) )
int cmd_get_data_size(char* arg, int default_size)
......
......@@ -81,6 +81,19 @@ U_BOOT_CMD(
);
#endif /* CFG_CMD_DHCP */
#if (CONFIG_COMMANDS & CFG_CMD_NFS)
int do_nfs (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
return netboot_common(NFS, cmdtp, argc, argv);
}
U_BOOT_CMD(
nfs, 3, 1, do_nfs,
"nfs - boot image via network using NFS protocol\n",
"[loadAddress] [host ip addr:bootfilename]\n"
);
#endif /* CFG_CMD_NFS */
static void netboot_update_env(void)
{
char tmp[16] ;
......
......@@ -23,5 +23,5 @@
PLATFORM_RELFLAGS += -fPIC -ffixed-r14 -meabi
PLATFORM_CPPFLAGS += -DCONFIG_MPC5XXX -ffixed-r2 -ffixed-r29 \
PLATFORM_CPPFLAGS += -DCONFIG_MPC5xxx -ffixed-r2 -ffixed-r29 \
-mstring -mcpu=603e -mmultiple
......@@ -183,7 +183,7 @@ int cpu_init_r (void)
/* route critical ints to normal ints */
*(vu_long *)MPC5XXX_ICTL_EXT |= 0x00000001;
#if (CONFIG_COMMANDS & CFG_CMD_NET) && defined(CONFIG_MPC5XXX_FEC)
#if (CONFIG_COMMANDS & CFG_CMD_NET) && defined(CONFIG_MPC5xxx_FEC)
/* load FEC microcode */
loadtask(0, 2);
#endif
......
......@@ -17,7 +17,7 @@
/* #define DEBUG 0x28 */
#if (CONFIG_COMMANDS & CFG_CMD_NET) && defined(CONFIG_NET_MULTI) && \
defined(CONFIG_MPC5XXX_FEC)
defined(CONFIG_MPC5xxx_FEC)
#if (DEBUG & 0x60)
static void tfifo_print(mpc5xxx_fec_priv *fec);
......@@ -980,4 +980,4 @@ static uint32 local_crc32(char *string, unsigned int crc_value, int len)
}
#endif /* DEBUG */
#endif /* CONFIG_MPC5XXX_FEC */
#endif /* CONFIG_MPC5xxx_FEC */
......@@ -29,7 +29,7 @@
#include <mpc5xxx.h>
#include <version.h>
#define CONFIG_MPC5XXX 1 /* needed for Linux kernel header files */
#define CONFIG_MPC5xxx 1 /* needed for Linux kernel header files */
#define _LINUX_CONFIG_H 1 /* avoid reading Linux autoconf.h file */
#include <ppc_asm.tmpl>
......
......@@ -46,7 +46,7 @@ typedef struct global_data {
unsigned long scc_clk;
unsigned long brg_clk;
#endif
#if defined(CONFIG_MPC5XXX)
#if defined(CONFIG_MPC5xxx)
unsigned long ipb_clk;
unsigned long pci_clk;
#endif
......
......@@ -42,7 +42,7 @@ typedef struct bd_info {
|| defined(CONFIG_E500)
unsigned long bi_immr_base; /* base of IMMR register */
#endif
#if defined(CONFIG_MPC5XXX)
#if defined(CONFIG_MPC5xxx)
unsigned long bi_mbar_base; /* base of internal registers */
#endif
unsigned long bi_bootflags; /* boot / reboot flag (for LynxOS) */
......@@ -57,7 +57,7 @@ typedef struct bd_info {
unsigned long bi_sccfreq; /* SCC_CLK Freq, in MHz */
unsigned long bi_vco; /* VCO Out from PLL, in MHz */
#endif
#if defined(CONFIG_MPC5XXX)
#if defined(CONFIG_MPC5xxx)
unsigned long bi_ipbfreq; /* IPB Bus Freq, in MHz */
unsigned long bi_pcifreq; /* PCI Bus Freq, in MHz */
#endif
......
......@@ -18,7 +18,7 @@ unsigned short bmp_logo_palette[] = {
0x0343, 0x0454, 0x0565, 0x0565, 0x0676, 0x0787, 0x0898, 0x0999,
0x0AAA, 0x0ABA, 0x0BCB, 0x0CCC, 0x0DDD, 0x0EEE, 0x0FFF, 0x0FB3,
0x0FB4, 0x0FC4, 0x0FC5, 0x0FC6, 0x0FD7, 0x0FD8, 0x0FD9, 0x0FDA,
0x0FEA, 0x0FEB, 0x0FEC, 0x0FFD, 0x0FFE, 0x0FFF, 0x0FFF,
0x0FEA, 0x0FEB, 0x0FEC, 0x0FFD, 0x0FFE, 0x0FFF, 0x0FFF,
};
unsigned char bmp_logo_bitmap[] = {
......
......@@ -86,6 +86,7 @@
#define CFG_CMD_FAT 0x0010000000000000U /* FAT support */
#define CFG_CMD_IMLS 0x0020000000000000U /* List all found images */
#define CFG_CMD_ITEST 0x0040000000000000U /* Integer (and string) test */
#define CFG_CMD_NFS 0x0080000000000000U /* NFS support */
#define CFG_CMD_ALL 0xFFFFFFFFFFFFFFFFU /* ALL commands */
......
......@@ -319,6 +319,7 @@ void relocate_code (ulong, gd_t *, ulong);
ulong get_endaddr (void);
void trap_init (ulong);
#if defined (CONFIG_4xx) || \
defined (CONFIG_5xxx) || \
defined (CONFIG_74xx_7xx) || \
defined (CONFIG_74x) || \
defined (CONFIG_75x) || \
......@@ -361,7 +362,7 @@ int sdram_adjust_866 (void);
#if defined(CONFIG_8260)
int prt_8260_clks (void);
#endif
#if defined(CONFIG_MPC5XXX)
#if defined(CONFIG_MPC5xxx)
int prt_mpc5xxx_clks (void);
#endif
#ifdef CONFIG_4xx
......
......@@ -29,7 +29,7 @@
* (easy to change)
*/
#define CONFIG_MPC5XXX 1 /* This is an MPC5xxx CPU */
#define CONFIG_MPC5xxx 1 /* This is an MPC5xxx CPU */
#define CONFIG_ICECUBE 1 /* ... on IceCube board */
#define CFG_MPC5XXX_CLKIN 33000000 /* ... running at 33.000000MHz */
......@@ -213,7 +213,7 @@
/*
* Ethernet configuration
*/
#define CONFIG_MPC5XXX_FEC 1
#define CONFIG_MPC5xxx_FEC 1
#define CONFIG_FEC_10MBIT 1 /* Workaround for FEC 100Mbit problem */
#define CONFIG_PHY_ADDR 0x00
......
......@@ -41,7 +41,7 @@
* (easy to change)
*/
#define CONFIG_MPC5XXX 1 /* This is an MPC5xxx CPU */
#define CONFIG_MPC5xxx 1 /* This is an MPC5xxx CPU */
#define CONFIG_MPC5200 1 /* More exactly a MPC5200 */
#define CONFIG_TOP5200 1 /* ... on TOP5200 board - we need this for FEC.C */
......@@ -281,7 +281,7 @@
/*
* Ethernet configuration
*/
#define CONFIG_MPC5XXX_FEC 1
#define CONFIG_MPC5xxx_FEC 1
#define CONFIG_FEC_10MBIT 1 /* Workaround for FEC 100Mbit problem */
#define CONFIG_PHY_ADDR 0x1f
#define CONFIG_PHY_TYPE 0x79c874
......
......@@ -21,13 +21,13 @@
# endif
#endif /* CONFIG_8xx */
#if defined(CONFIG_MPC5XXX)
#if defined(CONFIG_MPC5xxx)
# if !defined(CONFIG_NET_MULTI)
# if defined(CONFIG_MPC5XXX_FEC)
# if defined(CONFIG_MPC5xxx_FEC)
# define CONFIG_NET_MULTI
# endif
# endif
#endif /* CONFIG_MPC5XXX */
#endif /* CONFIG_MPC5xxx */
#if !defined(CONFIG_NET_MULTI) && (defined(CONFIG_8260) || defined(CONFIG_MPC8560))
#include <config.h>
......@@ -306,7 +306,7 @@ extern int NetState; /* Network loop state */
extern int NetRestartWrap; /* Tried all network devices */
#endif
typedef enum { BOOTP, RARP, ARP, TFTP, DHCP, PING, DNS } proto_t;
typedef enum { BOOTP, RARP, ARP, TFTP, DHCP, PING, DNS, NFS } proto_t;
/* from net/net.c */
extern char BootFile[128]; /* Boot File name */
......
......@@ -175,7 +175,7 @@
#define IM_IMMR (IM_REGBASE+0x01a8)
#define IM_SCCR (IM_REGBASE+0x0c80)
#elif defined(CONFIG_MPC5XXX)
#elif defined(CONFIG_MPC5xxx)
#define HID0_ICE_BITPOS 16
#define HID0_DCE_BITPOS 17
......
......@@ -32,7 +32,7 @@
#ifdef CONFIG_5xx
#include <mpc5xx.h>
#endif
#ifdef CONFIG_MPC5XXX
#ifdef CONFIG_MPC5xxx
#include <mpc5xxx.h>
#endif
#if (CONFIG_COMMANDS & CFG_CMD_IDE)
......@@ -288,9 +288,9 @@ init_fnc_t *init_sequence[] = {
prt_8260_clks,
#endif /* CONFIG_8260 */
checkcpu,
#if defined(CONFIG_MPC5XXX)
#if defined(CONFIG_MPC5xxx)
prt_mpc5xxx_clks,
#endif /* CONFIG_MPC5XXX */
#endif /* CONFIG_MPC5xxx */
checkboard,
INIT_FUNC_WATCHDOG_INIT
#if defined(CONFIG_MISC_INIT_F)
......@@ -478,7 +478,7 @@ void board_init_f (ulong bootflag)
defined(CONFIG_E500)
bd->bi_immr_base = CFG_IMMR; /* base of IMMR register */
#endif
#if defined(CONFIG_MPC5XXX)
#if defined(CONFIG_MPC5xxx)
bd->bi_mbar_base = CFG_MBAR; /* base of internal registers */
#endif
......@@ -493,10 +493,10 @@ void board_init_f (ulong bootflag)
bd->bi_sccfreq = gd->scc_clk;
bd->bi_vco = gd->vco_out;
#endif /* CONFIG_8260 */
#if defined(CONFIG_MPC5XXX)
#if defined(CONFIG_MPC5xxx)
bd->bi_ipbfreq = gd->ipb_clk;
bd->bi_pcifreq = gd->pci_clk;
#endif /* CONFIG_MPC5XXX */
#endif /* CONFIG_MPC5xxx */
bd->bi_baudrate = gd->baudrate; /* Console Baudrate */
#ifdef CFG_EXTBDINFO
......
......@@ -27,7 +27,7 @@ include $(TOPDIR)/config.mk
LIB = libnet.a
OBJS = net.o tftp.o bootp.o rarp.o eth.o
OBJS = net.o tftp.o bootp.o rarp.o eth.o nfs.o
all: $(LIB)
$(LIB): $(START) $(OBJS)
......
......@@ -155,7 +155,7 @@ int eth_initialize(bd_t *bis)
#if defined(FEC_ENET) || defined(CONFIG_ETHER_ON_FCC)
fec_initialize(bis);
#endif
#if defined(CONFIG_MPC5XXX_FEC)
#if defined(CONFIG_MPC5xxx_FEC)
mpc5xxx_fec_initialize(bis);
#endif
#if defined(CONFIG_SK98)
......
......@@ -55,6 +55,15 @@
* derived from our own IP address)
* We want: - load the boot file
* Next step: none
*
* NFS:
*
* Prerequisites: - own ethernet address
* - own IP address
* - name of bootfile (if unknown, we use a default name
* derived from our own IP address)
* We want: - load the boot file
* Next step: none
*/
......@@ -65,6 +74,7 @@
#include "bootp.h"
#include "tftp.h"
#include "rarp.h"
#include "nfs.h"
#ifdef CONFIG_STATUS_LED
#include <status_led.h>
#include <miiphy.h>
......@@ -278,6 +288,9 @@ restart:
*/
switch (protocol) {
#if (CONFIG_COMMANDS & CFG_CMD_NFS)
case NFS:
#endif
#if (CONFIG_COMMANDS & CFG_CMD_PING)
case PING:
#endif
......@@ -287,6 +300,9 @@ restart:
NetOurSubnetMask= getenv_IPaddr ("netmask");
switch (protocol) {
#if (CONFIG_COMMANDS & CFG_CMD_NFS)
case NFS:
#endif
case TFTP:
NetServerIP = getenv_IPaddr ("serverip");
break;
......@@ -356,6 +372,11 @@ restart:
case PING:
PingStart();
break;
#endif
#if (CONFIG_COMMANDS & CFG_CMD_NFS)
case NFS:
NfsStart();
break;
#endif
default:
break;
......@@ -918,6 +939,9 @@ static int net_check_prereq (proto_t protocol)
return (1);
}
goto common;
#endif
#if (CONFIG_COMMANDS & CFG_CMD_NFS)
case NFS:
#endif
case TFTP:
if (NetServerIP == 0) {
......
This diff is collapsed.
/*
* (C) Masami Komiya <mkomiya@sonare.it> 2004
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2, or (at
* your option) any later version.
*/
#ifndef __NFS_H__
#define __NFS_H__
#define SUNRPC_PORT 111
#define PROG_PORTMAP 100000
#define PROG_NFS 100003
#define PROG_MOUNT 100005
#define MSG_CALL 0
#define MSG_REPLY 1
#define PORTMAP_GETPORT 3
#define MOUNT_ADDENTRY 1
#define MOUNT_UMOUNTALL 4
#define NFS_LOOKUP 4
#define NFS_READLINK 5
#define NFS_READ 6
#define NFS_FHSIZE 32
#define NFSERR_PERM 1
#define NFSERR_NOENT 2
#define NFSERR_ACCES 13
#define NFSERR_ISDIR 21
#define NFSERR_INVAL 22
/* Block size used for NFS read accesses. A RPC reply packet (including all
* headers) must fit within a single Ethernet frame to avoid fragmentation.
* Chosen to be a power of two, as most NFS servers are optimized for this. */
#define NFS_READ_SIZE 1024
#define NFS_MAXLINKDEPTH 16
struct rpc_t {
union {
uint8_t data[2048];
struct {
uint32_t id;
uint32_t type;
uint32_t rpcvers;
uint32_t prog;
uint32_t vers;
uint32_t proc;
uint32_t data[1];
} call;
struct {
uint32_t id;
uint32_t type;
uint32_t rstatus;
uint32_t verifier;
uint32_t v2;
uint32_t astatus;
uint32_t data[1];
} reply;
} u;
};
extern void NfsStart (void); /* Begin NFS */
/**********************************************************************/
#endif /* __NFS_H__ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment