ixp425_npereg.h revision 164426
1/*- 2 * Copyright (c) 2006 Sam Leffler, Errno Consulting 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer, 10 * without modification. 11 * 2. Redistributions in binary form must reproduce at minimum a disclaimer 12 * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any 13 * redistribution must be conditioned upon including a substantially 14 * similar Disclaimer requirement for further binary redistribution. 15 * 16 * NO WARRANTY 17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY 20 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 21 * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, 22 * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 25 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 27 * THE POSSIBILITY OF SUCH DAMAGES. 28 * 29 * $FreeBSD: head/sys/arm/xscale/ixp425/ixp425_npereg.h 164426 2006-11-19 23:55:23Z sam $ 30 */ 31 32/*- 33 * Copyright (c) 2001-2005, Intel Corporation. 34 * All rights reserved. 35 * 36 * Redistribution and use in source and binary forms, with or without 37 * modification, are permitted provided that the following conditions 38 * are met: 39 * 1. Redistributions of source code must retain the above copyright 40 * notice, this list of conditions and the following disclaimer. 41 * 2. Redistributions in binary form must reproduce the above copyright 42 * notice, this list of conditions and the following disclaimer in the 43 * documentation and/or other materials provided with the distribution. 44 * 3. Neither the name of the Intel Corporation nor the names of its contributors 45 * may be used to endorse or promote products derived from this software 46 * without specific prior written permission. 47 * 48 * 49 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' 50 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 51 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 52 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 53 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 54 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 55 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 56 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 57 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 58 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 59 * SUCH DAMAGE. 60*/ 61 62#ifndef _IXP425_NPEREG_H_ 63#define _IXP425_NPEREG_H_ 64 65/* signature found as 1st word in a microcode image library */ 66#define IX_NPEDL_IMAGEMGR_SIGNATURE 0xDEADBEEF 67/* marks end of header in a microcode image library */ 68#define IX_NPEDL_IMAGEMGR_END_OF_HEADER 0xFFFFFFFF 69 70/* 71 * Intel (R) IXP400 Software NPE Image ID Definition 72 * 73 * Definition of NPE Image ID to be passed to ixNpeDlNpeInitAndStart() 74 * as input of type uint32_t which has the following fields format: 75 * 76 * Field [Bit Location] 77 * ----------------------------------- 78 * Device ID [31 - 28] 79 * NPE ID [27 - 24] 80 * NPE Functionality ID [23 - 16] 81 * Major Release Number [15 - 8] 82 * Minor Release Number [7 - 0] 83 */ 84#define IX_NPEDL_NPEID_FROM_IMAGEID_GET(imageId) \ 85 (((imageId) >> 24) & 0xf) 86#define IX_NPEDL_DEVICEID_FROM_IMAGEID_GET(imageId) \ 87 (((imageId) >> 28) & 0xf) 88#define IX_NPEDL_FUNCTIONID_FROM_IMAGEID_GET(imageId) \ 89 (((imageId) >> 16) & 0xff) 90#define IX_NPEDL_MAJOR_FROM_IMAGEID_GET(imageId) \ 91 (((imageId) >> 8) & 0xff) 92#define IX_NPEDL_MINOR_FROM_IMAGEID_GET(imageId) \ 93 (((imageId) >> 0) & 0xff) 94 95/* 96 * Instruction and Data Memory Size (in words) for each NPE 97 */ 98#ifndef __ixp46X 99#define IX_NPEDL_INS_MEMSIZE_WORDS_NPEA 4096 100#define IX_NPEDL_INS_MEMSIZE_WORDS_NPEB 2048 101#define IX_NPEDL_INS_MEMSIZE_WORDS_NPEC 2048 102 103#define IX_NPEDL_DATA_MEMSIZE_WORDS_NPEA 2048 104#define IX_NPEDL_DATA_MEMSIZE_WORDS_NPEB 2048 105#define IX_NPEDL_DATA_MEMSIZE_WORDS_NPEC 2048 106#else 107#define IX_NPEDL_INS_MEMSIZE_WORDS_NPEA 4096 108#define IX_NPEDL_INS_MEMSIZE_WORDS_NPEB 4096 109#define IX_NPEDL_INS_MEMSIZE_WORDS_NPEC 4096 110 111#define IX_NPEDL_DATA_MEMSIZE_WORDS_NPEA 4096 112#define IX_NPEDL_DATA_MEMSIZE_WORDS_NPEB 4096 113#define IX_NPEDL_DATA_MEMSIZE_WORDS_NPEC 4096 114#endif 115 116/* BAR offsets */ 117#define IX_NPEDL_REG_OFFSET_EXAD 0x00000000 /* Execution Address */ 118#define IX_NPEDL_REG_OFFSET_EXDATA 0x00000004 /* Execution Data */ 119#define IX_NPEDL_REG_OFFSET_EXCTL 0x00000008 /* Execution Control */ 120#define IX_NPEDL_REG_OFFSET_EXCT 0x0000000C /* Execution Count */ 121#define IX_NPEDL_REG_OFFSET_AP0 0x00000010 /* Action Point 0 */ 122#define IX_NPEDL_REG_OFFSET_AP1 0x00000014 /* Action Point 1 */ 123#define IX_NPEDL_REG_OFFSET_AP2 0x00000018 /* Action Point 2 */ 124#define IX_NPEDL_REG_OFFSET_AP3 0x0000001C /* Action Point 3 */ 125#define IX_NPEDL_REG_OFFSET_WFIFO 0x00000020 /* Watchpoint FIFO */ 126#define IX_NPEDL_REG_OFFSET_WC 0x00000024 /* Watch Count */ 127#define IX_NPEDL_REG_OFFSET_PROFCT 0x00000028 /* Profile Count */ 128#define IX_NPEDL_REG_OFFSET_STAT 0x0000002C /* Messaging Status */ 129#define IX_NPEDL_REG_OFFSET_CTL 0x00000030 /* Messaging Control */ 130#define IX_NPEDL_REG_OFFSET_MBST 0x00000034 /* Mailbox Status */ 131#define IX_NPEDL_REG_OFFSET_FIFO 0x00000038 /* Message FIFO */ 132 133/* 134 * Reset value for Mailbox (MBST) register 135 * NOTE that if used, it should be complemented with an NPE intruction 136 * to clear the Mailbox at the NPE side as well 137 */ 138#define IX_NPEDL_REG_RESET_MBST 0x0000F0F0 139 140#define IX_NPEDL_MASK_WFIFO_VALID 0x80000000 /* VALID bit */ 141#define IX_NPEDL_MASK_STAT_OFNE 0x00010000 /* OFNE bit */ 142#define IX_NPEDL_MASK_STAT_IFNE 0x00080000 /* IFNE bit */ 143 144/* 145 * EXCTL (Execution Control) Register commands 146*/ 147#define IX_NPEDL_EXCTL_CMD_NPE_STEP 0x01 /* Step 1 instruction */ 148#define IX_NPEDL_EXCTL_CMD_NPE_START 0x02 /* Start execution */ 149#define IX_NPEDL_EXCTL_CMD_NPE_STOP 0x03 /* Stop execution */ 150#define IX_NPEDL_EXCTL_CMD_NPE_CLR_PIPE 0x04 /* Clear ins pipeline */ 151 152/* 153 * Read/write operations use address in EXAD and data in EXDATA. 154 */ 155#define IX_NPEDL_EXCTL_CMD_RD_INS_MEM 0x10 /* Read ins memory */ 156#define IX_NPEDL_EXCTL_CMD_WR_INS_MEM 0x11 /* Write ins memory */ 157#define IX_NPEDL_EXCTL_CMD_RD_DATA_MEM 0x12 /* Read data memory */ 158#define IX_NPEDL_EXCTL_CMD_WR_DATA_MEM 0x13 /* Write data memory */ 159#define IX_NPEDL_EXCTL_CMD_RD_ECS_REG 0x14 /* Read ECS register */ 160#define IX_NPEDL_EXCTL_CMD_WR_ECS_REG 0x15 /* Write ECS register */ 161 162#define IX_NPEDL_EXCTL_CMD_CLR_PROFILE_CNT 0x0C /* Clear Profile Count register */ 163 164 165/* 166 * EXCTL (Execution Control) Register status bit masks 167 */ 168#define IX_NPEDL_EXCTL_STATUS_RUN 0x80000000 169#define IX_NPEDL_EXCTL_STATUS_STOP 0x40000000 170#define IX_NPEDL_EXCTL_STATUS_CLEAR 0x20000000 171#define IX_NPEDL_EXCTL_STATUS_ECS_K 0x00800000 /* pipeline Klean */ 172 173/* 174 * Executing Context Stack (ECS) level registers 175 */ 176#define IX_NPEDL_ECS_BG_CTXT_REG_0 0x00 /* reg 0 @ bg ctx */ 177#define IX_NPEDL_ECS_BG_CTXT_REG_1 0x01 /* reg 1 @ bg ctx */ 178#define IX_NPEDL_ECS_BG_CTXT_REG_2 0x02 /* reg 2 @ bg ctx */ 179 180#define IX_NPEDL_ECS_PRI_1_CTXT_REG_0 0x04 /* reg 0 @ pri 1 ctx */ 181#define IX_NPEDL_ECS_PRI_1_CTXT_REG_1 0x05 /* reg 1 @ pri 1 ctx */ 182#define IX_NPEDL_ECS_PRI_1_CTXT_REG_2 0x06 /* reg 2 @ pri 1 ctx */ 183 184#define IX_NPEDL_ECS_PRI_2_CTXT_REG_0 0x08 /* reg 0 @ pri 2 ctx */ 185#define IX_NPEDL_ECS_PRI_2_CTXT_REG_1 0x09 /* reg 1 @ pri 2 ctx */ 186#define IX_NPEDL_ECS_PRI_2_CTXT_REG_2 0x0A /* reg 2 @ pri 2 ctx */ 187 188#define IX_NPEDL_ECS_DBG_CTXT_REG_0 0x0C /* reg 0 @ debug ctx */ 189#define IX_NPEDL_ECS_DBG_CTXT_REG_1 0x0D /* reg 1 @ debug ctx */ 190#define IX_NPEDL_ECS_DBG_CTXT_REG_2 0x0E /* reg 2 @ debug ctx */ 191 192#define IX_NPEDL_ECS_INSTRUCT_REG 0x11 /* Instruction reg */ 193 194/* 195 * Execution Access register reset values 196 */ 197#define IX_NPEDL_ECS_BG_CTXT_REG_0_RESET 0xA0000000 198#define IX_NPEDL_ECS_BG_CTXT_REG_1_RESET 0x01000000 199#define IX_NPEDL_ECS_BG_CTXT_REG_2_RESET 0x00008000 200#define IX_NPEDL_ECS_PRI_1_CTXT_REG_0_RESET 0x20000080 201#define IX_NPEDL_ECS_PRI_1_CTXT_REG_1_RESET 0x01000000 202#define IX_NPEDL_ECS_PRI_1_CTXT_REG_2_RESET 0x00008000 203#define IX_NPEDL_ECS_PRI_2_CTXT_REG_0_RESET 0x20000080 204#define IX_NPEDL_ECS_PRI_2_CTXT_REG_1_RESET 0x01000000 205#define IX_NPEDL_ECS_PRI_2_CTXT_REG_2_RESET 0x00008000 206#define IX_NPEDL_ECS_DBG_CTXT_REG_0_RESET 0x20000000 207#define IX_NPEDL_ECS_DBG_CTXT_REG_1_RESET 0x00000000 208#define IX_NPEDL_ECS_DBG_CTXT_REG_2_RESET 0x001E0000 209#define IX_NPEDL_ECS_INSTRUCT_REG_RESET 0x1003C00F 210 211/* 212 * Masks used to read/write particular bits in Execution Access registers 213 */ 214 215#define IX_NPEDL_MASK_ECS_REG_0_ACTIVE 0x80000000 /* Active bit */ 216#define IX_NPEDL_MASK_ECS_REG_0_NEXTPC 0x1FFF0000 /* NextPC bits */ 217#define IX_NPEDL_MASK_ECS_REG_0_LDUR 0x00000700 /* LDUR bits */ 218 219#define IX_NPEDL_MASK_ECS_REG_1_CCTXT 0x000F0000 /* NextPC bits */ 220#define IX_NPEDL_MASK_ECS_REG_1_SELCTXT 0x0000000F 221 222#define IX_NPEDL_MASK_ECS_DBG_REG_2_IF 0x00100000 /* IF bit */ 223#define IX_NPEDL_MASK_ECS_DBG_REG_2_IE 0x00080000 /* IE bit */ 224 225 226/* 227 * Bit-Offsets from LSB of particular bit-fields in Execution Access registers. 228 */ 229 230#define IX_NPEDL_OFFSET_ECS_REG_0_NEXTPC 16 231#define IX_NPEDL_OFFSET_ECS_REG_0_LDUR 8 232 233#define IX_NPEDL_OFFSET_ECS_REG_1_CCTXT 16 234#define IX_NPEDL_OFFSET_ECS_REG_1_SELCTXT 0 235 236/* 237 * NPE core & co-processor instruction templates to load into NPE Instruction 238 * Register, for read/write of NPE register file registers. 239 */ 240 241/* 242 * Read an 8-bit NPE internal logical register 243 * and return the value in the EXDATA register (aligned to MSB). 244 * NPE Assembler instruction: "mov8 d0, d0 &&& DBG_WrExec" 245 */ 246#define IX_NPEDL_INSTR_RD_REG_BYTE 0x0FC00000 247 248/* 249 * Read a 16-bit NPE internal logical register 250 * and return the value in the EXDATA register (aligned to MSB). 251 * NPE Assembler instruction: "mov16 d0, d0 &&& DBG_WrExec" 252 */ 253#define IX_NPEDL_INSTR_RD_REG_SHORT 0x0FC08010 254 255/* 256 * Read a 16-bit NPE internal logical register 257 * and return the value in the EXDATA register. 258 * NPE Assembler instruction: "mov32 d0, d0 &&& DBG_WrExec" 259 */ 260#define IX_NPEDL_INSTR_RD_REG_WORD 0x0FC08210 261 262/* 263 * Write an 8-bit NPE internal logical register. 264 * NPE Assembler instruction: "mov8 d0, #0" 265 */ 266#define IX_NPEDL_INSTR_WR_REG_BYTE 0x00004000 267 268/* 269 * Write a 16-bit NPE internal logical register. 270 * NPE Assembler instruction: "mov16 d0, #0" 271 */ 272#define IX_NPEDL_INSTR_WR_REG_SHORT 0x0000C000 273 274/* 275 * Write a 16-bit NPE internal logical register. 276 * NPE Assembler instruction: "cprd32 d0 &&& DBG_RdInFIFO" 277 */ 278#define IX_NPEDL_INSTR_RD_FIFO 0x0F888220 279 280/* 281 * Reset Mailbox (MBST) register 282 * NPE Assembler instruction: "mov32 d0, d0 &&& DBG_ClearM" 283 */ 284#define IX_NPEDL_INSTR_RESET_MBOX 0x0FAC8210 285 286 287/* 288 * Bit-offsets from LSB, of particular bit-fields in an NPE instruction 289 */ 290#define IX_NPEDL_OFFSET_INSTR_SRC 4 /* src operand */ 291#define IX_NPEDL_OFFSET_INSTR_DEST 9 /* dest operand */ 292#define IX_NPEDL_OFFSET_INSTR_COPROC 18 /* coprocessor ins */ 293 294/* 295 * Masks used to read/write particular bits of an NPE Instruction 296 */ 297 298/** 299 * Mask the bits of 16-bit data value (least-sig 5 bits) to be used in 300 * SRC field of immediate-mode NPE instruction 301 */ 302#define IX_NPEDL_MASK_IMMED_INSTR_SRC_DATA 0x1F 303 304/** 305 * Mask the bits of 16-bit data value (most-sig 11 bits) to be used in 306 * COPROC field of immediate-mode NPE instruction 307 */ 308#define IX_NPEDL_MASK_IMMED_INSTR_COPROC_DATA 0xFFE0 309 310/** 311 * LSB offset of the bit-field of 16-bit data value (most-sig 11 bits) 312 * to be used in COPROC field of immediate-mode NPE instruction 313 */ 314#define IX_NPEDL_OFFSET_IMMED_INSTR_COPROC_DATA 5 315 316/** 317 * Number of left-shifts required to align most-sig 11 bits of 16-bit 318 * data value into COPROC field of immediate-mode NPE instruction 319 */ 320#define IX_NPEDL_DISPLACE_IMMED_INSTR_COPROC_DATA \ 321 (IX_NPEDL_OFFSET_INSTR_COPROC - IX_NPEDL_OFFSET_IMMED_INSTR_COPROC_DATA) 322 323/** 324 * LDUR value used with immediate-mode NPE Instructions by the NpeDl 325 * for writing to NPE internal logical registers 326 */ 327#define IX_NPEDL_WR_INSTR_LDUR 1 328 329/** 330 * LDUR value used with NON-immediate-mode NPE Instructions by the NpeDl 331 * for reading from NPE internal logical registers 332 */ 333#define IX_NPEDL_RD_INSTR_LDUR 0 334 335 336/** 337 * NPE internal Context Store registers. 338 */ 339typedef enum 340{ 341 IX_NPEDL_CTXT_REG_STEVT = 0, /**< identifies STEVT */ 342 IX_NPEDL_CTXT_REG_STARTPC, /**< identifies STARTPC */ 343 IX_NPEDL_CTXT_REG_REGMAP, /**< identifies REGMAP */ 344 IX_NPEDL_CTXT_REG_CINDEX, /**< identifies CINDEX */ 345 IX_NPEDL_CTXT_REG_MAX /**< Total number of Context Store registers */ 346} IxNpeDlCtxtRegNum; 347 348 349/* 350 * NPE Context Store register logical addresses 351 */ 352#define IX_NPEDL_CTXT_REG_ADDR_STEVT 0x0000001B 353#define IX_NPEDL_CTXT_REG_ADDR_STARTPC 0x0000001C 354#define IX_NPEDL_CTXT_REG_ADDR_REGMAP 0x0000001E 355#define IX_NPEDL_CTXT_REG_ADDR_CINDEX 0x0000001F 356 357/* 358 * NPE Context Store register reset values 359 */ 360 361/** 362 * Reset value of STEVT NPE internal Context Store register 363 * (STEVT = off, 0x80) 364 */ 365#define IX_NPEDL_CTXT_REG_RESET_STEVT 0x80 366 367/** 368 * Reset value of STARTPC NPE internal Context Store register 369 * (STARTPC = 0x0000) 370 */ 371#define IX_NPEDL_CTXT_REG_RESET_STARTPC 0x0000 372 373/** 374 * Reset value of REGMAP NPE internal Context Store register 375 * (REGMAP = d0->p0, d8->p2, d16->p4) 376 */ 377#define IX_NPEDL_CTXT_REG_RESET_REGMAP 0x0820 378 379/** 380 * Reset value of CINDEX NPE internal Context Store register 381 * (CINDEX = 0) 382 */ 383#define IX_NPEDL_CTXT_REG_RESET_CINDEX 0x00 384 385 386/* 387 * Numeric range of context levels available on an NPE 388 */ 389#define IX_NPEDL_CTXT_NUM_MIN 0 390#define IX_NPEDL_CTXT_NUM_MAX 15 391 392 393/** 394 * Number of Physical registers currently supported 395 * Initial NPE implementations will have a 32-word register file. 396 * Later implementations may have a 64-word register file. 397 */ 398#define IX_NPEDL_TOTAL_NUM_PHYS_REG 32 399 400/** 401 * LSB-offset of Regmap number in Physical NPE register address, used 402 * for Physical To Logical register address mapping in the NPE 403 */ 404#define IX_NPEDL_OFFSET_PHYS_REG_ADDR_REGMAP 1 405 406/** 407 * Mask to extract a logical NPE register address from a physical 408 * register address, used for Physical To Logical address mapping 409 */ 410#define IX_NPEDL_MASK_PHYS_REG_ADDR_LOGICAL_ADDR 0x1 411 412/* 413 * NPE Message/Mailbox interface. 414 */ 415#define IX_NPESTAT IX_NPEDL_REG_OFFSET_STAT /* status register */ 416#define IX_NPECTL IX_NPEDL_REG_OFFSET_CTL /* control register */ 417#define IX_NPEFIFO IX_NPEDL_REG_OFFSET_FIFO /* FIFO register */ 418 419/* control register */ 420#define IX_NPECTL_OFE 0x00010000 /* output fifo enable */ 421#define IX_NPECTL_IFE 0x00020000 /* input fifo enable */ 422#define IX_NPECTL_OFWE 0x01000000 /* output fifo write enable */ 423#define IX_NPECTL_IFWE 0x02000000 /* input fifo write enable */ 424 425/* status register */ 426#define IX_NPESTAT_OFNE 0x00010000 /* output fifo not empty */ 427#define IX_NPESTAT_IFNF 0x00020000 /* input fifo not full */ 428#define IX_NPESTAT_OFNF 0x00040000 /* output fifo not full */ 429#define IX_NPESTAT_IFNE 0x00080000 /* input fifo not empty */ 430#define IX_NPESTAT_MBINT 0x00100000 /* Mailbox interrupt */ 431#define IX_NPESTAT_IFINT 0x00200000 /* input fifo interrupt */ 432#define IX_NPESTAT_OFINT 0x00400000 /* output fifo interrupt */ 433#define IX_NPESTAT_WFINT 0x00800000 /* watch fifo interrupt */ 434#endif /* _IXP425_NPEREG_H_ */ 435