[PATCH] drm/radeon/kms: add ioport register access
Alex Deucher
alexdeucher at gmail.com
Tue Jul 6 22:58:56 PDT 2010
On Wed, Jul 7, 2010 at 12:29 AM, Dave Airlie <airlied at gmail.com> wrote:
>> int radeon_atombios_init(struct radeon_device *rdev)
>> {
>> struct card_info *atom_card_info =
>> @@ -427,6 +443,9 @@ int radeon_atombios_init(struct radeon_device *rdev)
>> atom_card_info->dev = rdev->ddev;
>> atom_card_info->reg_read = cail_reg_read;
>> atom_card_info->reg_write = cail_reg_write;
>> + /* needed for iio ops */
>> + atom_card_info->ioreg_read = cail_ioreg_read;
>> + atom_card_info->ioreg_write = cail_ioreg_write;
>> atom_card_info->mc_read = cail_mc_read;
>> atom_card_info->mc_write = cail_mc_write;
>> atom_card_info->pll_read = cail_pll_read;
>> @@ -659,6 +678,19 @@ int radeon_device_init(struct radeon_device *rdev,
>> DRM_INFO("register mmio base: 0x%08X\n", (uint32_t)rdev->rmmio_base);
>> DRM_INFO("register mmio size: %u\n", (unsigned)rdev->rmmio_size);
>>
>> + /* io port mapping */
>> + if (rdev->family >= CHIP_RV770) {
>> + rdev->rio_mem_size = pci_resource_len(rdev->pdev, 4);
>> + rdev->rio_mem = pci_iomap(rdev->pdev, 4, rdev->rio_mem_size);
>> + } else {
>> + rdev->rio_mem_size = pci_resource_len(rdev->pdev, 1);
>> + rdev->rio_mem = pci_iomap(rdev->pdev, 1, rdev->rio_mem_size);
>> + }
>> + if (rdev->rio_mem == NULL) {
>> + iounmap(rdev->rmmio);
>> + return -EIO;
>> + }
>> +
>
> This is all bad, my main r600 stopped working after this, from my
> quick boot test
> r100->r300 are all port 1, discrete r480 and upwards (not sure about
> rv410) is port 4,
> IGP, rs480 is port 1, rs690 is port 4, rs780 is port 1. We need to
> either guarantee these work
> or fallback gracefully instead of failing to load the driver.
>
The attached patch should handle it gracefully.
Alex
> Dave.
>
>> /* if we have > 1 VGA cards, then disable the radeon VGA resources */
>> /* this will fail for cards that aren't VGA class devices, just
>> * ignore it */
>> @@ -701,6 +733,8 @@ void radeon_device_fini(struct radeon_device *rdev)
>> destroy_workqueue(rdev->wq);
>> vga_switcheroo_unregister_client(rdev->pdev);
>> vga_client_register(rdev->pdev, NULL, NULL, NULL);
>> + pci_iounmap(rdev->pdev, rdev->rio_mem);
>> + rdev->rio_mem = NULL;
>> iounmap(rdev->rmmio);
>> rdev->rmmio = NULL;
>> }
>> --
>> 1.7.0.1
>>
>>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-drm-radeon-kms-ioport-fixes.patch
Type: text/x-patch
Size: 2766 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20100707/e3c61214/attachment.bin>
More information about the dri-devel
mailing list