win-pvdrivers

changeset 1030:37c0c84a42e8

Tidy up KdPrints
author James Harper <james.harper@bendigoit.com.au>
date Wed Feb 20 20:49:26 2013 +1100 (2013-02-20)
parents 9af729600589
children 329b9b9d47ec
files xenpci/evtchn.c xenpci/gnttbl.c xenpci/xenbus.c xenpci/xenpci.c xenpci/xenpci_fdo.c
line diff
     1.1 --- a/xenpci/evtchn.c	Wed Feb 20 19:16:08 2013 +1100
     1.2 +++ b/xenpci/evtchn.c	Wed Feb 20 20:49:26 2013 +1100
     1.3 @@ -111,16 +111,16 @@ to CPU != 0, but we should always use vc
     1.4    UNREFERENCED_PARAMETER(message_id);
     1.5  
     1.6    if (xpdd->interrupts_masked) {
     1.7 -    KdPrint((__DRIVER_NAME "     unhandled interrupt\n"));
     1.8 +    FUNCTION_MSG("unhandled interrupt\n");
     1.9    }
    1.10  
    1.11    if (xpdd->hibernated) {
    1.12 -    KdPrint((__DRIVER_NAME "     interrupt while hibernated\n"));
    1.13 +    FUNCTION_MSG("interrupt while hibernated\n");
    1.14    }
    1.15  
    1.16    for (i = 0; i < ARRAY_SIZE(xpdd->evtchn_pending_pvt[pcpu]); i++) {
    1.17      if (xpdd->evtchn_pending_pvt[pcpu][i]) {
    1.18 -      KdPrint((__DRIVER_NAME "     Unacknowledged event word = %d, val = %p\n", i, xpdd->evtchn_pending_pvt[pcpu][i]));
    1.19 +      FUNCTION_MSG("Unacknowledged event word = %d, val = %p\n", i, xpdd->evtchn_pending_pvt[pcpu][i]);
    1.20        xpdd->evtchn_pending_pvt[pcpu][i] = 0;
    1.21      }
    1.22    }
    1.23 @@ -149,16 +149,16 @@ to CPU != 0, but we should always use vc
    1.24        switch (ev_action->type)
    1.25        {
    1.26        case EVT_ACTION_TYPE_NORMAL:
    1.27 -        //KdPrint((__DRIVER_NAME "     EVT_ACTION_TYPE_NORMAL port = %d\n", port));
    1.28 +        //FUNCTION_MSG("EVT_ACTION_TYPE_NORMAL port = %d\n", port);
    1.29          ev_action->ServiceRoutine(ev_action->ServiceContext);
    1.30          break;
    1.31        case EVT_ACTION_TYPE_DPC:
    1.32 -        //KdPrint((__DRIVER_NAME "     EVT_ACTION_TYPE_DPC port = %d\n", port));
    1.33 +        //FUNCTION_MSG("EVT_ACTION_TYPE_DPC port = %d\n", port);
    1.34          KeInsertQueueDpc(&ev_action->Dpc, NULL, NULL);
    1.35          break;
    1.36  #if 0
    1.37        case EVT_ACTION_TYPE_SUSPEND:
    1.38 -        KdPrint((__DRIVER_NAME "     EVT_ACTION_TYPE_SUSPEND\n"));
    1.39 +        FUNCTION_MSG("EVT_ACTION_TYPE_SUSPEND\n");
    1.40          for (i = 0; i < NR_EVENTS; i++)
    1.41          {
    1.42            if (!(xpdd->ev_actions[i].flags & EVT_ACTION_FLAGS_NO_SUSPEND))
    1.43 @@ -191,7 +191,7 @@ to CPU != 0, but we should always use vc
    1.44          break;
    1.45  #endif
    1.46        default:
    1.47 -        KdPrint((__DRIVER_NAME "     Unhandled Event!!! port=%d\n", port));
    1.48 +        FUNCTION_MSG("Unhandled Event!!! port=%d\n", port);
    1.49          break;
    1.50        }
    1.51      }
    1.52 @@ -236,9 +236,8 @@ EvtChn_Bind(PVOID Context, evtchn_port_t
    1.53  
    1.54    FUNCTION_ENTER();
    1.55    
    1.56 -  if (InterlockedCompareExchange((volatile LONG *)&action->type, EVT_ACTION_TYPE_NEW, EVT_ACTION_TYPE_EMPTY) != EVT_ACTION_TYPE_EMPTY)
    1.57 -  {
    1.58 -    KdPrint((__DRIVER_NAME " Handler for port %d already registered\n", port));
    1.59 +  if (InterlockedCompareExchange((volatile LONG *)&action->type, EVT_ACTION_TYPE_NEW, EVT_ACTION_TYPE_EMPTY) != EVT_ACTION_TYPE_EMPTY) {
    1.60 +    FUNCTION_MSG("Handler for port %d already registered\n", port);
    1.61      return STATUS_UNSUCCESSFUL;
    1.62    }
    1.63  
    1.64 @@ -257,16 +256,14 @@ EvtChn_Bind(PVOID Context, evtchn_port_t
    1.65  }
    1.66  
    1.67  NTSTATUS
    1.68 -EvtChn_BindDpc(PVOID Context, evtchn_port_t port, PXN_EVENT_CALLBACK ServiceRoutine, PVOID ServiceContext, ULONG flags)
    1.69 -{
    1.70 +EvtChn_BindDpc(PVOID Context, evtchn_port_t port, PXN_EVENT_CALLBACK ServiceRoutine, PVOID ServiceContext, ULONG flags) {
    1.71    PXENPCI_DEVICE_DATA xpdd = Context;
    1.72    ev_action_t *action = &xpdd->ev_actions[port];
    1.73  
    1.74    FUNCTION_ENTER();
    1.75    
    1.76 -  if (InterlockedCompareExchange((volatile LONG *)&action->type, EVT_ACTION_TYPE_NEW, EVT_ACTION_TYPE_EMPTY) != EVT_ACTION_TYPE_EMPTY)
    1.77 -  {
    1.78 -    KdPrint((__DRIVER_NAME " Handler for port %d already registered\n", port));
    1.79 +  if (InterlockedCompareExchange((volatile LONG *)&action->type, EVT_ACTION_TYPE_NEW, EVT_ACTION_TYPE_EMPTY) != EVT_ACTION_TYPE_EMPTY) {
    1.80 +    FUNCTION_MSG(" Handler for port %d already registered\n", port);
    1.81      return STATUS_UNSUCCESSFUL;
    1.82    }
    1.83  
    1.84 @@ -295,7 +292,7 @@ EvtChn_BindIrq(PVOID Context, evtchn_por
    1.85    
    1.86    if (InterlockedCompareExchange((volatile LONG *)&action->type, EVT_ACTION_TYPE_NEW, EVT_ACTION_TYPE_EMPTY) != EVT_ACTION_TYPE_EMPTY)
    1.87    {
    1.88 -    KdPrint((__DRIVER_NAME " Handler for port %d already registered\n", port));
    1.89 +    FUNCTION_MSG("Handler for port %d already registered\n", port);
    1.90      return STATUS_UNSUCCESSFUL;
    1.91    }
    1.92  
    1.93 @@ -441,7 +438,7 @@ EvtChn_Init(PXENPCI_DEVICE_DATA xpdd)
    1.94    KeMemoryBarrier();
    1.95  
    1.96    result = hvm_set_parameter(xpdd, HVM_PARAM_CALLBACK_IRQ, xpdd->irq_number);
    1.97 -  KdPrint((__DRIVER_NAME "     hvm_set_parameter(HVM_PARAM_CALLBACK_IRQ, %d) = %d\n", xpdd->irq_number, (ULONG)result));
    1.98 +  FUNCTION_MSG("hvm_set_parameter(HVM_PARAM_CALLBACK_IRQ, %d) = %d\n", xpdd->irq_number, (ULONG)result);
    1.99  
   1.100    for (i = 0; i < MAX_VIRT_CPUS; i++)
   1.101      xpdd->shared_info_area->vcpu_info[i].evtchn_upcall_mask = 0;  
   1.102 @@ -453,7 +450,7 @@ EvtChn_Init(PXENPCI_DEVICE_DATA xpdd)
   1.103    xpdd->pdo_event_channel = EvtChn_AllocIpi(xpdd, 0);
   1.104    EvtChn_BindDpc(xpdd, xpdd->pdo_event_channel, EvtChn_PdoEventChannelDpc, xpdd, EVT_ACTION_FLAGS_DEFAULT);
   1.105    xpdd->ev_actions[xpdd->pdo_event_channel].type = EVT_ACTION_TYPE_SUSPEND; /* override dpc type */
   1.106 -  KdPrint((__DRIVER_NAME "     pdo_event_channel = %d\n", xpdd->pdo_event_channel));
   1.107 +  FUNCTION_MSG("pdo_event_channel = %d\n", xpdd->pdo_event_channel);
   1.108  #endif  
   1.109  
   1.110    FUNCTION_EXIT();
     2.1 --- a/xenpci/gnttbl.c	Wed Feb 20 19:16:08 2013 +1100
     2.2 +++ b/xenpci/gnttbl.c	Wed Feb 20 20:49:26 2013 +1100
     2.3 @@ -28,7 +28,7 @@ GntTbl_PutRef(PVOID Context, grant_ref_t
     2.4    
     2.5  #if DBG
     2.6    if (xpdd->gnttbl_tag[ref].tag != tag)
     2.7 -    KdPrint((__DRIVER_NAME "     Grant Entry %d for %.4s doesn't match %.4s\n", ref, (PUCHAR)&tag, (PUCHAR)&xpdd->gnttbl_tag[ref].tag));
     2.8 +    FUNCTION_MSG("Grant Entry %d for %.4s doesn't match %.4s\n", ref, (PUCHAR)&tag, (PUCHAR)&xpdd->gnttbl_tag[ref].tag);
     2.9    XN_ASSERT(xpdd->gnttbl_tag[ref].tag == tag);
    2.10    xpdd->gnttbl_tag[ref].tag = 0;
    2.11    xpdd->gnttbl_tag[ref].generation = (ULONG)-1;
    2.12 @@ -47,13 +47,13 @@ GntTbl_GetRef(PVOID Context, ULONG tag)
    2.13  
    2.14    if (!stack_pop(xpdd->gnttbl_ss, &ptr_ref))
    2.15    {
    2.16 -    KdPrint((__DRIVER_NAME "     No free grant refs\n"));
    2.17 +    FUNCTION_MSG("No free grant refs\n");
    2.18      return INVALID_GRANT_REF;
    2.19    }
    2.20    ref = (grant_ref_t)(ULONG_PTR)ptr_ref;
    2.21  #if DBG
    2.22    if (xpdd->gnttbl_tag[ref].tag)
    2.23 -    KdPrint((__DRIVER_NAME "     Grant Entry %d for %.4s in use by %.4s\n", ref, (PUCHAR)&tag, (PUCHAR)&xpdd->gnttbl_tag[ref].tag));
    2.24 +    FUNCTION_MSG("Grant Entry %d for %.4s in use by %.4s\n", ref, (PUCHAR)&tag, (PUCHAR)&xpdd->gnttbl_tag[ref].tag);
    2.25    XN_ASSERT(!xpdd->gnttbl_tag[ref].tag);
    2.26    xpdd->gnttbl_tag[ref].generation = xpdd->gnttbl_generation;
    2.27    xpdd->gnttbl_tag[ref].tag = tag;
    2.28 @@ -78,7 +78,7 @@ GntTbl_Map(PVOID Context, unsigned int s
    2.29      xatp.gpfn = (xen_pfn_t)MmGetMdlPfnArray(xpdd->gnttbl_mdl)[i];
    2.30      if (HYPERVISOR_memory_op(xpdd, XENMEM_add_to_physmap, &xatp))
    2.31      {
    2.32 -      KdPrint((__DRIVER_NAME "     *** ERROR MAPPING FRAME %d ***\n", i));
    2.33 +      FUNCTION_MSG("*** ERROR MAPPING FRAME %d ***\n", i);
    2.34      }
    2.35    } while (i-- > start_idx);
    2.36    FUNCTION_EXIT();
    2.37 @@ -97,8 +97,6 @@ GntTbl_GrantAccess(
    2.38  {
    2.39    PXENPCI_DEVICE_DATA xpdd = Context;
    2.40  
    2.41 -  //KdPrint((__DRIVER_NAME " --> GntTbl_GrantAccess\n"));
    2.42 -
    2.43    if (ref == INVALID_GRANT_REF)
    2.44      ref = GntTbl_GetRef(Context, tag);
    2.45    if (ref == INVALID_GRANT_REF)
    2.46 @@ -112,9 +110,9 @@ GntTbl_GrantAccess(
    2.47    if (xpdd->gnttbl_table[ref].flags)
    2.48    {
    2.49  #if DBG
    2.50 -    KdPrint((__DRIVER_NAME "     Grant Entry %d for %.4s still in use by %.4s\n", ref, (PUCHAR)&tag, (PUCHAR)&xpdd->gnttbl_tag[ref].tag));
    2.51 +    FUNCTION_MSG("Grant Entry %d for %.4s still in use by %.4s\n", ref, (PUCHAR)&tag, (PUCHAR)&xpdd->gnttbl_tag[ref].tag);
    2.52  #else
    2.53 -    KdPrint((__DRIVER_NAME "     Grant Entry %d for %.4s still in use\n", ref, (PUCHAR)&tag));
    2.54 +    FUNCTION_MSG("Grant Entry %d for %.4s still in use\n", ref, (PUCHAR)&tag);
    2.55  #endif
    2.56    }
    2.57    XN_ASSERT(!xpdd->gnttbl_table[ref].flags);
    2.58 @@ -143,7 +141,7 @@ GntTbl_EndAccess(
    2.59    do {
    2.60      if ((flags = nflags) & (GTF_reading|GTF_writing))
    2.61      {
    2.62 -      KdPrint((__DRIVER_NAME "     Grant Entry %d for %.4s still use\n", ref, (PUCHAR)&tag));
    2.63 +      FUNCTION_MSG("Grant Entry %d for %.4s still use\n", ref, (PUCHAR)&tag);
    2.64        return FALSE;
    2.65      }
    2.66    } while ((nflags = InterlockedCompareExchange16(
    2.67 @@ -151,7 +149,7 @@ GntTbl_EndAccess(
    2.68  
    2.69    if (!keepref)
    2.70      GntTbl_PutRef(Context, ref, tag);
    2.71 -  //KdPrint((__DRIVER_NAME " <-- GntTbl_EndAccess\n"));
    2.72 +
    2.73    return TRUE;
    2.74  }
    2.75  
    2.76 @@ -166,7 +164,7 @@ GntTbl_QueryMaxFrames(PXENPCI_DEVICE_DAT
    2.77    rc = HYPERVISOR_grant_table_op(xpdd, GNTTABOP_query_size, &query, 1);
    2.78    if ((rc < 0) || (query.status != GNTST_okay))
    2.79    {
    2.80 -    KdPrint((__DRIVER_NAME "     ***CANNOT QUERY MAX GRANT FRAME***\n"));
    2.81 +    FUNCTION_MSG("***CANNOT QUERY MAX GRANT FRAME***\n");
    2.82      return 4; /* Legacy max supported number of frames */
    2.83    }
    2.84    return query.max_nr_frames;
    2.85 @@ -183,9 +181,9 @@ GntTbl_Init(PXENPCI_DEVICE_DATA xpdd)
    2.86    FUNCTION_ENTER();
    2.87    
    2.88    xpdd->grant_frames = GntTbl_QueryMaxFrames(xpdd);
    2.89 -  KdPrint((__DRIVER_NAME "     grant_frames = %d\n", xpdd->grant_frames));
    2.90 +  FUNCTION_MSG("grant_frames = %d\n", xpdd->grant_frames);
    2.91    grant_entries = min(NR_GRANT_ENTRIES, (xpdd->grant_frames * PAGE_SIZE / sizeof(grant_entry_t)));
    2.92 -  KdPrint((__DRIVER_NAME "     grant_entries = %d\n", grant_entries));
    2.93 +  FUNCTION_MSG("grant_entries = %d\n", grant_entries);
    2.94    #if DBG
    2.95    xpdd->gnttbl_tag = ExAllocatePoolWithTag(NonPagedPool, grant_entries * sizeof(grant_tag_t), XENPCI_POOL_TAG);
    2.96    RtlZeroMemory(xpdd->gnttbl_tag, grant_entries * sizeof(grant_tag_t));
    2.97 @@ -214,12 +212,12 @@ GntTbl_Init(PXENPCI_DEVICE_DATA xpdd)
    2.98      reservation.nr_extents = 1;
    2.99      #pragma warning(disable: 4127) /* conditional expression is constant */
   2.100      pfn = (xen_pfn_t)MmGetMdlPfnArray(xpdd->gnttbl_mdl)[i];
   2.101 -    KdPrint((__DRIVER_NAME "     pfn = %x\n", (ULONG)pfn));
   2.102 +    FUNCTION_MSG("pfn = %x\n", (ULONG)pfn);
   2.103      set_xen_guest_handle(reservation.extent_start, &pfn);
   2.104      
   2.105 -    KdPrint((__DRIVER_NAME "     Calling HYPERVISOR_memory_op - pfn = %x\n", (ULONG)pfn));
   2.106 +    FUNCTION_MSG("Calling HYPERVISOR_memory_op - pfn = %x\n", (ULONG)pfn);
   2.107      ret = HYPERVISOR_memory_op(xpdd, XENMEM_decrease_reservation, &reservation);
   2.108 -    KdPrint((__DRIVER_NAME "     decreased %d pages for grant table frame %d\n", ret, i));
   2.109 +    FUNCTION_MSG("decreased %d pages for grant table frame %d\n", ret, i);
   2.110    }
   2.111  
   2.112    stack_new(&xpdd->gnttbl_ss, grant_entries);
   2.113 @@ -249,7 +247,7 @@ GntTbl_Suspend(PXENPCI_DEVICE_DATA xpdd)
   2.114    {
   2.115      if (xpdd->gnttbl_tag[i].tag != 0) // && xpdd->gnttbl_tag[i].generation < xpdd->gnttbl_generation)
   2.116      {
   2.117 -      KdPrint((__DRIVER_NAME "     grant entry for %.4s from generation %d\n", (PUCHAR)&xpdd->gnttbl_tag[i].tag, xpdd->gnttbl_tag[i].generation));
   2.118 +      FUNCTION_MSG("grant entry for %.4s from generation %d\n", (PUCHAR)&xpdd->gnttbl_tag[i].tag, xpdd->gnttbl_tag[i].generation);
   2.119      }
   2.120    }
   2.121    xpdd->gnttbl_generation++;
   2.122 @@ -258,7 +256,7 @@ GntTbl_Suspend(PXENPCI_DEVICE_DATA xpdd)
   2.123    /* copy some grant refs and switch to an alternate freelist, but only on hiber */
   2.124    if (KeGetCurrentIrql() <= DISPATCH_LEVEL)
   2.125    {
   2.126 -    KdPrint((__DRIVER_NAME "     backing up grant ref stack\n"));
   2.127 +    FUNCTION_MSG("backing up grant ref stack\n");
   2.128      for (i = 0; i < HIBER_GREF_COUNT; i++)
   2.129      {
   2.130        xpdd->hiber_grefs[i] = INVALID_GRANT_REF;
   2.131 @@ -268,7 +266,7 @@ GntTbl_Suspend(PXENPCI_DEVICE_DATA xpdd)
   2.132        if ((xpdd->hiber_grefs[i] = GntTbl_GetRef(xpdd, (ULONG)'HIBR')) == INVALID_GRANT_REF)
   2.133          break;
   2.134      }
   2.135 -    KdPrint((__DRIVER_NAME "     %d grant refs reserved\n", i));
   2.136 +    FUNCTION_MSG("%d grant refs reserved\n", i);
   2.137      xpdd->gnttbl_ss_copy = xpdd->gnttbl_ss;
   2.138      stack_new(&xpdd->gnttbl_ss, HIBER_GREF_COUNT);
   2.139    }
   2.140 @@ -322,19 +320,19 @@ GntTbl_Resume(PXENPCI_DEVICE_DATA xpdd)
   2.141      reservation.nr_extents = 1;
   2.142      #pragma warning(disable: 4127) /* conditional expression is constant */
   2.143      pfn = (xen_pfn_t)MmGetMdlPfnArray(xpdd->gnttbl_mdl)[i];
   2.144 -    KdPrint((__DRIVER_NAME "     pfn = %x\n", (ULONG)pfn));
   2.145 +    FUNCTION_MSG("pfn = %x\n", (ULONG)pfn);
   2.146      set_xen_guest_handle(reservation.extent_start, &pfn);
   2.147      
   2.148 -    KdPrint((__DRIVER_NAME "     Calling HYPERVISOR_memory_op - pfn = %x\n", (ULONG)pfn));
   2.149 +    FUNCTION_MSG("Calling HYPERVISOR_memory_op - pfn = %x\n", (ULONG)pfn);
   2.150      ret = HYPERVISOR_memory_op(xpdd, XENMEM_decrease_reservation, &reservation);
   2.151 -    KdPrint((__DRIVER_NAME "     decreased %d pages for grant table frame %d\n", ret, i));
   2.152 +    FUNCTION_MSG("decreased %d pages for grant table frame %d\n", ret, i);
   2.153    }
   2.154  
   2.155    new_grant_frames = GntTbl_QueryMaxFrames(xpdd);
   2.156 -  KdPrint((__DRIVER_NAME "     new_grant_frames = %d\n", new_grant_frames));
   2.157 +  FUNCTION_MSG("new_grant_frames = %d\n", new_grant_frames);
   2.158    XN_ASSERT(new_grant_frames >= xpdd->grant_frames); // lazy
   2.159    result = GntTbl_Map(xpdd, 0, xpdd->grant_frames - 1);
   2.160 -  KdPrint((__DRIVER_NAME "     GntTbl_Map result = %d\n", result));
   2.161 +  FUNCTION_MSG("GntTbl_Map result = %d\n", result);
   2.162    memcpy(xpdd->gnttbl_table, xpdd->gnttbl_table_copy, xpdd->grant_frames * PAGE_SIZE);
   2.163    #if DBG
   2.164    grant_entries = min(NR_GRANT_ENTRIES, (xpdd->grant_frames * PAGE_SIZE / sizeof(grant_entry_t)));
   2.165 @@ -344,7 +342,7 @@ GntTbl_Resume(PXENPCI_DEVICE_DATA xpdd)
   2.166    /* switch back and put the hiber grants back again */
   2.167    if (xpdd->gnttbl_ss_copy)
   2.168    {
   2.169 -    KdPrint((__DRIVER_NAME "     restoring grant ref stack\n"));
   2.170 +    FUNCTION_MSG("restoring grant ref stack\n");
   2.171      stack_delete(xpdd->gnttbl_ss, NULL, NULL);
   2.172      xpdd->gnttbl_ss = xpdd->gnttbl_ss_copy;
   2.173      for (i = 0; i < HIBER_GREF_COUNT; i++)
     3.1 --- a/xenpci/xenbus.c	Wed Feb 20 19:16:08 2013 +1100
     3.2 +++ b/xenpci/xenbus.c	Wed Feb 20 20:49:26 2013 +1100
     3.3 @@ -173,7 +173,7 @@ XenBus_Read(
     3.4    char *res;
     3.5    char *msg;
     3.6  
     3.7 -  //KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
     3.8 +  //FUNCTION_ENTER();
     3.9  
    3.10    XN_ASSERT(KeGetCurrentIrql() < DISPATCH_LEVEL);
    3.11  
    3.12 @@ -189,7 +189,7 @@ XenBus_Read(
    3.13    ExFreePoolWithTag(rep, XENPCI_POOL_TAG);
    3.14    *value = res;
    3.15  
    3.16 -  //KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
    3.17 +  FUNCTION_EXIT();
    3.18  
    3.19    return NULL;
    3.20  }
    3.21 @@ -240,7 +240,7 @@ XenBus_WatchWorkItemProc(WDFWORKITEM wor
    3.22    index = atoi(path + strlen(path) + 1);
    3.23    if (index < 0 || index >= MAX_WATCH_ENTRIES)
    3.24    {
    3.25 -    KdPrint((__DRIVER_NAME "     Watch index %d out of range\n", index));
    3.26 +    FUNCTION_MSG("Watch index %d out of range\n", index);
    3.27      WdfObjectDelete(workitem);
    3.28      //FUNCTION_ENTER();
    3.29      return;
    3.30 @@ -249,7 +249,7 @@ XenBus_WatchWorkItemProc(WDFWORKITEM wor
    3.31    entry = &xpdd->XenBus_WatchEntries[index];
    3.32    if (!entry->Active || !entry->ServiceRoutine)
    3.33    {
    3.34 -    KdPrint((__DRIVER_NAME "     No watch for index %d\n", index));
    3.35 +    FUNCTION_MSG("No watch for index %d\n", index);
    3.36      ExReleaseFastMutex(&xpdd->xb_watch_mutex);
    3.37      WdfObjectDelete(workitem);
    3.38      //FUNCTION_ENTER();
    3.39 @@ -289,7 +289,7 @@ XenBus_Dpc(PVOID ServiceContext)
    3.40      {
    3.41        if (rsp_prod - xpdd->xen_store_interface->rsp_cons < sizeof(xsd_sockmsg_t))
    3.42        {
    3.43 -        //KdPrint((__DRIVER_NAME " +++ Message incomplete (not even a full header)\n"));
    3.44 +        //FUNCTION_MSG("Message incomplete (not even a full header)\n");
    3.45          break;
    3.46        }
    3.47        memcpy_from_ring(xpdd->xen_store_interface->rsp, &msg,
    3.48 @@ -311,7 +311,7 @@ XenBus_Dpc(PVOID ServiceContext)
    3.49  
    3.50      if (xpdd->xb_msg_offset < sizeof(xsd_sockmsg_t) + xpdd->xb_msg->len)
    3.51      {
    3.52 -      //KdPrint((__DRIVER_NAME " +++ Message incomplete (header but not full body)\n"));
    3.53 +      //FUNCTION_MSG("Message incomplete (header but not full body)\n");
    3.54        EvtChn_Notify(xpdd, xpdd->xenbus_event); /* there is room on the ring now */
    3.55        break;
    3.56      }
    3.57 @@ -334,7 +334,7 @@ XenBus_Dpc(PVOID ServiceContext)
    3.58        status = WdfWorkItemCreate(&workitem_config, &workitem_attributes, &workitem);
    3.59        if (!NT_SUCCESS(status))
    3.60        {
    3.61 -        KdPrint((__DRIVER_NAME "     Failed to create work item for watch\n"));
    3.62 +        FUNCTION_MSG("Failed to create work item for watch\n");
    3.63          continue;
    3.64        }
    3.65        memcpy(WdfObjectGetTypedContext(workitem, xsd_sockmsg_t), xpdd->xb_msg, xpdd->xb_msg_offset);
    3.66 @@ -572,7 +572,7 @@ XenBus_Resume(PXENPCI_DEVICE_DATA xpdd)
    3.67    {
    3.68      if (xpdd->XenBus_WatchEntries[i].Active)
    3.69      {
    3.70 -      KdPrint((__DRIVER_NAME "     Adding watch for path = %s\n", xpdd->XenBus_WatchEntries[i].Path));
    3.71 +      FUNCTION_MSG("Adding watch for path = %s\n", xpdd->XenBus_WatchEntries[i].Path);
    3.72        XenBus_SendAddWatch(xpdd, XBT_NIL, xpdd->XenBus_WatchEntries[i].Path, i);
    3.73      }
    3.74    }
    3.75 @@ -607,7 +607,7 @@ XenBus_AddWatch(
    3.76    
    3.77    if (i == MAX_WATCH_ENTRIES)
    3.78    {
    3.79 -    KdPrint((__DRIVER_NAME " +++ No more watch slots left\n"));
    3.80 +    FUNCTION_MSG("No more watch slots left\n");
    3.81      ExReleaseFastMutex(&xpdd->xb_watch_mutex);
    3.82      return NULL;
    3.83    }
    3.84 @@ -656,14 +656,14 @@ XenBus_RemWatch(
    3.85          && !strcmp(xpdd->XenBus_WatchEntries[i].Path, Path)
    3.86          && xpdd->XenBus_WatchEntries[i].ServiceRoutine == ServiceRoutine
    3.87          && xpdd->XenBus_WatchEntries[i].ServiceContext == ServiceContext) {
    3.88 -      KdPrint((__DRIVER_NAME "     Match\n"));
    3.89 +      FUNCTION_MSG("Match\n");
    3.90        break;
    3.91      }
    3.92    }
    3.93  
    3.94    if (i == MAX_WATCH_ENTRIES) {
    3.95      ExReleaseFastMutex(&xpdd->xb_watch_mutex);
    3.96 -    KdPrint((__DRIVER_NAME "     Watch not set for %s - can't remove\n", Path));
    3.97 +    FUNCTION_MSG("Watch not set for %s - can't remove\n", Path);
    3.98      return NULL;
    3.99    }
   3.100  
     4.1 --- a/xenpci/xenpci.c	Wed Feb 20 19:16:08 2013 +1100
     4.2 +++ b/xenpci/xenpci.c	Wed Feb 20 20:49:26 2013 +1100
     4.3 @@ -64,16 +64,16 @@ XenPci_EvtDeviceUsageNotification(WDFDEV
     4.4    switch (notification_type)
     4.5    {
     4.6    case WdfSpecialFilePaging:
     4.7 -    KdPrint((__DRIVER_NAME "     notification_type = Paging, flag = %d\n", is_in_notification_path));
     4.8 +    FUNCTION_MSG("notification_type = Paging, flag = %d\n", is_in_notification_path);
     4.9      break;
    4.10    case WdfSpecialFileHibernation:
    4.11 -    KdPrint((__DRIVER_NAME "     notification_type = Hibernation, flag = %d\n", is_in_notification_path));
    4.12 +    FUNCTION_MSG("notification_type = Hibernation, flag = %d\n", is_in_notification_path);
    4.13      break;
    4.14    case WdfSpecialFileDump:
    4.15 -    KdPrint((__DRIVER_NAME "     notification_type = Dump, flag = %d\n", is_in_notification_path));
    4.16 +    FUNCTION_MSG("notification_type = Dump, flag = %d\n", is_in_notification_path);
    4.17      break;
    4.18    default:
    4.19 -    KdPrint((__DRIVER_NAME "     notification_type = %d, flag = %d\n", notification_type, is_in_notification_path));
    4.20 +    FUNCTION_MSG("notification_type = %d, flag = %d\n", notification_type, is_in_notification_path);
    4.21      break;
    4.22    }
    4.23  
    4.24 @@ -140,7 +140,7 @@ XenPci_EvtDeviceAdd_XenPci(WDFDRIVER dri
    4.25    WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&device_attributes, XENPCI_DEVICE_DATA);
    4.26    status = WdfDeviceCreate(&device_init, &device_attributes, &device);
    4.27    if (!NT_SUCCESS(status)) {
    4.28 -    KdPrint(("Error creating device %08x\n", status));
    4.29 +    FUNCTION_MSG("Error creating device %08x\n", status);
    4.30      return status;
    4.31    }
    4.32  
    4.33 @@ -166,11 +166,11 @@ XenPci_EvtDeviceAdd_XenPci(WDFDRIVER dri
    4.34    if (NT_SUCCESS(status)) {
    4.35      status = WdfRegistryQueryMultiString(param_key, &veto_devices_name, WDF_NO_OBJECT_ATTRIBUTES, veto_devices);
    4.36      if (!NT_SUCCESS(status)) {
    4.37 -      KdPrint(("Error reading parameters/veto_devices value %08x\n", status));
    4.38 +      FUNCTION_MSG("Error reading parameters/veto_devices value %08x\n", status);
    4.39      }
    4.40      WdfRegistryClose(param_key);
    4.41    } else {
    4.42 -    KdPrint(("Error opening parameters key %08x\n", status));
    4.43 +    FUNCTION_MSG("Error opening parameters key %08x\n", status);
    4.44    }
    4.45  
    4.46    InitializeListHead(&xpdd->veto_list);
    4.47 @@ -207,7 +207,7 @@ XenPci_EvtDeviceAdd_XenPci(WDFDRIVER dri
    4.48    queue_config.EvtIoDefault = XenPci_EvtIoDefault;
    4.49    status = WdfIoQueueCreate(device, &queue_config, WDF_NO_OBJECT_ATTRIBUTES, &xpdd->io_queue);
    4.50    if (!NT_SUCCESS(status)) {
    4.51 -      KdPrint(("Error creating queue 0x%x\n", status));
    4.52 +      FUNCTION_MSG("Error creating queue 0x%x\n", status);
    4.53        return status;
    4.54    }
    4.55    
    4.56 @@ -218,28 +218,28 @@ XenPci_EvtDeviceAdd_XenPci(WDFDRIVER dri
    4.57    status = WdfInterruptCreate(device, &interrupt_config, WDF_NO_OBJECT_ATTRIBUTES, &xpdd->interrupt);
    4.58    if (!NT_SUCCESS(status))
    4.59    {
    4.60 -    KdPrint(("Error creating interrupt 0x%x\n", status));
    4.61 +    FUNCTION_MSG("Error creating interrupt 0x%x\n", status);
    4.62      return status;
    4.63    }
    4.64    
    4.65    RtlInitUnicodeString(&reference, L"xenbus");
    4.66    status = WdfDeviceCreateDeviceInterface(device, &GUID_DEVINTERFACE_XENBUS, &reference);
    4.67    if (!NT_SUCCESS(status)) {
    4.68 -      KdPrint(("Error registering device interface 0x%x\n", status));
    4.69 +      FUNCTION_MSG("Error registering device interface 0x%x\n", status);
    4.70        return status;
    4.71    }
    4.72  
    4.73    RtlInitUnicodeString(&reference, L"evtchn");
    4.74    status = WdfDeviceCreateDeviceInterface(device, &GUID_DEVINTERFACE_EVTCHN, &reference);
    4.75    if (!NT_SUCCESS(status)) {
    4.76 -      KdPrint(("Error registering device interface 0x%x\n", status));
    4.77 +      FUNCTION_MSG("Error registering device interface 0x%x\n", status);
    4.78        return status;
    4.79    }
    4.80  
    4.81    RtlInitUnicodeString(&reference, L"gntdev");
    4.82    status = WdfDeviceCreateDeviceInterface(device, &GUID_DEVINTERFACE_GNTDEV, &reference);
    4.83    if (!NT_SUCCESS(status)) {
    4.84 -      KdPrint(("Error registering device interface 0x%x\n", status));
    4.85 +      FUNCTION_MSG("Error registering device interface 0x%x\n", status);
    4.86        return status;
    4.87    }
    4.88  
    4.89 @@ -277,7 +277,7 @@ XenPci_IdSuffixMatches(PWDFDEVICE_INIT d
    4.90    ULONG properties[] = {DevicePropertyCompatibleIDs, DevicePropertyHardwareID};
    4.91    int i;
    4.92    
    4.93 -//  KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
    4.94 +//  FUNCTION_ENTER();
    4.95    for (i = 0; i < ARRAY_SIZE(properties); i++)
    4.96    {
    4.97  
    4.98 @@ -396,7 +396,7 @@ VOID
    4.99  XenPci_HideQemuDevices() {
   4.100    #pragma warning(suppress:28138)
   4.101    WRITE_PORT_USHORT(XEN_IOPORT_DEVICE_MASK, (USHORT)qemu_hide_flags_value); //QEMU_UNPLUG_ALL_IDE_DISKS|QEMU_UNPLUG_ALL_NICS);
   4.102 -  KdPrint((__DRIVER_NAME "     Disabled qemu devices %02x\n", qemu_hide_flags_value));
   4.103 +  FUNCTION_MSG("Disabled qemu devices %02x\n", qemu_hide_flags_value);
   4.104  }
   4.105  
   4.106  static BOOLEAN
   4.107 @@ -406,7 +406,7 @@ XenPci_CheckHideQemuDevices()
   4.108    if (READ_PORT_USHORT(XEN_IOPORT_MAGIC) == 0x49d2) {
   4.109      #pragma warning(suppress:28138)
   4.110      qemu_protocol_version = READ_PORT_UCHAR(XEN_IOPORT_VERSION);
   4.111 -    KdPrint((__DRIVER_NAME "     Version = %d\n", qemu_protocol_version));
   4.112 +    FUNCTION_MSG("Version = %d\n", qemu_protocol_version);
   4.113      switch(qemu_protocol_version) {
   4.114      case 1:
   4.115        #pragma warning(suppress:28138)
   4.116 @@ -416,14 +416,14 @@ XenPci_CheckHideQemuDevices()
   4.117        #pragma warning(suppress:28138)
   4.118        if (READ_PORT_USHORT(XEN_IOPORT_MAGIC) != 0x49d2)
   4.119        {
   4.120 -        KdPrint((__DRIVER_NAME "     Blacklisted\n"));
   4.121 +        FUNCTION_MSG("Blacklisted\n");
   4.122          break;
   4.123        }
   4.124        /* fall through */
   4.125      case 0:
   4.126        return TRUE;
   4.127      default:
   4.128 -      KdPrint((__DRIVER_NAME "     Unknown qemu version %d\n", qemu_protocol_version));
   4.129 +      FUNCTION_MSG("Unknown qemu version %d\n", qemu_protocol_version);
   4.130        break;
   4.131      }
   4.132    }
   4.133 @@ -457,7 +457,7 @@ XenPci_FixLoadOrder()
   4.134    status = WdfRegistryOpenKey(NULL, &sgo_name, KEY_QUERY_VALUE, WDF_NO_OBJECT_ATTRIBUTES, &sgo_key);
   4.135    if (!NT_SUCCESS(status))
   4.136    {
   4.137 -    KdPrint((__DRIVER_NAME "     Error opening ServiceGroupOrder key %08x\n", status));
   4.138 +    FUNCTION_MSG("Error opening ServiceGroupOrder key %08x\n", status);
   4.139      return;
   4.140    }
   4.141    WdfCollectionCreate(WDF_NO_OBJECT_ATTRIBUTES, &old_load_order);
   4.142 @@ -465,12 +465,12 @@ XenPci_FixLoadOrder()
   4.143    status = WdfRegistryQueryMultiString(sgo_key, &list_name, WDF_NO_OBJECT_ATTRIBUTES, old_load_order);
   4.144    if (!NT_SUCCESS(status))
   4.145    {
   4.146 -    KdPrint((__DRIVER_NAME "     Error reading ServiceGroupOrder\\List value %08x\n", status));
   4.147 +    FUNCTION_MSG("Error reading ServiceGroupOrder\\List value %08x\n", status);
   4.148      WdfObjectDelete(new_load_order);
   4.149      WdfObjectDelete(old_load_order);
   4.150      return;
   4.151    }
   4.152 -  //KdPrint((__DRIVER_NAME "     Current Order:\n"));        
   4.153 +  //FUNCTION_MSG("Current Order:\n");        
   4.154    for (i = 0; i < WdfCollectionGetCount(old_load_order); i++)
   4.155    {
   4.156      WDFOBJECT ws = WdfCollectionGetItem(old_load_order, i);
   4.157 @@ -484,12 +484,12 @@ XenPci_FixLoadOrder()
   4.158        xenpci_group_index = (ULONG)i;         
   4.159      if (!RtlCompareUnicodeString(&val, &boot_bus_extender_name, TRUE))
   4.160        boot_bus_extender_index = (ULONG)i;         
   4.161 -    //KdPrint((__DRIVER_NAME "       %wZ\n", &val));        
   4.162 +    //FUNCTION_MSG("  %wZ\n", &val);        
   4.163    }
   4.164 -  KdPrint((__DRIVER_NAME "     dummy_group_index = %d\n", dummy_group_index));
   4.165 -  KdPrint((__DRIVER_NAME "     wdf_load_group_index = %d\n", wdf_load_group_index));
   4.166 -  KdPrint((__DRIVER_NAME "     xenpci_group_index = %d\n", xenpci_group_index));
   4.167 -  KdPrint((__DRIVER_NAME "     boot_bus_extender_index = %d\n", boot_bus_extender_index));
   4.168 +  FUNCTION_MSG("dummy_group_index = %d\n", dummy_group_index);
   4.169 +  FUNCTION_MSG("wdf_load_group_index = %d\n", wdf_load_group_index);
   4.170 +  FUNCTION_MSG("xenpci_group_index = %d\n", xenpci_group_index);
   4.171 +  FUNCTION_MSG("boot_bus_extender_index = %d\n", boot_bus_extender_index);
   4.172    if (boot_bus_extender_index == -1)
   4.173    {
   4.174      WdfObjectDelete(new_load_order);
   4.175 @@ -535,13 +535,13 @@ XenPci_FixLoadOrder()
   4.176      WdfCollectionAdd(new_load_order, ws);
   4.177    }
   4.178    WdfRegistryAssignMultiString(sgo_key, &list_name, new_load_order);
   4.179 -  //KdPrint((__DRIVER_NAME "     New Order:\n"));        
   4.180 +  //FUNCTION_MSG("New Order:\n");        
   4.181    for (i = 0; i < WdfCollectionGetCount(new_load_order); i++)
   4.182    {
   4.183      WDFOBJECT ws = WdfCollectionGetItem(new_load_order, i);
   4.184      UNICODE_STRING val;
   4.185      WdfStringGetUnicodeString(ws, &val);
   4.186 -    //KdPrint((__DRIVER_NAME "       %wZ\n", &val));        
   4.187 +    //FUNCTION_MSG("  %wZ\n", &val);        
   4.188    }
   4.189    WdfObjectDelete(new_load_order);
   4.190    WdfObjectDelete(old_load_order);
   4.191 @@ -647,15 +647,11 @@ DriverEntry(PDRIVER_OBJECT DriverObject,
   4.192    }
   4.193  #endif
   4.194  
   4.195 -  /* again after enabling DbgPrint hooking */
   4.196 -  KdPrint((__DRIVER_NAME " " VER_FILEVERSION_STR "\n"));
   4.197 -
   4.198 -  
   4.199    WDF_DRIVER_CONFIG_INIT(&config, XenPci_EvtDeviceAdd);
   4.200    config.EvtDriverUnload = XenPci_EvtDriverUnload;
   4.201    status = WdfDriverCreate(DriverObject, RegistryPath, WDF_NO_OBJECT_ATTRIBUTES, &config, &driver);
   4.202    if (!NT_SUCCESS(status)) {
   4.203 -    KdPrint((__DRIVER_NAME "     WdfDriverCreate failed with status 0x%x\n", status));
   4.204 +    FUNCTION_MSG("WdfDriverCreate failed with status 0x%x\n", status);
   4.205      FUNCTION_EXIT();
   4.206      //#if DBG
   4.207      //XenPci_UnHookDbgPrint();
   4.208 @@ -667,13 +663,13 @@ DriverEntry(PDRIVER_OBJECT DriverObject,
   4.209    
   4.210    status = WdfDriverOpenParametersRegistryKey(driver, KEY_QUERY_VALUE, &parent_attributes, &param_key);
   4.211    if (!NT_SUCCESS(status)) {
   4.212 -    KdPrint(("Error opening parameters key %08x\n", status));
   4.213 +    FUNCTION_MSG("Error opening parameters key %08x\n", status);
   4.214      goto error;
   4.215    }
   4.216  
   4.217    status = AuxKlibInitialize();
   4.218    if(!NT_SUCCESS(status)) {
   4.219 -    KdPrint((__DRIVER_NAME "     AuxKlibInitialize failed %08x\n", status));
   4.220 +    FUNCTION_MSG("AuxKlibInitialize failed %08x\n", status);
   4.221      goto error;
   4.222    }
   4.223  
   4.224 @@ -689,7 +685,7 @@ DriverEntry(PDRIVER_OBJECT DriverObject,
   4.225    }
   4.226    WdfRegistryClose(control_key);
   4.227  
   4.228 -  KdPrint((__DRIVER_NAME "     SystemStartOptions = %wZ\n", &system_start_options));
   4.229 +  FUNCTION_MSG("SystemStartOptions = %wZ\n", &system_start_options);
   4.230    
   4.231    always_patch = 0;
   4.232    WdfRegistryQueryULong(param_key, &txt_always_patch_name, &always_patch);
   4.233 @@ -698,7 +694,7 @@ DriverEntry(PDRIVER_OBJECT DriverObject,
   4.234      WDFKEY memory_key;
   4.235      ULONG verifier_value;
   4.236      
   4.237 -    KdPrint((__DRIVER_NAME "     PATCHTPR found\n"));
   4.238 +    FUNCTION_MSG("PATCHTPR found\n");
   4.239      
   4.240      tpr_patch_requested = TRUE;
   4.241      status = WdfRegistryOpenKey(NULL, &verifier_key_name, KEY_READ, &parent_attributes, &memory_key);
   4.242 @@ -708,7 +704,7 @@ DriverEntry(PDRIVER_OBJECT DriverObject,
   4.243        status = WdfRegistryQueryULong(memory_key, &verifier_value_name, &verifier_value);
   4.244        if (NT_SUCCESS(status) && verifier_value != 0)
   4.245        {
   4.246 -        KdPrint((__DRIVER_NAME "     Verifier active - not patching\n"));
   4.247 +        FUNCTION_MSG("Verifier active - not patching\n");
   4.248          tpr_patch_requested = FALSE;
   4.249        }
   4.250        WdfRegistryClose(memory_key);
   4.251 @@ -749,7 +745,7 @@ DriverEntry(PDRIVER_OBJECT DriverObject,
   4.252    return STATUS_SUCCESS;
   4.253  
   4.254  error:
   4.255 -  KdPrint(("Failed, returning %08x\n", status));
   4.256 +  FUNCTION_MSG("Failed, returning %08x\n", status);
   4.257    FUNCTION_EXIT();
   4.258    return status;
   4.259  }
     5.1 --- a/xenpci/xenpci_fdo.c	Wed Feb 20 19:16:08 2013 +1100
     5.2 +++ b/xenpci/xenpci_fdo.c	Wed Feb 20 20:49:26 2013 +1100
     5.3 @@ -52,14 +52,14 @@ XenPci_MapHalThenPatchKernel(PXENPCI_DEV
     5.4      amei = ExAllocatePoolWithTag(NonPagedPool, module_info_buffer_size, XENPCI_POOL_TAG);
     5.5    }
     5.6    
     5.7 -  KdPrint((__DRIVER_NAME "     AuxKlibQueryModuleInformation = %d\n", status));
     5.8 +  FUNCTION_MSG("AuxKlibQueryModuleInformation = %d\n", status);
     5.9    for (i = 0; i < module_info_buffer_size / sizeof(AUX_MODULE_EXTENDED_INFO); i++)
    5.10    {
    5.11      if (strcmp((PCHAR)amei[i].FullPathName + amei[i].FileNameOffset, "hal.dll") == 0)
    5.12      {
    5.13 -      KdPrint((__DRIVER_NAME "     hal.dll found at %p - %p\n", 
    5.14 +      FUNCTION_MSG("hal.dll found at %p - %p\n", 
    5.15          amei[i].BasicInfo.ImageBase,
    5.16 -        ((PUCHAR)amei[i].BasicInfo.ImageBase) + amei[i].ImageSize));
    5.17 +        ((PUCHAR)amei[i].BasicInfo.ImageBase) + amei[i].ImageSize);
    5.18        XenPci_PatchKernel(xpdd, amei[i].BasicInfo.ImageBase, amei[i].ImageSize);
    5.19      }
    5.20    }
    5.21 @@ -127,14 +127,14 @@ XenPci_Init(PXENPCI_DEVICE_DATA xpdd)
    5.22      xpdd->shared_info_area = MmMapIoSpace(xpdd->shared_info_area_unmapped,
    5.23        PAGE_SIZE, MmNonCached);
    5.24    }
    5.25 -  KdPrint((__DRIVER_NAME "     shared_info_area_unmapped.QuadPart = %lx\n", xpdd->shared_info_area_unmapped.QuadPart));
    5.26 +  FUNCTION_MSG("shared_info_area_unmapped.QuadPart = %lx\n", xpdd->shared_info_area_unmapped.QuadPart);
    5.27    xatp.domid = DOMID_SELF;
    5.28    xatp.idx = 0;
    5.29    xatp.space = XENMAPSPACE_shared_info;
    5.30    xatp.gpfn = (xen_pfn_t)(xpdd->shared_info_area_unmapped.QuadPart >> PAGE_SHIFT);
    5.31 -  KdPrint((__DRIVER_NAME "     gpfn = %x\n", xatp.gpfn));
    5.32 +  FUNCTION_MSG("gpfn = %x\n", xatp.gpfn);
    5.33    ret = HYPERVISOR_memory_op(xpdd, XENMEM_add_to_physmap, &xatp);
    5.34 -  KdPrint((__DRIVER_NAME "     hypervisor memory op (XENMAPSPACE_shared_info) ret = %d\n", ret));
    5.35 +  FUNCTION_MSG("hypervisor memory op (XENMAPSPACE_shared_info) ret = %d\n", ret);
    5.36  
    5.37    FUNCTION_EXIT();
    5.38  
    5.39 @@ -160,13 +160,13 @@ XenPci_SysrqHandler(char *path, PVOID co
    5.40  
    5.41    XenBus_Read(xpdd, XBT_NIL, SYSRQ_PATH, &value);
    5.42  
    5.43 -  KdPrint((__DRIVER_NAME "     SysRq Value = %s\n", value));
    5.44 +  FUNCTION_MSG("SysRq Value = %s\n", value);
    5.45  
    5.46    if (value != NULL && strlen(value) != 0) {
    5.47      letter = *value;
    5.48      res = XenBus_Write(xpdd, XBT_NIL, SYSRQ_PATH, "");
    5.49      if (res) {
    5.50 -      KdPrint(("Error writing sysrq path\n"));
    5.51 +      FUNCTION_MSG("Error writing sysrq path\n");
    5.52        XenPci_FreeMem(res);
    5.53        return;
    5.54      }
    5.55 @@ -190,7 +190,7 @@ XenPci_SysrqHandler(char *path, PVOID co
    5.56      XN_ASSERT(letter != 'A');
    5.57      break;
    5.58    default:
    5.59 -    KdPrint(("     Unhandled sysrq letter %c\n", letter));
    5.60 +    FUNCTION_MSG("Unhandled sysrq letter %c\n", letter);
    5.61      break;
    5.62    }
    5.63  
    5.64 @@ -244,7 +244,7 @@ XenPci_BalloonThreadProc(PVOID StartCont
    5.65      KeWaitForSingleObject(&xpdd->balloon_event, Executive, KernelMode, FALSE, ptimeout);
    5.66      if (xpdd->balloon_shutdown)
    5.67        PsTerminateSystemThread(0);
    5.68 -    KdPrint((__DRIVER_NAME "     Got balloon event, current = %d, target = %d\n", xpdd->current_memory_kb, xpdd->target_memory_kb));
    5.69 +    FUNCTION_MSG("Got balloon event, current = %d, target = %d\n", xpdd->current_memory_kb, xpdd->target_memory_kb);
    5.70      /* not really worried about races here, but cache target so we only read it once */
    5.71      new_target_kb = xpdd->target_memory_kb;
    5.72      // perform some sanity checks on target_memory
    5.73 @@ -252,10 +252,10 @@ XenPci_BalloonThreadProc(PVOID StartCont
    5.74      // make sure target > some % of initial
    5.75      
    5.76      if (xpdd->current_memory_kb == new_target_kb) {
    5.77 -      KdPrint((__DRIVER_NAME "     No change to memory\n"));
    5.78 +      FUNCTION_MSG("No change to memory\n");
    5.79        continue;
    5.80      } else if (xpdd->current_memory_kb < new_target_kb) {
    5.81 -      KdPrint((__DRIVER_NAME "     Trying to take %d KB from Xen\n", new_target_kb - xpdd->current_memory_kb));
    5.82 +      FUNCTION_MSG("Trying to take %d KB from Xen\n", new_target_kb - xpdd->current_memory_kb);
    5.83        while ((mdl = head) != NULL && xpdd->current_memory_kb < new_target_kb) {
    5.84          pfn_count = ADDRESS_AND_SIZE_TO_SPAN_PAGES(MmGetMdlVirtualAddress(mdl), MmGetMdlByteCount(mdl));
    5.85          pfns = ExAllocatePoolWithTag(NonPagedPool, pfn_count * sizeof(xen_pfn_t), XENPCI_POOL_TAG);
    5.86 @@ -269,15 +269,15 @@ XenPci_BalloonThreadProc(PVOID StartCont
    5.87          #pragma warning(disable: 4127) /* conditional expression is constant */
    5.88          set_xen_guest_handle(reservation.extent_start, pfns);
    5.89          
    5.90 -        //KdPrint((__DRIVER_NAME "     Calling HYPERVISOR_memory_op(XENMEM_populate_physmap) - pfn_count = %d\n", pfn_count));
    5.91 +        //FUNCTION_MSG("Calling HYPERVISOR_memory_op(XENMEM_populate_physmap) - pfn_count = %d\n", pfn_count);
    5.92          ret = HYPERVISOR_memory_op(xpdd, XENMEM_populate_physmap, &reservation);
    5.93 -        //KdPrint((__DRIVER_NAME "     populated %d pages\n", ret));
    5.94 +        //FUNCTION_MSG("populated %d pages\n", ret);
    5.95          if (ret < (ULONG)pfn_count) {
    5.96            if (ret > 0) {
    5.97              /* We hit the Xen hard limit: reprobe. */
    5.98              reservation.nr_extents = ret;
    5.99              ret = HYPERVISOR_memory_op(xpdd, XENMEM_decrease_reservation, &reservation);
   5.100 -            KdPrint((__DRIVER_NAME "     decreased %d pages (xen is out of pages)\n", ret));
   5.101 +            FUNCTION_MSG("decreased %d pages (xen is out of pages)\n", ret);
   5.102            }
   5.103            ExFreePoolWithTag(pfns, XENPCI_POOL_TAG);
   5.104            break;
   5.105 @@ -290,7 +290,7 @@ XenPci_BalloonThreadProc(PVOID StartCont
   5.106          xpdd->current_memory_kb += BALLOON_UNITS_KB;
   5.107        }
   5.108      } else {
   5.109 -      KdPrint((__DRIVER_NAME "     Trying to give %d KB to Xen\n", xpdd->current_memory_kb - new_target_kb));
   5.110 +      FUNCTION_MSG("Trying to give %d KB to Xen\n", xpdd->current_memory_kb - new_target_kb);
   5.111        while (xpdd->current_memory_kb > new_target_kb) {
   5.112          PHYSICAL_ADDRESS alloc_low;
   5.113          PHYSICAL_ADDRESS alloc_high;
   5.114 @@ -300,7 +300,7 @@ XenPci_BalloonThreadProc(PVOID StartCont
   5.115          alloc_skip.QuadPart = 0;
   5.116  
   5.117          if (!hit_initial_target && low_mem_event && KeReadStateEvent(low_mem_event)) {
   5.118 -          KdPrint((__DRIVER_NAME "     Low memory condition exists. Waiting.\n"));
   5.119 +          FUNCTION_MSG("Low memory condition exists. Waiting.\n");
   5.120            break;
   5.121          }
   5.122  
   5.123 @@ -311,7 +311,7 @@ XenPci_BalloonThreadProc(PVOID StartCont
   5.124          mdl = MmAllocatePagesForMdl(alloc_low, alloc_high, alloc_skip, BALLOON_UNITS_KB * 1024);
   5.125          #endif
   5.126          if (!mdl) {
   5.127 -          KdPrint((__DRIVER_NAME "     Allocation failed - try again soon\n"));
   5.128 +          FUNCTION_MSG("Allocation failed - try again soon\n");
   5.129            break;
   5.130          } else {
   5.131            int i;
   5.132 @@ -319,7 +319,7 @@ XenPci_BalloonThreadProc(PVOID StartCont
   5.133            int pfn_count = ADDRESS_AND_SIZE_TO_SPAN_PAGES(MmGetMdlVirtualAddress(mdl), MmGetMdlByteCount(mdl));
   5.134            if (pfn_count != BALLOON_UNIT_PAGES) {
   5.135              /* we could probably do this better but it will only happen in low memory conditions... */
   5.136 -            KdPrint((__DRIVER_NAME "     wanted %d pages got %d pages\n", BALLOON_UNIT_PAGES, pfn_count));
   5.137 +            FUNCTION_MSG("wanted %d pages got %d pages\n", BALLOON_UNIT_PAGES, pfn_count);
   5.138              MmFreePagesFromMdl(mdl);
   5.139              ExFreePool(mdl);
   5.140              break;
   5.141 @@ -347,7 +347,7 @@ XenPci_BalloonThreadProc(PVOID StartCont
   5.142          }
   5.143        }
   5.144      }
   5.145 -    KdPrint((__DRIVER_NAME "     Memory = %d, Balloon Target = %d\n", xpdd->current_memory_kb, new_target_kb));
   5.146 +    FUNCTION_MSG("Memory = %d, Balloon Target = %d\n", xpdd->current_memory_kb, new_target_kb);
   5.147    }
   5.148  }
   5.149  
   5.150 @@ -400,19 +400,19 @@ XenPci_Suspend0(PVOID context)
   5.151  
   5.152    /* this code was to fix a bug that existed in Xen for a short time... it is harmless but can probably be removed */
   5.153    if (__readmsr(0x174) != sysenter_cs) {
   5.154 -    KdPrint((__DRIVER_NAME "     sysenter_cs not restored. Fixing.\n"));
   5.155 +    FUNCTION_MSG("sysenter_cs not restored. Fixing.\n");
   5.156      __writemsr(0x174, sysenter_cs);
   5.157    }
   5.158    if (__readmsr(0x175) != sysenter_esp) {
   5.159 -    KdPrint((__DRIVER_NAME "     sysenter_esp not restored. Fixing.\n"));
   5.160 +    FUNCTION_MSG("sysenter_esp not restored. Fixing.\n");
   5.161      __writemsr(0x175, sysenter_esp);
   5.162    }
   5.163    if (__readmsr(0x176) != sysenter_eip) {
   5.164 -      KdPrint((__DRIVER_NAME "     sysenter_eip not restored. Fixing.\n"));
   5.165 +      FUNCTION_MSG("sysenter_eip not restored. Fixing.\n");
   5.166      __writemsr(0x176, sysenter_eip);
   5.167    }
   5.168  
   5.169 -  KdPrint((__DRIVER_NAME "     back from suspend, cancelled = %d\n", cancelled));
   5.170 +  FUNCTION_MSG("back from suspend, cancelled = %d\n", cancelled);
   5.171  
   5.172    if (qemu_hide_flags_value) {
   5.173      XenPci_HideQemuDevices();
   5.174 @@ -431,7 +431,7 @@ XenPci_SuspendN(PVOID context)
   5.175    UNREFERENCED_PARAMETER(context);
   5.176    
   5.177    FUNCTION_ENTER();
   5.178 -  KdPrint((__DRIVER_NAME "     doing nothing on cpu N\n"));
   5.179 +  FUNCTION_MSG("doing nothing on cpu N\n");
   5.180    FUNCTION_EXIT();
   5.181  }
   5.182  
   5.183 @@ -446,7 +446,7 @@ XenPci_ConnectSuspendEvt(PXENPCI_DEVICE_
   5.184    CHAR path[128];
   5.185  
   5.186    xpdd->suspend_evtchn = EvtChn_AllocUnbound(xpdd, 0);
   5.187 -  KdPrint((__DRIVER_NAME "     suspend event channel = %d\n", xpdd->suspend_evtchn));
   5.188 +  FUNCTION_MSG("suspend event channel = %d\n", xpdd->suspend_evtchn);
   5.189    RtlStringCbPrintfA(path, ARRAY_SIZE(path), "device/suspend/event-channel");
   5.190    XenBus_Printf(xpdd, XBT_NIL, path, "%d", xpdd->suspend_evtchn);
   5.191    EvtChn_BindDpc(xpdd, xpdd->suspend_evtchn, XenPci_SuspendEvtDpc, xpdd->wdf_device, EVT_ACTION_FLAGS_NO_SUSPEND);
   5.192 @@ -513,7 +513,7 @@ XenPci_SuspendEvtDpc(PVOID context)
   5.193    WDF_WORKITEM_CONFIG workitem_config;
   5.194    WDFWORKITEM workitem;
   5.195  
   5.196 -  KdPrint((__DRIVER_NAME "     Suspend detected via Dpc\n"));
   5.197 +  FUNCTION_MSG("Suspend detected via Dpc\n");
   5.198    WDF_WORKITEM_CONFIG_INIT(&workitem_config, XenPci_SuspendResume);
   5.199    WDF_OBJECT_ATTRIBUTES_INIT(&attributes);
   5.200    attributes.ParentObject = device;
   5.201 @@ -546,18 +546,18 @@ XenPci_ShutdownHandler(char *path, PVOID
   5.202    res = XenBus_Read(xpdd, XBT_NIL, SHUTDOWN_PATH, &value);
   5.203    if (res)
   5.204    {
   5.205 -    KdPrint(("Error reading shutdown path - %s\n", res));
   5.206 +    FUNCTION_MSG("Error reading shutdown path - %s\n", res);
   5.207      XenPci_FreeMem(res);
   5.208      FUNCTION_EXIT();
   5.209      return;
   5.210    }
   5.211  
   5.212 -  KdPrint((__DRIVER_NAME "     Shutdown value = %s\n", value));
   5.213 +  FUNCTION_MSG("Shutdown value = %s\n", value);
   5.214  
   5.215    if (strlen(value) && strcmp(value, "suspend") == 0)
   5.216    {
   5.217      {
   5.218 -      KdPrint((__DRIVER_NAME "     Suspend detected\n"));
   5.219 +      FUNCTION_MSG("Suspend detected\n");
   5.220        /* we have to queue this as a work item as we stop the xenbus thread, which we are currently running in! */
   5.221        WDF_WORKITEM_CONFIG_INIT(&workitem_config, XenPci_SuspendResume);
   5.222        WDF_OBJECT_ATTRIBUTES_INIT(&attributes);
   5.223 @@ -597,7 +597,7 @@ XenPci_DeviceWatchHandler(char *path, PV
   5.224      {
   5.225        XenPci_FreeMem(value);
   5.226        /* we probably have to be a bit smarter here and do nothing if xenpci isn't running yet */
   5.227 -      KdPrint((__DRIVER_NAME "     Rescanning child list\n"));
   5.228 +      FUNCTION_MSG("Rescanning child list\n");
   5.229        XenPci_EvtChildListScanForChildren(xpdd->child_list);
   5.230      }
   5.231    }
   5.232 @@ -624,13 +624,13 @@ XenPci_EvtDevicePrepareHardware (WDFDEVI
   5.233      translated_descriptor = WdfCmResourceListGetDescriptor(resources_translated, i);
   5.234      switch (raw_descriptor->Type) {
   5.235      case CmResourceTypePort:
   5.236 -      KdPrint((__DRIVER_NAME "     IoPort Address(%x) Length: %d\n", translated_descriptor->u.Port.Start.LowPart, translated_descriptor->u.Port.Length));
   5.237 +      FUNCTION_MSG("IoPort Address(%x) Length: %d\n", translated_descriptor->u.Port.Start.LowPart, translated_descriptor->u.Port.Length);
   5.238        xpdd->platform_ioport_addr = translated_descriptor->u.Port.Start.LowPart;
   5.239        xpdd->platform_ioport_len = translated_descriptor->u.Port.Length;
   5.240        break;
   5.241      case CmResourceTypeMemory:
   5.242 -      KdPrint((__DRIVER_NAME "     Memory mapped CSR:(%x:%x) Length:(%d)\n", translated_descriptor->u.Memory.Start.LowPart, translated_descriptor->u.Memory.Start.HighPart, translated_descriptor->u.Memory.Length));
   5.243 -      KdPrint((__DRIVER_NAME "     Memory flags = %04X\n", translated_descriptor->Flags));
   5.244 +      FUNCTION_MSG("Memory mapped CSR:(%x:%x) Length:(%d)\n", translated_descriptor->u.Memory.Start.LowPart, translated_descriptor->u.Memory.Start.HighPart, translated_descriptor->u.Memory.Length);
   5.245 +      FUNCTION_MSG("Memory flags = %04X\n", translated_descriptor->Flags);
   5.246        xpdd->platform_mmio_addr = translated_descriptor->u.Memory.Start;
   5.247        xpdd->platform_mmio_len = translated_descriptor->u.Memory.Length;
   5.248        xpdd->platform_mmio_flags = translated_descriptor->Flags;
   5.249 @@ -641,31 +641,31 @@ XenPci_EvtDevicePrepareHardware (WDFDEVI
   5.250  	    xpdd->irq_affinity = translated_descriptor->u.Interrupt.Affinity;
   5.251        xpdd->irq_mode = (translated_descriptor->Flags & CM_RESOURCE_INTERRUPT_LATCHED)?Latched:LevelSensitive;
   5.252        xpdd->irq_number = raw_descriptor->u.Interrupt.Vector;      
   5.253 -      KdPrint((__DRIVER_NAME "     irq_number = %03x\n", raw_descriptor->u.Interrupt.Vector));
   5.254 -      KdPrint((__DRIVER_NAME "     irq_vector = %03x\n", translated_descriptor->u.Interrupt.Vector));
   5.255 -      KdPrint((__DRIVER_NAME "     irq_level = %03x\n", translated_descriptor->u.Interrupt.Level));
   5.256 -      KdPrint((__DRIVER_NAME "     irq_mode = %s\n", (xpdd->irq_mode == Latched)?"Latched":"LevelSensitive"));
   5.257 +      FUNCTION_MSG("irq_number = %03x\n", raw_descriptor->u.Interrupt.Vector);
   5.258 +      FUNCTION_MSG("irq_vector = %03x\n", translated_descriptor->u.Interrupt.Vector);
   5.259 +      FUNCTION_MSG("irq_level = %03x\n", translated_descriptor->u.Interrupt.Level);
   5.260 +      FUNCTION_MSG("irq_mode = %s\n", (xpdd->irq_mode == Latched)?"Latched":"LevelSensitive");
   5.261        switch(translated_descriptor->ShareDisposition)
   5.262        {
   5.263        case CmResourceShareDeviceExclusive:
   5.264 -        KdPrint((__DRIVER_NAME "     ShareDisposition = CmResourceShareDeviceExclusive\n"));
   5.265 +        FUNCTION_MSG("ShareDisposition = CmResourceShareDeviceExclusive\n");
   5.266          break;
   5.267        case CmResourceShareDriverExclusive:
   5.268 -        KdPrint((__DRIVER_NAME "     ShareDisposition = CmResourceShareDriverExclusive\n"));
   5.269 +        FUNCTION_MSG("ShareDisposition = CmResourceShareDriverExclusive\n");
   5.270          break;
   5.271        case CmResourceShareShared:
   5.272 -        KdPrint((__DRIVER_NAME "     ShareDisposition = CmResourceShareShared\n"));
   5.273 +        FUNCTION_MSG("ShareDisposition = CmResourceShareShared\n");
   5.274          break;
   5.275        default:
   5.276 -        KdPrint((__DRIVER_NAME "     ShareDisposition = %d\n", translated_descriptor->ShareDisposition));
   5.277 +        FUNCTION_MSG("ShareDisposition = %d\n", translated_descriptor->ShareDisposition);
   5.278          break;
   5.279        }
   5.280        break;
   5.281      case CmResourceTypeDevicePrivate:
   5.282 -      KdPrint((__DRIVER_NAME "     Private Data: 0x%02x 0x%02x 0x%02x\n", translated_descriptor->u.DevicePrivate.Data[0], translated_descriptor->u.DevicePrivate.Data[1], translated_descriptor->u.DevicePrivate.Data[2]));
   5.283 +      FUNCTION_MSG("Private Data: 0x%02x 0x%02x 0x%02x\n", translated_descriptor->u.DevicePrivate.Data[0], translated_descriptor->u.DevicePrivate.Data[1], translated_descriptor->u.DevicePrivate.Data[2]);
   5.284        break;
   5.285      default:
   5.286 -      KdPrint((__DRIVER_NAME "     Unhandled resource type (0x%x)\n", translated_descriptor->Type));
   5.287 +      FUNCTION_MSG("Unhandled resource type (0x%x)\n", translated_descriptor->Type);
   5.288        break;
   5.289      }
   5.290    }
   5.291 @@ -687,25 +687,25 @@ XenPci_EvtDeviceD0Entry(WDFDEVICE device
   5.292    switch (previous_state)
   5.293    {
   5.294    case WdfPowerDeviceD0:
   5.295 -    KdPrint((__DRIVER_NAME "     WdfPowerDeviceD1\n"));
   5.296 +    FUNCTION_MSG("WdfPowerDeviceD1\n");
   5.297      break;
   5.298    case WdfPowerDeviceD1:
   5.299 -    KdPrint((__DRIVER_NAME "     WdfPowerDeviceD1\n"));
   5.300 +    FUNCTION_MSG("WdfPowerDeviceD1\n");
   5.301      break;
   5.302    case WdfPowerDeviceD2:
   5.303 -    KdPrint((__DRIVER_NAME "     WdfPowerDeviceD2\n"));
   5.304 +    FUNCTION_MSG("WdfPowerDeviceD2\n");
   5.305      break;
   5.306    case WdfPowerDeviceD3:
   5.307 -    KdPrint((__DRIVER_NAME "     WdfPowerDeviceD3\n"));
   5.308 +    FUNCTION_MSG("WdfPowerDeviceD3\n");
   5.309      break;
   5.310    case WdfPowerDeviceD3Final:
   5.311 -    KdPrint((__DRIVER_NAME "     WdfPowerDeviceD3Final\n"));
   5.312 +    FUNCTION_MSG("WdfPowerDeviceD3Final\n");
   5.313      break;
   5.314    case WdfPowerDevicePrepareForHibernation:
   5.315 -    KdPrint((__DRIVER_NAME "     WdfPowerDevicePrepareForHibernation\n"));
   5.316 +    FUNCTION_MSG("WdfPowerDevicePrepareForHibernation\n");
   5.317      break;  
   5.318    default:
   5.319 -    KdPrint((__DRIVER_NAME "     Unknown WdfPowerDevice state %d\n", previous_state));
   5.320 +    FUNCTION_MSG("Unknown WdfPowerDevice state %d\n", previous_state);
   5.321      break;  
   5.322    }
   5.323  
   5.324 @@ -789,30 +789,30 @@ XenPci_EvtDeviceD0ExitPreInterruptsDisab
   5.325    switch (target_state)
   5.326    {
   5.327    case WdfPowerDeviceD0:
   5.328 -    KdPrint((__DRIVER_NAME "     WdfPowerDeviceD1\n"));
   5.329 +    FUNCTION_MSG("WdfPowerDeviceD1\n");
   5.330      break;
   5.331    case WdfPowerDeviceD1:
   5.332 -    KdPrint((__DRIVER_NAME "     WdfPowerDeviceD1\n"));
   5.333 +    FUNCTION_MSG("WdfPowerDeviceD1\n");
   5.334      break;
   5.335    case WdfPowerDeviceD2:
   5.336 -    KdPrint((__DRIVER_NAME "     WdfPowerDeviceD2\n"));
   5.337 +    FUNCTION_MSG("WdfPowerDeviceD2\n");
   5.338      break;
   5.339    case WdfPowerDeviceD3:
   5.340 -    KdPrint((__DRIVER_NAME "     WdfPowerDeviceD3\n"));
   5.341 +    FUNCTION_MSG("WdfPowerDeviceD3\n");
   5.342      break;
   5.343    case WdfPowerDeviceD3Final:
   5.344 -    KdPrint((__DRIVER_NAME "     WdfPowerDeviceD3Final\n"));
   5.345 +    FUNCTION_MSG("WdfPowerDeviceD3Final\n");
   5.346      break;
   5.347    case WdfPowerDevicePrepareForHibernation:
   5.348 -    KdPrint((__DRIVER_NAME "     WdfPowerDevicePrepareForHibernation\n"));
   5.349 +    FUNCTION_MSG("WdfPowerDevicePrepareForHibernation\n");
   5.350      break;
   5.351    default:
   5.352 -    KdPrint((__DRIVER_NAME "     Unknown WdfPowerDevice state %d\n", target_state));
   5.353 +    FUNCTION_MSG("Unknown WdfPowerDevice state %d\n", target_state);
   5.354      break;  
   5.355    }
   5.356  
   5.357    if (target_state == WdfPowerDeviceD3Final) {
   5.358 -    KdPrint((__DRIVER_NAME "     Shutting down threads\n"));
   5.359 +    FUNCTION_MSG("Shutting down threads\n");
   5.360  
   5.361      xpdd->balloon_shutdown = TRUE;
   5.362      KeSetEvent(&xpdd->balloon_event, IO_NO_INCREMENT, FALSE);
   5.363 @@ -821,7 +821,7 @@ XenPci_EvtDeviceD0ExitPreInterruptsDisab
   5.364      while ((status = KeWaitForSingleObject(xpdd->balloon_thread, Executive, KernelMode, FALSE, &timeout)) != STATUS_SUCCESS)
   5.365      {
   5.366        timeout.QuadPart = (LONGLONG)-1 * 1000 * 1000 * 10;
   5.367 -      KdPrint((__DRIVER_NAME "     Waiting for balloon thread to stop\n"));
   5.368 +      FUNCTION_MSG("Waiting for balloon thread to stop\n");
   5.369      }
   5.370      ObDereferenceObject(xpdd->balloon_thread);
   5.371  
   5.372 @@ -846,26 +846,26 @@ XenPci_EvtDeviceD0Exit(WDFDEVICE device,
   5.373  
   5.374    switch (target_state) {
   5.375    case WdfPowerDeviceD0:
   5.376 -    KdPrint((__DRIVER_NAME "     WdfPowerDeviceD1\n"));
   5.377 +    FUNCTION_MSG("WdfPowerDeviceD1\n");
   5.378      break;
   5.379    case WdfPowerDeviceD1:
   5.380 -    KdPrint((__DRIVER_NAME "     WdfPowerDeviceD1\n"));
   5.381 +    FUNCTION_MSG("WdfPowerDeviceD1\n");
   5.382      break;
   5.383    case WdfPowerDeviceD2:
   5.384 -    KdPrint((__DRIVER_NAME "     WdfPowerDeviceD2\n"));
   5.385 +    FUNCTION_MSG("WdfPowerDeviceD2\n");
   5.386      break;
   5.387    case WdfPowerDeviceD3:
   5.388 -    KdPrint((__DRIVER_NAME "     WdfPowerDeviceD3\n"));
   5.389 +    FUNCTION_MSG("WdfPowerDeviceD3\n");
   5.390      break;
   5.391    case WdfPowerDeviceD3Final:
   5.392 -    KdPrint((__DRIVER_NAME "     WdfPowerDeviceD3Final\n"));
   5.393 +    FUNCTION_MSG("WdfPowerDeviceD3Final\n");
   5.394      break;
   5.395    case WdfPowerDevicePrepareForHibernation:
   5.396 -    KdPrint((__DRIVER_NAME "     WdfPowerDevicePrepareForHibernation\n"));
   5.397 +    FUNCTION_MSG("WdfPowerDevicePrepareForHibernation\n");
   5.398      xpdd->hibernated = TRUE;
   5.399      break;  
   5.400    default:
   5.401 -    KdPrint((__DRIVER_NAME "     Unknown WdfPowerDevice state %d\n", target_state));
   5.402 +    FUNCTION_MSG("Unknown WdfPowerDevice state %d\n", target_state);
   5.403      break;  
   5.404    }
   5.405    
   5.406 @@ -943,7 +943,7 @@ XenPci_EvtChildListScanForChildren(WDFCH
   5.407            RtlZeroMemory(&child_description, sizeof(child_description));
   5.408            WDF_CHILD_IDENTIFICATION_DESCRIPTION_HEADER_INIT(&child_description.header, sizeof(child_description));
   5.409            RtlStringCbPrintfA(path, ARRAY_SIZE(path), "device/%s/%s", devices[i], instances[j]);
   5.410 -          KdPrint((__DRIVER_NAME "     Found path = %s\n", path));
   5.411 +          FUNCTION_MSG("Found path = %s\n", path);
   5.412            RtlStringCbCopyA(child_description.path, ARRAY_SIZE(child_description.path), path);
   5.413            RtlStringCbCopyA(child_description.device, ARRAY_SIZE(child_description.device), devices[i]);
   5.414            child_description.index = atoi(instances[j]);
   5.415 @@ -973,7 +973,7 @@ XenPci_EvtChildListScanForChildren(WDFCH
   5.416                }
   5.417                if (xppdd->backend_state == XenbusStateClosing || xppdd->backend_state == XenbusStateClosed)
   5.418                {
   5.419 -                KdPrint((__DRIVER_NAME "     Surprise removing %s due to backend initiated remove\n", path));
   5.420 +                FUNCTION_MSG("Surprise removing %s due to backend initiated remove\n", path);
   5.421                  XenPci_FreeMem(instances[j]);
   5.422                  continue;
   5.423                }
   5.424 @@ -988,7 +988,7 @@ XenPci_EvtChildListScanForChildren(WDFCH
   5.425            status = WdfChildListAddOrUpdateChildDescriptionAsPresent(child_list, &child_description.header, NULL);
   5.426            if (!NT_SUCCESS(status))
   5.427            {
   5.428 -            KdPrint((__DRIVER_NAME "     WdfChildListAddOrUpdateChildDescriptionAsPresent failed with status 0x%08x\n", status));
   5.429 +            FUNCTION_MSG("WdfChildListAddOrUpdateChildDescriptionAsPresent failed with status 0x%08x\n", status);
   5.430            }
   5.431            XenPci_FreeMem(instances[j]);
   5.432          }
   5.433 @@ -997,7 +997,7 @@ XenPci_EvtChildListScanForChildren(WDFCH
   5.434        else
   5.435        {
   5.436          // wtf do we do here???
   5.437 -        KdPrint((__DRIVER_NAME "     Failed to list %s tree\n", devices[i]));
   5.438 +        FUNCTION_MSG("Failed to list %s tree\n", devices[i]);
   5.439        }
   5.440        XenPci_FreeMem(devices[i]);
   5.441      }
   5.442 @@ -1006,7 +1006,7 @@ XenPci_EvtChildListScanForChildren(WDFCH
   5.443    else
   5.444    {
   5.445      // wtf do we do here???
   5.446 -    KdPrint((__DRIVER_NAME "     Failed to list device tree\n"));
   5.447 +    FUNCTION_MSG("Failed to list device tree\n");
   5.448    }
   5.449  
   5.450    WdfChildListEndScan(child_list);