diff options
| -rw-r--r-- | arch/mips/include/asm/octeon/octeon.h | 135 |
1 files changed, 105 insertions, 30 deletions
diff --git a/arch/mips/include/asm/octeon/octeon.h b/arch/mips/include/asm/octeon/octeon.h index 3e505a272189..ba5df5023bae 100644 --- a/arch/mips/include/asm/octeon/octeon.h +++ b/arch/mips/include/asm/octeon/octeon.h | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | #define __ASM_OCTEON_OCTEON_H | 9 | #define __ASM_OCTEON_OCTEON_H |
| 10 | 10 | ||
| 11 | #include <asm/octeon/cvmx.h> | 11 | #include <asm/octeon/cvmx.h> |
| 12 | #include <asm/bitfield.h> | ||
| 12 | 13 | ||
| 13 | extern uint64_t octeon_bootmem_alloc_range_phys(uint64_t size, | 14 | extern uint64_t octeon_bootmem_alloc_range_phys(uint64_t size, |
| 14 | uint64_t alignment, | 15 | uint64_t alignment, |
| @@ -58,6 +59,7 @@ extern void octeon_io_clk_delay(unsigned long); | |||
| 58 | #define OCTOEN_SERIAL_LEN 20 | 59 | #define OCTOEN_SERIAL_LEN 20 |
| 59 | 60 | ||
| 60 | struct octeon_boot_descriptor { | 61 | struct octeon_boot_descriptor { |
| 62 | #ifdef __BIG_ENDIAN_BITFIELD | ||
| 61 | /* Start of block referenced by assembly code - do not change! */ | 63 | /* Start of block referenced by assembly code - do not change! */ |
| 62 | uint32_t desc_version; | 64 | uint32_t desc_version; |
| 63 | uint32_t desc_size; | 65 | uint32_t desc_size; |
| @@ -109,77 +111,149 @@ struct octeon_boot_descriptor { | |||
| 109 | uint8_t mac_addr_base[6]; | 111 | uint8_t mac_addr_base[6]; |
| 110 | uint8_t mac_addr_count; | 112 | uint8_t mac_addr_count; |
| 111 | uint64_t cvmx_desc_vaddr; | 113 | uint64_t cvmx_desc_vaddr; |
| 114 | #else | ||
| 115 | uint32_t desc_size; | ||
| 116 | uint32_t desc_version; | ||
| 117 | uint64_t stack_top; | ||
| 118 | uint64_t heap_base; | ||
| 119 | uint64_t heap_end; | ||
| 120 | /* Only used by bootloader */ | ||
| 121 | uint64_t entry_point; | ||
| 122 | uint64_t desc_vaddr; | ||
| 123 | /* End of This block referenced by assembly code - do not change! */ | ||
| 124 | uint32_t stack_size; | ||
| 125 | uint32_t exception_base_addr; | ||
| 126 | uint32_t argc; | ||
| 127 | uint32_t heap_size; | ||
| 128 | /* | ||
| 129 | * Argc count for application. | ||
| 130 | * Warning low bit scrambled in little-endian. | ||
| 131 | */ | ||
| 132 | uint32_t argv[OCTEON_ARGV_MAX_ARGS]; | ||
| 133 | |||
| 134 | #define BOOT_FLAG_INIT_CORE (1 << 0) | ||
| 135 | #define OCTEON_BL_FLAG_DEBUG (1 << 1) | ||
| 136 | #define OCTEON_BL_FLAG_NO_MAGIC (1 << 2) | ||
| 137 | /* If set, use uart1 for console */ | ||
| 138 | #define OCTEON_BL_FLAG_CONSOLE_UART1 (1 << 3) | ||
| 139 | /* If set, use PCI console */ | ||
| 140 | #define OCTEON_BL_FLAG_CONSOLE_PCI (1 << 4) | ||
| 141 | /* Call exit on break on serial port */ | ||
| 142 | #define OCTEON_BL_FLAG_BREAK (1 << 5) | ||
| 143 | |||
| 144 | uint32_t core_mask; | ||
| 145 | uint32_t flags; | ||
| 146 | /* physical address of free memory descriptor block. */ | ||
| 147 | uint32_t phy_mem_desc_addr; | ||
| 148 | /* DRAM size in megabyes. */ | ||
| 149 | uint32_t dram_size; | ||
| 150 | /* CPU clock speed, in hz. */ | ||
| 151 | uint32_t eclock_hz; | ||
| 152 | /* used to pass flags from app to debugger. */ | ||
| 153 | uint32_t debugger_flags_base_addr; | ||
| 154 | /* SPI4 clock in hz. */ | ||
| 155 | uint32_t spi_clock_hz; | ||
| 156 | /* DRAM clock speed, in hz. */ | ||
| 157 | uint32_t dclock_hz; | ||
| 158 | uint8_t chip_rev_minor; | ||
| 159 | uint8_t chip_rev_major; | ||
| 160 | uint16_t chip_type; | ||
| 161 | uint8_t board_rev_minor; | ||
| 162 | uint8_t board_rev_major; | ||
| 163 | uint16_t board_type; | ||
| 164 | |||
| 165 | uint64_t unused1[4]; /* Not even filled in by bootloader. */ | ||
| 166 | |||
| 167 | uint64_t cvmx_desc_vaddr; | ||
| 168 | #endif | ||
| 112 | }; | 169 | }; |
| 113 | 170 | ||
| 114 | union octeon_cvmemctl { | 171 | union octeon_cvmemctl { |
| 115 | uint64_t u64; | 172 | uint64_t u64; |
| 116 | struct { | 173 | struct { |
| 117 | /* RO 1 = BIST fail, 0 = BIST pass */ | 174 | /* RO 1 = BIST fail, 0 = BIST pass */ |
| 118 | uint64_t tlbbist:1; | 175 | __BITFIELD_FIELD(uint64_t tlbbist:1, |
| 119 | /* RO 1 = BIST fail, 0 = BIST pass */ | 176 | /* RO 1 = BIST fail, 0 = BIST pass */ |
| 120 | uint64_t l1cbist:1; | 177 | __BITFIELD_FIELD(uint64_t l1cbist:1, |
| 121 | /* RO 1 = BIST fail, 0 = BIST pass */ | 178 | /* RO 1 = BIST fail, 0 = BIST pass */ |
| 122 | uint64_t l1dbist:1; | 179 | __BITFIELD_FIELD(uint64_t l1dbist:1, |
| 123 | /* RO 1 = BIST fail, 0 = BIST pass */ | 180 | /* RO 1 = BIST fail, 0 = BIST pass */ |
| 124 | uint64_t dcmbist:1; | 181 | __BITFIELD_FIELD(uint64_t dcmbist:1, |
| 125 | /* RO 1 = BIST fail, 0 = BIST pass */ | 182 | /* RO 1 = BIST fail, 0 = BIST pass */ |
| 126 | uint64_t ptgbist:1; | 183 | __BITFIELD_FIELD(uint64_t ptgbist:1, |
| 127 | /* RO 1 = BIST fail, 0 = BIST pass */ | 184 | /* RO 1 = BIST fail, 0 = BIST pass */ |
| 128 | uint64_t wbfbist:1; | 185 | __BITFIELD_FIELD(uint64_t wbfbist:1, |
| 129 | /* Reserved */ | 186 | /* Reserved */ |
| 130 | uint64_t reserved:22; | 187 | __BITFIELD_FIELD(uint64_t reserved:17, |
| 188 | /* OCTEON II - TLB replacement policy: 0 = bitmask LRU; 1 = NLU. | ||
| 189 | * This field selects between the TLB replacement policies: | ||
| 190 | * bitmask LRU or NLU. Bitmask LRU maintains a mask of | ||
| 191 | * recently used TLB entries and avoids them as new entries | ||
| 192 | * are allocated. NLU simply guarantees that the next | ||
| 193 | * allocation is not the last used TLB entry. */ | ||
| 194 | __BITFIELD_FIELD(uint64_t tlbnlu:1, | ||
| 195 | /* OCTEON II - Selects the bit in the counter used for | ||
| 196 | * releasing a PAUSE. This counter trips every 2(8+PAUSETIME) | ||
| 197 | * cycles. If not already released, the cnMIPS II core will | ||
| 198 | * always release a given PAUSE instruction within | ||
| 199 | * 2(8+PAUSETIME). If the counter trip happens to line up, | ||
| 200 | * the cnMIPS II core may release the PAUSE instantly. */ | ||
| 201 | __BITFIELD_FIELD(uint64_t pausetime:3, | ||
| 202 | /* OCTEON II - This field is an extension of | ||
| 203 | * CvmMemCtl[DIDTTO] */ | ||
| 204 | __BITFIELD_FIELD(uint64_t didtto2:1, | ||
| 131 | /* R/W If set, marked write-buffer entries time out | 205 | /* R/W If set, marked write-buffer entries time out |
| 132 | * the same as as other entries; if clear, marked | 206 | * the same as as other entries; if clear, marked |
| 133 | * write-buffer entries use the maximum timeout. */ | 207 | * write-buffer entries use the maximum timeout. */ |
| 134 | uint64_t dismarkwblongto:1; | 208 | __BITFIELD_FIELD(uint64_t dismarkwblongto:1, |
| 135 | /* R/W If set, a merged store does not clear the | 209 | /* R/W If set, a merged store does not clear the |
| 136 | * write-buffer entry timeout state. */ | 210 | * write-buffer entry timeout state. */ |
| 137 | uint64_t dismrgclrwbto:1; | 211 | __BITFIELD_FIELD(uint64_t dismrgclrwbto:1, |
| 138 | /* R/W Two bits that are the MSBs of the resultant | 212 | /* R/W Two bits that are the MSBs of the resultant |
| 139 | * CVMSEG LM word location for an IOBDMA. The other 8 | 213 | * CVMSEG LM word location for an IOBDMA. The other 8 |
| 140 | * bits come from the SCRADDR field of the IOBDMA. */ | 214 | * bits come from the SCRADDR field of the IOBDMA. */ |
| 141 | uint64_t iobdmascrmsb:2; | 215 | __BITFIELD_FIELD(uint64_t iobdmascrmsb:2, |
| 142 | /* R/W If set, SYNCWS and SYNCS only order marked | 216 | /* R/W If set, SYNCWS and SYNCS only order marked |
| 143 | * stores; if clear, SYNCWS and SYNCS only order | 217 | * stores; if clear, SYNCWS and SYNCS only order |
| 144 | * unmarked stores. SYNCWSMARKED has no effect when | 218 | * unmarked stores. SYNCWSMARKED has no effect when |
| 145 | * DISSYNCWS is set. */ | 219 | * DISSYNCWS is set. */ |
| 146 | uint64_t syncwsmarked:1; | 220 | __BITFIELD_FIELD(uint64_t syncwsmarked:1, |
| 147 | /* R/W If set, SYNCWS acts as SYNCW and SYNCS acts as | 221 | /* R/W If set, SYNCWS acts as SYNCW and SYNCS acts as |
| 148 | * SYNC. */ | 222 | * SYNC. */ |
| 149 | uint64_t dissyncws:1; | 223 | __BITFIELD_FIELD(uint64_t dissyncws:1, |
| 150 | /* R/W If set, no stall happens on write buffer | 224 | /* R/W If set, no stall happens on write buffer |
| 151 | * full. */ | 225 | * full. */ |
| 152 | uint64_t diswbfst:1; | 226 | __BITFIELD_FIELD(uint64_t diswbfst:1, |
| 153 | /* R/W If set (and SX set), supervisor-level | 227 | /* R/W If set (and SX set), supervisor-level |
| 154 | * loads/stores can use XKPHYS addresses with | 228 | * loads/stores can use XKPHYS addresses with |
| 155 | * VA<48>==0 */ | 229 | * VA<48>==0 */ |
| 156 | uint64_t xkmemenas:1; | 230 | __BITFIELD_FIELD(uint64_t xkmemenas:1, |
| 157 | /* R/W If set (and UX set), user-level loads/stores | 231 | /* R/W If set (and UX set), user-level loads/stores |
| 158 | * can use XKPHYS addresses with VA<48>==0 */ | 232 | * can use XKPHYS addresses with VA<48>==0 */ |
| 159 | uint64_t xkmemenau:1; | 233 | __BITFIELD_FIELD(uint64_t xkmemenau:1, |
| 160 | /* R/W If set (and SX set), supervisor-level | 234 | /* R/W If set (and SX set), supervisor-level |
| 161 | * loads/stores can use XKPHYS addresses with | 235 | * loads/stores can use XKPHYS addresses with |
| 162 | * VA<48>==1 */ | 236 | * VA<48>==1 */ |
| 163 | uint64_t xkioenas:1; | 237 | __BITFIELD_FIELD(uint64_t xkioenas:1, |
| 164 | /* R/W If set (and UX set), user-level loads/stores | 238 | /* R/W If set (and UX set), user-level loads/stores |
| 165 | * can use XKPHYS addresses with VA<48>==1 */ | 239 | * can use XKPHYS addresses with VA<48>==1 */ |
| 166 | uint64_t xkioenau:1; | 240 | __BITFIELD_FIELD(uint64_t xkioenau:1, |
| 167 | /* R/W If set, all stores act as SYNCW (NOMERGE must | 241 | /* R/W If set, all stores act as SYNCW (NOMERGE must |
| 168 | * be set when this is set) RW, reset to 0. */ | 242 | * be set when this is set) RW, reset to 0. */ |
| 169 | uint64_t allsyncw:1; | 243 | __BITFIELD_FIELD(uint64_t allsyncw:1, |
| 170 | /* R/W If set, no stores merge, and all stores reach | 244 | /* R/W If set, no stores merge, and all stores reach |
| 171 | * the coherent bus in order. */ | 245 | * the coherent bus in order. */ |
| 172 | uint64_t nomerge:1; | 246 | __BITFIELD_FIELD(uint64_t nomerge:1, |
| 173 | /* R/W Selects the bit in the counter used for DID | 247 | /* R/W Selects the bit in the counter used for DID |
| 174 | * time-outs 0 = 231, 1 = 230, 2 = 229, 3 = | 248 | * time-outs 0 = 231, 1 = 230, 2 = 229, 3 = |
| 175 | * 214. Actual time-out is between 1x and 2x this | 249 | * 214. Actual time-out is between 1x and 2x this |
| 176 | * interval. For example, with DIDTTO=3, expiration | 250 | * interval. For example, with DIDTTO=3, expiration |
| 177 | * interval is between 16K and 32K. */ | 251 | * interval is between 16K and 32K. */ |
| 178 | uint64_t didtto:2; | 252 | __BITFIELD_FIELD(uint64_t didtto:2, |
| 179 | /* R/W If set, the (mem) CSR clock never turns off. */ | 253 | /* R/W If set, the (mem) CSR clock never turns off. */ |
| 180 | uint64_t csrckalwys:1; | 254 | __BITFIELD_FIELD(uint64_t csrckalwys:1, |
| 181 | /* R/W If set, mclk never turns off. */ | 255 | /* R/W If set, mclk never turns off. */ |
| 182 | uint64_t mclkalwys:1; | 256 | __BITFIELD_FIELD(uint64_t mclkalwys:1, |
| 183 | /* R/W Selects the bit in the counter used for write | 257 | /* R/W Selects the bit in the counter used for write |
| 184 | * buffer flush time-outs (WBFLT+11) is the bit | 258 | * buffer flush time-outs (WBFLT+11) is the bit |
| 185 | * position in an internal counter used to determine | 259 | * position in an internal counter used to determine |
| @@ -187,25 +261,26 @@ union octeon_cvmemctl { | |||
| 187 | * 2x this interval. For example, with WBFLT = 0, a | 261 | * 2x this interval. For example, with WBFLT = 0, a |
| 188 | * write buffer expires between 2K and 4K cycles after | 262 | * write buffer expires between 2K and 4K cycles after |
| 189 | * the write buffer entry is allocated. */ | 263 | * the write buffer entry is allocated. */ |
| 190 | uint64_t wbfltime:3; | 264 | __BITFIELD_FIELD(uint64_t wbfltime:3, |
| 191 | /* R/W If set, do not put Istream in the L2 cache. */ | 265 | /* R/W If set, do not put Istream in the L2 cache. */ |
| 192 | uint64_t istrnol2:1; | 266 | __BITFIELD_FIELD(uint64_t istrnol2:1, |
| 193 | /* R/W The write buffer threshold. */ | 267 | /* R/W The write buffer threshold. */ |
| 194 | uint64_t wbthresh:4; | 268 | __BITFIELD_FIELD(uint64_t wbthresh:4, |
| 195 | /* Reserved */ | 269 | /* Reserved */ |
| 196 | uint64_t reserved2:2; | 270 | __BITFIELD_FIELD(uint64_t reserved2:2, |
| 197 | /* R/W If set, CVMSEG is available for loads/stores in | 271 | /* R/W If set, CVMSEG is available for loads/stores in |
| 198 | * kernel/debug mode. */ | 272 | * kernel/debug mode. */ |
| 199 | uint64_t cvmsegenak:1; | 273 | __BITFIELD_FIELD(uint64_t cvmsegenak:1, |
| 200 | /* R/W If set, CVMSEG is available for loads/stores in | 274 | /* R/W If set, CVMSEG is available for loads/stores in |
| 201 | * supervisor mode. */ | 275 | * supervisor mode. */ |
| 202 | uint64_t cvmsegenas:1; | 276 | __BITFIELD_FIELD(uint64_t cvmsegenas:1, |
| 203 | /* R/W If set, CVMSEG is available for loads/stores in | 277 | /* R/W If set, CVMSEG is available for loads/stores in |
| 204 | * user mode. */ | 278 | * user mode. */ |
| 205 | uint64_t cvmsegenau:1; | 279 | __BITFIELD_FIELD(uint64_t cvmsegenau:1, |
| 206 | /* R/W Size of local memory in cache blocks, 54 (6912 | 280 | /* R/W Size of local memory in cache blocks, 54 (6912 |
| 207 | * bytes) is max legal value. */ | 281 | * bytes) is max legal value. */ |
| 208 | uint64_t lmemsz:6; | 282 | __BITFIELD_FIELD(uint64_t lmemsz:6, |
| 283 | ;))))))))))))))))))))))))))))))))) | ||
| 209 | } s; | 284 | } s; |
| 210 | }; | 285 | }; |
| 211 | 286 | ||
