[PATCH] drm/radeon/kms: add ioport register access

Dave Airlie airlied at gmail.com
Tue Jul 6 21:29:24 PDT 2010


>  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.

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
>
>


More information about the dri-devel mailing list