Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

102 lines
3.8 KiB

  1. /*++
  2. Copyright (c) 1992 Microsoft Corporation
  3. Module Name:
  4. pci.c
  5. Abstract:
  6. WinDbg Extension Api
  7. Author:
  8. Ken Reneris (kenr) 18-August-1997
  9. Environment:
  10. User Mode.
  11. Revision History:
  12. --*/
  13. #include "precomp.h"
  14. #include "i386.h"
  15. #pragma hdrstop
  16. DECLARE_API(pciir)
  17. {
  18. ULONG64 addr;
  19. ULONG64 pciIrqRoutingTable;
  20. ULONG64 slot;
  21. ULONG64 lastSlot;
  22. ULONG slotSz, SizeOfRoutingTable, TableSize;
  23. if (TargetMachine != IMAGE_FILE_MACHINE_I386) {
  24. dprintf("X86 target only API.\n");
  25. return E_INVALIDARG;
  26. }
  27. slotSz = GetTypeSize("hal!_SLOT_INFO");
  28. SizeOfRoutingTable = GetTypeSize("hal!_PCI_IRQ_ROUTING_TABLE");
  29. addr = GetExpression("Hal!HalpPciIrqRoutingInfo");
  30. if (addr == 0)
  31. {
  32. dprintf("Error reading Pci Irq Routing Info!\n");
  33. }
  34. else
  35. {
  36. pciIrqRoutingTable = 0;
  37. if (ReadPointer(addr, &pciIrqRoutingTable))
  38. {
  39. if (pciIrqRoutingTable)
  40. {
  41. //
  42. // Read and dump the header.
  43. //
  44. if (!InitTypeRead(pciIrqRoutingTable, hal!_PCI_IRQ_ROUTING_TABLE))
  45. {
  46. dprintf("Version = %04x\n", (ULONG) ReadField(Version));
  47. dprintf("Size = %04x\n", TableSize = (ULONG) ReadField(TableSize));
  48. dprintf("RouterBus = %02x\n", (ULONG) ReadField(RouterBus));
  49. dprintf("RouterDevFunc = %02x:%02x\n", (ULONG) ReadField(RouterDevFunc) >> 3, (ULONG) ReadField(RouterDevFunc) & 0x7);
  50. dprintf("ExclusiveIRQs = %04x\n", (ULONG) ReadField(ExclusiveIRQs));
  51. dprintf("CompatibleRouterId = %08x\n", (ULONG) ReadField(CompatibleRouter));
  52. dprintf("MiniportData = %08x\n", (ULONG) ReadField(MiniportData));
  53. dprintf("CheckSum = %04x\n", (ULONG) ReadField(Checksum));
  54. //
  55. // Read and dump the table.
  56. //
  57. dprintf("----------------------------------------------------------------\n");
  58. dprintf("Bus Device LnkA Mask LnkB Mask LnkC Mask LnkD Mask Slot\n");
  59. dprintf("----------------------------------------------------------------\n");
  60. slot = pciIrqRoutingTable + SizeOfRoutingTable;
  61. for (lastSlot = pciIrqRoutingTable + TableSize; slot < lastSlot; slot+=slotSz)
  62. {
  63. if (!InitTypeRead(slot, hal!_SLOT_INFO))
  64. {
  65. dprintf("%02x %02x %02x %04x %02x %04x %02x %04x %02x %04x %02x\n",
  66. (ULONG) ReadField(BusNumber),
  67. (ULONG) ReadField(DeviceNumber) >> 3,
  68. (ULONG) ReadField(PinInfo[0].Link), (ULONG) ReadField(PinInfo[0].InterruptMap),
  69. (ULONG) ReadField(PinInfo[1].Link), (ULONG) ReadField(PinInfo[1].InterruptMap),
  70. (ULONG) ReadField(PinInfo[2].Link), (ULONG) ReadField(PinInfo[2].InterruptMap),
  71. (ULONG) ReadField(PinInfo[3].Link), (ULONG) ReadField(PinInfo[3].InterruptMap),
  72. (ULONG) ReadField(SlotNumber));
  73. }
  74. }
  75. }
  76. }
  77. else
  78. {
  79. dprintf("Pci Irq Routing Table not found.\n");
  80. }
  81. }
  82. }
  83. return S_OK;
  84. }