pcibr_idbg.c
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:4k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. /*
  2.  *
  3.  * This file is subject to the terms and conditions of the GNU General Public
  4.  * License.  See the file "COPYING" in the main directory of this archive
  5.  * for more details.
  6.  *
  7.  * Copyright (C) 2001-2002 Silicon Graphics, Inc. All rights reserved.
  8.  */
  9. #include <linux/types.h>
  10. #include <linux/slab.h>
  11. #include <linux/module.h>
  12. #include <asm/sn/sgi.h>
  13. #include <asm/sn/sn_cpuid.h>
  14. #include <asm/sn/addrs.h>
  15. #include <asm/sn/arch.h>
  16. #include <asm/sn/iograph.h>
  17. #include <asm/sn/invent.h>
  18. #include <asm/sn/hcl.h>
  19. #include <asm/sn/labelcl.h>
  20. #include <asm/sn/xtalk/xwidget.h>
  21. #include <asm/sn/pci/bridge.h>
  22. #include <asm/sn/pci/pciio.h>
  23. #include <asm/sn/pci/pcibr.h>
  24. #include <asm/sn/pci/pcibr_private.h>
  25. #include <asm/sn/pci/pci_defs.h>
  26. #include <asm/sn/prio.h>
  27. #include <asm/sn/xtalk/xbow.h>
  28. #include <asm/sn/ioc3.h>
  29. #include <asm/sn/eeprom.h>
  30. #include <asm/sn/io.h>
  31. #include <asm/sn/sn_private.h>
  32. #ifdef LATER
  33. char *pci_space[] = {"NONE", 
  34.      "ROM",
  35.      "IO",
  36.      "",
  37.      "MEM",
  38.      "MEM32",
  39.      "MEM64",
  40.      "CFG",
  41.      "WIN0",
  42.      "WIN1",
  43.      "WIN2",
  44.      "WIN3",
  45.      "WIN4",
  46.      "WIN5",
  47.      "",
  48.      "BAD"};
  49. void
  50. idbg_pss_func(pcibr_info_h pcibr_infoh, int func)
  51. {
  52.     pcibr_info_t pcibr_info = pcibr_infoh[func];
  53.     char name[MAXDEVNAME];
  54.     int win;
  55.     
  56.     if (!pcibr_info)
  57. return;
  58.     qprintf("Per-slot Function Infon");
  59.     sprintf(name, "%v", pcibr_info->f_vertex);
  60.     qprintf("tSlot Name : %sn",name);
  61.     qprintf("tPCI Bus : %d ",pcibr_info->f_bus);
  62.     qprintf("Slot : %d ", pcibr_info->f_slot);
  63.     qprintf("Function : %d ", pcibr_info->f_func);
  64.     qprintf("VendorId : 0x%x " , pcibr_info->f_vendor);
  65.     qprintf("DeviceId : 0x%xn", pcibr_info->f_device);
  66.     sprintf(name, "%v", pcibr_info->f_master);
  67.     qprintf("tBus provider : %sn",name);
  68.     qprintf("tProvider Fns : 0x%x ", pcibr_info->f_pops);
  69.     qprintf("Error Handler : 0x%x Arg 0x%xn", 
  70.     pcibr_info->f_efunc,pcibr_info->f_einfo);
  71.     for(win = 0 ; win < 6 ; win++) 
  72. qprintf("tBase Reg #%d space %s base 0x%x size 0x%xn",
  73. win,pci_space[pcibr_info->f_window[win].w_space],
  74. pcibr_info->f_window[win].w_base,
  75. pcibr_info->f_window[win].w_size);
  76.     qprintf("tRom base 0x%x size 0x%xn", 
  77.     pcibr_info->f_rbase,pcibr_info->f_rsize);
  78.     qprintf("tInterrupt Bit Mapn");
  79.     qprintf("ttPCI Int#tBridge Pin#n");
  80.     for (win = 0 ; win < 4; win++)
  81. qprintf("ttINT%ctt%dn",win+'A',pcibr_info->f_ibit[win]);
  82.     qprintf("n");
  83. }
  84. void
  85. idbg_pss_info(pcibr_soft_t pcibr_soft, pciio_slot_t slot)
  86. {
  87.     pcibr_soft_slot_t pss;
  88.     char slot_conn_name[MAXDEVNAME];
  89.     int func;
  90.     pss = &pcibr_soft->bs_slot[slot];
  91.     qprintf("PCI INFRASTRUCTURAL INFO FOR SLOT %dn", slot);
  92.     qprintf("tHost Present ? %s ", pss->has_host ? "yes" : "no");
  93.     qprintf("tHost Slot : %dn",pss->host_slot);
  94.     sprintf(slot_conn_name, "%v", pss->slot_conn);
  95.     qprintf("tSlot Conn : %sn",slot_conn_name);
  96.     qprintf("t#Functions : %dn",pss->bss_ninfo);
  97.     for (func = 0; func < pss->bss_ninfo; func++)
  98. idbg_pss_func(pss->bss_infos,func);
  99.     qprintf("tSpace : %s ",pci_space[pss->bss_devio.bssd_space]);
  100.     qprintf("tBase : 0x%x ", pss->bss_devio.bssd_base);
  101.     qprintf("tShadow Devreg : 0x%xn", pss->bss_device);
  102.     qprintf("tUsage counts : pmu %d d32 %d d64 %dn",
  103.     pss->bss_pmu_uctr,pss->bss_d32_uctr,pss->bss_d64_uctr);
  104.     
  105.     qprintf("tDirect Trans Info : d64_base 0x%x d64_flags 0x%x"
  106.     "d32_base 0x%x d32_flags 0x%xn",
  107.     pss->bss_d64_base, pss->bss_d64_flags,
  108.     pss->bss_d32_base, pss->bss_d32_flags);
  109.     
  110.     qprintf("tExt ATEs active ? %s", 
  111.     pss->bss_ext_ates_active ? "yes" : "no");
  112.     qprintf(" Command register : 0x%x ", pss->bss_cmd_pointer);
  113.     qprintf(" Shadow command val : 0x%xn", pss->bss_cmd_shadow);
  114.     qprintf("tRRB Info : Valid %d+%d Reserved %dn",
  115.     pcibr_soft->bs_rrb_valid[slot],
  116.     pcibr_soft->bs_rrb_valid[slot + PCIBR_RRB_SLOT_VIRTUAL],
  117.     pcibr_soft->bs_rrb_res[slot]);
  118. }
  119. int ips = 0;
  120. void
  121. idbg_pss(pcibr_soft_t pcibr_soft)
  122. {
  123.     pciio_slot_t slot;
  124.     
  125.     if (ips >= 0 && ips < 8)
  126. idbg_pss_info(pcibr_soft,ips);
  127.     else if (ips < 0)
  128. for (slot = 0; slot < 8; slot++) 
  129.     idbg_pss_info(pcibr_soft,slot);
  130.     else
  131. qprintf("Invalid ips %dn",ips);
  132. }
  133. #endif /* LATER */