Skip to content

Serial kprintf not working from Mac mini 2018  #2075

@joevt

Description

@joevt

I have connected a Sonnet Echo Express III-D with PCIe serial card and have setup serial debug output from OpenCore. I am trying to determine why my patches to displaypolicyd (using my fork of Lilu/WhateverGreen) sometimes cause macOS Monterey 12.4 boot to hang. I am unable to get xnu to do kprintf to the PCIe serial card with the Mac mini 2018 like I could with my iMac 27 inch 2013. The OpenCore log says it patched xnu successfully:

42:251 00:013 OCAK: Registering PCI serial device PMIO port 0x4008
42:259 00:008 OCAK: Registering PCI serial device register stride 1
42:329 00:070 OCAK: Patched CustomPciSerialDevice PMIO port 56 times
42:337 00:007 OCAK: Patch success CustomPciSerialDevice

I verified that the PMIO address of 0x4008 is unchanged in macOS (using lspci)
I verified that the serial card is usable in macOS using Serial.app (requires PCIeSerialThunderboltEnable.kext; requires that PCIeSerialDisable.kext is not enabled for the port to be tested)

The last line I usually see in the serial output is this:

42:947 00:009 AAPL: #[EB|LOG:EXITBS:START] 2022-07-06T00:43:52

If I have Send early prints to serial port and/or Enable early serial output on RELEASE kernel patches enabled, then I can see these lines appear after the above line:

i386_init
kernel_startup_bootstrap
tunables
locks_early
kprintf
PE_init_printf
i386_vm_init
power_management_init
machine_startup
vm_mem_bootstrap
vm_page_bootstrap
pmap_steal
vm_page_buckets
vm_page_bucket_locks
pmap_startup
page_frame_init
vm_page_bootstrap complete
zone_bootstrap
vm_object_bootstrap
vm_map_init
kmem_init
kmem
pmap_init
vm_fault_init
zalloc
atm_init
percpu
locks
codesigning
oslog
telemetry_init
console_init
stackshot_init
sched_init
mac_policy_init
mach_ipc
PMAP_ACTIVATE_KERNEL
mapping_free_prime
machine_init
thread_machine_init_template
clock_init
coalitions_init
task_init
thread_init
restartable_init
workq_init
turnstiles_init
mach_init_activity_id
bank_init
ipc_pthread_priority_init
exception_init
sfi_init
kernel_thread_create
load_context - done
idle_thread_create
sched_startup
thread_daemon_init
thread_call
thread_bind
mapping_adjust
clock_service_create
kdp_init
hv_support_init
bootprofile_init
sysctl
PE_init_iokit
early_boot
mac_policy_initmach
dtrace_early_init
trust_cache_init
OSKextRemoveKextBootstrap
machine_lockdown
PE_lockdown_iokit

I believe my boot-args are set correctly for serial kprintf (same as my iMac 2013)

I guess I need to figure out if PE_init_kprintf is being called and if it is setting or clearing disable_serial_output.

Is it possible to make a patch to xnu that jumps to some new code, rather than just changing a few bytes? Perhaps xnu can jump into OpenCoreRuntime or some other block of code that is loaded at EFI time? Is there an example of such a patch?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions