Subversion Repositories HelenOS-historic

Rev

Rev 1302 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1302 Rev 1307
Line 77... Line 77...
77
    a->debug("...sanity check");
77
    a->debug("...sanity check");
78
    d.bus = 0;
78
    d.bus = 0;
79
    d.func = 0;
79
    d.func = 0;
80
    for (d.dev = 0; d.dev < 32; d.dev++) {
80
    for (d.dev = 0; d.dev < 32; d.dev++) {
81
        u16 class, vendor;
81
        u16 class, vendor;
82
        if (m->
-
 
83
            read(&d, PCI_CLASS_DEVICE, (byte *) & class,
82
        if (m->read(&d, PCI_CLASS_DEVICE, (byte *) & class,
84
             sizeof(class))
83
             sizeof(class))
85
            && (class == cpu_to_le16(PCI_CLASS_BRIDGE_HOST)
84
            && (class == cpu_to_le16(PCI_CLASS_BRIDGE_HOST)
86
            || class == cpu_to_le16(PCI_CLASS_DISPLAY_VGA))
85
            || class == cpu_to_le16(PCI_CLASS_DISPLAY_VGA))
87
            || m->read(&d, PCI_VENDOR_ID, (byte *) & vendor,
86
            || m->read(&d, PCI_VENDOR_ID, (byte *) & vendor,
88
                   sizeof(vendor))
87
                   sizeof(vendor))
Line 176... Line 175...
176
 */
175
 */
177
 
176
 
178
static int conf2_detect(struct pci_access *a)
177
static int conf2_detect(struct pci_access *a)
179
{
178
{
180
    /* This is ugly and tends to produce false positives. Beware. */
179
    /* This is ugly and tends to produce false positives. Beware. */
181
 
-
 
182
    outb(0x00, 0xCFB);
180
    outb(0x00, 0xCFB);
183
    outb(0x00, 0xCF8);
181
    outb(0x00, 0xCF8);
184
    outb(0x00, 0xCFA);
182
    outb(0x00, 0xCFA);
185
    if (inb(0xCF8) == 0x00 && inb(0xCFA) == 0x00)
183
    if (inb(0xCF8) == 0x00 && inb(0xCFA) == 0x00)
186
        return intel_sanity_check(a, &pm_intel_conf2);
184
        return intel_sanity_check(a, &pm_intel_conf2);
Line 224... Line 222...
224
 
222
 
225
    if (pos >= 256)
223
    if (pos >= 256)
226
        return 0;
224
        return 0;
227
 
225
 
228
    if (d->dev >= 16)
226
    if (d->dev >= 16)
229
        d->access->
-
 
230
            error("conf2_write: only first 16 devices exist.");
227
        d->access->error("conf2_write: only first 16 devices exist.");
231
    outb((d->func << 1) | 0xf0, 0xcf8);
228
    outb((d->func << 1) | 0xf0, 0xcf8);
232
    outb(d->bus, 0xcfa);
229
    outb(d->bus, 0xcfa);
233
    switch (len) {
230
    switch (len) {
234
    case 1:
231
    case 1:
235
        outb(buf[0], addr);
232
        outb(buf[0], addr);