From 88cc5f07f7b8d1937f69002fb99c9bfa6db6212f Mon Sep 17 00:00:00 2001 From: starfrost013 Date: Sun, 29 Dec 2024 17:24:17 +0000 Subject: [PATCH] sort out the logging but there are still regressions (driver fail to boot) --- src/video/nv/nv3/nv3_core.c | 2 ++ src/video/nv/nv3/subsystems/nv3_pbus.c | 4 ++-- src/video/nv/nv3/subsystems/nv3_pextdev.c | 4 ++-- src/video/nv/nv3/subsystems/nv3_pfb.c | 4 ++-- src/video/nv/nv3/subsystems/nv3_pfifo.c | 2 +- src/video/nv/nv3/subsystems/nv3_pgraph.c | 4 ++-- src/video/nv/nv3/subsystems/nv3_pmc.c | 7 ++++--- src/video/nv/nv3/subsystems/nv3_pme.c | 9 ++------- src/video/nv/nv3/subsystems/nv3_pramdac.c | 11 +++-------- src/video/nv/nv3/subsystems/nv3_ptimer.c | 11 +++-------- src/video/nv/nv3/subsystems/nv3_pvideo.c | 4 ++-- 11 files changed, 25 insertions(+), 37 deletions(-) diff --git a/src/video/nv/nv3/nv3_core.c b/src/video/nv/nv3/nv3_core.c index f0ff0f028..dde1043c4 100644 --- a/src/video/nv/nv3/nv3_core.c +++ b/src/video/nv/nv3/nv3_core.c @@ -842,8 +842,10 @@ void* nv3_init(const device_t *info) // These only get turned on when the requisite registers are twiddled timer_add(&nv3->nvbase.pixel_clock_timer, nv3_pramdac_pixel_clock_poll, nv3, false); nv_log("NV3: Pixel clock OK. Will be started when the VBIOS tells us to start\n"); + timer_add(&nv3->nvbase.memory_clock_timer, nv3_pramdac_memory_clock_poll, nv3, false); nv_log("NV3: Memory clock OK. Will be started when the VBIOS tells us to start\n"); + return nv3; } diff --git a/src/video/nv/nv3/subsystems/nv3_pbus.c b/src/video/nv/nv3/subsystems/nv3_pbus.c index b61c36e52..84df73169 100644 --- a/src/video/nv/nv3/subsystems/nv3_pbus.c +++ b/src/video/nv/nv3/subsystems/nv3_pbus.c @@ -75,13 +75,13 @@ uint32_t nv3_pbus_read(uint32_t address) } if (reg->friendly_name) - nv_log(": %s (value = %04x)\n", reg->friendly_name, ret); + nv_log(": %s (value = 0x%04x)\n", reg->friendly_name, ret); else nv_log("\n"); } else { - nv_log(": Unknown register read (address=%04x), returning 0x00\n", address); + nv_log(": Unknown register read (address=0x%04x), returning 0x00\n", address); } return ret; diff --git a/src/video/nv/nv3/subsystems/nv3_pextdev.c b/src/video/nv/nv3/subsystems/nv3_pextdev.c index 452550ad9..d4c1ce353 100644 --- a/src/video/nv/nv3/subsystems/nv3_pextdev.c +++ b/src/video/nv/nv3/subsystems/nv3_pextdev.c @@ -112,13 +112,13 @@ uint32_t nv3_pextdev_read(uint32_t address) } if (reg->friendly_name) - nv_log(": %s (value = %04x)\n", reg->friendly_name, ret); + nv_log(": %s (value = 0x%04x)\n", reg->friendly_name, ret); else nv_log("\n"); } else { - nv_log(": Unknown register read (address=%04x), returning 0x00\n", address); + nv_log(": Unknown register read (address=0x%04x), returning 0x00\n", address); } return ret; diff --git a/src/video/nv/nv3/subsystems/nv3_pfb.c b/src/video/nv/nv3/subsystems/nv3_pfb.c index 02f3618ff..3172f30d3 100644 --- a/src/video/nv/nv3/subsystems/nv3_pfb.c +++ b/src/video/nv/nv3/subsystems/nv3_pfb.c @@ -88,13 +88,13 @@ uint32_t nv3_pfb_read(uint32_t address) } if (reg->friendly_name) - nv_log(": %s (value = %04x)\n", reg->friendly_name, ret); + nv_log(": %s (value = 0x%04x)\n", reg->friendly_name, ret); else nv_log("\n"); } else { - nv_log(": Unknown register read (address=%04x), returning 0x00\n", address); + nv_log(": Unknown register read (address=0x%04x), returning 0x00\n", address); } return ret; diff --git a/src/video/nv/nv3/subsystems/nv3_pfifo.c b/src/video/nv/nv3/subsystems/nv3_pfifo.c index e5453a348..6b6ab2aaf 100644 --- a/src/video/nv/nv3/subsystems/nv3_pfifo.c +++ b/src/video/nv/nv3/subsystems/nv3_pfifo.c @@ -98,7 +98,7 @@ uint32_t nv3_pfifo_read(uint32_t address) } else { - nv_log(": Unknown register read (address=%04x), returning 0x00\n", address); + nv_log(": Unknown register read (address=0x%04x), returning 0x00\n", address); } return ret; diff --git a/src/video/nv/nv3/subsystems/nv3_pgraph.c b/src/video/nv/nv3/subsystems/nv3_pgraph.c index 68ba20509..070eabd62 100644 --- a/src/video/nv/nv3/subsystems/nv3_pgraph.c +++ b/src/video/nv/nv3/subsystems/nv3_pgraph.c @@ -125,7 +125,7 @@ uint32_t nv3_pgraph_read(uint32_t address) } if (reg->friendly_name) - nv_log(": %s (value = %04x)\n", reg->friendly_name, ret); + nv_log(": %s (value = 0x%04x)\n", reg->friendly_name, ret); else nv_log("\n"); } @@ -142,7 +142,7 @@ uint32_t nv3_pgraph_read(uint32_t address) } else /* Completely unknown */ { - nv_log(": Unknown register read (address=%04x), returning 0x00\n", address); + nv_log(": Unknown register read (address=0x%04x), returning 0x00\n", address); } } diff --git a/src/video/nv/nv3/subsystems/nv3_pmc.c b/src/video/nv/nv3/subsystems/nv3_pmc.c index e8c3fe0e1..d94798152 100644 --- a/src/video/nv/nv3/subsystems/nv3_pmc.c +++ b/src/video/nv/nv3/subsystems/nv3_pmc.c @@ -190,9 +190,10 @@ uint32_t nv3_pmc_read(uint32_t address) case NV3_PMC_BOOT: ret = nv3->pmc.boot; case NV3_PMC_INTERRUPT_STATUS: + nv_log("\n"); // clear_interrupts logs nv3_pmc_clear_interrupts(); - ret = nv3_pmc_handle_interrupts(false); + ret = nv3_pmc_handle_interrupts(false); case NV3_PMC_INTERRUPT_ENABLE: //TODO: ACTUALLY CHANGE THE INTERRUPT STATE ret = nv3->pmc.interrupt_enable; @@ -203,13 +204,13 @@ uint32_t nv3_pmc_read(uint32_t address) } if (reg->friendly_name) - nv_log(": %s (value = %04x)\n", reg->friendly_name, ret); + nv_log(": %s (value = 0x%04x)\n", reg->friendly_name, ret); else nv_log("\n"); } else { - nv_log(": Unknown register read (address=%04x), returning 0x00\n", address); + nv_log(": Unknown register read (address=0x%04x), returning 0x00\n", address); } return ret; diff --git a/src/video/nv/nv3/subsystems/nv3_pme.c b/src/video/nv/nv3/subsystems/nv3_pme.c index b55ed4df0..11b84a040 100644 --- a/src/video/nv/nv3/subsystems/nv3_pme.c +++ b/src/video/nv/nv3/subsystems/nv3_pme.c @@ -54,11 +54,6 @@ uint32_t nv3_pme_read(uint32_t address) // if the register actually exists if (reg) { - if (reg->friendly_name) - nv_log(": %s\n", reg->friendly_name); - else - nv_log("\n"); - // on-read function if (reg->on_read) ret = reg->on_read(); @@ -80,13 +75,13 @@ uint32_t nv3_pme_read(uint32_t address) } if (reg->friendly_name) - nv_log(": %s (value = %04x)\n", reg->friendly_name, ret); + nv_log(": %s (value = 0x%04x)\n", reg->friendly_name, ret); else nv_log("\n"); } else { - nv_log(": Unknown register read (address=%04x), returning 0x00\n", address); + nv_log(": Unknown register read (address=0x%04x), returning 0x00\n", address); } return ret; diff --git a/src/video/nv/nv3/subsystems/nv3_pramdac.c b/src/video/nv/nv3/subsystems/nv3_pramdac.c index 46ccde970..8d162fe2b 100644 --- a/src/video/nv/nv3/subsystems/nv3_pramdac.c +++ b/src/video/nv/nv3/subsystems/nv3_pramdac.c @@ -211,7 +211,7 @@ uint32_t nv3_pramdac_read(uint32_t address) nv_register_t* reg = nv_get_register(address, pramdac_registers, sizeof(pramdac_registers)/sizeof(pramdac_registers[0])); uint32_t ret = 0x00; - + // todo: friendly logging nv_log("NV3: PRAMDAC Read from 0x%08x", address); @@ -219,11 +219,6 @@ uint32_t nv3_pramdac_read(uint32_t address) // if the register actually exists if (reg) { - if (reg->friendly_name) - nv_log(": %s\n", reg->friendly_name); - else - nv_log("\n"); - // on-read function if (reg->on_read) ret = reg->on_read(); @@ -268,13 +263,13 @@ uint32_t nv3_pramdac_read(uint32_t address) } if (reg->friendly_name) - nv_log(": %s (value = %04x)\n", reg->friendly_name, ret); + nv_log(": %s (value = 0x%04x)\n", reg->friendly_name, ret); else nv_log("\n"); } else { - nv_log(": Unknown register read (address=%04x), returning 0x00\n", address); + nv_log(": Unknown register read (address=0x%04x), returning 0x00\n", address); } return ret; diff --git a/src/video/nv/nv3/subsystems/nv3_ptimer.c b/src/video/nv/nv3/subsystems/nv3_ptimer.c index 2a722e4e1..1d714222a 100644 --- a/src/video/nv/nv3/subsystems/nv3_ptimer.c +++ b/src/video/nv/nv3/subsystems/nv3_ptimer.c @@ -88,15 +88,10 @@ uint32_t nv3_ptimer_read(uint32_t address) nv_log("NV3: PTIMER Read from 0x%08x", address); uint32_t ret = 0x00; - + // if the register actually exists if (reg) { - if (reg->friendly_name) - nv_log(": %s\n", reg->friendly_name); - else - nv_log("\n"); - // on-read function if (reg->on_read) ret = reg->on_read(); @@ -128,13 +123,13 @@ uint32_t nv3_ptimer_read(uint32_t address) } if (reg->friendly_name) - nv_log(": %s (value = %04x)\n", reg->friendly_name, ret); + nv_log(": %s (value = 0x%04x)\n", reg->friendly_name, ret); else nv_log("\n"); } else { - nv_log(": Unknown register read (address=%04x), returning 0x00\n", address); + nv_log(": Unknown register read (address=0x%04x), returning 0x00\n", address); } return ret; diff --git a/src/video/nv/nv3/subsystems/nv3_pvideo.c b/src/video/nv/nv3/subsystems/nv3_pvideo.c index 6e0a725a4..f5e1ee4e8 100644 --- a/src/video/nv/nv3/subsystems/nv3_pvideo.c +++ b/src/video/nv/nv3/subsystems/nv3_pvideo.c @@ -80,13 +80,13 @@ uint32_t nv3_pvideo_read(uint32_t address) } if (reg->friendly_name) - nv_log(": %s (value = %04x)\n", reg->friendly_name, ret); + nv_log(": %s (value = 0x%04x)\n", reg->friendly_name, ret); else nv_log("\n"); } else { - nv_log(": Unknown register read (address=%04x), returning 0x00\n", address); + nv_log(": Unknown register read (address=0x%04x), returning 0x00\n", address); } return ret;