mirror of
https://github.com/AsahiLinux/m1n1
synced 2024-11-22 14:43:08 +00:00
m1n1.fw.asc.oslog: Implement properly
Signed-off-by: Hector Martin <marcan@marcan.st>
This commit is contained in:
parent
d5267123c1
commit
36bcc36173
1 changed files with 24 additions and 14 deletions
|
@ -7,24 +7,34 @@ from ...utils import *
|
|||
class OSLogMessage(Register64):
|
||||
TYPE = 63, 56
|
||||
|
||||
class OSLog_Init(OSLogMessage):
|
||||
class OSLog_GetBuf(OSLogMessage):
|
||||
TYPE = 63, 56, Constant(1)
|
||||
UNK = 51, 0
|
||||
|
||||
class OSLog_Ack(OSLogMessage):
|
||||
TYPE = 63, 56, Constant(3)
|
||||
SIZE = 55, 48
|
||||
DVA = 47, 0
|
||||
|
||||
class ASCOSLogEndpoint(ASCBaseEndpoint):
|
||||
BASE_MESSAGE = OSLogMessage
|
||||
SHORT = "oslog"
|
||||
SHORT = "iorep"
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.started = False
|
||||
self.iobuffer = None
|
||||
self.iobuffer_dva = None
|
||||
|
||||
@msg_handler(1, OSLog_GetBuf)
|
||||
def GetBuf(self, msg):
|
||||
if self.iobuffer:
|
||||
self.log("WARNING: trying to reset iobuffer!")
|
||||
|
||||
|
||||
if msg.DVA != 0:
|
||||
self.bufsize = 0x1000 * msg.SIZE
|
||||
self.iobuffer = self.iobuffer_dva = msg.DVA << 12
|
||||
self.log(f"buf prealloc {self.iobuffer:#x} / {self.iobuffer_dva:#x}")
|
||||
else:
|
||||
self.bufsize = align(0x1000 * msg.SIZE, 0x4000)
|
||||
self.iobuffer, self.iobuffer_dva = self.asc.ioalloc(self.bufsize)
|
||||
self.log(f"buf {self.iobuffer:#x} / {self.iobuffer_dva:#x}")
|
||||
self.send(OSLog_GetBuf(DVA=self.iobuffer_dva >> 12, SIZE=self.bufsize // 0x1000))
|
||||
|
||||
@msg_handler(1, OSLog_Init)
|
||||
def Init(self, msg):
|
||||
self.log(f"oslog init: {msg.UNK:#x}")
|
||||
self.send(OSLog_Ack())
|
||||
self.started = True
|
||||
return True
|
||||
|
|
Loading…
Reference in a new issue