diff --git a/.clang-format b/.clang-format index 1fc9898d0..6493bd0b2 100644 --- a/.clang-format +++ b/.clang-format @@ -3,8 +3,8 @@ Language: Cpp AlignConsecutiveMacros: Enabled: true - AcrossEmptyLines: false - AcrossComments: false + AcrossEmptyLines: true + AcrossComments: true AlignCompound: false AlignFunctionPointers: false PadOperators: false diff --git a/.github/workflows/clang-format.yml b/.github/workflows/clang-format.yml index 6cc85d660..1b2d84433 100644 --- a/.github/workflows/clang-format.yml +++ b/.github/workflows/clang-format.yml @@ -9,7 +9,7 @@ jobs: matrix: path: - check: '.' - exclude: './fwcfg64|./ivshmem|./NetKVM|./pciserial|./pvpanic|./viocrypt|./viofs|./viogpu|./vioinput|./viomem|./viorng|./vioscsi|./vioserial|./viosock|./viostor|./VirtIO' + exclude: './ivshmem|./NetKVM|./pciserial|./pvpanic|./viocrypt|./viofs|./viogpu|./vioinput|./viomem|./viorng|./vioscsi|./vioserial|./viosock|./viostor|./VirtIO' - check: 'VirtIO' exclude: '' diff --git a/.hck-ci/triggers.yml b/.hck-ci/triggers.yml index 936749c1c..25a7bda0d 100644 --- a/.hck-ci/triggers.yml +++ b/.hck-ci/triggers.yml @@ -122,6 +122,8 @@ viomem: - build/ - VirtIO/ exclude: + - .clang-format + - VirtIO/.clang-format - .github/ - .hck-ci/triggers.yml - Tools/ diff --git a/Balloon/sys/ProtoTypes.h b/Balloon/sys/ProtoTypes.h index a5aadc118..8e842e6e8 100644 --- a/Balloon/sys/ProtoTypes.h +++ b/Balloon/sys/ProtoTypes.h @@ -35,7 +35,7 @@ #include "trace.h" /* The ID for virtio_balloon */ -#define VIRTIO_ID_BALLOON 5 +#define VIRTIO_ID_BALLOON 5 /* The feature bitmap for virtio balloon */ #define VIRTIO_BALLOON_F_MUST_TELL_HOST 0 /* Tell before reclaiming pages */ diff --git a/Balloon/sys/trace.h b/Balloon/sys/trace.h index 92a1a5bf9..ec34f629e 100644 --- a/Balloon/sys/trace.h +++ b/Balloon/sys/trace.h @@ -96,11 +96,11 @@ extern int driverDebugLevel; WPP_DEFINE_BIT(DBG_HW_ACCESS) /* bit 12 = 0x00001000 */ \ ) -#define WPP_FLAG_LEVEL_LOGGER(flag, level) WPP_LEVEL_LOGGER(flag) +#define WPP_FLAG_LEVEL_LOGGER(flag, level) WPP_LEVEL_LOGGER(flag) #define WPP_FLAG_LEVEL_ENABLED(flag, level) (WPP_LEVEL_ENABLED(flag) && WPP_CONTROL(WPP_BIT_##flag).Level >= level) -#define WPP_LEVEL_FLAGS_LOGGER(lvl, flags) WPP_LEVEL_LOGGER(flags) +#define WPP_LEVEL_FLAGS_LOGGER(lvl, flags) WPP_LEVEL_LOGGER(flags) #define WPP_LEVEL_FLAGS_ENABLED(lvl, flags) (WPP_LEVEL_ENABLED(flags) && WPP_CONTROL(WPP_BIT_##flags).Level >= lvl) diff --git a/fwcfg64/driver.c b/fwcfg64/driver.c index cfbdfb5c4..b34350865 100644 --- a/fwcfg64/driver.c +++ b/fwcfg64/driver.c @@ -24,8 +24,7 @@ NTSTATUS VMCoreInfoFill(PDEVICE_CONTEXT ctx) TraceEvents(TRACE_LEVEL_VERBOSE, DBG_ALL, "Obtaining header"); hdr_buf = (PUCHAR)ctx->vmci_data.pNote + FIELD_OFFSET(VMCI_ELF64_NOTE, n_desc); - status = KeInitializeCrashDumpHeader(DUMP_TYPE_FULL, 0, hdr_buf, - DUMP_HDR_SIZE, &bufSizeNeeded); + status = KeInitializeCrashDumpHeader(DUMP_TYPE_FULL, 0, hdr_buf, DUMP_HDR_SIZE, &bufSizeNeeded); if (!NT_SUCCESS(status)) { @@ -53,8 +52,12 @@ NTSTATUS VMCoreInfoSend(PDEVICE_CONTEXT ctx) TraceEvents(TRACE_LEVEL_VERBOSE, DBG_ALL, "Sending header"); - status = FWCfgDmaSend(ctx->ioBase, ctx->vmci_data.vmci_pa, ctx->index, - sizeof(VMCOREINFO), ctx->dma_access, ctx->dma_access_pa); + status = FWCfgDmaSend(ctx->ioBase, + ctx->vmci_data.vmci_pa, + ctx->index, + sizeof(VMCOREINFO), + ctx->dma_access, + ctx->dma_access_pa); return status; } @@ -73,7 +76,7 @@ NTSTATUS GetKdbg(PDEVICE_CONTEXT ctx) PUCHAR minidump; ULONG32 kdbg_offset; ULONG32 kdbg_size; - CONTEXT context = { 0 }; + CONTEXT context = {0}; NTSTATUS status = STATUS_SUCCESS; minidump = ExAllocatePoolUninitialized(NonPagedPoolNx, MINIDUMP_BUFFER_SIZE, 'pmdm'); @@ -88,9 +91,11 @@ NTSTATUS GetKdbg(PDEVICE_CONTEXT ctx) kdbg_offset = *(PULONG32)(minidump + MINIDUMP_OFFSET_KDBG_OFFSET); kdbg_size = *(PULONG32)(minidump + MINIDUMP_OFFSET_KDBG_SIZE); - TraceEvents(TRACE_LEVEL_VERBOSE, DBG_INIT, - "KdDebuggerDataBlock size = %lx, offset = 0x%lx", - kdbg_size, kdbg_offset); + TraceEvents(TRACE_LEVEL_VERBOSE, + DBG_INIT, + "KdDebuggerDataBlock size = %lx, offset = 0x%lx", + kdbg_size, + kdbg_offset); /* * KeCapturePersistentThreadState is supposed to save Small Memory Dump to the buffer. @@ -164,35 +169,28 @@ NTSTATUS FwCfgEvtDeviceAdd(IN WDFDRIVER Driver, IN PWDFDEVICE_INIT DeviceInit) if (!NT_SUCCESS(status)) { - TraceEvents(TRACE_LEVEL_ERROR, DBG_INIT, - "WdfDeviceCreate failed: %!STATUS!", status); + TraceEvents(TRACE_LEVEL_ERROR, DBG_INIT, "WdfDeviceCreate failed: %!STATUS!", status); return status; } ctx = GetDeviceContext(device); memset(ctx, 0, sizeof(*ctx)); - WDF_DMA_ENABLER_CONFIG_INIT(&dmaEnablerConfig, WdfDmaProfilePacket64, - sizeof(CBUF_DATA)); - status = WdfDmaEnablerCreate(device, &dmaEnablerConfig, - WDF_NO_OBJECT_ATTRIBUTES, &ctx->dmaEnabler); + WDF_DMA_ENABLER_CONFIG_INIT(&dmaEnablerConfig, WdfDmaProfilePacket64, sizeof(CBUF_DATA)); + status = WdfDmaEnablerCreate(device, &dmaEnablerConfig, WDF_NO_OBJECT_ATTRIBUTES, &ctx->dmaEnabler); if (!NT_SUCCESS(status)) { - TraceEvents(TRACE_LEVEL_ERROR, DBG_INIT, - "Failed to create DMA enabler"); + TraceEvents(TRACE_LEVEL_ERROR, DBG_INIT, "Failed to create DMA enabler"); return status; } - TraceEvents(TRACE_LEVEL_VERBOSE, DBG_INIT, - "DMA enabler created"); + TraceEvents(TRACE_LEVEL_VERBOSE, DBG_INIT, "DMA enabler created"); - status = WdfCommonBufferCreate(ctx->dmaEnabler, sizeof(CBUF_DATA), - WDF_NO_OBJECT_ATTRIBUTES, &ctx->cbuf); + status = WdfCommonBufferCreate(ctx->dmaEnabler, sizeof(CBUF_DATA), WDF_NO_OBJECT_ATTRIBUTES, &ctx->cbuf); if (!NT_SUCCESS(status)) { - TraceEvents(TRACE_LEVEL_ERROR, DBG_INIT, - "Failed to create common buffer"); + TraceEvents(TRACE_LEVEL_ERROR, DBG_INIT, "Failed to create common buffer"); return status; } @@ -205,8 +203,7 @@ NTSTATUS FwCfgEvtDeviceAdd(IN WDFDRIVER Driver, IN PWDFDEVICE_INIT DeviceInit) return STATUS_SUCCESS; } -NTSTATUS DriverEntry(IN PDRIVER_OBJECT DriverObject, - IN PUNICODE_STRING RegistryPath) +NTSTATUS DriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath) { NTSTATUS status; WDF_DRIVER_CONFIG config; @@ -219,12 +216,10 @@ NTSTATUS DriverEntry(IN PDRIVER_OBJECT DriverObject, WDF_DRIVER_CONFIG_INIT(&config, FwCfgEvtDeviceAdd); - status = WdfDriverCreate(DriverObject, RegistryPath, &attributes, - &config, WDF_NO_HANDLE); + status = WdfDriverCreate(DriverObject, RegistryPath, &attributes, &config, WDF_NO_HANDLE); if (!NT_SUCCESS(status)) { - TraceEvents(TRACE_LEVEL_ERROR, DBG_INIT, - "WdfDriverCreate failed: %!STATUS!", status); + TraceEvents(TRACE_LEVEL_ERROR, DBG_INIT, "WdfDriverCreate failed: %!STATUS!", status); WPP_CLEANUP(DriverObject); } diff --git a/fwcfg64/driver.h b/fwcfg64/driver.h index e8c100108..990278e64 100644 --- a/fwcfg64/driver.h +++ b/fwcfg64/driver.h @@ -8,28 +8,29 @@ #include #include "fwcfg.h" -#define ENTRY_NAME "etc/vmcoreinfo" -#define VMCI_ELF_NOTE_NAME "VMCOREINFO" -#define DUMP_TYPE_FULL 1 -#define VMCOREINFO_FORMAT_ELF 0x1 +#define ENTRY_NAME "etc/vmcoreinfo" +#define VMCI_ELF_NOTE_NAME "VMCOREINFO" +#define DUMP_TYPE_FULL 1 +#define VMCOREINFO_FORMAT_ELF 0x1 #ifdef _AMD64_ - #define DUMP_HDR_SIZE (PAGE_SIZE * 2) - #define MINIDUMP_OFFSET_KDBG_OFFSET (DUMP_HDR_SIZE + 0x70) - #define MINIDUMP_OFFSET_KDBG_SIZE (DUMP_HDR_SIZE + 0x74) - #define DUMP_HDR_OFFSET_BUGCHECK_PARAM1 0x40 +#define DUMP_HDR_SIZE (PAGE_SIZE * 2) +#define MINIDUMP_OFFSET_KDBG_OFFSET (DUMP_HDR_SIZE + 0x70) +#define MINIDUMP_OFFSET_KDBG_SIZE (DUMP_HDR_SIZE + 0x74) +#define DUMP_HDR_OFFSET_BUGCHECK_PARAM1 0x40 #else - #define DUMP_HDR_SIZE (PAGE_SIZE) - #define MINIDUMP_OFFSET_KDBG_OFFSET (DUMP_HDR_SIZE + 0x58) - #define MINIDUMP_OFFSET_KDBG_SIZE (DUMP_HDR_SIZE + 0x5c) - #define DUMP_HDR_OFFSET_BUGCHECK_PARAM1 0x2c +#define DUMP_HDR_SIZE (PAGE_SIZE) +#define MINIDUMP_OFFSET_KDBG_OFFSET (DUMP_HDR_SIZE + 0x58) +#define MINIDUMP_OFFSET_KDBG_SIZE (DUMP_HDR_SIZE + 0x5c) +#define DUMP_HDR_OFFSET_BUGCHECK_PARAM1 0x2c #endif #define MINIDUMP_BUFFER_SIZE 0x40000 -#define ROUND_UP(x, n) (((x) + (n) - 1) & (-(n))) +#define ROUND_UP(x, n) (((x) + (n) - 1) & (-(n))) #pragma pack(push, 1) -typedef struct VMCOREINFO { +typedef struct VMCOREINFO +{ UINT16 host_fmt; UINT16 guest_fmt; UINT32 size; @@ -38,38 +39,42 @@ typedef struct VMCOREINFO { #pragma pack(pop) #pragma pack(push, 1) -typedef struct VMCI_ELF64_NOTE { - UINT32 n_namesz; - UINT32 n_descsz; - UINT32 n_type; - UCHAR n_name[ROUND_UP(sizeof(VMCI_ELF_NOTE_NAME), 4)]; - UCHAR n_desc[ROUND_UP(DUMP_HDR_SIZE, 4)]; +typedef struct VMCI_ELF64_NOTE +{ + UINT32 n_namesz; + UINT32 n_descsz; + UINT32 n_type; + UCHAR n_name[ROUND_UP(sizeof(VMCI_ELF_NOTE_NAME), 4)]; + UCHAR n_desc[ROUND_UP(DUMP_HDR_SIZE, 4)]; } VMCI_ELF64_NOTE, *PVMCI_ELF64_NOTE; #pragma pack(pop) -typedef struct CBUF_DATA { +typedef struct CBUF_DATA +{ VMCI_ELF64_NOTE note; VMCOREINFO vmci; FWCfgDmaAccess fwcfg_da; } CBUF_DATA, *PCBUF_DATA; -typedef struct VMCI_DATA { - PVMCOREINFO pVmci; - PVMCI_ELF64_NOTE pNote; - LONGLONG vmci_pa; - LONGLONG note_pa; +typedef struct VMCI_DATA +{ + PVMCOREINFO pVmci; + PVMCI_ELF64_NOTE pNote; + LONGLONG vmci_pa; + LONGLONG note_pa; } VMCI_DATA, *PVMCI_DATA; -typedef struct DEVICE_CONTEXT { - PVOID ioBase; - ULONG ioSize; - UINT16 index; - WDFCOMMONBUFFER cbuf; - WDFDMAENABLER dmaEnabler; - VMCI_DATA vmci_data; - FWCfgDmaAccess *dma_access; - LONGLONG dma_access_pa; - PUCHAR kdbg; +typedef struct DEVICE_CONTEXT +{ + PVOID ioBase; + ULONG ioSize; + UINT16 index; + WDFCOMMONBUFFER cbuf; + WDFDMAENABLER dmaEnabler; + VMCI_DATA vmci_data; + FWCfgDmaAccess *dma_access; + LONGLONG dma_access_pa; + PUCHAR kdbg; } DEVICE_CONTEXT, *PDEVICE_CONTEXT; ULONG NTAPI KeCapturePersistentThreadState(PCONTEXT Context, diff --git a/fwcfg64/fwcfg.c b/fwcfg64/fwcfg.c index e45aa7707..fc01569ed 100644 --- a/fwcfg64/fwcfg.c +++ b/fwcfg64/fwcfg.c @@ -19,12 +19,13 @@ NTSTATUS FWCfgCheckSig(PVOID ioBase) UCHAR signature[FW_CFG_SIG_SIZE]; FWCfgReadBlob(ioBase, FW_CFG_SIGNATURE, signature, FW_CFG_SIG_SIZE); - TraceEvents(TRACE_LEVEL_VERBOSE, DBG_ALL, - "Signature is [%.4s]", (PCHAR)signature); + TraceEvents(TRACE_LEVEL_VERBOSE, DBG_ALL, "Signature is [%.4s]", (PCHAR)signature); if (memcmp(signature, FW_CFG_QEMU, FW_CFG_SIG_SIZE)) { - TraceEvents(TRACE_LEVEL_ERROR, DBG_ALL, "Signature check failed, " - "["FW_CFG_QEMU"] expected"); + TraceEvents(TRACE_LEVEL_ERROR, + DBG_ALL, + "Signature check failed, " + "[" FW_CFG_QEMU "] expected"); return STATUS_BAD_DATA; } @@ -39,8 +40,11 @@ NTSTATUS FWCfgCheckFeatures(PVOID ioBase, UINT32 features) TraceEvents(TRACE_LEVEL_VERBOSE, DBG_ALL, "Features are 0x%lx", f_bitmap); if ((f_bitmap & features) != features) { - TraceEvents(TRACE_LEVEL_ERROR, DBG_ALL, "Features check failed, " - " 0x%lx expected", features); + TraceEvents(TRACE_LEVEL_ERROR, + DBG_ALL, + "Features check failed, " + " 0x%lx expected", + features); return STATUS_BAD_DATA; } @@ -89,8 +93,7 @@ UINT32 FWCfgGetEntriesNum(PVOID ioBase) return num; } -NTSTATUS FWCfgFindEntry(PVOID ioBase, const char *name, - PUSHORT index, ULONG size) +NTSTATUS FWCfgFindEntry(PVOID ioBase, const char *name, PUSHORT index, ULONG size) { UINT32 i; UINT32 total = FWCfgGetEntriesNum(ioBase); @@ -119,8 +122,12 @@ NTSTATUS FWCfgFindEntry(PVOID ioBase, const char *name, return STATUS_BAD_DATA; } -NTSTATUS FWCfgDmaSend(PVOID ioBase, LONGLONG data_pa, USHORT index, - UINT32 size, FWCfgDmaAccess *pDmaAccess, LONGLONG dmaAccess_pa) +NTSTATUS FWCfgDmaSend(PVOID ioBase, + LONGLONG data_pa, + USHORT index, + UINT32 size, + FWCfgDmaAccess *pDmaAccess, + LONGLONG dmaAccess_pa) { UINT16 ctrl = FW_CFG_DMA_CTL_SELECT | FW_CFG_DMA_CTL_WRITE; NTSTATUS status; diff --git a/fwcfg64/fwcfg.h b/fwcfg64/fwcfg.h index 70486d68a..f227bfa61 100644 --- a/fwcfg64/fwcfg.h +++ b/fwcfg64/fwcfg.h @@ -7,42 +7,44 @@ #pragma once #include -#define FW_CFG_CTL_OFFSET 0x00 -#define FW_CFG_DAT_OFFSET 0x01 -#define FW_CFG_DMA_OFFSET 0x04 +#define FW_CFG_CTL_OFFSET 0x00 +#define FW_CFG_DAT_OFFSET 0x01 +#define FW_CFG_DMA_OFFSET 0x04 -#define FW_CFG_CTL(p) ((PUCHAR)(p) + FW_CFG_CTL_OFFSET) -#define FW_CFG_DAT(p) ((PUCHAR)(p) + FW_CFG_DAT_OFFSET) -#define FW_CFG_DMA(p) ((PUCHAR)(p) + FW_CFG_DMA_OFFSET) +#define FW_CFG_CTL(p) ((PUCHAR)(p) + FW_CFG_CTL_OFFSET) +#define FW_CFG_DAT(p) ((PUCHAR)(p) + FW_CFG_DAT_OFFSET) +#define FW_CFG_DMA(p) ((PUCHAR)(p) + FW_CFG_DMA_OFFSET) -#define FW_CFG_SIG_SIZE 4 -#define FW_CFG_MAX_FILE_PATH 56 +#define FW_CFG_SIG_SIZE 4 +#define FW_CFG_MAX_FILE_PATH 56 -#define FW_CFG_SIGNATURE 0x00 -#define FW_CFG_ID 0x01 -#define FW_CFG_FILE_DIR 0x19 +#define FW_CFG_SIGNATURE 0x00 +#define FW_CFG_ID 0x01 +#define FW_CFG_FILE_DIR 0x19 -#define FW_CFG_VERSION 0x01 -#define FW_CFG_VERSION_DMA 0x02 +#define FW_CFG_VERSION 0x01 +#define FW_CFG_VERSION_DMA 0x02 -#define FW_CFG_DMA_CTL_ERROR 0x01 -#define FW_CFG_DMA_CTL_READ 0x02 -#define FW_CFG_DMA_CTL_SKIP 0x04 -#define FW_CFG_DMA_CTL_SELECT 0x08 -#define FW_CFG_DMA_CTL_WRITE 0x10 +#define FW_CFG_DMA_CTL_ERROR 0x01 +#define FW_CFG_DMA_CTL_READ 0x02 +#define FW_CFG_DMA_CTL_SKIP 0x04 +#define FW_CFG_DMA_CTL_SELECT 0x08 +#define FW_CFG_DMA_CTL_WRITE 0x10 -#define FW_CFG_QEMU "QEMU" -#define FW_CFG_QEMU_DMA 0x51454d5520434647ULL +#define FW_CFG_QEMU "QEMU" +#define FW_CFG_QEMU_DMA 0x51454d5520434647ULL #pragma pack(push, 1) -typedef struct FWCfgFile { - UINT32 size; - UINT16 select; - UINT16 reserved; - char name[FW_CFG_MAX_FILE_PATH]; +typedef struct FWCfgFile +{ + UINT32 size; + UINT16 select; + UINT16 reserved; + char name[FW_CFG_MAX_FILE_PATH]; } FWCfgFile; -typedef struct FWCfgDmaAccess { +typedef struct FWCfgDmaAccess +{ UINT32 control; UINT32 length; UINT64 address; @@ -56,7 +58,5 @@ UINT64 FWCfgReadDmaReg(PVOID ioBase); VOID FWCfgWriteDmaReg(PVOID ioBase, UINT64 val); NTSTATUS FWCfgCheckDma(PVOID ioBase); UINT32 FWCfgGetEntriesNum(PVOID ioBase); -NTSTATUS FWCfgFindEntry(PVOID ioBase, const char *name, - PUSHORT index, ULONG size); -NTSTATUS FWCfgDmaSend(PVOID ioBase, LONGLONG data_pa, USHORT index, - UINT32 size, FWCfgDmaAccess *da, LONGLONG da_pa); +NTSTATUS FWCfgFindEntry(PVOID ioBase, const char *name, PUSHORT index, ULONG size); +NTSTATUS FWCfgDmaSend(PVOID ioBase, LONGLONG data_pa, USHORT index, UINT32 size, FWCfgDmaAccess *da, LONGLONG da_pa); diff --git a/fwcfg64/power.c b/fwcfg64/power.c index cd131846c..9ee654cc2 100644 --- a/fwcfg64/power.c +++ b/fwcfg64/power.c @@ -26,8 +26,7 @@ VOID PutKdbg(PDEVICE_CONTEXT ctx) } } -NTSTATUS FwCfgEvtDeviceD0Exit(IN WDFDEVICE Device, - IN WDF_POWER_DEVICE_STATE TargetState) +NTSTATUS FwCfgEvtDeviceD0Exit(IN WDFDEVICE Device, IN WDF_POWER_DEVICE_STATE TargetState) { UNREFERENCED_PARAMETER(Device); UNREFERENCED_PARAMETER(TargetState); @@ -37,8 +36,7 @@ NTSTATUS FwCfgEvtDeviceD0Exit(IN WDFDEVICE Device, return STATUS_SUCCESS; } -NTSTATUS FwCfgEvtDeviceD0Entry(IN WDFDEVICE Device, - IN WDF_POWER_DEVICE_STATE PreviousState) +NTSTATUS FwCfgEvtDeviceD0Entry(IN WDFDEVICE Device, IN WDF_POWER_DEVICE_STATE PreviousState) { PDEVICE_CONTEXT ctx = GetDeviceContext(Device); NTSTATUS status; @@ -77,32 +75,25 @@ NTSTATUS PrepareVMCoreInfo(PDEVICE_CONTEXT ctx) { NTSTATUS status; - if (FWCfgCheckSig(ctx->ioBase) || - FWCfgCheckFeatures(ctx->ioBase, FW_CFG_VERSION_DMA) || - FWCfgCheckDma(ctx->ioBase)) + if (FWCfgCheckSig(ctx->ioBase) || FWCfgCheckFeatures(ctx->ioBase, FW_CFG_VERSION_DMA) || FWCfgCheckDma(ctx->ioBase)) { - TraceEvents(TRACE_LEVEL_ERROR, DBG_PNP, - "FwCfg device is not suitable for VMCoreInfo"); + TraceEvents(TRACE_LEVEL_ERROR, DBG_PNP, "FwCfg device is not suitable for VMCoreInfo"); return STATUS_UNSUCCESSFUL; } - status = FWCfgFindEntry(ctx->ioBase, ENTRY_NAME, &ctx->index, - sizeof(VMCOREINFO)); + status = FWCfgFindEntry(ctx->ioBase, ENTRY_NAME, &ctx->index, sizeof(VMCOREINFO)); if (!NT_SUCCESS(status)) { - TraceEvents(TRACE_LEVEL_ERROR, DBG_PNP, - "VMCoreInfo entry is not found"); + TraceEvents(TRACE_LEVEL_ERROR, DBG_PNP, "VMCoreInfo entry is not found"); return status; } - TraceEvents(TRACE_LEVEL_VERBOSE, DBG_PNP, - "VMCoreInfo entry index is 0x%x", ctx->index); + TraceEvents(TRACE_LEVEL_VERBOSE, DBG_PNP, "VMCoreInfo entry index is 0x%x", ctx->index); status = GetKdbg(ctx); if (!NT_SUCCESS(status)) { - TraceEvents(TRACE_LEVEL_ERROR, DBG_PNP, - "Failed to get KdDebuggerDataBlock"); + TraceEvents(TRACE_LEVEL_ERROR, DBG_PNP, "Failed to get KdDebuggerDataBlock"); return status; } @@ -110,8 +101,8 @@ NTSTATUS PrepareVMCoreInfo(PDEVICE_CONTEXT ctx) } NTSTATUS FwCfgEvtDevicePrepareHardware(IN WDFDEVICE Device, - IN WDFCMRESLIST Resources, - IN WDFCMRESLIST ResourcesTranslated) + IN WDFCMRESLIST Resources, + IN WDFCMRESLIST ResourcesTranslated) { ULONG i; PCM_PARTIAL_RESOURCE_DESCRIPTOR desc; @@ -127,14 +118,14 @@ NTSTATUS FwCfgEvtDevicePrepareHardware(IN WDFDEVICE Device, for (i = 0; i < WdfCmResourceListGetCount(ResourcesTranslated); i++) { desc = WdfCmResourceListGetDescriptor(ResourcesTranslated, i); - if (desc && - (desc->Type == CmResourceTypePort) && - (desc->Flags & CM_RESOURCE_PORT_IO)) + if (desc && (desc->Type == CmResourceTypePort) && (desc->Flags & CM_RESOURCE_PORT_IO)) { ctx->ioBase = (PVOID)(ULONG_PTR)desc->u.Port.Start.QuadPart; ctx->ioSize = desc->u.Port.Length; - TraceEvents(TRACE_LEVEL_VERBOSE, DBG_PNP, - "I/O ports: 0x%llx-0x%llx", (UINT64)ctx->ioBase, + TraceEvents(TRACE_LEVEL_VERBOSE, + DBG_PNP, + "I/O ports: 0x%llx-0x%llx", + (UINT64)ctx->ioBase, (UINT64)ctx->ioBase + ctx->ioSize); status = STATUS_SUCCESS; } @@ -159,8 +150,7 @@ NTSTATUS FwCfgEvtDevicePrepareHardware(IN WDFDEVICE Device, return STATUS_SUCCESS; } -NTSTATUS FwCfgEvtDeviceReleaseHardware(IN WDFDEVICE Device, - IN WDFCMRESLIST ResourcesTranslated) +NTSTATUS FwCfgEvtDeviceReleaseHardware(IN WDFDEVICE Device, IN WDFCMRESLIST ResourcesTranslated) { PDEVICE_CONTEXT ctx; diff --git a/fwcfg64/trace.h b/fwcfg64/trace.h index 429dcba6d..5755142d7 100644 --- a/fwcfg64/trace.h +++ b/fwcfg64/trace.h @@ -9,26 +9,18 @@ // Tracing GUID - 2C697E85-A518-427D-9D00-F95368D51E17 // -#define WPP_CONTROL_GUIDS \ - WPP_DEFINE_CONTROL_GUID( \ - VmcoreinfoTraceGuid, (2C697E85,A518,427D,9D00,F95368D51E17), \ - WPP_DEFINE_BIT(DBG_ALL) \ - WPP_DEFINE_BIT(DBG_INIT) \ - WPP_DEFINE_BIT(DBG_PNP) \ - WPP_DEFINE_BIT(DBG_POWER) \ - ) +#define WPP_CONTROL_GUIDS \ + WPP_DEFINE_CONTROL_GUID(VmcoreinfoTraceGuid, \ + (2C697E85, A518, 427D, 9D00, F95368D51E17), \ + WPP_DEFINE_BIT(DBG_ALL) WPP_DEFINE_BIT(DBG_INIT) WPP_DEFINE_BIT(DBG_PNP) WPP_DEFINE_BIT(DBG_POWER)) -#define WPP_FLAG_LEVEL_LOGGER(flag, level) \ - WPP_LEVEL_LOGGER(flag) +#define WPP_FLAG_LEVEL_LOGGER(flag, level) WPP_LEVEL_LOGGER(flag) -#define WPP_FLAG_LEVEL_ENABLED(flag, level) \ - (WPP_LEVEL_ENABLED(flag) && WPP_CONTROL(WPP_BIT_ ## flag).Level >= level) +#define WPP_FLAG_LEVEL_ENABLED(flag, level) (WPP_LEVEL_ENABLED(flag) && WPP_CONTROL(WPP_BIT_##flag).Level >= level) -#define WPP_LEVEL_FLAGS_LOGGER(lvl,flags) \ - WPP_LEVEL_LOGGER(flags) +#define WPP_LEVEL_FLAGS_LOGGER(lvl, flags) WPP_LEVEL_LOGGER(flags) -#define WPP_LEVEL_FLAGS_ENABLED(lvl, flags) \ - (WPP_LEVEL_ENABLED(flags) && WPP_CONTROL(WPP_BIT_ ## flags).Level >= lvl) +#define WPP_LEVEL_FLAGS_ENABLED(lvl, flags) (WPP_LEVEL_ENABLED(flags) && WPP_CONTROL(WPP_BIT_##flags).Level >= lvl) // // begin_wpp config