Subversion Repositories Kolibri OS

Rev

Rev 2326 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. #include <linux/kernel.h>
  2. #include <linux/module.h>
  3. #include <linux/mod_devicetable.h>
  4. #include <errno-base.h>
  5. #include <linux/pci.h>
  6. #include <syscall.h>
  7.  
  8. int init_agp(void);
  9.  
  10. static char  log[256];
  11.  
  12. u32_t drvEntry(int action, char *cmdline)
  13. {
  14.     struct pci_device_id  *ent;
  15.  
  16.     int     err = 0;
  17.  
  18.     if(action != 1)
  19.         return 0;
  20.  
  21.     if( GetService("DISPLAY") != 0 )
  22.         return 0;
  23.  
  24. //    if( cmdline && *cmdline )
  25. //        parse_cmdline(cmdline, &usermode, log, &radeon_modeset);
  26.  
  27.     if(!dbg_open(log))
  28.     {
  29.         strcpy(log, "/RD/1/DRIVERS/i915.log");
  30.  
  31.         if(!dbg_open(log))
  32.         {
  33.             printf("Can't open %s\nExit\n", log);
  34.             return 0;
  35.         };
  36.     }
  37.     dbgprintf("i915 RC01 cmdline %s\n", cmdline);
  38.  
  39.     enum_pci_devices();
  40.  
  41.     err = i915_init();
  42.  
  43. //    rdev = rdisplay->ddev->dev_private;
  44.  
  45. //    err = RegService("DISPLAY", display_handler);
  46.  
  47. //    if( err != 0)
  48. //        dbgprintf("Set DISPLAY handler\n");
  49.  
  50.     return err;
  51. };
  52.  
  53. #define PCI_CLASS_REVISION      0x08
  54. #define PCI_CLASS_DISPLAY_VGA   0x0300
  55. #define PCI_CLASS_BRIDGE_HOST   0x0600
  56.  
  57. int pci_scan_filter(u32_t id, u32_t busnr, u32_t devfn)
  58. {
  59.     u16_t vendor, device;
  60.     u32_t class;
  61.     int   ret = 0;
  62.  
  63.     vendor   = id & 0xffff;
  64.     device   = (id >> 16) & 0xffff;
  65.  
  66.     if(vendor == 0x8086)
  67.     {
  68.         class = PciRead32(busnr, devfn, PCI_CLASS_REVISION);
  69.         class >>= 16;
  70.  
  71.         if( (class == PCI_CLASS_DISPLAY_VGA) ||
  72.             (class == PCI_CLASS_BRIDGE_HOST) )
  73.             ret = 1;
  74.     }
  75.     return ret;
  76. };
  77.