From acb30d42bac247c40556f8674f76cb6c817efb8e Mon Sep 17 00:00:00 2001 From: angelosa Date: Fri, 15 Apr 2022 03:39:51 +0200 Subject: [PATCH] i82371ab.cpp: convert to logmacro, fix log writes --- src/devices/bus/lpci/i82371ab.cpp | 34 ++++++++++++++++++++++-------- src/devices/cpu/i386/cpuidmsrs.hxx | 4 ++-- 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/src/devices/bus/lpci/i82371ab.cpp b/src/devices/bus/lpci/i82371ab.cpp index ef32506481a..6d9a1c72bc3 100644 --- a/src/devices/bus/lpci/i82371ab.cpp +++ b/src/devices/bus/lpci/i82371ab.cpp @@ -19,6 +19,20 @@ #include "emu.h" #include "i82371ab.h" +#define LOG_ISA (1U << 1) +#define LOG_IDE (1U << 2) +#define LOG_USB (1U << 3) +#define LOG_ACPI (1U << 4) + +#define VERBOSE (LOG_GENERAL | LOG_ISA | LOG_IDE | LOG_USB | LOG_ACPI) +//#define LOG_OUTPUT_FUNC osd_printf_info +#include "logmacro.h" + +#define LOGISA(...) LOGMASKED(LOG_ISA, __VA_ARGS__) +#define LOGIDE(...) LOGMASKED(LOG_IDE, __VA_ARGS__) +#define LOGUSB(...) LOGMASKED(LOG_USB, __VA_ARGS__) +#define LOGACPI(...) LOGMASKED(LOG_ACPI, __VA_ARGS__) + DEFINE_DEVICE_TYPE(I82371AB, i82371ab_device, "i82371ab", "Intel 82371AB") @@ -28,6 +42,8 @@ i82371ab_device::i82371ab_device(const machine_config &mconfig, const char *tag, { } + + uint32_t i82371ab_device::pci_isa_r(device_t *busdevice, int offset, uint32_t mem_mask) { uint32_t result = m_regs[0][offset] | @@ -35,7 +51,7 @@ uint32_t i82371ab_device::pci_isa_r(device_t *busdevice, int offset, uint32_t me m_regs[0][offset+2] << 16| m_regs[0][offset+3] << 24; - logerror("i82371ab_pci_isa_r, offset = %02x, mem_mask = %08x\n", offset, mem_mask); + LOGISA("ISA read: [%02x] -> %08x & %08x\n", offset, result, mem_mask); return result; } @@ -46,7 +62,7 @@ void i82371ab_device::pci_isa_w(device_t *busdevice, int offset, uint32_t data, int i; COMBINE_DATA(&cdata); - logerror("i82371ab_pci_isa_w, offset = %02x, data = %08x, mem_mask = %08x\n", offset, data, mem_mask); + LOGISA("ISA write: [%02x] <- %08x & %08x\n", offset, data, mem_mask); for(i = 0; i < 4; i++, offset++, cdata >>= 8) { @@ -74,7 +90,7 @@ uint32_t i82371ab_device::pci_ide_r(device_t *busdevice, int offset, uint32_t me m_regs[1][offset+2] << 16| m_regs[1][offset+3] << 24; - logerror("i82371ab_pci_ide_r, offset = %02x, mem_mask = %08x\n", offset, mem_mask); + LOGIDE("IDE read: [%02x] -> %08x & %08x\n", offset, result, mem_mask); return result; } @@ -85,7 +101,7 @@ void i82371ab_device::pci_ide_w(device_t *busdevice, int offset, uint32_t data, int i; COMBINE_DATA(&cdata); - logerror("i82371ab_pci_isa_w, offset = %02x, data = %08x, mem_mask = %08x\n", offset, data, mem_mask); + LOGIDE("IDE write: [%02x] <- %08x & %08x\n", offset, data, mem_mask); for(i = 0; i < 4; i++, offset++, cdata >>= 8) { @@ -113,7 +129,7 @@ uint32_t i82371ab_device::pci_usb_r(device_t *busdevice, int offset, uint32_t me m_regs[2][offset+2] << 16| m_regs[2][offset+3] << 24; - logerror("i82371ab_pci_usb_r, offset = %02x, mem_mask = %08x\n", offset, mem_mask); + LOGUSB("USB read: [%02x] -> %08x & %08x\n", offset, result, mem_mask); return result; } @@ -124,7 +140,7 @@ void i82371ab_device::pci_usb_w(device_t *busdevice, int offset, uint32_t data, int i; COMBINE_DATA(&cdata); - logerror("i82371ab_pci_isa_w, offset = %02x, data = %08x, mem_mask = %08x\n", offset, data, mem_mask); + LOGUSB("USB write: [%02x] <- %08x & %08x\n", offset, data, mem_mask); for(i = 0; i < 4; i++, offset++, cdata >>= 8) { @@ -152,7 +168,7 @@ uint32_t i82371ab_device::pci_acpi_r(device_t *busdevice, int offset, uint32_t m m_regs[3][offset+2] << 16| m_regs[3][offset+3] << 24; - logerror("i82371ab_pci_acpi_r, offset = %02x, mem_mask = %08x\n", offset, mem_mask); + LOGACPI("ACPI read: [%02x] -> %08x & %08x\n", offset, result, mem_mask); return result; } @@ -163,7 +179,7 @@ void i82371ab_device::pci_acpi_w(device_t *busdevice, int offset, uint32_t data, int i; COMBINE_DATA(&cdata); - logerror("i82371ab_pci_isa_w, offset = %02x, data = %08x, mem_mask = %08x\n", offset, data, mem_mask); + LOGACPI("ACPI write: [%02x] <- %08x & %08x\n", offset, data, mem_mask); for(i = 0; i < 4; i++, offset++, cdata >>= 8) { @@ -194,7 +210,7 @@ uint32_t i82371ab_device::pci_read(pci_bus_device *pcibus, int function, int off case 3: return pci_acpi_r(pcibus, offset, mem_mask); } - logerror("i82371ab_pci_read: read from undefined function %d\n", function); + LOG("read from undefined function %d\n", function); return 0; } diff --git a/src/devices/cpu/i386/cpuidmsrs.hxx b/src/devices/cpu/i386/cpuidmsrs.hxx index 63c233f6776..4eb85406bf5 100644 --- a/src/devices/cpu/i386/cpuidmsrs.hxx +++ b/src/devices/cpu/i386/cpuidmsrs.hxx @@ -36,7 +36,7 @@ uint64_t pentium_device::opcode_rdmsr(bool &valid_msr) if (!(offset & ~0xf)) // 2-f are test registers { valid_msr = true; - logerror("RDMSR: Reading test MSR %x", offset); + logerror("RDMSR: Reading test MSR %x\n", offset); return 0; } logerror("RDMSR: invalid P5 MSR read %08x at %08x\n", offset, m_pc - 2); @@ -84,7 +84,7 @@ void pentium_device::opcode_wrmsr(uint64_t data, bool &valid_msr) if (!(offset & ~0xf)) // 2-f are test registers { valid_msr = true; - logerror("WRMSR: Writing test MSR %x", offset); + logerror("WRMSR: Writing test MSR %x\n", offset); break; } logerror("WRMSR: invalid MSR write %08x (%08x%08x) at %08x\n", offset, (uint32_t)(data >> 32), (uint32_t)data, m_pc - 2);