34 #include <linux/slab.h>
58 bios =
ioremap(vram_base, size);
63 if (size == 0 || bios[0] != 0x55 || bios[1] != 0xaa) {
89 if (size == 0 || bios[0] != 0x55 || bios[1] != 0xaa) {
107 #define ATRM_BIOS_PAGE 4096
129 atrm_arg.pointer = &atrm_arg_elements[0];
132 atrm_arg_elements[0].integer.value =
offset;
135 atrm_arg_elements[1].integer.value = len;
153 int size = 256 * 1024;
165 dhandle = DEVICE_ACPI_HANDLE(&pdev->
dev);
181 DRM_ERROR(
"Unable to allocate bios\n");
185 for (i = 0; i < size / ATRM_BIOS_PAGE; i++) {
186 ret = radeon_atrm_call(atrm_handle,
188 (i * ATRM_BIOS_PAGE),
190 if (ret < ATRM_BIOS_PAGE)
194 if (i == 0 || rdev->
bios[0] != 0x55 || rdev->
bios[1] != 0xaa) {
201 static inline bool radeon_atrm_get_bios(
struct radeon_device *rdev)
207 static bool ni_read_disabled_bios(
struct radeon_device *rdev)
212 u32 vga_render_control;
235 r = radeon_read_bios(rdev);
246 static bool r700_read_disabled_bios(
struct radeon_device *rdev)
295 r = radeon_read_bios(rdev);
303 while (!(cg_spll_status & R600_SPLL_CHG_STATUS))
315 static bool r600_read_disabled_bios(
struct radeon_device *rdev)
325 uint32_t medium_vid_lower_gpio_cntl;
365 (low_vid_lower_gpio_cntl & ~0x400));
367 (medium_vid_lower_gpio_cntl & ~0x400));
369 (high_vid_lower_gpio_cntl & ~0x400));
371 (ctxsw_vid_lower_gpio_cntl & ~0x400));
374 r = radeon_read_bios(rdev);
392 static bool avivo_read_disabled_bios(
struct radeon_device *rdev)
438 r = radeon_read_bios(rdev);
453 static bool legacy_read_disabled_bios(
struct radeon_device *rdev)
516 r = radeon_read_bios(rdev);
536 static bool radeon_read_disabled_bios(
struct radeon_device *rdev)
539 return igp_read_bios_from_vram(rdev);
541 return ni_read_disabled_bios(rdev);
543 return r700_read_disabled_bios(rdev);
545 return r600_read_disabled_bios(rdev);
547 return avivo_read_disabled_bios(rdev);
549 return legacy_read_disabled_bios(rdev);
553 static bool radeon_acpi_vfct_bios(
struct radeon_device *rdev)
565 DRM_ERROR(
"ACPI VFCT table present but broken (too short #1)\n");
571 DRM_ERROR(
"ACPI VFCT table present but broken (too short #2)\n");
577 DRM_INFO(
"ACPI VFCT contains a BIOS for %02x:%02x.%d %04x:%04x, size %d\n",
581 if (vhdr->
PCIBus != rdev->
pdev->bus->number ||
586 DRM_INFO(
"ACPI VFCT table is not for this card\n");
591 DRM_ERROR(
"ACPI VFCT image truncated\n");
602 static inline bool radeon_acpi_vfct_bios(
struct radeon_device *rdev)
613 r = radeon_atrm_get_bios(rdev);
615 r = radeon_acpi_vfct_bios(rdev);
617 r = igp_read_bios_from_vram(rdev);
619 r = radeon_read_bios(rdev);
621 r = radeon_read_disabled_bios(rdev);
623 if (r ==
false || rdev->
bios ==
NULL) {
624 DRM_ERROR(
"Unable to locate a BIOS ROM\n");
628 if (rdev->
bios[0] != 0x55 || rdev->
bios[1] != 0xaa) {
629 printk(
"BIOS signature incorrect %x %x\n", rdev->
bios[0], rdev->
bios[1]);
634 if (
RBIOS8(tmp + 0x14) != 0x0) {
635 DRM_INFO(
"Not an x86 BIOS ROM, not using.\n");
651 DRM_DEBUG(
"%sBIOS detected\n", rdev->
is_atom_bios ?
"ATOM" :
"COM");