win-pvdrivers

changeset 364:2ff96a909c28

Fixed an interrupt problem that was causing hangs on boot.
author James Harper <james.harper@bendigoit.com.au>
date Mon Jul 07 22:46:08 2008 +1000 (2008-07-07)
parents 097ab7d19ea2
children d76831a77d19 649b05070ede
files xenpci/evtchn.c xenpci/xenpci_pdo.c
line diff
     1.1 --- a/xenpci/evtchn.c	Mon Jul 07 14:03:39 2008 +0800
     1.2 +++ b/xenpci/evtchn.c	Mon Jul 07 22:46:08 2008 +1000
     1.3 @@ -97,9 +97,14 @@ EvtChn_DpcBounce(PRKDPC Dpc, PVOID Conte
     1.4    //KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
     1.5  
     1.6    if (action->type == EVT_ACTION_TYPE_IRQ)
     1.7 +  {
     1.8 +    //KdPrint((__DRIVER_NAME "     Calling interrupt vector %02x\n", action->vector));
     1.9      sw_interrupt((UCHAR)action->vector);
    1.10 +  }
    1.11    else
    1.12 +  {
    1.13      action->ServiceRoutine(NULL, action->ServiceContext);
    1.14 +  }
    1.15    //KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
    1.16  }
    1.17  
    1.18 @@ -115,8 +120,9 @@ EvtChn_Interrupt(PKINTERRUPT Interrupt, 
    1.19    unsigned long evt_bit;
    1.20    unsigned int port;
    1.21    ev_action_t *ev_action;
    1.22 +  BOOLEAN handled = FALSE;
    1.23  
    1.24 -//  KdPrint((__DRIVER_NAME " --> " __FUNCTION__ " (cpu = %d)\n", cpu));
    1.25 +  //KdPrint((__DRIVER_NAME " --> " __FUNCTION__ " (cpu = %d)\n", cpu));
    1.26  
    1.27    UNREFERENCED_PARAMETER(Interrupt);
    1.28  
    1.29 @@ -131,6 +137,7 @@ EvtChn_Interrupt(PKINTERRUPT Interrupt, 
    1.30      evt_words &= ~(1 << evt_word);
    1.31      while (bit_scan_forward(&evt_bit, shared_info_area->evtchn_pending[evt_word] & ~shared_info_area->evtchn_mask[evt_word]))
    1.32      {
    1.33 +      handled = TRUE;
    1.34        port = (evt_word << 5) + evt_bit;
    1.35        ev_action = &xpdd->ev_actions[port];
    1.36        switch (ev_action->type)
    1.37 @@ -150,9 +157,9 @@ EvtChn_Interrupt(PKINTERRUPT Interrupt, 
    1.38      }
    1.39    }
    1.40  
    1.41 -//  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
    1.42 +  //KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
    1.43  
    1.44 -  return TRUE;
    1.45 +  return handled;
    1.46  }
    1.47  
    1.48  NTSTATUS
     2.1 --- a/xenpci/xenpci_pdo.c	Mon Jul 07 14:03:39 2008 +0800
     2.2 +++ b/xenpci/xenpci_pdo.c	Mon Jul 07 22:46:08 2008 +1000
     2.3 @@ -807,17 +807,19 @@ XenPci_Pnp_RemoveDevice(PDEVICE_OBJECT d
     2.4  static NTSTATUS
     2.5  XenPci_QueryResourceRequirements(PDEVICE_OBJECT device_object, PIRP irp)
     2.6  {
     2.7 -  //PXENPCI_PDO_DEVICE_DATA xppdd = (PXENPCI_PDO_DEVICE_DATA)device_object->DeviceExtension;
     2.8 -  //PXENPCI_DEVICE_DATA xpdd = xppdd->bus_fdo->DeviceExtension;
     2.9 +  PXENPCI_PDO_DEVICE_DATA xppdd = (PXENPCI_PDO_DEVICE_DATA)device_object->DeviceExtension;
    2.10 +  PXENPCI_DEVICE_DATA xpdd = xppdd->bus_fdo->DeviceExtension;
    2.11    PIO_RESOURCE_REQUIREMENTS_LIST irrl;
    2.12    PIO_RESOURCE_DESCRIPTOR ird;
    2.13    ULONG length;
    2.14 +  ULONG available_interrupts[] = {2, 3, 4, 5, 7, 10, 11, 14, 15};
    2.15 +  int i;
    2.16  
    2.17    UNREFERENCED_PARAMETER(device_object);
    2.18  
    2.19    length = FIELD_OFFSET(IO_RESOURCE_REQUIREMENTS_LIST, List) +
    2.20      FIELD_OFFSET(IO_RESOURCE_LIST, Descriptors) +
    2.21 -    sizeof(IO_RESOURCE_DESCRIPTOR) * 2;
    2.22 +    sizeof(IO_RESOURCE_DESCRIPTOR) * ARRAY_SIZE(available_interrupts);
    2.23    irrl = ExAllocatePoolWithTag(PagedPool,
    2.24      length,
    2.25      XENPCI_POOL_TAG);
    2.26 @@ -831,34 +833,19 @@ XenPci_QueryResourceRequirements(PDEVICE
    2.27    irrl->List[0].Revision = 1;
    2.28    irrl->List[0].Count = 0;
    2.29  
    2.30 -  ird = &irrl->List[0].Descriptors[irrl->List[0].Count++];
    2.31 -  ird->Option = 0;
    2.32 -  ird->Type = CmResourceTypeInterrupt;
    2.33 -  ird->ShareDisposition = CmResourceShareShared;
    2.34 -  ird->Flags = CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE;
    2.35 -  ird->u.Interrupt.MinimumVector = 1;
    2.36 -  ird->u.Interrupt.MaximumVector = 6;
    2.37 -
    2.38 -  ird = &irrl->List[0].Descriptors[irrl->List[0].Count++];
    2.39 -  ird->Option = IO_RESOURCE_ALTERNATIVE;
    2.40 -  ird->Type = CmResourceTypeInterrupt;
    2.41 -  ird->ShareDisposition = CmResourceShareShared;
    2.42 -  ird->Flags = CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE;
    2.43 -  ird->u.Interrupt.MinimumVector = 10;
    2.44 -  ird->u.Interrupt.MaximumVector = 14;
    2.45 +  for (i = 0; i < ARRAY_SIZE(available_interrupts); i++)
    2.46 +  {
    2.47 +    if (i == (int)xpdd->irq_number)
    2.48 +      continue;
    2.49 +    ird = &irrl->List[0].Descriptors[irrl->List[0].Count++];
    2.50 +    ird->Option = i?IO_RESOURCE_ALTERNATIVE:0;
    2.51 +    ird->Type = CmResourceTypeInterrupt;
    2.52 +    ird->ShareDisposition = CmResourceShareShared;
    2.53 +    ird->Flags = CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE;
    2.54 +    ird->u.Interrupt.MinimumVector = available_interrupts[i];
    2.55 +    ird->u.Interrupt.MaximumVector = available_interrupts[i];
    2.56 +  }
    2.57    
    2.58 -#if 0 
    2.59 -  ird = &irrl->List[0].Descriptors[irrl->List[0].Count++];
    2.60 -  ird->Option = 0;  
    2.61 -  ird->Type = CmResourceTypeMemory;
    2.62 -  ird->ShareDisposition = CmResourceShareDeviceExclusive;
    2.63 -  ird->Flags = CM_RESOURCE_MEMORY_READ_WRITE;
    2.64 -  ird->u.Memory.Length = PAGE_SIZE;
    2.65 -  ird->u.Memory.Alignment = PAGE_SIZE;
    2.66 -  ird->u.Memory.MinimumAddress.QuadPart = 0; //MmGetMdlPfnArray(xppdd->config_mdl)[0] << PAGE_SHIFT;
    2.67 -  ird->u.Memory.MaximumAddress.QuadPart = 0xFFFFFFFFFFFFFFFF; //ird->u.Memory.MinimumAddress.QuadPart + PAGE_SIZE - 1;
    2.68 -#endif
    2.69 -
    2.70    irp->IoStatus.Information = (ULONG_PTR)irrl;
    2.71    return STATUS_SUCCESS;
    2.72  }