bugfix:return value of NFS command
PATCH 1/1 bugfix:return value of NFS command
Hello,
1.nfs command return code is depend on umount-all, but not state of
downloading.
2.When fail to write flash, it doesn't change state to umount
example1:
---nfs server---
[mldbox]# ls -l u-boot.bin
---------- 1 root root 204048 Dec 11 02:06 u-boot.bin
--- u-boot ---
# if nfs 80400000 192.168.3.98:/usr/src/mldbox/u-boot.bin; then echo ok; else echo error; fi Trying i82559#0 Using i82559#0 device File transfer via NFS from server 192.168.3.98; our IP address is 192.168.3.200 Filename '/usr/src/mldbox/u-boot.bin'. Load address: 0x80400000 Loading: * done ok <= Wrong!!
example2:
[root at tv mldbox]# rm u-boot.bin
rm: remove regular file `u-boot.bin'? y
[root@tv mldbox]#
# if nfs 80400000 192.168.3.98:/usr/src/mldbox/u-boot.bin; then echo ok; else echo error; fi Trying i82559#0 Using i82559#0 device File transfer via NFS from server 192.168.3.98; our IP address is 192.168.3.200 Filename '/usr/src/mldbox/u-boot.bin'. Load address: 0x80400000 Loading: *** ERROR: File lookup fail
done
ok <= Wrong!!
#
attached patch fixes these problems.
patch is for current CVS.
--------
Hiroshi Ito
Media Lab. Inc.,
URL http://www.mlb.co.jp ( Sorry, Japanese only. ) TEL +81-3-5294-7255 FAX +81-3-5294-7256 -------------- next part --------------
Index: net/nfs.c
===================================================================
RCS file: /cvsroot/u-boot/u-boot/net/nfs.c,v retrieving revision 1.8
nfs.c +9 -5
@@ -44,6 +44,7 @@ static int nfs_len;static char dirfh[NFS_FHSIZE ];/* file handle of directory */ static char filefh[NFS_FHSIZE ];/* file handle of kernel image */ +static int NfsDownloadState;static IPaddr_t NfsServerIP;static int NfsSrvMountPort;static int NfsSrvNfsPort;
@@ -63,7 +64,7 @@ static char *nfs_filename;static char *nfs_path;static char nfs_path_buff[2048 ]; -static __inline__void +static __inline__int store_block (uchar * src,unsigned offset,unsigned len) {ulong newsize = offset + len;
@@ -82,8 +83,7 @@ store_block (uchar * src, unsigned offse rc =flash_write ((uchar *)src, (ulong)(load_addr+offset), len);if (rc) {flash_perror (rc); - NetState =NETLOOP_FAIL ; -return ; +return -1 ; } } else#endif /* CFG_DIRECT_FLASH_NFS */
@@ -93,6 +93,7 @@ store_block (uchar * src, unsigned offseif (NetBootFileXferSize < (offset+len)) NetBootFileXferSize = newsize; +return 0 ; } static char*
@@ -573,7 +574,8 @@ nfs_read_reply (uchar *pkt, unsigned len } rlen =ntohl (rpc_pkt.u.reply.data[18 ]); -store_block ((uchar *)pkt+sizeof (rpc_pkt.u.reply), nfs_offset, rlen); +if (store_block ((uchar *)pkt+sizeof (rpc_pkt.u.reply), nfs_offset, rlen) ) +return -9999 ;return rlen; }
@@ -632,7 +634,7 @@ NfsHandler (uchar *pkt, unsigned dest, u NetState =NETLOOP_FAIL ; }else {puts ("\ndone\n" ); - NetState =NETLOOP_SUCCESS ; + NetState = NfsDownloadState; }break ;
@@ -678,6 +680,7 @@ NfsHandler (uchar *pkt, unsigned dest, u NfsState =STATE_READLINK_REQ ;NfsSend (); }else { +if ( ! rlen ) NfsDownloadState =NETLOOP_SUCCESS ; NfsState =STATE_UMOUNT_REQ ;NfsSend (); }
@@ -692,6 +695,7 @@ NfsStart (void)#ifdef NFS_DEBUG printf ("%s\n" , __FUNCTION__);#endif + NfsDownloadState =NETLOOP_FAIL ; NfsServerIP = NetServerIP; nfs_path = (char *)nfs_path_buff;
[U-Boot-Users] Porting U-Boot - SDRAM mode register set command - question
I have some problems to understand how to initialize SDRAM... probably this is a little off topic... please forgive me.
I need to program the mode register of the SDRAM in order to get the SDRAM working.
So I'm going to write some opcode in the MAR of my MPC875, issue a "run" command to the MCR and have a Ram-Word executed which sets the CS/RAS/CAS/WE lines correctly so the SDRAM will know I'm trying to issue a mode register set command.
The content of the MAR will be put on the address lines, as I'll set AMX of the ram-word to 11.
The SDRAM won't see bits 30 and 31, as I have a 32-bit bus and these lines are not connected, so I'll take care of that when assembling the contents of MAR.
The SDRAM also won't see bit 19, as it's not connected, too - I'll have to make GPL_A0 be in the right state in the ram-word instead (which I find not very elegant, but I don't see a way to have the MPC875 assign the state of address line A19 to GPL_A0).
Okay... that's not such a big problem in theory (correct me if necessary).
The problem is that my SDRAM data sheet says it takes/samples the opcode for the mode register set command from its input lines BA0/1, AP/A10, A11-12 and A0-9 (I count 15 bit).
To my sorrow this data sheet doesn't mention any opcode. I needed to search half the internet to find information on that issue.
The Internet ressource I found says the mode register is only 12 (not
15) bits wide and only the least significant 7 bits are in use.
So I'm confused... where can I find reliable information on SDRAM mode register opcodes, and how many bits is an SDRAM mode register wide?
Peter Asemann
PATCH 1/1 bugfix:return value of NFS command
In reply to Hiroshi ItoQuoted 5 lines · In message <[email protected]> you wrote:
1.nfs command return code is depend on umount-all, but not state of
downloading.2.When fail to write flash, it doesn't change state to umount
...
Quoted 1 line
attached patch fixes these problems.
Thanks, added.
Best regards,
Wolfgang Denk
Signature · 7 lines
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
I see that Microsoft's campaign to destroy all knowledge of any
operating environment but its own environment-of-the-year has
succeeded in creating a generation of users who don't understand the
concept of a shell...
-- L. Peter Deutsch in <[email protected]>