Improve log output, further fixes

This commit is contained in:
Bjoern Kerler 2021-08-26 17:43:41 +02:00
parent 42a0d0bc6e
commit 09d0088fc5
6 changed files with 357 additions and 214 deletions

3
mtk
View file

@ -367,7 +367,7 @@ class Main(metaclass=LogBase):
if mtk.preloader.send_da(daaddr, len(dadata), 0x100, dadata):
self.info(f"Sent preloader to {hex(daaddr)}, length {hex(len(dadata))}")
if mtk.preloader.jump_da(daaddr):
self.info(f"PL Jumped to pl {hex(daaddr)}.")
self.info(f"PL Jumped to daaddr {hex(daaddr)}.")
time.sleep(2)
mtk = Mtk(loader=self.args["--loader"], loglevel=self.__logger.level, vid=vid, pid=pid,
interface=interface,
@ -404,6 +404,7 @@ class Main(metaclass=LogBase):
daaddr = mtk.config.chipconfig.pl_payload_addr
else:
daaddr = 0x40200000 # 0x40001000
self.info(f"\nSuccessfully connected to pl, loading stage2 at addr {hex(daaddr)}")
if mtk.preloader.send_da(daaddr, len(dadata), 0x100, dadata):
self.info(f"Sent da to {hex(daaddr)}, length {hex(len(dadata))}")
mtk.preloader.get_hw_sw_ver()

View file

@ -281,9 +281,11 @@ ErrorCodes_XFlash={
class ErrorHandler:
def __init__(self):
self.ec = ErrorCodes
self.xec = ErrorCodes_XFlash
def status(self, status):
if status in self.ec:
return self.ec[status]
else:
return "Unknown: " + hex(status)
if status in self.xec:
return self.xec[status]
return "Unknown: " + hex(status)

View file

@ -95,11 +95,11 @@ class hwcrypto(metaclass=LogBase):
self.gcpu.init()
self.gcpu.acquire()
self.info("Disable Caches")
refreshcache(0xB1)
refreshcache(b"\xB1")
self.info("GCPU Disable Range Blacklist")
self.gcpu.disable_range_blacklist()
elif btype == "cqdma":
self.info("Disable Caches")
refreshcache(0xB1)
refreshcache(b"\xB1")
self.info("CQDMA Disable Range Blacklist")
self.cqdma.disable_range_blacklist()

View file

@ -8,7 +8,7 @@ import hashlib
from binascii import hexlify
from struct import pack, unpack
from mtkclient.Library.utils import LogBase, progress, logsetup
from mtkclient.Library.error import ErrorHandler, ErrorCodes_XFlash
from mtkclient.Library.error import ErrorHandler
from mtkclient.Library.daconfig import EMMC_PartitionType, UFS_PartitionType, DaStorage
from mtkclient.Library.partition import Partition
from mtkclient.config.payloads import pathconfig
@ -259,11 +259,7 @@ class DAXFlash(metaclass=LogBase):
if status == 0:
return True
else:
if status in ErrorCodes_XFlash:
errorstring = ErrorCodes_XFlash[status]
self.error(f"Error on sending parameter: {errorstring}")
else:
self.error(f"Error on sending parameter, status {hex(status)}.")
self.error(f"Error on sending parameter: {self.eh.status(status)}")
return False
@ -281,7 +277,7 @@ class DAXFlash(metaclass=LogBase):
else:
return self.send_param(param)
if status[0] != 0xC0010004:
self.error("Error on sending dev ctrl 0x%X, status 0x%X" % (cmd, status[0]))
self.error(f"Error on sending dev ctrl {cmd}:"+self.eh.status(status[0]))
return b""
def set_reset_key(self, reset_key=0x68):
@ -301,9 +297,12 @@ class DAXFlash(metaclass=LogBase):
def send_emi(self, emi):
if self.send(self.Cmd.INIT_EXT_RAM):
if self.status() == 0:
status=self.status()
if status==0:
if self.send(pack("<I", len(emi))):
return self.send_param([emi])
else:
self.error(f"Error on sending emi: {self.eh.status(status)}")
return False
def send_data(self, data):
@ -319,11 +318,7 @@ class DAXFlash(metaclass=LogBase):
if status == 0x0:
return True
else:
if status in ErrorCodes_XFlash:
errorstring = ErrorCodes_XFlash[status]
self.error(f"Error on sending data: {errorstring}")
else:
self.error(f"Error on sending data, status {hex(status)}.")
self.error(f"Error on sending data: {self.eh.status(status)}")
return False
def compute_hash_pos(self, da2, bootldr):
@ -349,7 +344,8 @@ class DAXFlash(metaclass=LogBase):
res = []
for pos in range(dwords):
if self.send(self.Cmd.DOWNLOAD):
if self.status() == 0:
status=self.status()
if status==0x0:
param = pack("<I", addr + (pos * 4))
pkt1 = pack("<III", self.Cmd.MAGIC, self.DataType.DT_PROTOCOL_FLOW, len(param))
if self.usbwrite(pkt1):
@ -358,6 +354,8 @@ class DAXFlash(metaclass=LogBase):
if dwords == 1:
return val
res.append(val)
else:
self.error(f"Error on download: {self.eh.status(status)}")
return res
def write(self, addr, dwords):
@ -366,7 +364,8 @@ class DAXFlash(metaclass=LogBase):
pos = 0
for val in dwords:
if self.send(self.Cmd.UPLOAD):
if self.status() == 0:
status=self.status()
if status==0x0:
param = pack("<II", addr + pos, val)
pkt1 = pack("<III", self.Cmd.MAGIC, self.DataType.DT_PROTOCOL_FLOW, len(param))
if self.usbwrite(pkt1):
@ -375,6 +374,7 @@ class DAXFlash(metaclass=LogBase):
if len(dwords) == 1:
return True
else:
self.error(f"Error on upload: {self.eh.status(status)}")
return False
pos += 4
return True
@ -400,13 +400,7 @@ class DAXFlash(metaclass=LogBase):
if status == 0x434E5953:
return True
else:
if status in ErrorCodes_XFlash:
errorstring = ErrorCodes_XFlash[status]
if display:
self.error(f"Error on boot to: {errorstring}")
else:
if display:
self.error(f"Error on boot to, status {hex(status)}.")
self.error(f"Error on boot to: {self.eh.status(status)}")
return False
def get_connection_agent(self):
@ -416,11 +410,7 @@ class DAXFlash(metaclass=LogBase):
if status == 0x0:
return res
else:
if status in ErrorCodes_XFlash:
errorstring = ErrorCodes_XFlash[status]
self.error(f"Error on getting connection agent: {errorstring}")
else:
self.error(f"Error on getting connection agent, status {hex(status)}.")
self.error(f"Error on getting connection agent: {self.eh.status(status)}")
return None
"""
@ -504,7 +494,8 @@ class DAXFlash(metaclass=LogBase):
storage, parttype, length = part_info
if self.send(self.Cmd.FORMAT):
if self.status() == 0:
status=self.status()
if status == 0:
# storage: emmc:1,slc,nand,nor,ufs
# section: boot,user of emmc:8, LU1, LU2
@ -520,12 +511,9 @@ class DAXFlash(metaclass=LogBase):
status = self.ack()
if status == 0x40040005: # STATUS_COMPLETE
return True
else:
if status in ErrorCodes_XFlash:
errorstring = ErrorCodes_XFlash[status]
self.error(f"Error on sending formatting: {errorstring}")
else:
self.error(f"Error on sending formatting, status {hex(status)}.")
if status!=0x0:
self.error(f"Error on format: {self.eh.status(status)}")
return False
def get_chip_id(self):
@ -540,13 +528,17 @@ class DAXFlash(metaclass=LogBase):
data = self.send_devctrl(self.Cmd.GET_CHIP_ID)
cid.hw_code, cid.hw_sub_code, cid.hw_version, cid.sw_version, cid.chip_evolution = unpack(">HHHHH",
data[:(5 * 2)])
if self.status() == 0:
status=self.status()
if status == 0:
return cid
else:
self.error(f"Error on getting chip id: {self.eh.status(status)}")
return None
def get_ram_info(self):
resp = self.send_devctrl(self.Cmd.GET_RAM_INFO)
if self.status() == 0x0:
status=self.status()
if status == 0x0:
class RamInfo:
type = 0
base_address = 0
@ -562,11 +554,14 @@ class DAXFlash(metaclass=LogBase):
resp)
return sram, dram
else:
self.error(f"Error on getting ram info: {self.eh.status(status)}")
return None, None
def get_emmc_info(self, display=True):
resp = self.send_devctrl(self.Cmd.GET_EMMC_INFO)
if self.status() == 0:
status=self.status()
if status == 0:
class EmmcInfo:
type = 1 # emmc or sdmmc or none
block_size = 0x200
@ -606,11 +601,14 @@ class DAXFlash(metaclass=LogBase):
self.info(f"EMMC RPMB Size: {hex(emmc.rpmb_size)}")
self.info(f"EMMC USER Size: {hex(emmc.user_size)}")
return emmc
else:
self.error(f"Error on getting emmc info: {self.eh.status(status)}")
return None
def get_nand_info(self):
resp = self.send_devctrl(self.Cmd.GET_NAND_INFO)
if self.status() == 0:
status=self.status()
if status == 0:
class NandInfo:
type = 1 # slc, mlc, spi, none
page_size = 0
@ -638,11 +636,14 @@ class DAXFlash(metaclass=LogBase):
self.info(f"NAND Avail: {hex(nand.available_size)}")
self.info(f"NAND ID: {hexlify(nand.nand_id).decode('utf-8')}")
return nand
else:
self.error(f"Error on getting nand info: {self.eh.status(status)}")
return None
def get_nor_info(self):
resp = self.send_devctrl(self.Cmd.GET_NOR_INFO)
if self.status() == 0:
status=self.status()
if status == 0:
class NorInfo:
type = 1 # nor, none
page_size = 0
@ -654,11 +655,14 @@ class DAXFlash(metaclass=LogBase):
self.info(f"NOR Pagesize: {hex(nor.page_size)}")
self.info(f"NOR Size: {hex(nor.available_size)}")
return nor
else:
self.error(f"Error on getting nor info: {self.eh.status(status)}")
return None
def get_ufs_info(self):
resp = self.send_devctrl(self.Cmd.GET_UFS_INFO)
if self.status() == 0:
status=self.status()
if status == 0:
class UfsInfo:
type = 1 # nor, none
block_size = 0
@ -684,31 +688,45 @@ class DAXFlash(metaclass=LogBase):
self.mtk.config.pagesize = ufs.block_size
self.mtk.daloader.daconfig.pagesize = ufs.block_size
return ufs
else:
self.error(f"Error on getting ufs info: {self.eh.status(status)}")
return None
def get_expire_date(self):
res = self.send_devctrl(self.Cmd.GET_EXPIRE_DATE)
if res != b"":
if self.status() == 0x0:
status=self.status()
if status == 0x0:
return res
else:
self.error(f"Error on getting expire date: {self.eh.status(status)}")
return None
def get_random_id(self):
res = self.send_devctrl(self.Cmd.GET_RANDOM_ID)
if self.status() == 0:
status=self.status()
if status == 0:
return res
else:
self.error(f"Error on getting random id: {self.eh.status(status)}")
return None
def get_hrid(self):
res = self.send_devctrl(self.Cmd.GET_HRID)
if self.status() == 0:
status=self.status()
if status == 0:
return res
else:
self.error(f"Error on getting hrid info: {self.eh.status(status)}")
return None
def get_dev_fw_info(self):
res = self.send_devctrl(self.Cmd.GET_DEV_FW_INFO)
if self.status() == 0:
status=self.status()
if status == 0:
return res
else:
self.error(f"Error on getting dev fw info: {self.eh.status(status)}")
return None
def get_da_stor_life_check(self):
@ -727,17 +745,14 @@ class DAXFlash(metaclass=LogBase):
plen.write_packet_length, plen.read_packet_length = unpack("<II", resp)
return plen
else:
if status in ErrorCodes_XFlash:
errorstring = ErrorCodes_XFlash[status]
self.error(f"Error on getting packet length: {errorstring}")
else:
self.error(f"Error on getting packet length, status {hex(status)}.")
self.error(f"Error on getting packet length: {self.eh.status(status)}")
return None
def cmd_write_data(self, addr, size, storage=DaStorage.MTK_DA_STORAGE_EMMC,
parttype=EMMC_PartitionType.MTK_DA_EMMC_PART_USER):
if self.send(self.Cmd.WRITE_DATA):
if self.status() == 0:
status=self.status()
if status == 0:
# storage: emmc:1,slc,nand,nor,ufs
# section: boot,user of emmc:8, LU1, LU2
ne = NandExtension()
@ -746,12 +761,15 @@ class DAXFlash(metaclass=LogBase):
ne.sys_slc_percent, ne.usr_slc_percent, ne.phy_max_size, 0x0)
if self.send_param(param):
return True
else:
self.error(f"Error on writing data: {self.eh.status(status)}")
return False
def cmd_read_data(self, addr, size, storage=DaStorage.MTK_DA_STORAGE_EMMC,
parttype=EMMC_PartitionType.MTK_DA_EMMC_PART_USER):
if self.send(self.Cmd.READ_DATA):
if self.status() == 0:
status=self.status()
if status == 0:
# storage: emmc:1,slc,nand,nor,ufs
# section: boot,user of emmc:8, LU1, LU2
ne = NandExtension()
@ -762,12 +780,8 @@ class DAXFlash(metaclass=LogBase):
status = self.status()
if status == 0x0:
return True
else:
if status in ErrorCodes_XFlash:
errorstring = ErrorCodes_XFlash[status]
self.error(f"Error on reading data: {errorstring}")
else:
self.error(f"Error on reading data, status {hex(status)}.")
if status != 0x0:
self.error(f"Error on reading data: {self.eh.status(status)}")
return False
def readflash(self, addr, length, filename, parttype=None, display=True):
@ -812,9 +826,12 @@ class DAXFlash(metaclass=LogBase):
def close(self):
if self.send(self.Cmd.SHUTDOWN):
if self.status() == 0:
status=self.status()
if status == 0:
self.mtk.port.close()
return True
else:
self.error(f"Error on sending shutdown: {self.eh.status(status)}")
self.mtk.port.close()
return False
@ -861,10 +878,13 @@ class DAXFlash(metaclass=LogBase):
return False
bytestowrite -= dsize
pos += dsize
if self.status() == 0x0:
status=self.status()
if status == 0x0:
self.send_devctrl(self.Cmd.CC_OPTIONAL_DOWNLOAD_ACT)
self.progress.show_progress("Write", length, length, display)
return True
else:
self.error(f"Error on writeflash: {self.eh.status(status)}")
except Exception as e:
self.error(str(e))
return False

View file

@ -10,6 +10,20 @@ from mtkclient.Library.utils import LogBase, logsetup
from mtkclient.Library.error import ErrorHandler
from mtkclient.Library.utils import getint
def calc_xflash_checksum(data):
checksum = 0
pos = 0
for i in range(0, len(data) // 4):
checksum += unpack("<I", data[i * 4:(i * 4) + 4])[0]
pos += 4
if len(data) % 4 != 0:
for i in range(4 - (len(data) % 4)):
checksum += data[pos]
pos += 1
return checksum & 0xFFFFFFFF
class Preloader(metaclass=LogBase):
class Rsp(Enum):
NONE = b''
@ -96,6 +110,9 @@ class Preloader(metaclass=LogBase):
def __init__(self, mtk, loglevel=logging.INFO):
self.mtk = mtk
self.__logger = logsetup(self, self.__logger, loglevel)
self.info = self.__logger.info
self.debug = self.__logger.debug
self.error = self.__logger.error
self.eh = ErrorHandler()
self.gcpu = None
self.config = mtk.config
@ -115,14 +132,14 @@ class Preloader(metaclass=LogBase):
self.info("Status: Waiting for PreLoader VCOM, please connect mobile")
res = False
tries = 0
while not res and tries<10:
res=self.mtk.port.handshake(maxtries=maxtries)
while not res and tries < 10:
res = self.mtk.port.handshake(maxtries=maxtries)
if not res:
if display:
self.error("Status: Handshake failed, please retry")
self.mtk.port.close()
tries+=1
if tries==10:
tries += 1
if tries == 10:
return False
if not self.echo(self.Cmd.GET_HW_CODE.value): # 0xFD
@ -131,8 +148,8 @@ class Preloader(metaclass=LogBase):
return False
else:
val = self.rdword()
self.config.hwcode = (val>>16)&0xFFFF
self.config.hwver = val&0xFFFF
self.config.hwcode = (val >> 16) & 0xFFFF
self.config.hwver = val & 0xFFFF
self.config.init_hwcode(self.config.hwcode)
da_address = args["--da_addr"]
if da_address is not None:
@ -194,7 +211,7 @@ class Preloader(metaclass=LogBase):
with open(os.path.join("logs", "hwcode.txt"), "w") as wf:
wf.write(hex(self.config.hwcode))
self.config.target_config = self.get_target_config(self.display)
blver=self.get_blver()
# blver = self.get_blver()
meid = self.get_meid()
if len(meid) >= 16:
with open(os.path.join("logs", "meid.txt"), "wb") as wf:
@ -260,59 +277,44 @@ class Preloader(metaclass=LogBase):
value += b"\x00"
self.write32(addr + i, unpack("<I", value))
def run_ext_cmd(self, cmd=b"\xB1"):
def run_ext_cmd(self, cmd: bytes = b"\xB1"):
self.usbwrite(self.Cmd.CMD_C8.value)
assert self.usbread(1) == self.Cmd.CMD_C8.value
cmd = bytes([cmd])
self.usbwrite(cmd)
assert self.usbread(1) == cmd
self.usbread(1)
self.usbread(2)
def jump_to_partition(self, partitionname):
if isinstance(partitionname,str):
partitionname=bytes(partitionname,'utf-8')[:64]
partitionname=partitionname+(64-len(partitionname))*b'\x00'
if isinstance(partitionname, str):
partitionname = bytes(partitionname, 'utf-8')[:64]
partitionname = partitionname + (64 - len(partitionname)) * b'\x00'
if self.echo(self.Cmd.JUMP_TO_PARTITION.value):
self.usbwrite(partitionname)
status2 = self.rword()
if status2 <= 0xFF:
return True
def calc_xflash_checksum(self, data):
checksum=0
pos=0
for i in range(0,len(data)//4):
checksum+=unpack("<I", data[i * 4:(i * 4) + 4])[0]
pos+=4
if len(data)%4!=0:
for i in range(4-(len(data)%4)):
checksum+=data[pos]
pos+=1
return checksum&0xFFFFFFFF
def send_partition_data(self, partitionname, data):
checksum = self.calc_xflash_checksum(data)
if isinstance(partitionname,str):
partitionname=bytes(partitionname,'utf-8')[:64]
partitionname=partitionname+(64-len(partitionname))*b'\x00'
checksum = calc_xflash_checksum(data)
if isinstance(partitionname, str):
partitionname = bytes(partitionname, 'utf-8')[:64]
partitionname = partitionname + (64 - len(partitionname)) * b'\x00'
if self.echo(self.Cmd.SEND_PARTITION_DATA.value):
self.usbwrite(partitionname)
self.usbwrite(pack(">I",len(data)))
self.usbwrite(pack(">I", len(data)))
status = self.rword()
if status <= 0xFF:
length = len(data)
pos=0
pos = 0
while length > 0:
dsize = min(length, 0x200)
if not self.usbwrite(data[pos:pos + dsize]):
break
pos += dsize
length -= dsize
#self.usbwrite(data)
self.usbwrite(pack(">I",checksum))
# self.usbwrite(data)
self.usbwrite(pack(">I", checksum))
def setreg_disablewatchdogtimer(self, hwcode):
"""
@ -344,7 +346,7 @@ class Preloader(metaclass=LogBase):
self.mtk.config.blver = -2
return -2
else:
self.mtk.config.blver=unpack("B", res)[0]
self.mtk.config.blver = unpack("B", res)[0]
return self.mtk.config.blver
return -1
@ -436,7 +438,7 @@ class Preloader(metaclass=LogBase):
def uart1_set_baud(self, baudrate):
if self.echo(self.Cmd.UART1_SET_BAUDRATE.value):
self.usbwrite(pack(">I",baudrate))
self.usbwrite(pack(">I", baudrate))
status = self.rword()
if status == 0:
return True
@ -447,7 +449,7 @@ class Preloader(metaclass=LogBase):
def send_root_cert(self, cert):
gen_chksum, data = self.prepare_data(b"", cert)
if self.echo(self.Cmd.SEND_CERT.value):
if self.echo(pack(">I",len(data))):
if self.echo(pack(">I", len(data))):
status = self.rword()
if 0x0 <= status <= 0xFF:
if not self.upload_data(cert, gen_chksum):
@ -487,9 +489,9 @@ class Preloader(metaclass=LogBase):
def brom_register_access(self, address, length, data=None, check_status=True):
if data is None:
mode=0
mode = 0
else:
mode=1
mode = 1
self.mtk.port.echo(self.Cmd.brom_register_access.value)
self.mtk.port.echo(pack(">I", mode))
self.mtk.port.echo(pack(">I", address))
@ -500,11 +502,11 @@ class Preloader(metaclass=LogBase):
except:
pass
if status!=0:
raise RuntimeError(f"status is {hex(status)}")
if status != 0:
raise RuntimeError(self.eh.status(status))
if mode==0:
data=self.mtk.port.usbread(length)
if mode == 0:
data = self.mtk.port.usbread(length)
else:
self.mtk.port.usbwrite(data[:length])
@ -514,8 +516,8 @@ class Preloader(metaclass=LogBase):
status = unpack("<H", status)[0]
except:
pass
if status!=0:
raise RuntimeError(f"status is {hex(status)}")
if status != 0:
raise RuntimeError(self.eh.status(status))
return data
def get_plcap(self):
@ -567,14 +569,14 @@ class Preloader(metaclass=LogBase):
return gen_chksum, data
def upload_data(self, data, gen_chksum):
bytestowrite=len(data)
pos=0
while bytestowrite>0:
size=min(bytestowrite,64)
bytestowrite = len(data)
pos = 0
while bytestowrite > 0:
size = min(bytestowrite, 64)
self.usbwrite(data[pos:pos + size])
bytestowrite-=size
pos+=size
#self.usbwrite(b"")
bytestowrite -= size
pos += size
# self.usbwrite(b"")
try:
checksum, status = self.rword(2)
if gen_chksum != checksum and checksum != 0:
@ -583,7 +585,7 @@ class Preloader(metaclass=LogBase):
if 0 <= status <= 0xFF:
return True
else:
self.error(f"upload_data failed with status: {hex(status)}")
self.error(f"upload_data failed with error: "+self.eh.status(status))
return False
except Exception as e:
self.error(f"upload_data resp error : " + str(e))

View file

@ -147,7 +147,7 @@ hwconfig = {
uart=0x11005000,
brom_payload_addr=0x100A00,
da_payload_addr=0x2008000,
pl_payload_addr=0x2008000,
pl_payload_addr=0x81E00000, #
# no gcpu_base =0x10210000,
sej_base =0x1000A000, # hacc
# no dxcc
@ -167,8 +167,9 @@ hwconfig = {
0x3967: chipconfig( # var1
# watchdog
# uart
# brom_payload_addr
brom_payload_addr=0x100A00,
da_payload_addr=0x201000,
pl_payload_addr=0x40020000,
# gcpu_base
# sej_base
# no dxcc
@ -244,6 +245,7 @@ hwconfig = {
uart=0x11002000,
brom_payload_addr=0x100A00, # todo: check
da_payload_addr=0x201000,
pl_payload_addr=0x80001000, #
gcpu_base=0x1020D000,
sej_base=0x1000A000,
# no dxcc
@ -255,8 +257,8 @@ hwconfig = {
0x6571: chipconfig( # var1
watchdog=0x10007400,
# uart
da_payload_addr=0x2008000,
pl_payload_addr=0x801E0000,
da_payload_addr=0x2009000,
pl_payload_addr=0x80001000,
# gcpu_base
# sej_base
# no dxcc
@ -272,7 +274,7 @@ hwconfig = {
uart=0x11005000,
brom_payload_addr=0x10036A0,
da_payload_addr=0x2008000,
pl_payload_addr=0x801E0000,
pl_payload_addr=0x81E00000, #
# gcpu_base
# sej_base
# no dxcc
@ -290,12 +292,13 @@ hwconfig = {
name="MT6572",
loader="mt6572_payload.bin"),
0x6573: chipconfig( # var1
watchdog=0x220,
watchdog=0x70025000,
# uart
da_payload_addr=0x90005000,
da_payload_addr=0x90006000,
pl_payload_addr=0xf1020000,
# gcpu_base
# sej_base
# dxcc_base
sej_base=0x7002A000,
# no dxcc
# cqdma_base
# ap_dma_mem
# blacklist
@ -303,27 +306,27 @@ hwconfig = {
dacode=0x6573,
name="MT6573/MT6260"),
0x6575: chipconfig( # var1
watchdog=0xC0000000,
watchdog=0xC0000000, #
# uart
da_payload_addr=0xc2000000,
da_payload_addr=0xc2001000,
pl_payload_addr=0xc2058000,
# gcpu_base
# sej_base
# dxcc_base
# cqdma_base
# ap_dma_mem
# blacklist
ap_dma_mem=0xC100119C,
sej_base=0xC101A000,
# no dxcc
# cqdma_base
ap_dma_mem=0xC100119C,
# blacklist
damode=damodes.DEFAULT, #
dacode=0x6575,
name="MT6575/77"),
0x6577: chipconfig( # var1
watchdog=0xC0000000, # fixme
uart=0xC1009000,
da_payload_addr=0xc2000000,
da_payload_addr=0xc2001000,
pl_payload_addr=0xc2058000,
# gcpu_base
sej_base=0xC101A000,
# dxcc_base
# no dxcc
# cqdma_base
ap_dma_mem=0xC100119C,
# blacklist
@ -335,7 +338,7 @@ hwconfig = {
uart=0x11005000,
brom_payload_addr=0x100A00,
da_payload_addr=0x201000,
pl_payload_addr=0x80001000,
pl_payload_addr=0x80001000, #
# no gcpu_base
sej_base=0x1000A000,
# dxcc_base
@ -358,10 +361,10 @@ hwconfig = {
uart=0x11002000,
brom_payload_addr=0x100A00,
da_payload_addr=0x201000,
pl_payload_addr=0x80001000,
pl_payload_addr=0x80001000, #
gcpu_base=0x1101B000,
sej_base=0x1000A000,
# dxcc_base
# no dxcc
# no cqdma_base
ap_dma_mem=0x11000000 + 0x320, # AP_DMA_I2C_0_RX_MEM_ADDR
blacklist=[(0x102788, 0x0),(0x00105BE4, 0x0)],
@ -379,8 +382,8 @@ hwconfig = {
watchdog=0x10000000, # fixme
uart=0x11006000,
brom_payload_addr=0x100A00,
da_payload_addr=0x201000,
pl_payload_addr=0x80001000,
da_payload_addr=0x12001000,
pl_payload_addr=0x80001000, #
gcpu_base=0x10210000,
sej_base=0x1000A000,
# no dxcc
@ -395,7 +398,7 @@ hwconfig = {
watchdog=0x10007000,
uart=0x11002000,
brom_payload_addr=0x100A00,
da_payload_addr=0x110000,
da_payload_addr=0x111000,
pl_payload_addr=0x80001000,
gcpu_base=0x10210000,
sej_base=0x1000A000,
@ -417,7 +420,7 @@ hwconfig = {
watchdog=0x10007000,
uart=0x11002000,
brom_payload_addr=0x100A00,
da_payload_addr=0x110000,
da_payload_addr=0x111000,
# gcpu_base
sej_base=0x1000A000,
# dxcc_base
@ -441,7 +444,7 @@ hwconfig = {
uart=0x11002000,
brom_payload_addr=0x100A00,
da_payload_addr=0x201000,
pl_payload_addr=0x40200000,
pl_payload_addr=0x40200000, #
gcpu_base=0x10216000,
sej_base=0x10008000, # hacc
# no dxcc
@ -464,7 +467,7 @@ hwconfig = {
uart=0x11002000,
brom_payload_addr=0x100A00,
da_payload_addr=0x201000,
pl_payload_addr=0x40200000,
pl_payload_addr=0x40200000, #
gcpu_base=0x10216000,
sej_base=0x10008000,
# no dxcc
@ -488,7 +491,7 @@ hwconfig = {
uart=0x11002000,
brom_payload_addr=0x100A00,
da_payload_addr=0x201000,
pl_payload_addr=0x40200000,
pl_payload_addr=0x40200000, #
gcpu_base=0x10050000,
sej_base=0x1000A000, # hacc
dxcc_base=0x10210000,
@ -512,6 +515,7 @@ hwconfig = {
uart=0x11002000,
brom_payload_addr=0x100A00,
da_payload_addr=0x201000,
pl_payload_addr=0x40200000, #
gcpu_base=0x10210000,
sej_base=0x1000A000, # hacc
cqdma_base=0x10212C00,
@ -524,8 +528,8 @@ hwconfig = {
watchdog=0x10007000,
uart=0x11002000,
brom_payload_addr=0x100A00,
da_payload_addr=0x110000,
pl_payload_addr=0x40001000,
da_payload_addr=0x201000, #
pl_payload_addr=0x40001000, #
gcpu_base=0x10210000,
sej_base=0x1000A000, # hacc
# no dxcc
@ -541,7 +545,7 @@ hwconfig = {
uart=0x11002000,
brom_payload_addr=0x100A00,
da_payload_addr=0x201000,
pl_payload_addr=0x40200000,
pl_payload_addr=0x40200000, #
gcpu_base=0x10216000,
sej_base=0x10008000,
# no dxcc
@ -564,9 +568,10 @@ hwconfig = {
uart=0x11002000,
brom_payload_addr=0x100A00,
da_payload_addr=0x201000,
pl_payload_addr=0x40200000,
pl_payload_addr=0x40200000, #
gcpu_base=0x10210000,
sej_base=0x1000A000, # hacc
# no dxcc
cqdma_base=0x10212C00,
ap_dma_mem=0x11000000 + 0x1A0, # AP_DMA_I2C_1_RX_MEM_ADDR
blacklist=[(0x10276C, 0x0),(0x00105704, 0x0)],
@ -587,9 +592,10 @@ hwconfig = {
uart=0x11002000,
brom_payload_addr=0x100A00,
da_payload_addr=0x201000,
pl_payload_addr=0x40200000,
pl_payload_addr=0x40200000, #
gcpu_base=0x10210000,
sej_base=0x1000A000,
# no dxcc
cqdma_base=0x10212C00,
ap_dma_mem=0x11000000 + 0x1A0, # AP_DMA_I2C_1_RX_MEM_ADDR
blacklist=[(0x102774, 0x0), (0x00105704, 0x0)],
@ -604,42 +610,63 @@ hwconfig = {
name="MT6757/MT6757D",
description="Helio P20",
loader="mt6757_payload.bin"),
0x688: chipconfig( # var1
0x688: chipconfig(
#var1
watchdog=0x10210000,
uart=0x11020000,
brom_payload_addr=0x100A00, # todo
brom_payload_addr=0x100A00,
da_payload_addr=0x201000,
pl_payload_addr=0x40200000, #
gcpu_base=0x10050000,
sej_base=0x10080000, # hacc
# no dxcc
dxcc_base=0x11240000,
cqdma_base=0x10200000,
ap_dma_mem=0x11000000 + 0x1A0,
# blacklist
# blacklist_count
# send_ptr
# ctrl_buffer
# cmd_handler
# brom_Register_access
# meid_addr
damode=damodes.XFLASH,
dacode=0x6758,
name="MT6758"
name="MT6758",
description="Helio P30",
# loader
),
0x507: chipconfig( # var1
watchdog=0x10210000,
uart=0x11020000,
brom_payload_addr=0x100A00, # todo
da_payload_addr=0x201000,
# pl_payload_addr
gcpu_base=0x10210000,
# sej_base
# dxcc_base
# cqdma_base
ap_dma_mem=0x1030000 + 0x1A0, # todo
# blacklist
# blacklist_count
# send_ptr
# ctrl_buffer
# cmd_handler
# brom_Register_access
# meid_addr
damode=damodes.DEFAULT,
dacode=0x6759, # todo
dacode=0x6758,
name="MT6759",
description="Helio P30"),
description="Helio P30"
# loader
),
0x717: chipconfig(
var1=0x25,
watchdog=0x10007000,
uart=0x11002000,
brom_payload_addr=0x100A00,
da_payload_addr=0x201000,
pl_payload_addr=0x40200000,
pl_payload_addr=0x40200000, #
gcpu_base=0x10050000,
sej_base=0x1000A000, # hacc
dxcc_base=0x10210000,
@ -664,6 +691,7 @@ hwconfig = {
uart=0x11002000,
brom_payload_addr=0x100A00,
da_payload_addr=0x201000,
pl_payload_addr=0x40200000, #
gcpu_base=0x10050000,
dxcc_base=0x10210000,
sej_base=0x1000A000, # hacc
@ -688,7 +716,7 @@ hwconfig = {
uart=0x11002000,
brom_payload_addr=0x100A00,
da_payload_addr=0x201000,
pl_payload_addr=0x40200000,
pl_payload_addr=0x40200000, #
gcpu_base=0x10050000, # not confirmed
sej_base=0x1000a000, # hacc
dxcc_base=0x10210000,
@ -708,12 +736,12 @@ hwconfig = {
description="Helio P35/G35",
loader="mt6765_payload.bin"),
0x707: chipconfig(
var1=0x25, # todo
var1=0x25,
watchdog=0x10007000,
uart=0x11002000,
brom_payload_addr=0x100A00,
da_payload_addr=0x201000,
pl_payload_addr=0x40200000,
pl_payload_addr=0x40200000, #
gcpu_base=0x10050000,
sej_base=0x1000A000, # hacc
dxcc_base=0x10210000,
@ -730,7 +758,7 @@ hwconfig = {
damode=damodes.XFLASH,
dacode=0x6768,
name="MT6768",
description="Helio P65/G85",
description="Helio P65/G85 k68v1",
loader="mt6768_payload.bin"),
0x788: chipconfig(
var1=0xA,
@ -738,7 +766,7 @@ hwconfig = {
uart=0x11002000,
brom_payload_addr=0x100A00,
da_payload_addr=0x201000,
pl_payload_addr=0x40200000,
pl_payload_addr=0x40200000, #
gcpu_base=0x10050000,
sej_base=0x1000A000, # hacc
dxcc_base=0x10210000, # dxcc_sec
@ -773,7 +801,7 @@ hwconfig = {
uart=0x11002000,
brom_payload_addr=0x100A00,
da_payload_addr=0x201000,
pl_payload_addr=0x40200000,
pl_payload_addr=0x40200000, #
gcpu_base=0x10050000,
sej_base=0x1000a000, # hacc
dxcc_base=0x10210000,
@ -790,7 +818,7 @@ hwconfig = {
damode=damodes.XFLASH,
dacode=0x6779,
name="MT6779",
description="Helio P90",
description="Helio P90 k79v1",
loader="mt6779_payload.bin"),
0x1066: chipconfig(
# var1=0xA, #confirmed
@ -823,7 +851,7 @@ hwconfig = {
uart=0x11002000,
brom_payload_addr=0x100A00,
da_payload_addr=0x201000,
pl_payload_addr=0x40200000,
pl_payload_addr=0x40200000, #
gcpu_base=0x10050000,
sej_base=0x1000A000, # hacc
dxcc_base=0x10210000,
@ -848,7 +876,7 @@ hwconfig = {
uart=0x11002000,
brom_payload_addr=0x100A00,
da_payload_addr=0x110000,
pl_payload_addr=0x40200000,
pl_payload_addr=0x40200000, #
gcpu_base=0x10210000,
sej_base=0x1000A000, # hacc
# no dxcc
@ -872,7 +900,7 @@ hwconfig = {
uart=0x11002000,
brom_payload_addr=0x100A00,
da_payload_addr=0x201000,
pl_payload_addr=0x40200000,
pl_payload_addr=0x40200000, #
gcpu_base=0x10210000,
# no dxcc
sej_base=0x1000A000, # hacc
@ -896,11 +924,11 @@ hwconfig = {
uart=0x11020000,
brom_payload_addr=0x100A00,
da_payload_addr=0x201000,
pl_payload_addr=0x40200000,
pl_payload_addr=0x40200000, # not confirmed
gcpu_base=0x10210000,
cqdma_base=0x11B30000,
ap_dma_mem=0x11000000 + 0x1A0, # AP_DMA_I2C_2_RX_MEM_ADDR
# no dxcc
dxcc_base=0x11B20000,
sej_base=0x1000A000,
blacklist=[(0x00102870, 0x0),(0x00107070, 0x0)],
blacklist_count=0x0000000A,
@ -921,12 +949,12 @@ hwconfig = {
uart=0x11002000,
brom_payload_addr=0x100A00, #
da_payload_addr=0x201000, #
pl_payload_addr=0x40200000,
# gcpu_base=0x10050000, #
pl_payload_addr=0x40200000, #
gcpu_base=0x10050000,
dxcc_base=0x10210000,
sej_base=0x1000a000, # hacc
# cqdma_base=0x10212000, #
# ap_dma_mem=0x11000a80 + 0x1a0, # todo check
cqdma_base=0x10212000,
ap_dma_mem=0x10217a80 + 0x1a0,
blacklist=[(0x00102844, 0x0),(0x00106B54, 0x0)],
blacklist_count=0x0000000A,
send_ptr=(0x102884, 0xdfe0),
@ -938,18 +966,19 @@ hwconfig = {
damode=damodes.XFLASH,
dacode=0x6833,
name="MT6833",
description="Dimensity 700 5G",
description="Dimensity 700 5G k6833",
loader="mt6833_payload.bin"),
0x996: chipconfig(var1=0xA,
watchdog=0x10007000,
uart=0x11002000,
brom_payload_addr=0x100A00,
da_payload_addr=0x201000,
pl_payload_addr=0x40200000, #
gcpu_base=0x10050000,
dxcc_base=0x10210000,
cqdma_base=0x10212000,
sej_base=0x1000a000, # hacc
ap_dma_mem=0x11000000 + 0x1A0,
ap_dma_mem=0x10217a80 + 0x1A0,
blacklist=[(0x10284C, 0x0),(0x00106B60, 0x0)],
blacklist_count=0x0000000A,
send_ptr=(0x10288c, 0xea64),
@ -974,7 +1003,7 @@ hwconfig = {
dxcc_base=0x10210000,
sej_base=0x1000a000, # hacc
cqdma_base=0x10212000,
ap_dma_mem=0x11000000 + 0x1A0,
ap_dma_mem=0x10217a80 + 0x1A0,
blacklist=[(0x10284C, 0x0),(0x00106B60, 0x0)],
blacklist_count=0x0000000A,
send_ptr=(0x10288c, 0xea78),
@ -994,15 +1023,24 @@ hwconfig = {
# brom_payload_addr
# da_payload_addr
# gcpu_base
dxcc_base=0x10210000,
sej_base=0x1000a000, # hacc
dxcc_base=0x10210000,
# cqdma_base
# ap_dma_mem
# blacklist
# blacklist_count
# send_ptr
# ctrl_buffer
# cmd_handler
# brom_register_access
# meid_addr=
# socid_addr=
damode=damodes.XFLASH,
dacode=0x6877, # todo
name="MT6877",
description="Dimensity 900",
name="MT6877"),
# loader
),
0x816: chipconfig(
var1=0xA, # confirmed
watchdog=0x10007000,
@ -1014,7 +1052,7 @@ hwconfig = {
dxcc_base=0x10210000,
sej_base=0x1000a000, # hacc
cqdma_base=0x10212000,
ap_dma_mem=0x11000a80 + 0x1a0, # todo check
ap_dma_mem=0x11000a80 + 0x1a0,
blacklist=[(0x102848, 0x0),(0x00106B60, 0x0)],
blacklist_count=0x0000000A,
send_ptr=(0x102888, 0xE6FC),
@ -1035,11 +1073,11 @@ hwconfig = {
brom_payload_addr=0x100A00,
da_payload_addr=0x201000,
pl_payload_addr=0x40200000,
#gcpu_base=0x10050000,
gcpu_base=0x10050000,
dxcc_base=0x10210000,
sej_base=0x1000a000, # hacc
#cqdma_base=0x10212000,
#ap_dma_mem=0x11000a80 + 0x1a0, # todo check
cqdma_base=0x10212000,
ap_dma_mem=0x11000a80 + 0x1a0,
blacklist=[(0x102848, 0x0), (0x00106B60, 0x0)],
blacklist_count=0x0000000A,
send_ptr=(0x102888, 0xE79C),
@ -1094,21 +1132,32 @@ hwconfig = {
# uart
# brom_payload_addr
da_payload_addr=0x12001000,
# pl_payload_addr
# gcpu_base
# sej_base
# cqdma_base
# ap_dma_mem
# blacklist
# blacklist_count
# send_ptr
# ctrl_buffer
# cmd_handler
# brom_register_access
# meid_addr
# socid_addr
damode=damodes.DEFAULT, #
dacode=0x8135,
name="MT8135"),
name="MT8135"
# description
# loader
),
0x8163: chipconfig(
var1=0xB1,
watchdog=0x10007000,
uart=0x11002000,
brom_payload_addr=0x100A00,
da_payload_addr=0x201000,
pl_payload_addr=0x40001000,
pl_payload_addr=0x40001000, #
gcpu_base=0x10210000,
sej_base=0x1000A000,
# no dxcc
@ -1130,7 +1179,7 @@ hwconfig = {
uart=0x11005000,
brom_payload_addr=0x100A00,
da_payload_addr=0x201000,
pl_payload_addr=0x40001000,
pl_payload_addr=0x40001000, #
gcpu_base=0x1020D000,
sej_base=0x1000A000,
# no dxcc
@ -1147,30 +1196,43 @@ hwconfig = {
damode=damodes.XFLASH,
dacode=0x8167,
name="MT8167/MT8516/MT8362",
# description
loader="mt8167_payload.bin"),
0x8168: chipconfig( # var1
watchdog=0x10007000,
uart=0x11002000,
brom_payload_addr=0x100A00,
da_payload_addr=0x201000, # todo
da_payload_addr=0x201000,
# pl_payload_addr=0x40001000
# gcpu_base
# sej_base
# sej_base=0x1000A000,
# cqdma_base
ap_dma_mem=0x11000000 + 0x1A0,
ap_dma_mem=0x11000280 + 0x1A0,
# blacklist
# blacklist_count
# send_ptr
# ctrl_buffer
# cmd_handler
# brom_register_access
# meid_addr
# socid_addr
damode=damodes.XFLASH,
dacode=0x8168,
name="MT8168"),
name="MT8168"
# description
# loader
),
0x8172: chipconfig(
var1=0xA,
watchdog=0x10007000,
uart=0x11002000,
brom_payload_addr=0x120A00,
da_payload_addr=0xc0000,
pl_payload_addr=0x40200000,
da_payload_addr=0xC0000,
pl_payload_addr=0x40001000, #
# gcpu_base
# sej_base
# cqdma_base
sej_base=0x1000a000,
# no dxcc
cqdma_base=0x10212c00,
ap_dma_mem=0x11000000 + 0x1A0,
blacklist=[(0x122774, 0x0),(0x00125904, 0x0)],
blacklist_count=0x00000008,
@ -1182,46 +1244,82 @@ hwconfig = {
damode=damodes.DEFAULT, #
dacode=0x8173,
name="MT8173",
# description
loader="mt8173_payload.bin"), # sloane, suez
0x8176: chipconfig( # var1
0x8176: chipconfig(
# var1
watchdog=0x10212c00,
# uart
# brom_payload_addr
# da_payload_addr
uart=0x11002000,
brom_payload_addr=0x120A00,
da_payload_addr=0xC0000,
pl_payload_addr=0x40200000,
# gcpu_base
# sej_base
# cqdma_base
# ap_dma_mem
sej_base=0x1000A000,
# no dxcc
cqdma_base=0x10212c00,
ap_dma_mem=0x11000000 + 0x1A0,
# blacklist
# blacklist_count
# send_ptr
# ctrl_buffer
# cmd_handler
# brom_register_access
# meid_addr
# socid_addr
dacode=0x8173,
damode=damodes.DEFAULT, #
name="MT8176"),
0x930: chipconfig( # var1
damode=damodes.DEFAULT,
# description
name="MT8176"
# loader
),
0x930: chipconfig(
# var1
# watchdog
# uart
# brom_payload_addr
brom_payload_addr=0x100A00,
da_payload_addr=0x201000,
pl_payload_addr=0x40200000,
# gcpu_base
# sej_base
# cqdma_base
# ap_dma_mem
# blacklist
# blacklist_count
# send_ptr
# ctrl_buffer
# cmd_handler
# brom_register_access
# meid_addr
# socid_addr
dacode=0x8195,
damode=damodes.XFLASH,
name="MT8195"),
# description
name="MT8195"
# loader
),
0x8512: chipconfig( # var1
# watchdog
# uart
# brom_payload_addr
da_payload_addr=0x110000,
da_payload_addr=0x111000,
# gcpu_base
# sej_base
# cqdma_base
# ap_dma_mem
# blacklist
# blacklist_count
# send_ptr
# ctrl_buffer
# cmd_handler
# brom_register_access
# meid_addr
# socid_addr
dacode=0x8512,
damode=damodes.XFLASH,
name="MT8512"),
# description
name="MT8512"
# loader
),
0x8518: chipconfig( # var1
# watchdog
# uart
@ -1232,11 +1330,18 @@ hwconfig = {
# cqdma_base
# ap_dma_mem
# blacklist
# blacklist_count
# send_ptr
# ctrl_buffer
# cmd_handler
# brom_register_access
# meid_addr
# socid_addr
dacode=0x8518,
damode=damodes.XFLASH,
name="MT8518"),
0x8590: chipconfig(
var1=0xA, # confirmed
var1=0xA, # confirmed, router
watchdog=0x10007000,
uart=0x11002000,
brom_payload_addr=0x100A00,
@ -1256,6 +1361,7 @@ hwconfig = {
dacode=0x8590,
damode=damodes.DEFAULT,
name="MT8590/MT7683/MT8521/MT7623",
#description=
loader="mt8590_payload.bin"),
0x8695: chipconfig(
var1=0xA, # confirmed
@ -1263,9 +1369,9 @@ hwconfig = {
uart=0x11002000,
brom_payload_addr=0x100A00,
da_payload_addr=0x201000,
pl_payload_addr=0x40001000,
pl_payload_addr=0x40001000, #
# gcpu_base
# sej_base
sej_base=0x1000A000,
# cqdma_base
ap_dma_mem=0x11000280 + 0x1A0,
blacklist=[(0x103048, 0x0),(0x00106EC4, 0x0)],
@ -1277,9 +1383,11 @@ hwconfig = {
meid_addr=0x1032B8,
damode=damodes.XFLASH,
dacode=0x8695,
name="MT8695",
name="MT8695", #mantis
# description
loader="mt8695_payload.bin"),
0x908: chipconfig( # var1
0x908: chipconfig(
# var1
watchdog=0x10007000,
# uart
brom_payload_addr=0x100A00,
@ -1289,9 +1397,19 @@ hwconfig = {
# cqdma_base
# ap_dma_mem
# blacklist
# blacklist_count
# send_ptr
# ctrl_buffer
# cmd_handler
# brom_register_access
# meid_addr
# socid_addr
damode=damodes.XFLASH,
dacode=0x8696,
name="MT8696"),
# description
name="MT8696"
# loader
),
}