xref: /openbmc/u-boot/net/nfs.h (revision fea7f3aa)
1 /*
2  * (C) Masami Komiya <mkomiya@sonare.it> 2004
3  *
4  * SPDX-License-Identifier:	GPL-2.0+
5  */
6 
7 #ifndef __NFS_H__
8 #define __NFS_H__
9 
10 #define SUNRPC_PORT     111
11 
12 #define PROG_PORTMAP    100000
13 #define PROG_NFS        100003
14 #define PROG_MOUNT      100005
15 
16 #define MSG_CALL        0
17 #define MSG_REPLY       1
18 
19 #define PORTMAP_GETPORT 3
20 
21 #define MOUNT_ADDENTRY  1
22 #define MOUNT_UMOUNTALL 4
23 
24 #define NFS_LOOKUP      4
25 #define NFS_READLINK    5
26 #define NFS_READ        6
27 
28 #define NFS_FHSIZE      32
29 
30 #define NFSERR_PERM     1
31 #define NFSERR_NOENT    2
32 #define NFSERR_ACCES    13
33 #define NFSERR_ISDIR    21
34 #define NFSERR_INVAL    22
35 
36 /* Block size used for NFS read accesses.  A RPC reply packet (including  all
37  * headers) must fit within a single Ethernet frame to avoid fragmentation.
38  * However, if CONFIG_IP_DEFRAG is set, the config file may want to use a
39  * bigger value. In any case, most NFS servers are optimized for a power of 2.
40  */
41 #ifdef CONFIG_NFS_READ_SIZE
42 #define NFS_READ_SIZE CONFIG_NFS_READ_SIZE
43 #else
44 #define NFS_READ_SIZE 1024 /* biggest power of two that fits Ether frame */
45 #endif
46 
47 #define NFS_MAXLINKDEPTH 16
48 
49 struct rpc_t {
50 	union {
51 		uint8_t data[2048];
52 		struct {
53 			uint32_t id;
54 			uint32_t type;
55 			uint32_t rpcvers;
56 			uint32_t prog;
57 			uint32_t vers;
58 			uint32_t proc;
59 			uint32_t data[1];
60 		} call;
61 		struct {
62 			uint32_t id;
63 			uint32_t type;
64 			uint32_t rstatus;
65 			uint32_t verifier;
66 			uint32_t v2;
67 			uint32_t astatus;
68 			uint32_t data[19];
69 		} reply;
70 	} u;
71 };
72 void nfs_start(void);	/* Begin NFS */
73 
74 
75 /**********************************************************************/
76 
77 #endif /* __NFS_H__ */
78