Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 62103
Collapse All | Expand All

(-)nv/nv.c (-39 / +35 lines)
Lines 1225-1230 Link Here
1225
        {
1225
        {
1226
            nv_state_t *nv = NV_STATE_PTR(&nv_linux_devices[i]);
1226
            nv_state_t *nv = NV_STATE_PTR(&nv_linux_devices[i]);
1227
            release_mem_region(nv->bar.regs.address, nv->bar.regs.size);
1227
            release_mem_region(nv->bar.regs.address, nv->bar.regs.size);
1228
            pci_disable_device(nv_linux_devices[i].dev);
1228
        }
1229
        }
1229
    }
1230
    }
1230
1231
Lines 3516-3521 Link Here
3516
        return -1;
3517
        return -1;
3517
    }
3518
    }
3518
3519
3520
    // enable io, mem, and bus-mastering in pci config space
3521
    if (pci_enable_device(dev) != 0)
3522
    {
3523
        nv_printf(NV_DBG_ERRORS,
3524
            "NVRM: pci_enable_device failed, aborting\n");
3525
        return -1;
3526
    }
3527
3528
    // request ownership of our bars
3529
    // keeps other drivers from banging our registers.
3530
    // only do this for registers, as vesafb requests our framebuffer and will
3531
    // keep us from working properly
3532
    if (!request_mem_region(dev->resource[0].start,
3533
                            dev->resource[0].end - dev->resource[0].start + 1,
3534
                            "nvidia"))
3535
    {
3536
        nv_printf(NV_DBG_ERRORS,
3537
            "NVRM: pci_request_regions failed, aborting\n");
3538
        goto err_disable_dev;
3539
    }
3540
    pci_set_master(dev);
3541
3519
    /* initialize bus-dependent config state */
3542
    /* initialize bus-dependent config state */
3520
    nvl = &nv_linux_devices[num_nv_devices];
3543
    nvl = &nv_linux_devices[num_nv_devices];
3521
    nv  = NV_STATE_PTR(nvl);
3544
    nv  = NV_STATE_PTR(nvl);
Lines 3545-3551 Link Here
3545
        nv_printf(NV_DBG_ERRORS, "NVRM: Please check your BIOS settings.         \n");
3568
        nv_printf(NV_DBG_ERRORS, "NVRM: Please check your BIOS settings.         \n");
3546
        nv_printf(NV_DBG_ERRORS, "NVRM: [Plug & Play OS   ] should be set to NO  \n");
3569
        nv_printf(NV_DBG_ERRORS, "NVRM: [Plug & Play OS   ] should be set to NO  \n");
3547
        nv_printf(NV_DBG_ERRORS, "NVRM: [Assign IRQ to VGA] should be set to YES \n");
3570
        nv_printf(NV_DBG_ERRORS, "NVRM: [Assign IRQ to VGA] should be set to YES \n");
3548
        return -1;
3571
        goto err_zero_dev;
3549
    }
3572
    }
3550
3573
3551
    /* sanity check the IO apertures */
3574
    /* sanity check the IO apertures */
Lines 3569-3607 Link Here
3569
                nv->bar.fb.address, nv->bar.fb.size);
3592
                nv->bar.fb.address, nv->bar.fb.size);
3570
        }
3593
        }
3571
3594
3572
        /* Clear out the data */
3595
        goto err_zero_dev;
3573
        os_mem_set(nvl, 0, sizeof(nv_linux_state_t));
3574
3575
        return -1;
3576
    }
3577
3578
    // request ownership of our bars
3579
    // keeps other drivers from banging our registers.
3580
    // only do this for registers, as vesafb requests our framebuffer and will
3581
    // keep us from working properly
3582
    if (!request_mem_region(nv->bar.regs.address, nv->bar.regs.size, "nvidia"))
3583
    {
3584
        nv_printf(NV_DBG_ERRORS,
3585
            "NVRM: pci_request_regions failed, aborting\n");
3586
3587
        /* Clear out the data */
3588
        os_mem_set(nvl, 0, sizeof(nv_linux_state_t));
3589
3590
        return -1;
3591
    }
3596
    }
3592
3597
3593
    // enable io, mem, and bus-mastering in pci config space
3594
    if (pci_enable_device(dev) != 0)
3595
    {
3596
        nv_printf(NV_DBG_ERRORS,
3597
            "NVRM: pci_enable_device failed, aborting\n");
3598
3599
        pci_release_regions(dev);
3600
        os_mem_set(nvl, 0, sizeof(nv_linux_state_t));
3601
3602
        return -1;
3603
    }
3604
    pci_set_master(nvl->dev);
3605
3598
3606
#if defined(NV_BUILD_NV_PAT_SUPPORT)
3599
#if defined(NV_BUILD_NV_PAT_SUPPORT)
3607
    if (nvos_find_pci_express_capability(nvl->dev))
3600
    if (nvos_find_pci_express_capability(nvl->dev))
Lines 3618-3630 Link Here
3618
    if (nv->bar.regs.map == NULL)
3611
    if (nv->bar.regs.map == NULL)
3619
    {
3612
    {
3620
        nv_printf(NV_DBG_ERRORS, "NVRM: failed to map registers!!\n");
3613
        nv_printf(NV_DBG_ERRORS, "NVRM: failed to map registers!!\n");
3621
3614
        goto err_zero_dev;
3622
        pci_release_regions(dev);
3623
3624
        /* Clear out the data */
3625
        os_mem_set(nvl, 0, sizeof(nv_linux_state_t));
3626
3627
        return -1;
3628
    }
3615
    }
3629
    nv->flags |= NV_FLAG_MAP_REGS_EARLY;
3616
    nv->flags |= NV_FLAG_MAP_REGS_EARLY;
3630
#endif
3617
#endif
Lines 3641-3646 Link Here
3641
    num_nv_devices++;
3628
    num_nv_devices++;
3642
3629
3643
    return 0;
3630
    return 0;
3631
3632
err_zero_dev:
3633
    os_mem_set(nvl, 0, sizeof(nv_linux_state_t));
3634
    release_mem_region(dev->resource[0].start,
3635
                       dev->resource[0].end - dev->resource[0].start + 1);
3636
3637
err_disable_dev:
3638
    pci_disable_device(dev);
3639
    return -1;
3644
}
3640
}
3645
3641
3646
int NV_API_CALL nv_no_incoherent_mappings
3642
int NV_API_CALL nv_no_incoherent_mappings

Return to bug 62103