m1n1.trace.isp: t8112 etc changes

Signed-off-by: Asahi Lina <lina@asahilina.net>
This commit is contained in:
Asahi Lina 2023-10-06 21:07:51 +09:00
parent ef7655568b
commit 0db48488a9
3 changed files with 115 additions and 76 deletions

View file

@ -10,6 +10,7 @@ CISP_CMD_SET_ISP_PMU_BASE = 0x0011
CISP_CMD_RPC_ENABLE = 0x0013
CISP_CMD_PMP_CTRL_SET = 0x001c
CISP_CMD_TRACE_ENABLE = 0x001d
CISP_CMD_FLICKER_SENSOR_SET = 0x0024
CISP_CMD_CH_START = 0x0100
CISP_CMD_CH_STOP = 0x0101
CISP_CMD_CH_BUFFER_RETURN = 0x0104
@ -39,11 +40,14 @@ CISP_CMD_CH_AE_STABILITY_TO_STABLE_SET = 0x0229
CISP_CMD_CH_SENSOR_NVM_GET = 0x0501
CISP_CMD_CH_SENSOR_PERMODULE_LSC_INFO_GET = 0x0507
CISP_CMD_CH_SENSOR_PERMODULE_LSC_GRID_GET = 0x0511
CISP_CMD_CH_LPDP_HS_RECEIVER_TUNING_SET = 0x051b
CISP_CMD_CH_FOCUS_LIMITS_GET = 0x0701
CISP_CMD_CH_CROP_SET = 0x0801
CISP_CMD_CH_CROP_SCL1_SET = 0x080c
CISP_CMD_CH_CNR_START = 0x0a2f
CISP_CMD_CH_MBNR_ENABLE = 0x0a3a
CISP_CMD_CH_OUTPUT_CONFIG_SET = 0x0b01
CISP_CMD_CH_OUTPUT_CONFIG_SCL1_SET = 0x0b09
CISP_CMD_CH_PREVIEW_STREAM_SET = 0x0b0d
CISP_CMD_CH_FACE_DETECTION_START = 0x0d00
CISP_CMD_CH_FACE_DETECTION_CONFIG_GET = 0x0d02
@ -71,6 +75,7 @@ opcode_dict = {
0x0013 : "CISP_CMD_RPC_ENABLE",
0x001c : "CISP_CMD_PMP_CTRL_SET",
0x001d : "CISP_CMD_TRACE_ENABLE",
0x0024 : "CISP_CMD_FLICKER_SENSOR_SET",
0x0100 : "CISP_CMD_CH_START",
0x0101 : "CISP_CMD_CH_STOP",
0x0104 : "CISP_CMD_CH_BUFFER_RETURN",
@ -100,11 +105,14 @@ opcode_dict = {
0x0501 : "CISP_CMD_CH_SENSOR_NVM_GET",
0x0507 : "CISP_CMD_CH_SENSOR_PERMODULE_LSC_INFO_GET",
0x0511 : "CISP_CMD_CH_SENSOR_PERMODULE_LSC_GRID_GET",
0x051b : "CISP_CMD_CH_LPDP_HS_RECEIVER_TUNING_SET",
0x0701 : "CISP_CMD_CH_FOCUS_LIMITS_GET",
0x0801 : "CISP_CMD_CH_CROP_SET",
0x080c : "CISP_CMD_CH_CROP_SCL1_SET",
0x0a2f : "CISP_CMD_CH_CNR_START",
0x0a3a : "CISP_CMD_CH_MBNR_ENABLE",
0x0b01 : "CISP_CMD_CH_OUTPUT_CONFIG_SET",
0x0b09 : "CISP_CMD_CH_OUTPUT_CONFIG_SCL1_SET",
0x0b0d : "CISP_CMD_CH_PREVIEW_STREAM_SET",
0x0d00 : "CISP_CMD_CH_FACE_DETECTION_START",
0x0d02 : "CISP_CMD_CH_FACE_DETECTION_CONFIG_GET",

View file

@ -1,70 +1,83 @@
# SPDX-License-Identifier: MIT
from ..utils import *
class ISP_REVISION(Register32):
REVISION = 15, 0
class ISPRegs(RegMap):
ISP_PMGR_0 = 0x738, Register32
ISP_PMGR_1 = 0x798, Register32
ISP_PMGR_2 = 0x7f8, Register32
ISP_PMGR_3 = 0x858, Register32
ISP_ASC_RVBAR = 0x1050000, Register64
ISP_ASC_EDPRCR = 0x1010310, Register32
ISP_ASC_CONTROL = 0x1400044, Register32
ISP_ASC_STATUS = 0x1400048, Register32
ISP_ASC_POWER_CYCLE_0 = 0x1400a00, Register32
ISP_ASC_POWER_CYCLE_1 = 0x1400a04, Register32
ISP_ASC_POWER_CYCLE_2 = 0x1400a08, Register32
ISP_ASC_POWER_CYCLE_3 = 0x1400a0c, Register32
ISP_ASC_POWER_CYCLE_4 = 0x1400a10, Register32
ISP_ASC_POWER_CYCLE_5 = 0x1400a14, Register32
ISP_REVISION = 0x1800000, ISP_REVISION
ISP_POWER_UNK_0 = 0x20e0080, Register32
ISP_POWER_UNK_1 = 0x20f0020, Register32
ISP_POWER_UNK_2 = 0x20f8020, Register32
ISP_GPIO_0 = 0x2104170, Register32
ISP_GPIO_1 = 0x2104174, Register32
ISP_GPIO_2 = 0x2104178, Register32
ISP_GPIO_3 = 0x210417c, Register32
ISP_GPIO_4 = 0x2104180, Register32
ISP_GPIO_5 = 0x2104184, Register32
ISP_GPIO_6 = 0x2104188, Register32
ISP_GPIO_7 = 0x210418c, Register32
ISP_SENSOR_CLOCK_0_EN = 0x2104190, Register32
ISP_SENSOR_CLOCK_1_EN = 0x2104194, Register32
ISP_SENSOR_CLOCK_2_EN = 0x2104198, Register32
ISP_IRQ_INTERRUPT = 0x2104000, Register32
ISP_IRQ_ENABLE = 0x2104004, Register32
ISP_IRQ_DOORBELL = 0x21043f0, Register32
ISP_IRQ_ACK = 0x21043fc, Register32
ISP_IRQ_INTERRUPT_1 = 0x2104008, Register32
ISP_IRQ_INTERRUPT_2 = 0x2104010, Register32
ISP_IRQ_INTERRUPT_3 = 0x2104018, Register32
ISP_IRQ_INTERRUPT_4 = 0x21043f8, Register32
ISP_DPE_UNK_0 = 0x2504000, Register32
ISP_DPE_UNK_1 = 0x2508000, Register32
class ISPPSRegs(RegMap): # This doesn't really make sense
ISP_PS_00 = 0x4000, Register32
ISP_PS_08 = 0x4008, Register32
ISP_PS_10 = 0x4010, Register32
ISP_PS_18 = 0x4018, Register32
ISP_PS_20 = 0x4020, Register32
ISP_PS_28 = 0x4028, Register32
ISP_PS_30 = 0x4030, Register32
ISP_PS_38 = 0x4038, Register32
ISP_PS_40 = 0x4040, Register32
ISP_PS_48 = 0x4048, Register32
ISP_PS_50 = 0x4050, Register32
ISP_PS_58 = 0x4058, Register32
ISP_PS_60 = 0x4060, Register32
# SPDX-License-Identifier: MIT
from ..utils import *
class ISP_REVISION(Register32):
REVISION = 15, 0
class ISPRegs(RegMap):
ISP_PMGR_0 = 0x738, Register32
ISP_PMGR_1 = 0x798, Register32
ISP_PMGR_2 = 0x7f8, Register32
ISP_PMGR_3 = 0x858, Register32
ISP_ASC_RVBAR = 0x1050000, Register64
ISP_ASC_EDPRCR = 0x1010310, Register32
ISP_ASC_CONTROL = 0x1400044, Register32
ISP_ASC_STATUS = 0x1400048, Register32
ISP_ASC_POWER_CYCLE_0 = 0x1400a00, Register32
ISP_ASC_POWER_CYCLE_1 = 0x1400a04, Register32
ISP_ASC_POWER_CYCLE_2 = 0x1400a08, Register32
ISP_ASC_POWER_CYCLE_3 = 0x1400a0c, Register32
ISP_ASC_POWER_CYCLE_4 = 0x1400a10, Register32
ISP_ASC_POWER_CYCLE_5 = 0x1400a14, Register32
ISP_REVISION = 0x1800000, ISP_REVISION
ISP_POWER_UNK_0 = 0x20e0080, Register32
ISP_POWER_UNK_1 = 0x20f0020, Register32
ISP_POWER_UNK_2 = 0x20f8020, Register32
ISP_GPIO_0 = 0x2104170, Register32
ISP_GPIO_1 = 0x2104174, Register32
ISP_GPIO_2 = 0x2104178, Register32
ISP_GPIO_3 = 0x210417c, Register32
ISP_GPIO_4 = 0x2104180, Register32
ISP_GPIO_5 = 0x2104184, Register32
ISP_GPIO_6 = 0x2104188, Register32
ISP_GPIO_7 = 0x210418c, Register32
ISP_GPIO_0_T8112 = 0x24c41b0, Register32
ISP_GPIO_1_T8112 = 0x24c41b4, Register32
ISP_GPIO_2_T8112 = 0x24c41b8, Register32
ISP_GPIO_3_T8112 = 0x24c41bc, Register32
ISP_GPIO_4_T8112 = 0x24c41c0, Register32
ISP_GPIO_5_T8112 = 0x24c41c4, Register32
ISP_GPIO_6_T8112 = 0x24c41c8, Register32
ISP_GPIO_7_T8112 = 0x24c41cc, Register32
ISP_SENSOR_CLOCK_0_EN = 0x2104190, Register32
ISP_SENSOR_CLOCK_1_EN = 0x2104194, Register32
ISP_SENSOR_CLOCK_2_EN = 0x2104198, Register32
ISP_IRQ_INTERRUPT = 0x2104000, Register32
ISP_IRQ_ENABLE = 0x2104004, Register32
ISP_IRQ_DOORBELL = 0x21043f0, Register32
ISP_IRQ_ACK = 0x21043fc, Register32
ISP_IRQ_INTERRUPT_T8112 = 0x24c4000, Register32
ISP_IRQ_DOORBELL_T8112 = 0x24c4430, Register32
ISP_IRQ_ACK_T8112 = 0x24c443c, Register32
ISP_IRQ_INTERRUPT_1 = 0x2104008, Register32
ISP_IRQ_INTERRUPT_2 = 0x2104010, Register32
ISP_IRQ_INTERRUPT_3 = 0x2104018, Register32
ISP_IRQ_INTERRUPT_4 = 0x21043f8, Register32
ISP_IRQ_INTERRUPT_4_T8112 = 0x24c4438, Register32
ISP_DPE_UNK_0 = 0x2504000, Register32
ISP_DPE_UNK_1 = 0x2508000, Register32
class ISPPSRegs(RegMap): # This doesn't really make sense
ISP_PS_00 = 0x4000, Register32
ISP_PS_08 = 0x4008, Register32
ISP_PS_10 = 0x4010, Register32
ISP_PS_18 = 0x4018, Register32
ISP_PS_20 = 0x4020, Register32
ISP_PS_28 = 0x4028, Register32
ISP_PS_30 = 0x4030, Register32
ISP_PS_38 = 0x4038, Register32
ISP_PS_40 = 0x4040, Register32
ISP_PS_48 = 0x4048, Register32
ISP_PS_50 = 0x4050, Register32
ISP_PS_58 = 0x4058, Register32
ISP_PS_60 = 0x4060, Register32

View file

@ -63,8 +63,7 @@ class ISPIOCommand(ISPCommand):
class ISPT2HBufferCommand(ISPCommand):
def __init__(self, chan, msg, direction):
super().__init__(chan, msg, direction)
#self.contents = self.read_iova(0x1013140, 0x4000)
self.contents = None
self.contents = self.read_iova(self.iova, 0x280)
def dump(self):
super().dump()
@ -75,8 +74,8 @@ class ISPT2HBufferCommand(ISPCommand):
class ISPH2TBufferCommand(ISPCommand):
def __init__(self, chan, msg, direction):
super().__init__(chan, msg, direction)
#self.contents = self.read_iova(0x1013140, 0x4000)
self.contents = None
self.contents = self.read_iova(self.iova, 0x4000)
#self.contents = None
def dump(self):
super().dump()
@ -182,11 +181,21 @@ class ISPTracer(ADTDevTracer):
self.dart_tracer = DARTTracer(hv, dart_dev_path, verbose=0)
self.dart_tracer.start()
self.dart = self.dart_tracer.dart
self.iova_base = 0
chip_id = hv.adt["/chosen"].chip_id
if 0x6020 <= chip_id <= 0x6fff:
self.iova_base = 0x100_0000_0000
self.ignored_ranges = [
(0x22c0e8000, 0x4000), # dart 1
(0x22c0f4000, 0x4000), # dart 2
(0x22c0fc000, 0x4000), # dart 3
(0x3860e8000, 0x4000), # dart 1
(0x3860f4000, 0x4000), # dart 2
(0x3860fc000, 0x4000), # dart 3
(0x22c4a8000, 0x4000), # dart 1
(0x22c4b4000, 0x4000), # dart 2
(0x22c4bc000, 0x4000), # dart 3
]
self.table = None
@ -196,43 +205,52 @@ class ISPTracer(ADTDevTracer):
self.log("ISP_GPIO_0 r32: 0x%x" % (val.value))
if val.value == 0x8042006:
self.log(f"ISP_GPIO0 = ACK")
elif val.value < 64:
elif val.value == 0xf7fbdff9:
self.log(f"ISP_GPIO0 = NACK?")
elif val.value < 64:
self.log(f"ISP_IPC_CHANNELS = {val!s}")
self.num_chans = val.value
elif val.value > 0:
self.log(f"IPC BASE IOVA: {val!s}")
self.ipc_iova = val.value
# self.dart_tracer.trace_range(0, irange(val.value | self.iova_base, 0x40000))
self.table = ISPChannelTable(self, self.num_chans, val.value)
self.log("======== CHANNEL TABLE ========")
for chan in self.table.chans:
self.log(f"ISPIPC: {str(chan)}")
self.log("======== END OF CHANNEL TABLE ========")
r_ISP_GPIO_0_T8112 = r_ISP_GPIO_0
def r_ISP_IRQ_INTERRUPT(self, val):
#self.log("ISP_IRQ_INTERRUPT r32: 0x%x" % (val.value))
#self.log(f"======== BEGIN IRQ ========")
self.table.get_last_rx_commands(int(val.value))
#self.log(f"======== END IRQ ========")
r_ISP_IRQ_INTERRUPT_T8112 = r_ISP_IRQ_INTERRUPT
def w_ISP_IRQ_DOORBELL(self, val):
#self.log("ISP_IRQ_DOORBELL w32: 0x%x" % (val.value))
#self.log(f"======== BEGIN DOORBELL ========")
self.table.get_last_tx_commands(int(val.value))
#self.log(f"======== END DOORBELL ========")
w_ISP_IRQ_DOORBELL_T8112 = w_ISP_IRQ_DOORBELL
def w_ISP_GPIO_0(self, val):
self.log("ISP_GPIO_0 w32: 0x%x" % (val.value))
if (val.value >= 0xe00000) and (val.value <= 0x1100000): # dunno
self.log("ISP bootargs at 0x%x:" % val.value)
bootargs = self.dart.ioread(0, val.value, 0x200) # justt in case
bootargs = self.dart.ioread(0, val.value | self.iova_base, 0x200) # justt in case
chexdump32(bootargs, print_fn=self.log)
x = ISPIPCBootArgs.parse(bootargs[:ISPIPCBootArgs.sizeof()])
self.log(x)
w_ISP_GPIO_0_T8112 = w_ISP_GPIO_0
def ioread(self, iova, size):
iova |= self.iova_base
return self.dart.ioread(0, iova, size)
def iowrite(self, iova, data):
iova |= self.iova_base
return self.dart.iowrite(0, iova, data)
def start(self):