mirror of
https://github.com/AsahiLinux/m1n1
synced 2024-11-30 10:10:17 +00:00
m1n1.hw.dart: Add show_error() and some more defs
Signed-off-by: Hector Martin <marcan@marcan.st>
This commit is contained in:
parent
0d0a646922
commit
73180e29fa
1 changed files with 14 additions and 0 deletions
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
import struct
|
import struct
|
||||||
|
|
||||||
|
from enum import IntEnum
|
||||||
from ..utils import *
|
from ..utils import *
|
||||||
from ..malloc import Heap
|
from ..malloc import Heap
|
||||||
|
|
||||||
|
@ -11,6 +12,8 @@ class R_ERROR(Register32):
|
||||||
FLAG = 31
|
FLAG = 31
|
||||||
STREAM = 27, 24
|
STREAM = 27, 24
|
||||||
CODE = 23, 0
|
CODE = 23, 0
|
||||||
|
NO_DAPF_MATCH = 11
|
||||||
|
WRITE = 10
|
||||||
READ_FAULT = 4
|
READ_FAULT = 4
|
||||||
WRITE_FAULT = 3
|
WRITE_FAULT = 3
|
||||||
NO_PTE = 2
|
NO_PTE = 2
|
||||||
|
@ -44,6 +47,9 @@ class PTE(Register64):
|
||||||
class R_CONFIG(Register32):
|
class R_CONFIG(Register32):
|
||||||
LOCK = 15
|
LOCK = 15
|
||||||
|
|
||||||
|
class R_DAPF_LOCK(Register32):
|
||||||
|
LOCK = 0
|
||||||
|
|
||||||
class DARTRegs(RegMap):
|
class DARTRegs(RegMap):
|
||||||
STREAM_COMMAND = 0x20, R_STREAM_COMMAND
|
STREAM_COMMAND = 0x20, R_STREAM_COMMAND
|
||||||
STREAM_SELECT = 0x34, Register32
|
STREAM_SELECT = 0x34, Register32
|
||||||
|
@ -53,6 +59,7 @@ class DARTRegs(RegMap):
|
||||||
CONFIG = 0x60, R_CONFIG
|
CONFIG = 0x60, R_CONFIG
|
||||||
REMAP = irange(0x80, 4, 4), R_REMAP
|
REMAP = irange(0x80, 4, 4), R_REMAP
|
||||||
|
|
||||||
|
DAPF_LOCK = 0xf0, R_DAPF_LOCK
|
||||||
UNK1 = 0xf8, Register32
|
UNK1 = 0xf8, Register32
|
||||||
ENABLED_STREAMS = 0xfc, Register32
|
ENABLED_STREAMS = 0xfc, Register32
|
||||||
|
|
||||||
|
@ -272,12 +279,19 @@ class DART(Reloadable):
|
||||||
for j in range(4):
|
for j in range(4):
|
||||||
self.regs.TTBR[i, j].reg = R_TTBR(VALID = 0)
|
self.regs.TTBR[i, j].reg = R_TTBR(VALID = 0)
|
||||||
|
|
||||||
|
self.regs.ERROR.val = 0xffffffff
|
||||||
self.regs.UNK1.val = 0
|
self.regs.UNK1.val = 0
|
||||||
self.regs.ENABLED_STREAMS.val = 0
|
self.regs.ENABLED_STREAMS.val = 0
|
||||||
self.enabled_streams = 0
|
self.enabled_streams = 0
|
||||||
|
|
||||||
self.invalidate_streams()
|
self.invalidate_streams()
|
||||||
|
|
||||||
|
def show_error(self):
|
||||||
|
if self.regs.ERROR.reg.FLAG:
|
||||||
|
print(f"ERROR: {self.regs.ERROR.reg!s}")
|
||||||
|
print(f"ADDR: {self.regs.ERROR_ADDR_HI.val:#x}:{self.regs.ERROR_ADDR_LO.val:#x}")
|
||||||
|
self.regs.ERROR.val = 0xffffffff
|
||||||
|
|
||||||
def invalidate_streams(self, streams=0xffffffff):
|
def invalidate_streams(self, streams=0xffffffff):
|
||||||
self.regs.STREAM_SELECT.val = streams
|
self.regs.STREAM_SELECT.val = streams
|
||||||
self.regs.STREAM_COMMAND.val = R_STREAM_COMMAND(INVALIDATE=1)
|
self.regs.STREAM_COMMAND.val = R_STREAM_COMMAND(INVALIDATE=1)
|
||||||
|
|
Loading…
Reference in a new issue