Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1.  
  2. #define PCI_CLASS_BRIDGE_HOST    0x06
  3.  
  4. #define INTEL_82443LX_0         (0x7180<<16)|0x8086
  5. #define INTEL_82443BX_0         (0x7190<<16)|0x8086
  6. #define INTEL_82443GX_0         (0x71a0<<16)|0x8086
  7. #define INTEL_82810_MC1         (0x7120<<16)|0x8086
  8. #define INTEL_82810_MC3         (0x7122<<16)|0x8086
  9. #define INTEL_82810E_MC         (0x7124<<16)|0x8086
  10. #define INTEL_82815_MC          (0x1130<<16)|0x8086
  11. #define INTEL_82820_HB          (0x2500<<16)|0x8086
  12. #define INTEL_82820_UP_HB       (0x2501<<16)|0x8086
  13. #define INTEL_82830_HB          (0x3575<<16)|0x8086
  14. #define INTEL_82840_HB          (0x1a21<<16)|0x8086
  15. #define INTEL_82845_HB          (0x1a30<<16)|0x8086
  16. #define INTEL_82845G_HB         (0x2560<<16)|0x8086
  17. #define INTEL_82850_HB          (0x2530<<16)|0x8086
  18. #define INTEL_82855PM_HB        (0x3340<<16)|0x8086
  19. #define INTEL_82855GM_HB        (0x3580<<16)|0x8086
  20. #define INTEL_82860_HB          (0x2531<<16)|0x8086
  21. #define INTEL_82865_HB          (0x2570<<16)|0x8086
  22. #define INTEL_82875_HB          (0x2578<<16)|0x8086
  23. #define INTEL_7505_0            (0x2550<<16)|0x8086
  24. #define INTEL_7205_0            (0x255d<<16)|0x8086
  25. #define INTEL_82915G_HB         (0x2580<<16)|0x8086
  26. #define INTEL_82915GM_HB        (0x2590<<16)|0x8086
  27. #define INTEL_82945G_HB         (0x2770<<16)|0x8086
  28. #define INTEL_82945GM_HB        (0x27A0<<16)|0x8086
  29.  
  30.  
  31. typedef struct
  32. {
  33.     int    id;
  34.     int    driver;
  35. }pci_device_t;
  36.  
  37.  
  38. static pci_device_t agp_dev_table[] = {
  39.  
  40. //    { INTEL_82443LX_0,  0 },
  41. //    { INTEL_82443BX_0,  0 },
  42. //    { INTEL_82443GX_0,  0 },
  43. //    { INTEL_82810_MC1,  0 },
  44. //    { INTEL_82810_MC3,  0 },
  45. //    { INTEL_82810E_MC,  0 },
  46. //    { INTEL_82815_MC,   0 },
  47. //    { INTEL_82820_HB,   0 },
  48. //    { INTEL_82820_UP_HB,0 },
  49. //    { INTEL_82830_HB,   0 },
  50. //    { INTEL_82840_HB,   0 },
  51. //    { INTEL_82845_HB,   0 },
  52. //    { INTEL_82845G_HB,  0 },
  53. //    { INTEL_82850_HB,   0 },
  54. //    { INTEL_82855PM_HB, 0 },
  55. //    { INTEL_82855GM_HB, 0 },
  56. //    { INTEL_82860_HB,   0 },
  57.     { INTEL_82865_HB,   0 },
  58. //    { INTEL_82875_HB,   0 },
  59. //    { INTEL_7505_0,     0 },
  60. //    { INTEL_7205_0,     0 },
  61. //    { INTEL_82915G_HB,  0 },
  62. //    { INTEL_82915GM_HB, 0 },
  63. //    { INTEL_82945G_HB,  0 },
  64. //    { INTEL_82945GM_HB, 0 },
  65.     { 0, 0 }
  66. };
  67.  
  68. pci_device_t* agp_dev_match(u32_t dev, pci_device_t *list)
  69. {
  70.   while(list->id)
  71.   {
  72.     if(dev == list->id)
  73.       return list;
  74.     list++;
  75.   }
  76.   return NULL;
  77. }
  78.  
  79. int FindPciDevice()
  80. {
  81.     u32_t bus, last_bus;
  82.     PCITAG tag;
  83.  
  84.     if( (last_bus = PciApi(1))==-1)
  85.         return 0;
  86.  
  87.     for(bus=0;bus<=last_bus;bus++)
  88.     {
  89.         u32_t devfn;
  90.  
  91.         for(devfn=0;devfn<256;devfn++)
  92.         {
  93.             u32_t pciId;
  94.             u8_t  devclass;
  95.             pci_device_t *dev;
  96.  
  97.             pciId  = PciRead32(bus,devfn, 0);
  98.             devclass = PciRead8(bus,devfn, 0x0B);
  99.  
  100.             if( devclass != PCI_CLASS_BRIDGE_HOST)
  101.                 continue;
  102.  
  103.             if( (dev = agp_dev_match(pciId, agp_dev_table))!=NULL)
  104.             {
  105.                 dbgprintf("detect agp host %x\n",dev->id);
  106.  
  107.                 PCITAG PciTag = pciTag(bus,(devfn>>3)&0x1F,devfn&0x7);
  108.  
  109.                 return init_bridge(PciTag);
  110.             };
  111.         };
  112.     };
  113.     return 0;
  114. };
  115.  
  116.  
  117.