aboutsummaryrefslogtreecommitdiff
path: root/arch/metag/include/asm/metag_mem.h
blob: aa5a076df439a9490f941cd335c7af8c90b62b0c (plain)
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
/*
 * asm/metag_mem.h
 *
 * Copyright (C) 2000-2007, 2012 Imagination Technologies.
 *
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU General Public License version 2 as published by the
 * Free Software Foundation.
 *
 * Various defines for Meta (memory-mapped) registers.
 */

#ifndef _ASM_METAG_MEM_H_
#define _ASM_METAG_MEM_H_

/*****************************************************************************
 *                   META MEMORY MAP LINEAR ADDRESS VALUES
 ****************************************************************************/
/*
 * COMMON MEMORY MAP
 * -----------------
 */

#define LINSYSTEM_BASE  0x00200000
#define LINSYSTEM_LIMIT 0x07FFFFFF

/* Linear cache flush now implemented via DCACHE instruction. These defines
   related to a special region that used to exist for achieving cache flushes.
 */
#define         LINSYSLFLUSH_S 0

#define     LINSYSRES0_BASE     0x00200000
#define     LINSYSRES0_LIMIT    0x01FFFFFF

#define     LINSYSCUSTOM_BASE 0x02000000
#define     LINSYSCUSTOM_LIMIT   0x02FFFFFF

#define     LINSYSEXPAND_BASE 0x03000000
#define     LINSYSEXPAND_LIMIT   0x03FFFFFF

#define     LINSYSEVENT_BASE  0x04000000
#define         LINSYSEVENT_WR_ATOMIC_UNLOCK    0x04000000
#define         LINSYSEVENT_WR_ATOMIC_LOCK      0x04000040
#define         LINSYSEVENT_WR_CACHE_DISABLE    0x04000080
#define         LINSYSEVENT_WR_CACHE_ENABLE     0x040000C0
#define         LINSYSEVENT_WR_COMBINE_FLUSH    0x04000100
#define         LINSYSEVENT_WR_FENCE            0x04000140
#define     LINSYSEVENT_LIMIT   0x04000FFF

#define     LINSYSCFLUSH_BASE   0x04400000
#define         LINSYSCFLUSH_DCACHE_LINE    0x04400000
#define         LINSYSCFLUSH_ICACHE_LINE    0x04500000
#define         LINSYSCFLUSH_MMCU           0x04700000
#ifndef METAC_1_2
#define         LINSYSCFLUSH_TxMMCU_BASE    0x04700020
#define         LINSYSCFLUSH_TxMMCU_STRIDE  0x00000008
#endif
#define         LINSYSCFLUSH_ADDR_BITS      0x000FFFFF
#define         LINSYSCFLUSH_ADDR_S         0
#define     LINSYSCFLUSH_LIMIT  0x047FFFFF

#define     LINSYSCTRL_BASE     0x04800000
#define     LINSYSCTRL_LIMIT    0x04FFFFFF

#define     LINSYSMTABLE_BASE   0x05000000
#define     LINSYSMTABLE_LIMIT  0x05FFFFFF

#define     LINSYSDIRECT_BASE   0x06000000
#define     LINSYSDIRECT_LIMIT  0x07FFFFFF

#define LINLOCAL_BASE   0x08000000
#define LINLOCAL_LIMIT  0x7FFFFFFF

#define LINCORE_BASE    0x80000000
#define LINCORE_LIMIT   0x87FFFFFF

#define LINCORE_CODE_BASE  0x80000000
#define LINCORE_CODE_LIMIT 0x81FFFFFF

#define LINCORE_DATA_BASE  0x82000000
#define LINCORE_DATA_LIMIT 0x83FFFFFF


/* The core can support locked icache lines in this region */
#define LINCORE_ICACHE_BASE  0x84000000
#define LINCORE_ICACHE_LIMIT 0x85FFFFFF

/* The core can support locked dcache lines in this region */
#define LINCORE_DCACHE_BASE  0x86000000
#define LINCORE_DCACHE_LIMIT 0x87FFFFFF

#define LINGLOBAL_BASE  0x88000000
#define LINGLOBAL_LIMIT 0xFFFDFFFF

/*
 * CHIP Core Register Map
 * ----------------------
 */
#define CORE_HWBASE     0x04800000
#define PRIV_HWBASE     0x04810000
#define TRIG_HWBASE     0x04820000
#define SYSC_HWBASE     0x04830000

/*****************************************************************************
 *         INTER-THREAD KICK REGISTERS FOR SOFTWARE EVENT GENERATION
 ****************************************************************************/
/*
 * These values define memory mapped registers that can be used to supply
 * kicks to threads that service arbitrary software events.
 */

#define T0KICK     0x04800800   /* Background kick 0     */
#define     TXXKICK_MAX 0xFFFF  /* Maximum kicks */
#define     TnXKICK_STRIDE      0x00001000  /* Thread scale value    */
#define     TnXKICK_STRIDE_S    12
#define T0KICKI    0x04800808   /* Interrupt kick 0      */
#define     TXIKICK_OFFSET  0x00000008  /* Int level offset value */
#define T1KICK     0x04801800   /* Background kick 1     */
#define T1KICKI    0x04801808   /* Interrupt kick 1      */
#define T2KICK     0x04802800   /* Background kick 2     */
#define T2KICKI    0x04802808   /* Interrupt kick 2      */
#define T3KICK     0x04803800   /* Background kick 3     */
#define T3KICKI    0x04803808   /* Interrupt kick 3      */

/*****************************************************************************
 *                GLOBAL REGISTER ACCESS RESOURCES
 ****************************************************************************/
/*
 * These values define memory mapped registers that allow access to the
 * internal state of all threads in order to allow global set-up of thread
 * state and external handling of thread events, errors, or debugging.
 *
 * The actual unit and register index values needed to access individul
 * registers are chip specific see - METAC_TXUXX_VALUES in metac_x_y.h.
 * However two C array initialisers TXUXX_MASKS and TGUXX_MASKS will always be
 * defined to allow arbitrary loading, display, and saving of all valid
 * register states without detailed knowledge of their purpose - TXUXX sets
 * bits for all valid registers and TGUXX sets bits for the sub-set which are
 * global.
 */

#define T0UCTREG0   0x04800000  /* Access to all CT regs */
#define TnUCTRX_STRIDE      0x00001000  /* Thread scale value    */
#define TXUCTREGn_STRIDE    0x00000008  /* Register scale value  */

#define TXUXXRXDT  0x0480FFF0   /* Data to/from any threads reg */
#define TXUXXRXRQ  0x0480FFF8
#define     TXUXXRXRQ_DREADY_BIT 0x80000000  /* Poll for done */
#define     TXUXXRXRQ_DSPEXT_BIT 0x00020000  /* Addr DSP Regs */
#define     TXUXXRXRQ_RDnWR_BIT  0x00010000  /* Set for read  */
#define     TXUXXRXRQ_TX_BITS    0x00003000  /* Thread number */
#define     TXUXXRXRQ_TX_S       12
#define     TXUXXRXRQ_RX_BITS    0x000001F0  /* Register num  */
#define     TXUXXRXRQ_RX_S       4
#define         TXUXXRXRQ_DSPRARD0    0      /* DSP RAM A Read Pointer 0 */
#define         TXUXXRXRQ_DSPRARD1    1      /* DSP RAM A Read Pointer 1 */
#define         TXUXXRXRQ_DSPRAWR0    2      /* DSP RAM A Write Pointer 0 */
#define         TXUXXRXRQ_DSPRAWR2    3      /* DSP RAM A Write Pointer 1 */
#define         TXUXXRXRQ_DSPRBRD0    4      /* DSP RAM B Read Pointer 0 */
#define         TXUXXRXRQ_DSPRBRD1    5      /* DSP RAM B Read Pointer 1 */
#define         TXUXXRXRQ_DSPRBWR0    6      /* DSP RAM B Write Pointer 0 */
#define         TXUXXRXRQ_DSPRBWR1    7      /* DSP RAM B Write Pointer 1 */
#define         TXUXXRXRQ_DSPRARINC0  8      /* DSP RAM A Read Increment 0 */
#define         TXUXXRXRQ_DSPRARINC1  9      /* DSP RAM A Read Increment 1 */
#define         TXUXXRXRQ_DSPRAWINC0 10      /* DSP RAM A Write Increment 0 */
#define         TXUXXRXRQ_DSPRAWINC1 11      /* DSP RAM A Write Increment 1 */
#define         TXUXXRXRQ_DSPRBRINC0 12      /* DSP RAM B Read Increment 0 */
#define         TXUXXRXRQ_DSPRBRINC1 13      /* DSP RAM B Read Increment 1 */
#define         TXUXXRXRQ_DSPRBWINC0 14      /* DSP RAM B Write Increment 0 */
#define         TXUXXRXRQ_DSPRBWINC1 15      /* DSP RAM B Write Increment 1 */

#define         TXUXXRXRQ_ACC0L0     16      /* Accumulator 0 bottom 32-bits */
#define         TXUXXRXRQ_ACC1L0     17      /* Accumulator 1 bottom 32-bits */
#define         TXUXXRXRQ_ACC2L0     18      /* Accumulator 2 bottom 32-bits */
#define         TXUXXRXRQ_ACC3L0     19      /* Accumulator 3 bottom 32-bits */
#define         TXUXXRXRQ_ACC0HI     20      /* Accumulator 0 top 8-bits */
#define         TXUXXRXRQ_ACC1HI     21      /* Accumulator 1 top 8-bits */
#define         TXUXXRXRQ_ACC2HI     22      /* Accumulator 2 top 8-bits */
#define         TXUXXRXRQ_ACC3HI     23      /* Accumulator 3 top 8-bits */
#define     TXUXXRXRQ_UXX_BITS   0x0000000F  /* Unit number   */
#define     TXUXXRXRQ_UXX_S      0

/*****************************************************************************
 *          PRIVILEGE CONTROL VALUES FOR MEMORY MAPPED RESOURCES
 ****************************************************************************/
/*
 * These values define memory mapped registers that give control over and
 * the privilege required to access other memory mapped resources. These
 * registers themselves always require privilege to update them.
 */

#define TXPRIVREG_STRIDE    0x8 /* Delta between per-thread regs */
#define TXPRIVREG_STRIDE_S  3

/*
 * Each bit 0 to 15 defines privilege required to access internal register
 * regions 0x04800000 to 0x048FFFFF in 64k chunks
 */
#define T0PIOREG    0x04810100
#define T1PIOREG    0x04810108
#define T2PIOREG    0x04810110
#define T3PIOREG    0x04810118

/*
 * Each bit 0 to 31 defines privilege required to use the pair of
 * system events implemented as writee in the regions 0x04000000 to
 * 0x04000FFF in 2*64 byte chunks.
 */
#define T0PSYREG    0x04810180
#define T1PSYREG    0x04810188
#define T2PSYREG    0x04810190
#define T3PSYREG    0x04810198

/*
 * CHIP PRIV CONTROLS
 * ------------------
 */

/* The TXPIOREG register holds a bit mask directly mappable to
   corresponding addresses in the range 0x04800000 to 049FFFFF */
#define     TXPIOREG_ADDR_BITS  0x1F0000 /* Up to 32x64K bytes */
#define     TXPIOREG_ADDR_S     16

/* Hence based on the _HWBASE values ... */
#define     TXPIOREG_CORE_BIT       (1<<((0x04800000>>16)&0x1F))
#define     TXPIOREG_PRIV_BIT       (1<<((0x04810000>>16)&0x1F))
#define     TXPIOREG_TRIG_BIT       (1<<((0x04820000>>16)&0x1F))
#define     TXPIOREG_SYSC_BIT       (1<<((0x04830000>>16)&0x1F))

#define     TXPIOREG_WRC_BIT          0x00080000  /* Wr combiner reg priv */
#define     TXPIOREG_LOCALBUS_RW_BIT  0x00040000  /* Local bus rd/wr priv */
#define     TXPIOREG_SYSREGBUS_RD_BIT 0x00020000  /* Sys reg bus write priv */
#define     TXPIOREG_SYSREGBUS_WR_BIT 0x00010000  /* Sys reg bus read priv */

/* CORE region privilege controls */
#define T0PRIVCORE 0x04800828
#define         TXPRIVCORE_TXBKICK_BIT   0x001  /* Background kick priv */
#define         TXPRIVCORE_TXIKICK_BIT   0x002  /* Interrupt kick priv  */
#define         TXPRIVCORE_TXAMAREGX_BIT 0x004  /* TXAMAREG4|5|6 priv   */
#define TnPRIVCORE_STRIDE 0x00001000

#define T0PRIVSYSR 0x04810000
#define     TnPRIVSYSR_STRIDE   0x00000008
#define     TnPRIVSYSR_STRIDE_S 3
#define     TXPRIVSYSR_CFLUSH_BIT     0x01
#define     TXPRIVSYSR_MTABLE_BIT     0x02
#define     TXPRIVSYSR_DIRECT_BIT     0x04
#ifdef METAC_1_2
#define     TXPRIVSYSR_ALL_BITS       0x07
#else
#define     TXPRIVSYSR_CORE_BIT       0x08
#define     TXPRIVSYSR_CORECODE_BIT   0x10
#define     TXPRIVSYSR_ALL_BITS       0x1F
#endif
#define T1PRIVSYSR 0x04810008
#define T2PRIVSYSR 0x04810010
#define T3PRIVSYSR 0x04810018

/*****************************************************************************
 *          H/W TRIGGER STATE/LEVEL REGISTERS AND H/W TRIGGER VECTORS
 ****************************************************************************/
/*
 * These values define memory mapped registers that give control over and
 * the state of hardware trigger sources both external to the META processor
 * and internal to it.
 */

#define HWSTATMETA  0x04820000  /* Hardware status/clear META trig */
#define         HWSTATMETA_T0HALT_BITS 0xF
#define         HWSTATMETA_T0HALT_S    0
#define     HWSTATMETA_T0BHALT_BIT 0x1  /* Background HALT */
#define     HWSTATMETA_T0IHALT_BIT 0x2  /* Interrupt HALT  */
#define     HWSTATMETA_T0PHALT_BIT 0x4  /* PF/RO Memory HALT */
#define     HWSTATMETA_T0AMATR_BIT 0x8  /* AMA trigger */
#define     HWSTATMETA_TnINT_S     4    /* Shift by (thread*4) */
#define HWSTATEXT   0x04820010  /* H/W status/clear external trigs  0-31 */
#define HWSTATEXT2  0x04820018  /* H/W status/clear external trigs 32-63 */
#define HWSTATEXT4  0x04820020  /* H/W status/clear external trigs 64-95 */
#define HWSTATEXT6  0x04820028  /* H/W status/clear external trigs 96-128 */
#define HWLEVELEXT  0x04820030  /* Edge/Level type of external trigs  0-31 */
#define HWLEVELEXT2 0x04820038  /* Edge/Level type of external trigs 32-63 */
#define HWLEVELEXT4 0x04820040  /* Edge/Level type of external trigs 64-95 */
#define HWLEVELEXT6 0x04820048  /* Edge/Level type of external trigs 96-128 */