aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/include/asm/dcr.h
blob: 620c9ba642e94bc2e432f9ef9098e551268d0e92 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#ifndef _SPARC64_DCR_H
#define _SPARC64_DCR_H

/* UltraSparc-III/III+ Dispatch Control Register, ASR 0x12 */
#define DCR_DPE		0x0000000000001000 /* III+: D$ Parity Error Enable	*/
#define DCR_OBS		0x0000000000000fc0 /* Observability Bus Controls	*/
#define DCR_BPE		0x0000000000000020 /* Branch Predict Enable		*/
#define DCR_RPE		0x0000000000000010 /* Return Address Prediction Enable	*/
#define DCR_SI		0x0000000000000008 /* Single Instruction Disable	*/
#define DCR_IPE		0x0000000000000004 /* III+: I$ Parity Error Enable	*/
#define DCR_IFPOE	0x0000000000000002 /* IRQ FP Operation Enable		*/
#define DCR_MS		0x0000000000000001 /* Multi-Scalar dispatch		*/

#endif /* _SPARC64_DCR_H */
e>
baab935ff3bd


e83aece3afad

baab935ff3bd

1da177e4c3f4
















c89172e36e3d


74cae61ab45f
1da177e4c3f4

f0db79d54b6c
1da177e4c3f4






30bc4dfd3b64
1da177e4c3f4
3476964dba98
1da177e4c3f4




30bc4dfd3b64

1da177e4c3f4

















4bdff8c0950a
1da177e4c3f4
















c89172e36e3d
8d270f7f4cda



1da177e4c3f4
8d270f7f4cda
30bc4dfd3b64

1da177e4c3f4



1da177e4c3f4
c89172e36e3d
30bc4dfd3b64

1da177e4c3f4
a63bb99660d8
30bc4dfd3b64
1da177e4c3f4


e83aece3afad
c89172e36e3d
30bc4dfd3b64
8d270f7f4cda
a63bb99660d8
1da177e4c3f4


30bc4dfd3b64
d4bb527e9e6c
1da177e4c3f4

f99d49adf527
1da177e4c3f4







af6a4e280e3f
1da177e4c3f4





af6a4e280e3f



1da177e4c3f4


c32c2f63a9d6
1da177e4c3f4



1da177e4c3f4
8d270f7f4cda
1da177e4c3f4
8d270f7f4cda





1da177e4c3f4



8d270f7f4cda

1da177e4c3f4
8d270f7f4cda


efc36aa5608f
1da177e4c3f4

af6a4e280e3f

1da177e4c3f4

8d270f7f4cda

1da177e4c3f4
8d270f7f4cda


e83aece3afad

1da177e4c3f4

8d270f7f4cda








e5f06f720eff
8d270f7f4cda

8d270f7f4cda

73fb847a4422
8d270f7f4cda







61f8603d93fa

8d270f7f4cda
8d270f7f4cda






61f8603d93fa



c89172e36e3d
61f8603d93fa


8d270f7f4cda
c89172e36e3d
8d270f7f4cda






c89172e36e3d

8d270f7f4cda

61f8603d93fa
8d270f7f4cda
c89172e36e3d
8d270f7f4cda





1da177e4c3f4


1da177e4c3f4
933469190ed5

a1f05514b016
933469190ed5

a1f05514b016


933469190ed5
a1f05514b016

933469190ed5
a1f05514b016


933469190ed5

baab935ff3bd
1da177e4c3f4
baab935ff3bd
547754916148
baab935ff3bd
933469190ed5
885c91f74662
baab935ff3bd
1da177e4c3f4










cf28b4863f9e
1da177e4c3f4








74cae61ab45f

4f7774c3a055
1da177e4c3f4
774b147828e3
1da177e4c3f4

f2ca7153ca49


1da177e4c3f4

f2ca7153ca49
1da177e4c3f4


774b147828e3






1da177e4c3f4


af6a4e280e3f
1da177e4c3f4



774b147828e3
af6a4e280e3f
3e3b48009656
1da177e4c3f4

cfaea787c058


1da177e4c3f4



1da177e4c3f4



933469190ed5







be69da8052af



933469190ed5
a007c4c3e943
933469190ed5












































e677bfe4d451

e677bfe4d451
1f53146da9cb

e677bfe4d451
be69da8052af



1f53146da9cb
e677bfe4d451

1f53146da9cb
e677bfe4d451


a007c4c3e943
e677bfe4d451


80492e7d49be



e677bfe4d451
a007c4c3e943
e677bfe4d451









933469190ed5
e677bfe4d451



933469190ed5

0d63790c3658




be69da8052af



0d63790c3658

94eb36892d72
0d63790c3658

94eb36892d72
0d63790c3658





1da177e4c3f4






c1a2a4756df0
1da177e4c3f4

1da177e4c3f4




c1a2a4756df0

1da177e4c3f4

1da177e4c3f4
c1a2a4756df0


1da177e4c3f4







c1a2a4756df0





1da177e4c3f4
1da177e4c3f4
db3a35326362
9cf514ccfacb
c1a2a4756df0
1da177e4c3f4



c1a2a4756df0
1da177e4c3f4


4a4b88317aa0

1da177e4c3f4
4a4b88317aa0
c1a2a4756df0

1da177e4c3f4



c1a2a4756df0

4c1e1b34d5c8
1da177e4c3f4


c1a2a4756df0

4c1e1b34d5c8
1da177e4c3f4


c1a2a4756df0

1da177e4c3f4

af6a4e280e3f


0d63790c3658


e677bfe4d451

af6a4e280e3f





c1a2a4756df0
af6a4e280e3f
933469190ed5
2b0143b5c986
af6a4e280e3f
c1a2a4756df0

427d6c6646d8
6f6cc3205c5f






427d6c6646d8





6f6cc3205c5f
427d6c6646d8



6f6cc3205c5f
9cf514ccfacb

1da177e4c3f4

4f7774c3a055
1da177e4c3f4
4f7774c3a055


1da177e4c3f4
4f7774c3a055



c1a2a4756df0
af6a4e280e3f

c1a2a4756df0
c1a2a4756df0



f99d49adf527
1da177e4c3f4


933469190ed5
4c1e1b34d5c8
91fe39d35ebd
1da177e4c3f4











c32c2f63a9d6
1da177e4c3f4



af6a4e280e3f
933469190ed5

af6a4e280e3f


94eb36892d72
af6a4e280e3f




91fe39d35ebd
af6a4e280e3f
1da177e4c3f4


4f7774c3a055
1da177e4c3f4
4f7774c3a055


b77a4b2edb29
1da177e4c3f4
4f7774c3a055

1da177e4c3f4
4f7774c3a055


efc36aa5608f
1da177e4c3f4
0da22a919d69

933469190ed5


8a4c3926889e
2eeb9b2abc83
db3a35326362
1da177e4c3f4

4f7774c3a055
1da177e4c3f4
4f7774c3a055

e677bfe4d451
4f7774c3a055
1da177e4c3f4



9cf514ccfacb

af6a4e280e3f

933469190ed5





8a4c3926889e
e677bfe4d451



1da177e4c3f4

4f7774c3a055








2355c59644de
4f7774c3a055

4f7774c3a055

73fb847a4422
4f7774c3a055







61f8603d93fa

4f7774c3a055
4f7774c3a055
61f8603d93fa
4f7774c3a055
547754916148

61f8603d93fa







4f7774c3a055
db3a35326362
4f7774c3a055





74cae61ab45f
4f7774c3a055


61f8603d93fa
4f7774c3a055
db3a35326362
4f7774c3a055




1da177e4c3f4

74cae61ab45f
e6d615f7428b
c89172e36e3d
1da177e4c3f4




2d3bb25209c1
1da177e4c3f4




c89172e36e3d
2d3bb25209c1

c89172e36e3d
2d3bb25209c1

1da177e4c3f4


e6d615f7428b


1da177e4c3f4

2d3bb25209c1
e83aece3afad
1da177e4c3f4
2d3bb25209c1
1da177e4c3f4

55430e2ecee5
2a75cfa64e63
1da177e4c3f4
4f7774c3a055
2d3bb25209c1

2a75cfa64e63
2d3bb25209c1

1da177e4c3f4





e6d615f7428b

1da177e4c3f4
5bf3bd2b5cb6
e6d615f7428b
5bf3bd2b5cb6




2a75cfa64e63
1da177e4c3f4
5bf3bd2b5cb6

1da177e4c3f4


1da177e4c3f4
1da177e4c3f4






e6d615f7428b
2a75cfa64e63
1da177e4c3f4

a63bb99660d8
1da177e4c3f4


b3853e0ea1f2

1da177e4c3f4


a63bb99660d8

1da177e4c3f4

2b0143b5c986
1da177e4c3f4

a63bb99660d8
1da177e4c3f4
2a75cfa64e63
4b41bd85d5f9



1da177e4c3f4




a63bb99660d8
1da177e4c3f4






a63bb99660d8
1da177e4c3f4


2a75cfa64e63

cce76f9b9696
eab7e2e647c3

e5f06f720eff

2d3bb25209c1
e231c2ee64eb
eab7e2e647c3
2a75cfa64e63
e5f06f720eff
eab7e2e647c3
2d3bb25209c1
e231c2ee64eb
eab7e2e647c3


32c1eb0cd7ee









d5497fc693a4
32c1eb0cd7ee



d5497fc693a4

32c1eb0cd7ee

ed94164398c9









32c1eb0cd7ee


0989a7889695
2ea2209f073d



0989a7889695




91c9fa8f7587
0989a7889695
9a25b96c1f6e
9695c7057f48
b3853e0ea1f2
2ea2209f073d


3ab4d8b1215d
2ea2209f073d
2a75cfa64e63
2ea2209f073d










2a75cfa64e63
2ea2209f073d

9a25b96c1f6e
2ea2209f073d

0989a7889695




9a25b96c1f6e
9695c7057f48
b3853e0ea1f2
2ea2209f073d


3ab4d8b1215d
2ea2209f073d
2a75cfa64e63

2ea2209f073d










2a75cfa64e63
2ea2209f073d


9a25b96c1f6e
2ea2209f073d

0989a7889695


e64c390ca0b6
0989a7889695
e64c390ca0b6

2ea2209f073d
e64c390ca0b6




2ea2209f073d
e64c390ca0b6

2ea2209f073d
0989a7889695
eab7e2e647c3
ed748aacb8e3
f39bde24b275
f39bde24b275



260c64d23532
f39bde24b275

1da177e4c3f4




c7afef1f963b
df547efb03e3
1da177e4c3f4
eab7e2e647c3
c7afef1f963b
1da177e4c3f4
ed748aacb8e3
6899320c2cef

547754916148
d0ebd9c0e71d
1da177e4c3f4


1da177e4c3f4









18c01ab30288
1da177e4c3f4



eb4c86c6a5ad
9b3075c59f85
1da177e4c3f4


ac34cdb03dfd
1da177e4c3f4
1da177e4c3f4
ac34cdb03dfd
1da177e4c3f4

ac34cdb03dfd


1da177e4c3f4


ac34cdb03dfd

91fe39d35ebd





74ec1e1269eb




















91fe39d35ebd



74ec1e1269eb
91fe39d35ebd


74ec1e1269eb






91fe39d35ebd
91fe39d35ebd

ac34cdb03dfd
4c1e1b34d5c8
ac34cdb03dfd

1da177e4c3f4
ac34cdb03dfd
4c1e1b34d5c8





933469190ed5



ac34cdb03dfd
933469190ed5









1da177e4c3f4





f2c7ea10f901
1da177e4c3f4
bc6f02e516b4
1da177e4c3f4




bf18f163e89c
f2c7ea10f901
1da177e4c3f4
a09581f29434
f2c7ea10f901
1da177e4c3f4

88e9d34c7278
c8c081b70cb5


1da177e4c3f4


1da177e4c3f4


dbf847ecb631
b89109bef4a6
1da177e4c3f4
dbf847ecb631
b3853e0ea1f2

b89109bef4a6
1da177e4c3f4
b3853e0ea1f2



dbf847ecb631
b3853e0ea1f2

e5f06f720eff


b3853e0ea1f2
e5f06f720eff



b3853e0ea1f2
1da177e4c3f4
e5f06f720eff

b3853e0ea1f2




1da177e4c3f4





b3853e0ea1f2
1da177e4c3f4
b3853e0ea1f2

e5f06f720eff
b3853e0ea1f2
1da177e4c3f4





b89109bef4a6
1da177e4c3f4
b3853e0ea1f2
1da177e4c3f4
b89109bef4a6
1da177e4c3f4
e5f06f720eff
b3853e0ea1f2
e5f06f720eff
b3853e0ea1f2
e5f06f720eff
1da177e4c3f4
b89109bef4a6
1da177e4c3f4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
  











                                                             
                       
                        
                         
                           
                                  
 
                 
                  
                  
                 
 
                                              
 











                                                                                
 
                                        
 


                                                                             

                                                     

                                        
















                                                                              


                                                                                            
 

                                                                      
                                                






                                       
                                     
 
                                   




                                             

                         

















                                                        
                                                    
















                                                        
                                         



                         
                                                                
                      

                                               



                                                
                                                      
                                                     

                                      
                
                                                      
                        


                                                    
 
                                                     
                        
                                      
                                       


                      
               
                                      

                                     
                   







                                               
              





                                                              



                                                      


                                                   
                                                     



                            
 
                                                                           
 





                                                                                 



                         

                                                            
 


                                                                            
                                        

                                             

                                                                  

 

                                                            
 


                                                                            

                                     

 








                                                               
                                                        

                                         

                                     
                                         







                                        

                                        
 






                                                           



                          
                                                                   


                                         
 
                                                     






                                                              

                                                                  

                              
                                        
 
                                                             





                                                              


                                                     
 

                                                               
                                                               

              


                       
                                                      

                                          
         


                                

 
                                            
 
                                                                             
                                
                                        
                                           
                            
                   










                                                                       
                                                 








                                      

                                                                    
                                                                 
 
                                                                             

 


                                                                    

                                      
                                      


                                    






                                                                        


                                                                        
                                                                        



                                                                  
                                      
                           
                                                                           

                               


                                                      



                                                                    



                 







                                                                     



                                 
                      
                                                      












































                                                                        

                                                                        
                                  

                     
 



                                   
                                        

                           
                                        


                                                                        
                                                       


                                   



                                                                        
                   
                                                









                                                                            
                          



                                                                                

      




                                                         



                                

                                                        
                               

                               
                                                       





                               






                                                                          
                                          

                   




                                             

                               

                    
                      


                                               







                                    





                                                          
 
                            
                    
                                
 



                                              
                          


                                      

                             
                                                      
                

                                      



                                              

                                  
                                                                  


                                              

                                  
                                                                  


                                              

                                  

                                     


                                                                              


                                                                           

                                                                      





                                                                             
                                          
                 
 
                                                                              
                                                

                                  
                  






                                                                        





                                                                        
                              



                                                
                        

                                              

         
                                       
                 


                                                     
                      



                              
     

                                          
     



                               
                   


                   
                                                             
                                                                               
                                                                     











                                                     
                                              



                                                       
                                                   

                                                                               


                                              
                                                           




                                                                       
                                     
         


                           
                                                                       
 


                                                                        
                                                          
 

                                                                              
 


                                                                            
                                        
                                         

                                     


                                           
                                 
                            
                           

 
                                                                            
 

                                                                            
              
 



                                             

                                               

                                     





                                                                         
                                                     



                                                         

 








                                                               
                                                        

                                         

                                         
                                             







                                           

                                       
 
                 
 
                                                         

                                                               







                                         
 
                                                         





                                                              
                          


                                                                 
                                        
 
                                                                  




                                                              

 
                          
                                                                             
                                                




                                   
                                        




                                                       
                                         

                                        
                                            

                                    


                  


                                                                 

                                    
                
 
                 
                                        

                            
                            
                    
 
                                      

                                        
                                             

                                    





                                            

                                                                               
 
                                                  
                                                                      




                                                                   
                                                           
         

                             


                   
 






                                                                        
                                                                
                                           

                                     
                                     


                                       

                                                                    


                                                                     

                                                                   

                           
                                     

                                                        
                                              
                                                  
                                         



                                   




                                                           
                                                    






                                                          
                        


                   

                                                                          
                                                                      

                               

                                                                                                
                       
                                    
 
                                                           
                                                
 
                        
                                     


                   









                                                                         
                                                                



                                                  

                                                                

                                 









                                                             


                               
  



                                                                        




                                                                        
                                                               
 
                                                           
                                                                       
                                                       


                                     
 
                                             
                                                                              










                                                                    
                                                                                    

                                       
                         

                             




                                                                
                                                           
                                                                       
                                                       


                                     
 
                                             

                                                       










                                                                    
                                                                    


                                                                    
                         

                             


                   
                                                          
 

                                                                   
 




                                                                   
         

                             
                   
 
 
                                                                    
 



                                                
                                                     

 




                                                                   
      
                                                          
 
                               
                  
 
                                               

                                              
                                                             
                     


                  









                                                                
                                                    



                                                           
                                         
                                     


                      
                                                                  
 
                          
                             

                                                


                                                    


                                                                                

 





                                                             




















                                                                                                         



                                                                         
                  


                                  






                                                       
         

 
                                                             
                                                                             

                                                
                               
                                                





                                                                              



                                                                         
                                               









                                                                               





                                                                        
                                             
 
                                   




                                                            
                     
                                           
                         
                     
                                          

 
                                              


                                  


                         


                                 
   
                                 
 
               

                                                            
                                                                      
 



                                                                                 
               

                                          


                                                                                 
                                             



                                                           
                 
 

                                                     




                                                        





                                                               
                                  
 

                                                            
                                          
                                          





                               
                                     
 
                                                            
 
                                                                       
 
                                                        
                                                        
                                                     
                                                     
                                
 
                                                                    
 
/*
 * NFS exporting and validation.
 *
 * We maintain a list of clients, each of which has a list of
 * exports. To export an fs to a given client, you first have
 * to create the client entry with NFSCTL_ADDCLIENT, which
 * creates a client control block and adds it to the hash
 * table. Then, you call NFSCTL_EXPORT for each fs.
 *
 *
 * Copyright (C) 1995, 1996 Olaf Kirch, <okir@monad.swb.de>
 */

#include <linux/slab.h>
#include <linux/namei.h>
#include <linux/module.h>
#include <linux/exportfs.h>
#include <linux/sunrpc/svc_xprt.h>

#include "nfsd.h"
#include "nfsfh.h"
#include "netns.h"
#include "pnfs.h"

#define NFSDDBG_FACILITY	NFSDDBG_EXPORT

/*
 * We have two caches.
 * One maps client+vfsmnt+dentry to export options - the export map
 * The other maps client+filehandle-fragment to export options. - the expkey map
 *
 * The export options are actually stored in the first map, and the
 * second map contains a reference to the entry in the first map.
 */

#define	EXPKEY_HASHBITS		8
#define	EXPKEY_HASHMAX		(1 << EXPKEY_HASHBITS)
#define	EXPKEY_HASHMASK		(EXPKEY_HASHMAX -1)

static void expkey_put(struct kref *ref)
{
	struct svc_expkey *key = container_of(ref, struct svc_expkey, h.ref);

	if (test_bit(CACHE_VALID, &key->h.flags) &&
	    !test_bit(CACHE_NEGATIVE, &key->h.flags))
		path_put(&key->ek_path);
	auth_domain_put(key->ek_client);
	kfree(key);
}

static void expkey_request(struct cache_detail *cd,
			   struct cache_head *h,
			   char **bpp, int *blen)
{
	/* client fsidtype \xfsid */
	struct svc_expkey *ek = container_of(h, struct svc_expkey, h);
	char type[5];

	qword_add(bpp, blen, ek->ek_client->name);
	snprintf(type, 5, "%d", ek->ek_fsidtype);
	qword_add(bpp, blen, type);
	qword_addhex(bpp, blen, (char*)ek->ek_fsid, key_len(ek->ek_fsidtype));
	(*bpp)[-1] = '\n';
}

static struct svc_expkey *svc_expkey_update(struct cache_detail *cd, struct svc_expkey *new,
					    struct svc_expkey *old);
static struct svc_expkey *svc_expkey_lookup(struct cache_detail *cd, struct svc_expkey *);

static int expkey_parse(struct cache_detail *cd, char *mesg, int mlen)
{
	/* client fsidtype fsid expiry [path] */
	char *buf;
	int len;
	struct auth_domain *dom = NULL;
	int err;
	int fsidtype;
	char *ep;
	struct svc_expkey key;
	struct svc_expkey *ek = NULL;

	if (mesg[mlen - 1] != '\n')
		return -EINVAL;
	mesg[mlen-1] = 0;

	buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
	err = -ENOMEM;
	if (!buf)
		goto out;

	err = -EINVAL;
	if ((len=qword_get(&mesg, buf, PAGE_SIZE)) <= 0)
		goto out;

	err = -ENOENT;
	dom = auth_domain_find(buf);
	if (!dom)
		goto out;
	dprintk("found domain %s\n", buf);

	err = -EINVAL;
	if ((len=qword_get(&mesg, buf, PAGE_SIZE)) <= 0)
		goto out;
	fsidtype = simple_strtoul(buf, &ep, 10);
	if (*ep)
		goto out;
	dprintk("found fsidtype %d\n", fsidtype);
	if (key_len(fsidtype)==0) /* invalid type */
		goto out;
	if ((len=qword_get(&mesg, buf, PAGE_SIZE)) <= 0)
		goto out;
	dprintk("found fsid length %d\n", len);
	if (len != key_len(fsidtype))
		goto out;

	/* OK, we seem to have a valid key */
	key.h.flags = 0;
	key.h.expiry_time = get_expiry(&mesg);
	if (key.h.expiry_time == 0)
		goto out;

	key.ek_client = dom;	
	key.ek_fsidtype = fsidtype;
	memcpy(key.ek_fsid, buf, len);

	ek = svc_expkey_lookup(cd, &key);
	err = -ENOMEM;
	if (!ek)
		goto out;

	/* now we want a pathname, or empty meaning NEGATIVE  */
	err = -EINVAL;
	len = qword_get(&mesg, buf, PAGE_SIZE);
	if (len < 0)
		goto out;
	dprintk("Path seems to be <%s>\n", buf);
	err = 0;
	if (len == 0) {
		set_bit(CACHE_NEGATIVE, &key.h.flags);
		ek = svc_expkey_update(cd, &key, ek);
		if (!ek)
			err = -ENOMEM;
	} else {
		err = kern_path(buf, 0, &key.ek_path);
		if (err)
			goto out;

		dprintk("Found the path %s\n", buf);

		ek = svc_expkey_update(cd, &key, ek);
		if (!ek)
			err = -ENOMEM;
		path_put(&key.ek_path);
	}
	cache_flush();
 out:
	if (ek)
		cache_put(&ek->h, cd);
	if (dom)
		auth_domain_put(dom);
	kfree(buf);
	return err;
}

static int expkey_show(struct seq_file *m,
		       struct cache_detail *cd,
		       struct cache_head *h)
{
	struct svc_expkey *ek ;
	int i;

	if (h ==NULL) {
		seq_puts(m, "#domain fsidtype fsid [path]\n");
		return 0;
	}
	ek = container_of(h, struct svc_expkey, h);
	seq_printf(m, "%s %d 0x", ek->ek_client->name,
		   ek->ek_fsidtype);
	for (i=0; i < key_len(ek->ek_fsidtype)/4; i++)
		seq_printf(m, "%08x", ek->ek_fsid[i]);
	if (test_bit(CACHE_VALID, &h->flags) && 
	    !test_bit(CACHE_NEGATIVE, &h->flags)) {
		seq_printf(m, " ");
		seq_path(m, &ek->ek_path, "\\ \t\n");
	}
	seq_printf(m, "\n");
	return 0;
}

static inline int expkey_match (struct cache_head *a, struct cache_head *b)
{
	struct svc_expkey *orig = container_of(a, struct svc_expkey, h);
	struct svc_expkey *new = container_of(b, struct svc_expkey, h);

	if (orig->ek_fsidtype != new->ek_fsidtype ||
	    orig->ek_client != new->ek_client ||
	    memcmp(orig->ek_fsid, new->ek_fsid, key_len(orig->ek_fsidtype)) != 0)