xref: /rk3399_rockchip-uboot/net/nfs.h (revision d23d7bd7935127bf50713ec2b4c3014ac279d2e5)
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 struct rpc_t {
48 	union {
49 		uint8_t data[2048];
50 		struct {
51 			uint32_t id;
52 			uint32_t type;
53 			uint32_t rpcvers;
54 			uint32_t prog;
55 			uint32_t vers;
56 			uint32_t proc;
57 			uint32_t data[1];
58 		} call;
59 		struct {
60 			uint32_t id;
61 			uint32_t type;
62 			uint32_t rstatus;
63 			uint32_t verifier;
64 			uint32_t v2;
65 			uint32_t astatus;
66 			uint32_t data[19];
67 		} reply;
68 	} u;
69 };
70 void nfs_start(void);	/* Begin NFS */
71 
72 
73 /**********************************************************************/
74 
75 #endif /* __NFS_H__ */
76