Subversion Repositories Kolibri OS

Rev

Rev 2325 | Rev 2330 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2325 Serge 1
#include 
2
#include 
3
#include 
4
#include 
5
#include 
6
#include 
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
2326 Serge 56
#define PCI_CLASS_BRIDGE_ISA    0x0601
2325 Serge 57
 
58
int pci_scan_filter(u32_t id, u32_t busnr, u32_t devfn)
59
{
60
    u16_t vendor, device;
61
    u32_t class;
62
    int   ret = 0;
63
 
64
    vendor   = id & 0xffff;
65
    device   = (id >> 16) & 0xffff;
66
 
67
    if(vendor == 0x8086)
68
    {
69
        class = PciRead32(busnr, devfn, PCI_CLASS_REVISION);
70
        class >>= 16;
71
 
72
        if( (class == PCI_CLASS_DISPLAY_VGA) ||
2326 Serge 73
            (class == PCI_CLASS_BRIDGE_HOST) ||
74
            (class == PCI_CLASS_BRIDGE_ISA))
2325 Serge 75
            ret = 1;
76
    }
77
    return ret;
78
};