2
* GRUB -- GRand Unified Bootloader
3
* Copyright (C) 2010 Free Software Foundation, Inc.
5
* GRUB is free software: you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation, either version 3 of the License, or
8
* (at your option) any later version.
10
* GRUB is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
19
#ifndef GRUB_LOONGSON_CPU_HEADER
20
#define GRUB_LOONGSON_CPU_HEADER 1
23
#define GRUB_CPU_REGISTER_WRAP(x) x
25
#define GRUB_CPU_REGISTER_WRAP(x) #x
28
#define GRUB_CPU_LOONGSON_FLASH_START 0xbfc00000
29
#define GRUB_CPU_LOONGSON_FLASH_TLB_REFILL 0xbfc00200
30
#define GRUB_CPU_LOONGSON_FLASH_CACHE_ERROR 0xbfc00300
31
#define GRUB_CPU_LOONGSON_FLASH_OTHER_EXCEPTION 0xbfc00380
33
#define GRUB_CPU_LOONGSON_DDR2_BASE 0xaffffe00
34
#define GRUB_CPU_LOONGSON_DDR2_REG1_HI_8BANKS 0x00000001
35
#define GRUB_CPU_LOONGSON_DDR2_REG_SIZE 0x8
36
#define GRUB_CPU_LOONGSON_DDR2_REG_STEP 0x10
38
#define GRUB_CPU_LOONGSON_COP0_CACHE_CONFIG GRUB_CPU_REGISTER_WRAP($16)
39
#define GRUB_CPU_LOONGSON_COP0_CACHE_CONFIG_ILINESIZE 0x10
40
#define GRUB_CPU_LOONGSON_COP0_CACHE_CONFIG_DLINESIZE 0x8
41
#define GRUB_CPU_LOONGSON_COP0_CACHE_DSIZE_SHIFT 6
42
#define GRUB_CPU_LOONGSON_COP0_CACHE_ISIZE_SHIFT 9
43
#define GRUB_CPU_LOONGSON_COP0_CACHE_SIZE_MASK 0x7
44
#define GRUB_CPU_LOONGSON_COP0_CACHE_SIZE_OFFSET 12
46
#define GRUB_CPU_LOONGSON_COP0_I_INDEX_INVALIDATE 0
47
#define GRUB_CPU_LOONGSON_COP0_D_INDEX_TAG_STORE 9
48
#define GRUB_CPU_LOONGSON_COP0_S_INDEX_TAG_STORE 11
50
#define GRUB_CPU_LOONGSON_COP0_I_INDEX_BIT_OFFSET 5
51
#define GRUB_CPU_LOONGSON_COP0_D_INDEX_BIT_OFFSET 5
52
#define GRUB_CPU_LOONGSON_COP0_S_INDEX_BIT_OFFSET 5
54
#define GRUB_CPU_LOONGSON_CACHE_ACCELERATED 7
55
#define GRUB_CPU_LOONGSON_CACHE_UNCACHED 2
56
#define GRUB_CPU_LOONGSON_CACHE_CACHED 3
57
#define GRUB_CPU_LOONGSON_CACHE_TYPE_MASK 7
58
#define GRUB_CPU_LOONGSON_CACHE_LINE_SIZE_LOG_SMALL 4
59
#define GRUB_CPU_LOONGSON_CACHE_LINE_SIZE_LOG_BIG 5
60
#define GRUB_CPU_LOONGSON_CACHE_LINE_SIZE_SMALL 16
61
#define GRUB_CPU_LOONGSON_CACHE_LINE_SIZE_BIG 32
63
#define GRUB_CPU_LOONGSON_I_CACHE_LOG_WAYS 2
64
#define GRUB_CPU_LOONGSON_D_CACHE_LOG_WAYS 2
65
#define GRUB_CPU_LOONGSON_S_CACHE_LOG_WAYS 2
67
/* FIXME: determine dynamically. */
68
#define GRUB_CPU_LOONGSON_SECONDARY_CACHE_LOG_SIZE 19
70
#define GRUB_CPU_LOONGSON_COP0_BADVADDR GRUB_CPU_REGISTER_WRAP($8)
71
#define GRUB_CPU_LOONGSON_COP0_TIMER_COUNT GRUB_CPU_REGISTER_WRAP($9)
72
#define GRUB_CPU_LOONGSON_COP0_CAUSE GRUB_CPU_REGISTER_WRAP($13)
73
#define GRUB_CPU_LOONGSON_COP0_EPC GRUB_CPU_REGISTER_WRAP($14)
74
#define GRUB_CPU_LOONGSON_COP0_CACHE_TAGLO GRUB_CPU_REGISTER_WRAP($28)
75
#define GRUB_CPU_LOONGSON_COP0_CACHE_TAGHI GRUB_CPU_REGISTER_WRAP($29)
77
#define GRUB_CPU_LOONGSON_LIOCFG 0xbfe00108
78
#define GRUB_CPU_LOONGSON_ROM_DELAY_OFFSET 2
79
#define GRUB_CPU_LOONGSON_ROM_DELAY_MASK 0x1f
80
#define GRUB_CPU_LOONGSON_CORECFG 0xbfe00180
81
#define GRUB_CPU_LOONGSON_CORECFG_DISABLE_DDR2_SPACE 0x100
82
#define GRUB_CPU_LOONGSON_CORECFG_BUFFER_CPU 0x200
84
#define GRUB_CPU_LOONGSON_PCI_HIT1_SEL_LO 0xbfe00150
85
#define GRUB_CPU_LOONGSON_PCI_HIT1_SEL_HI 0xbfe00154
87
#define GRUB_CPU_LOONGSON_GPIOCFG 0xbfe00120
88
#define GRUB_CPU_LOONGSON_SHUTDOWN_GPIO 1