1bf215546Sopenharmony_ci<?xml version="1.0" encoding="UTF-8"?> 2bf215546Sopenharmony_ci<database xmlns="http://nouveau.freedesktop.org/" 3bf215546Sopenharmony_cixmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 4bf215546Sopenharmony_cixsi:schemaLocation="http://nouveau.freedesktop.org/ rules-ng.xsd"> 5bf215546Sopenharmony_ci 6bf215546Sopenharmony_ci<!-- 7bf215546Sopenharmony_ci This documents the internal register space used by the CP firmware since 8bf215546Sopenharmony_ci the afuc instruction set was introduced. 9bf215546Sopenharmony_ci--> 10bf215546Sopenharmony_ci 11bf215546Sopenharmony_ci<domain name="A5XX_CONTROL_REG" width="32"> 12bf215546Sopenharmony_ci <reg64 name="IB1_BASE" offset="0x0b0"/> 13bf215546Sopenharmony_ci <reg32 name="IB1_DWORDS" offset="0x0b2"/> 14bf215546Sopenharmony_ci <reg64 name="IB2_BASE" offset="0x0b4"/> 15bf215546Sopenharmony_ci <reg32 name="IB2_DWORDS" offset="0x0b6"/> 16bf215546Sopenharmony_ci 17bf215546Sopenharmony_ci <doc> 18bf215546Sopenharmony_ci To use these, write the address and number of dwords, then read 19bf215546Sopenharmony_ci the result from $addr. 20bf215546Sopenharmony_ci </doc> 21bf215546Sopenharmony_ci <reg64 name="MEM_READ_ADDR" offset="0x0b8"/> 22bf215546Sopenharmony_ci <reg32 name="MEM_READ_DWORDS" offset="0x0ba"/> 23bf215546Sopenharmony_ci</domain> 24bf215546Sopenharmony_ci 25bf215546Sopenharmony_ci<domain name="A6XX_CONTROL_REG" width="32"> 26bf215546Sopenharmony_ci <reg32 name="RB_RPTR" offset="0x001"/> 27bf215546Sopenharmony_ci <doc> 28bf215546Sopenharmony_ci Instruction to jump to when the CP is preempted to perform a 29bf215546Sopenharmony_ci context switch, initialized to entry 15 of the jump table at 30bf215546Sopenharmony_ci bootup. 31bf215546Sopenharmony_ci </doc> 32bf215546Sopenharmony_ci <reg32 name="PREEMPT_INSTR" offset="0x004"/> 33bf215546Sopenharmony_ci 34bf215546Sopenharmony_ci <reg64 name="IB1_BASE" offset="0x010"/> 35bf215546Sopenharmony_ci <reg32 name="IB1_DWORDS" offset="0x012"/> 36bf215546Sopenharmony_ci <reg64 name="IB2_BASE" offset="0x014"/> 37bf215546Sopenharmony_ci <reg32 name="IB2_DWORDS" offset="0x016"/> 38bf215546Sopenharmony_ci 39bf215546Sopenharmony_ci <reg64 name="MEM_READ_ADDR" offset="0x018"/> 40bf215546Sopenharmony_ci <reg32 name="MEM_READ_DWORDS" offset="0x01a"/> 41bf215546Sopenharmony_ci 42bf215546Sopenharmony_ci <reg32 name="REG_WRITE_ADDR" offset="0x024"/> 43bf215546Sopenharmony_ci <doc> 44bf215546Sopenharmony_ci Writing to this triggers a register write and auto-increments 45bf215546Sopenharmony_ci REG_WRITE_ADDR. 46bf215546Sopenharmony_ci 47bf215546Sopenharmony_ci Note that there seems to be some upper bits that are possilby 48bf215546Sopenharmony_ci flags, ie: 49bf215546Sopenharmony_ci 50bf215546Sopenharmony_ci l284: 0d12: 8a8c0003 mov $0c, 0x0003 << 20 51bf215546Sopenharmony_ci GPR: $0c: 00300000 52bf215546Sopenharmony_ci 0d13: 318c9e0b or $0c, $0c, 0x9e0b 53bf215546Sopenharmony_ci GPR: $0c: 00309e0b 54bf215546Sopenharmony_ci 0d14: a80c0024 cwrite $0c, [$00 + @REG_WRITE_ADDR], 0x0 55bf215546Sopenharmony_ci CTRL: @REG_WRITE_ADDR: 00309e0b 56bf215546Sopenharmony_ci 57bf215546Sopenharmony_ci </doc> 58bf215546Sopenharmony_ci <reg32 name="REG_WRITE" offset="0x025"/> 59bf215546Sopenharmony_ci 60bf215546Sopenharmony_ci <doc> After setting these, read result from $addr2 </doc> 61bf215546Sopenharmony_ci <reg32 name="REG_READ_DWORDS" offset="0x026"/> 62bf215546Sopenharmony_ci <reg32 name="REG_READ_ADDR" offset="0x027"/> 63bf215546Sopenharmony_ci 64bf215546Sopenharmony_ci <doc> 65bf215546Sopenharmony_ci Write to increase WFI_PEND_CTR, decremented by WFI_PEND_DECR 66bf215546Sopenharmony_ci pipe register. 67bf215546Sopenharmony_ci </doc> 68bf215546Sopenharmony_ci <reg32 name="WFI_PEND_INCR" offset="0x030"/> 69bf215546Sopenharmony_ci <reg32 name="QUERY_PEND_INCR" offset="0x031"/> 70bf215546Sopenharmony_ci <reg32 name="CACHE_FLUSH_PEND_INCR" offset="0x031"/> 71bf215546Sopenharmony_ci 72bf215546Sopenharmony_ci <reg32 name="WFI_PEND_CTR" offset="0x038"/> 73bf215546Sopenharmony_ci <reg32 name="QUERY_PEND_CTR" offset="0x039"/> 74bf215546Sopenharmony_ci <reg32 name="CACHE_FLUSH_PEND_CTR" offset="0x03a"/> 75bf215546Sopenharmony_ci 76bf215546Sopenharmony_ci <reg32 name="DRAW_STATE_SEL" offset="0x041"> 77bf215546Sopenharmony_ci <doc> 78bf215546Sopenharmony_ci SQE writes DRAW_STATE_SEL to select the SDS state group, and 79bf215546Sopenharmony_ci then reads out the SDS header (DRAW_STATE_HDR), ie. the first 80bf215546Sopenharmony_ci dword in the state group entry (see CP_SET_DRAW_STATE), and 81bf215546Sopenharmony_ci base address of the state group cmdstream (DRAW_STATE_BASE) 82bf215546Sopenharmony_ci </doc> 83bf215546Sopenharmony_ci </reg32> 84bf215546Sopenharmony_ci <reg64 name="SDS_BASE" offset="0x042"> 85bf215546Sopenharmony_ci <doc> 86bf215546Sopenharmony_ci base address for executing draw state group when IB_LEVEL 87bf215546Sopenharmony_ci is set to 3 (ie. it's a bit like IB3 equiv of IBn_BASE) 88bf215546Sopenharmony_ci 89bf215546Sopenharmony_ci Note that SDS_BASE/SDS_DWORDS seem to be per-state-group, 90bf215546Sopenharmony_ci the values reflected switch when DRAW_STATE_SEL is written. 91bf215546Sopenharmony_ci </doc> 92bf215546Sopenharmony_ci </reg64> 93bf215546Sopenharmony_ci <reg32 name="SDS_DWORDS" offset="0x044"> 94bf215546Sopenharmony_ci <doc> 95bf215546Sopenharmony_ci state group equiv of IBn_DWORDS 96bf215546Sopenharmony_ci </doc> 97bf215546Sopenharmony_ci </reg32> 98bf215546Sopenharmony_ci 99bf215546Sopenharmony_ci <reg64 name="DRAW_STATE_BASE" offset="0x045"/> 100bf215546Sopenharmony_ci <reg32 name="DRAW_STATE_HDR" offset="0x047"> 101bf215546Sopenharmony_ci <doc> 102bf215546Sopenharmony_ci Contains information from the first dword of the state group 103bf215546Sopenharmony_ci entry in CP_SET_DRAW_STATE, but format isn't exactly the 104bf215546Sopenharmony_ci same. The # of dwords is in low 16b, and mode mask is in 105bf215546Sopenharmony_ci high 16 bits 106bf215546Sopenharmony_ci </doc> 107bf215546Sopenharmony_ci </reg32> 108bf215546Sopenharmony_ci <reg32 name="DRAW_STATE_ACTIVE_BITMASK" offset="0x049"/> 109bf215546Sopenharmony_ci <reg32 name="DRAW_STATE_SET" offset="0x04a"/> 110bf215546Sopenharmony_ci 111bf215546Sopenharmony_ci <doc> Controls whether RB, IB1, or IB2 is executed </doc> 112bf215546Sopenharmony_ci <reg32 name="IB_LEVEL" offset="0x054"/> 113bf215546Sopenharmony_ci 114bf215546Sopenharmony_ci <doc> Controls high 32 bits used by load and store afuc instructions </doc> 115bf215546Sopenharmony_ci <reg32 name="LOAD_STORE_HI" offset="0x058"/> 116bf215546Sopenharmony_ci 117bf215546Sopenharmony_ci <doc> Used to initialize the jump table for handling packets at bootup </doc> 118bf215546Sopenharmony_ci <reg32 name="PACKET_TABLE_WRITE_ADDR" offset="0x060"/> 119bf215546Sopenharmony_ci <reg32 name="PACKET_TABLE_WRITE" offset="0x061"/> 120bf215546Sopenharmony_ci 121bf215546Sopenharmony_ci <reg32 name="PREEMPT_ENABLE" offset="0x071"/> 122bf215546Sopenharmony_ci <reg32 name="SECURE_MODE" offset="0x075"/> 123bf215546Sopenharmony_ci 124bf215546Sopenharmony_ci <!-- 125bf215546Sopenharmony_ci Note: I think that registers above 0x100 are actually just a 126bf215546Sopenharmony_ci scratch space which can be used by firmware however it wants, 127bf215546Sopenharmony_ci so these might change if the the firmware is updated. 128bf215546Sopenharmony_ci --> 129bf215546Sopenharmony_ci 130bf215546Sopenharmony_ci <doc> 131bf215546Sopenharmony_ci These are addresses of various preemption records for the 132bf215546Sopenharmony_ci current context. When context switching, the CP will save the 133bf215546Sopenharmony_ci current state into these buffers, restore the state of the 134bf215546Sopenharmony_ci next context from the buffers in the corresponding 135bf215546Sopenharmony_ci CP_CONTEXT_SWITCH_PRIV_* registers written by the kernel, 136bf215546Sopenharmony_ci then set these internal registers to the contents of 137bf215546Sopenharmony_ci those registers. The kernel sets the initial values via 138bf215546Sopenharmony_ci CP_SET_PSEUDO_REG on startup, and from then on the firmware 139bf215546Sopenharmony_ci keeps track of them. 140bf215546Sopenharmony_ci </doc> 141bf215546Sopenharmony_ci <reg64 name="SAVE_REGISTER_SMMU_INFO" offset="0x110"/> 142bf215546Sopenharmony_ci <reg64 name="SAVE_REGISTER_PRIV_NON_SECURE" offset="0x112"/> 143bf215546Sopenharmony_ci <reg64 name="SAVE_REGISTER_PRIV_SECURE" offset="0x114"/> 144bf215546Sopenharmony_ci <reg64 name="SAVE_REGISTER_NON_PRIV" offset="0x116"/> 145bf215546Sopenharmony_ci <reg64 name="SAVE_REGISTER_COUNTER" offset="0x118"/> 146bf215546Sopenharmony_ci 147bf215546Sopenharmony_ci <doc> 148bf215546Sopenharmony_ci Used only during preemption, saved and restored from the "info" 149bf215546Sopenharmony_ci field of a6xx_preemption_record. From the downstream kernel: 150bf215546Sopenharmony_ci 151bf215546Sopenharmony_ci "Type of record. Written non-zero (usually) by CP. 152bf215546Sopenharmony_ci we must set to zero for all ringbuffers." 153bf215546Sopenharmony_ci </doc> 154bf215546Sopenharmony_ci 155bf215546Sopenharmony_ci <reg32 name="PREEMPTION_INFO" offset="0x126"/> 156bf215546Sopenharmony_ci 157bf215546Sopenharmony_ci <doc> 158bf215546Sopenharmony_ci Seems to be a shadow for PC_MARKER 159bf215546Sopenharmony_ci </doc> 160bf215546Sopenharmony_ci <reg32 name="MARKER" offset="0x12a"/> 161bf215546Sopenharmony_ci 162bf215546Sopenharmony_ci <doc> 163bf215546Sopenharmony_ci Set by SET_MARKER, used to conditionally execute 164bf215546Sopenharmony_ci CP_COND_REG_EXEC and draw states. 165bf215546Sopenharmony_ci </doc> 166bf215546Sopenharmony_ci <reg32 name="MODE_BITMASK" offset="0x12b"/> 167bf215546Sopenharmony_ci 168bf215546Sopenharmony_ci <reg32 name="SCRATCH_REG0" offset="0x170"/> 169bf215546Sopenharmony_ci <reg32 name="SCRATCH_REG1" offset="0x171"/> 170bf215546Sopenharmony_ci <reg32 name="SCRATCH_REG2" offset="0x172"/> 171bf215546Sopenharmony_ci <reg32 name="SCRATCH_REG3" offset="0x173"/> 172bf215546Sopenharmony_ci <reg32 name="SCRATCH_REG4" offset="0x174"/> 173bf215546Sopenharmony_ci <reg32 name="SCRATCH_REG5" offset="0x175"/> 174bf215546Sopenharmony_ci <reg32 name="SCRATCH_REG6" offset="0x176"/> 175bf215546Sopenharmony_ci <reg32 name="SCRATCH_REG7" offset="0x177"/> 176bf215546Sopenharmony_ci</domain> 177bf215546Sopenharmony_ci 178bf215546Sopenharmony_ci</database> 179