2009-06-05 20:42:42 +08:00
|
|
|
/*
|
|
|
|
* Copyright 2008 Advanced Micro Devices, Inc.
|
|
|
|
* Copyright 2008 Red Hat Inc.
|
|
|
|
* Copyright 2009 Jerome Glisse.
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
|
|
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
|
|
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
|
|
* OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
*
|
|
|
|
* Authors: Dave Airlie
|
|
|
|
* Alex Deucher
|
|
|
|
* Jerome Glisse
|
|
|
|
*/
|
2012-10-03 01:01:07 +08:00
|
|
|
#include <drm/drmP.h>
|
2009-06-05 20:42:42 +08:00
|
|
|
#include "radeon_reg.h"
|
|
|
|
#include "radeon.h"
|
|
|
|
#include "atom.h"
|
|
|
|
|
2010-02-01 13:38:10 +08:00
|
|
|
#include <linux/vga_switcheroo.h>
|
include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.
percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.
http://userweb.kernel.org/~tj/misc/slabh-sweep.py
The script does the followings.
* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.
* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.
* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.
The conversion was done in the following steps.
1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.
2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.
3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.
4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.
5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.
6. percpu.h was updated not to include slab.h.
7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).
* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig
8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.
Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.
Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2010-03-24 16:04:11 +08:00
|
|
|
#include <linux/slab.h>
|
2012-08-17 03:45:20 +08:00
|
|
|
#include <linux/acpi.h>
|
2009-06-05 20:42:42 +08:00
|
|
|
/*
|
|
|
|
* BIOS.
|
|
|
|
*/
|
2009-10-03 05:36:41 +08:00
|
|
|
|
|
|
|
/* If you boot an IGP board with a discrete card as the primary,
|
|
|
|
* the IGP rom is not accessible via the rom bar as the IGP rom is
|
|
|
|
* part of the system bios. On boot, the system bios puts a
|
|
|
|
* copy of the igp rom at the start of vram if a discrete card is
|
|
|
|
* present.
|
|
|
|
*/
|
|
|
|
static bool igp_read_bios_from_vram(struct radeon_device *rdev)
|
|
|
|
{
|
|
|
|
uint8_t __iomem *bios;
|
|
|
|
resource_size_t vram_base;
|
|
|
|
resource_size_t size = 256 * 1024; /* ??? */
|
|
|
|
|
2010-06-21 11:31:38 +08:00
|
|
|
if (!(rdev->flags & RADEON_IS_IGP))
|
|
|
|
if (!radeon_card_posted(rdev))
|
|
|
|
return false;
|
|
|
|
|
2009-10-03 05:36:41 +08:00
|
|
|
rdev->bios = NULL;
|
2010-05-28 03:40:24 +08:00
|
|
|
vram_base = pci_resource_start(rdev->pdev, 0);
|
2009-10-03 05:36:41 +08:00
|
|
|
bios = ioremap(vram_base, size);
|
|
|
|
if (!bios) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (size == 0 || bios[0] != 0x55 || bios[1] != 0xaa) {
|
|
|
|
iounmap(bios);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
rdev->bios = kmalloc(size, GFP_KERNEL);
|
|
|
|
if (rdev->bios == NULL) {
|
|
|
|
iounmap(bios);
|
|
|
|
return false;
|
|
|
|
}
|
2010-02-01 13:38:10 +08:00
|
|
|
memcpy_fromio(rdev->bios, bios, size);
|
2009-10-03 05:36:41 +08:00
|
|
|
iounmap(bios);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2009-06-05 20:42:42 +08:00
|
|
|
static bool radeon_read_bios(struct radeon_device *rdev)
|
|
|
|
{
|
|
|
|
uint8_t __iomem *bios;
|
|
|
|
size_t size;
|
|
|
|
|
|
|
|
rdev->bios = NULL;
|
2009-10-03 05:36:41 +08:00
|
|
|
/* XXX: some cards may return 0 for rom size? ddx has a workaround */
|
2009-06-05 20:42:42 +08:00
|
|
|
bios = pci_map_rom(rdev->pdev, &size);
|
|
|
|
if (!bios) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (size == 0 || bios[0] != 0x55 || bios[1] != 0xaa) {
|
|
|
|
pci_unmap_rom(rdev->pdev, bios);
|
|
|
|
return false;
|
|
|
|
}
|
2010-05-16 05:17:40 +08:00
|
|
|
rdev->bios = kmemdup(bios, size, GFP_KERNEL);
|
2009-06-05 20:42:42 +08:00
|
|
|
if (rdev->bios == NULL) {
|
|
|
|
pci_unmap_rom(rdev->pdev, bios);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
pci_unmap_rom(rdev->pdev, bios);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2013-03-27 05:25:56 +08:00
|
|
|
static bool radeon_read_platform_bios(struct radeon_device *rdev)
|
|
|
|
{
|
|
|
|
uint8_t __iomem *bios;
|
|
|
|
size_t size;
|
|
|
|
|
|
|
|
rdev->bios = NULL;
|
|
|
|
|
|
|
|
bios = pci_platform_rom(rdev->pdev, &size);
|
|
|
|
if (!bios) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (size == 0 || bios[0] != 0x55 || bios[1] != 0xaa) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
rdev->bios = kmemdup(bios, size, GFP_KERNEL);
|
|
|
|
if (rdev->bios == NULL) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-08-17 03:39:09 +08:00
|
|
|
#ifdef CONFIG_ACPI
|
2010-02-01 13:38:10 +08:00
|
|
|
/* ATRM is used to get the BIOS on the discrete cards in
|
|
|
|
* dual-gpu systems.
|
|
|
|
*/
|
2012-08-17 03:39:09 +08:00
|
|
|
/* retrieve the ROM in 4k blocks */
|
|
|
|
#define ATRM_BIOS_PAGE 4096
|
|
|
|
/**
|
|
|
|
* radeon_atrm_call - fetch a chunk of the vbios
|
|
|
|
*
|
|
|
|
* @atrm_handle: acpi ATRM handle
|
|
|
|
* @bios: vbios image pointer
|
|
|
|
* @offset: offset of vbios image data to fetch
|
|
|
|
* @len: length of vbios image data to fetch
|
|
|
|
*
|
|
|
|
* Executes ATRM to fetch a chunk of the discrete
|
|
|
|
* vbios image on PX systems (all asics).
|
|
|
|
* Returns the length of the buffer fetched.
|
|
|
|
*/
|
|
|
|
static int radeon_atrm_call(acpi_handle atrm_handle, uint8_t *bios,
|
|
|
|
int offset, int len)
|
|
|
|
{
|
|
|
|
acpi_status status;
|
|
|
|
union acpi_object atrm_arg_elements[2], *obj;
|
|
|
|
struct acpi_object_list atrm_arg;
|
|
|
|
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL};
|
|
|
|
|
|
|
|
atrm_arg.count = 2;
|
|
|
|
atrm_arg.pointer = &atrm_arg_elements[0];
|
|
|
|
|
|
|
|
atrm_arg_elements[0].type = ACPI_TYPE_INTEGER;
|
|
|
|
atrm_arg_elements[0].integer.value = offset;
|
|
|
|
|
|
|
|
atrm_arg_elements[1].type = ACPI_TYPE_INTEGER;
|
|
|
|
atrm_arg_elements[1].integer.value = len;
|
|
|
|
|
|
|
|
status = acpi_evaluate_object(atrm_handle, NULL, &atrm_arg, &buffer);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
printk("failed to evaluate ATRM got %s\n", acpi_format_exception(status));
|
|
|
|
return -ENODEV;
|
|
|
|
}
|
|
|
|
|
|
|
|
obj = (union acpi_object *)buffer.pointer;
|
|
|
|
memcpy(bios+offset, obj->buffer.pointer, obj->buffer.length);
|
|
|
|
len = obj->buffer.length;
|
|
|
|
kfree(buffer.pointer);
|
|
|
|
return len;
|
|
|
|
}
|
|
|
|
|
2010-02-01 13:38:10 +08:00
|
|
|
static bool radeon_atrm_get_bios(struct radeon_device *rdev)
|
|
|
|
{
|
|
|
|
int ret;
|
2011-06-24 21:15:38 +08:00
|
|
|
int size = 256 * 1024;
|
2010-02-01 13:38:10 +08:00
|
|
|
int i;
|
2012-08-17 03:39:09 +08:00
|
|
|
struct pci_dev *pdev = NULL;
|
|
|
|
acpi_handle dhandle, atrm_handle;
|
|
|
|
acpi_status status;
|
|
|
|
bool found = false;
|
|
|
|
|
|
|
|
/* ATRM is for the discrete card only */
|
|
|
|
if (rdev->flags & RADEON_IS_IGP)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, pdev)) != NULL) {
|
2013-11-15 06:17:21 +08:00
|
|
|
dhandle = ACPI_HANDLE(&pdev->dev);
|
2012-08-17 03:39:09 +08:00
|
|
|
if (!dhandle)
|
|
|
|
continue;
|
2010-02-01 13:38:10 +08:00
|
|
|
|
2012-08-17 03:39:09 +08:00
|
|
|
status = acpi_get_handle(dhandle, "ATRM", &atrm_handle);
|
|
|
|
if (!ACPI_FAILURE(status)) {
|
|
|
|
found = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-05-09 08:04:03 +08:00
|
|
|
if (!found) {
|
|
|
|
while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_OTHER << 8, pdev)) != NULL) {
|
|
|
|
dhandle = ACPI_HANDLE(&pdev->dev);
|
|
|
|
if (!dhandle)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
status = acpi_get_handle(dhandle, "ATRM", &atrm_handle);
|
|
|
|
if (!ACPI_FAILURE(status)) {
|
|
|
|
found = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-08-17 03:39:09 +08:00
|
|
|
if (!found)
|
2010-02-01 13:38:10 +08:00
|
|
|
return false;
|
|
|
|
|
|
|
|
rdev->bios = kmalloc(size, GFP_KERNEL);
|
|
|
|
if (!rdev->bios) {
|
|
|
|
DRM_ERROR("Unable to allocate bios\n");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < size / ATRM_BIOS_PAGE; i++) {
|
2012-08-17 03:39:09 +08:00
|
|
|
ret = radeon_atrm_call(atrm_handle,
|
|
|
|
rdev->bios,
|
|
|
|
(i * ATRM_BIOS_PAGE),
|
|
|
|
ATRM_BIOS_PAGE);
|
2012-01-22 22:47:28 +08:00
|
|
|
if (ret < ATRM_BIOS_PAGE)
|
2010-02-01 13:38:10 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (i == 0 || rdev->bios[0] != 0x55 || rdev->bios[1] != 0xaa) {
|
|
|
|
kfree(rdev->bios);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
2012-08-17 03:39:09 +08:00
|
|
|
#else
|
|
|
|
static inline bool radeon_atrm_get_bios(struct radeon_device *rdev)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
#endif
|
2010-12-01 08:11:45 +08:00
|
|
|
|
2011-01-07 10:19:23 +08:00
|
|
|
static bool ni_read_disabled_bios(struct radeon_device *rdev)
|
|
|
|
{
|
|
|
|
u32 bus_cntl;
|
|
|
|
u32 d1vga_control;
|
|
|
|
u32 d2vga_control;
|
|
|
|
u32 vga_render_control;
|
|
|
|
u32 rom_cntl;
|
|
|
|
bool r;
|
|
|
|
|
|
|
|
bus_cntl = RREG32(R600_BUS_CNTL);
|
|
|
|
d1vga_control = RREG32(AVIVO_D1VGA_CONTROL);
|
|
|
|
d2vga_control = RREG32(AVIVO_D2VGA_CONTROL);
|
|
|
|
vga_render_control = RREG32(AVIVO_VGA_RENDER_CONTROL);
|
|
|
|
rom_cntl = RREG32(R600_ROM_CNTL);
|
|
|
|
|
|
|
|
/* enable the rom */
|
|
|
|
WREG32(R600_BUS_CNTL, (bus_cntl & ~R600_BIOS_ROM_DIS));
|
2012-08-31 02:34:30 +08:00
|
|
|
if (!ASIC_IS_NODCE(rdev)) {
|
|
|
|
/* Disable VGA mode */
|
|
|
|
WREG32(AVIVO_D1VGA_CONTROL,
|
|
|
|
(d1vga_control & ~(AVIVO_DVGA_CONTROL_MODE_ENABLE |
|
|
|
|
AVIVO_DVGA_CONTROL_TIMING_SELECT)));
|
|
|
|
WREG32(AVIVO_D2VGA_CONTROL,
|
|
|
|
(d2vga_control & ~(AVIVO_DVGA_CONTROL_MODE_ENABLE |
|
|
|
|
AVIVO_DVGA_CONTROL_TIMING_SELECT)));
|
|
|
|
WREG32(AVIVO_VGA_RENDER_CONTROL,
|
|
|
|
(vga_render_control & ~AVIVO_VGA_VSTATUS_CNTL_MASK));
|
|
|
|
}
|
2011-01-07 10:19:23 +08:00
|
|
|
WREG32(R600_ROM_CNTL, rom_cntl | R600_SCK_OVERWRITE);
|
|
|
|
|
|
|
|
r = radeon_read_bios(rdev);
|
|
|
|
|
|
|
|
/* restore regs */
|
|
|
|
WREG32(R600_BUS_CNTL, bus_cntl);
|
2012-08-31 02:34:30 +08:00
|
|
|
if (!ASIC_IS_NODCE(rdev)) {
|
|
|
|
WREG32(AVIVO_D1VGA_CONTROL, d1vga_control);
|
|
|
|
WREG32(AVIVO_D2VGA_CONTROL, d2vga_control);
|
|
|
|
WREG32(AVIVO_VGA_RENDER_CONTROL, vga_render_control);
|
|
|
|
}
|
2011-01-07 10:19:23 +08:00
|
|
|
WREG32(R600_ROM_CNTL, rom_cntl);
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
2009-06-05 20:42:42 +08:00
|
|
|
static bool r700_read_disabled_bios(struct radeon_device *rdev)
|
|
|
|
{
|
|
|
|
uint32_t viph_control;
|
|
|
|
uint32_t bus_cntl;
|
|
|
|
uint32_t d1vga_control;
|
|
|
|
uint32_t d2vga_control;
|
|
|
|
uint32_t vga_render_control;
|
|
|
|
uint32_t rom_cntl;
|
|
|
|
uint32_t cg_spll_func_cntl = 0;
|
|
|
|
uint32_t cg_spll_status;
|
|
|
|
bool r;
|
|
|
|
|
|
|
|
viph_control = RREG32(RADEON_VIPH_CONTROL);
|
2010-12-01 08:11:45 +08:00
|
|
|
bus_cntl = RREG32(R600_BUS_CNTL);
|
2009-06-05 20:42:42 +08:00
|
|
|
d1vga_control = RREG32(AVIVO_D1VGA_CONTROL);
|
|
|
|
d2vga_control = RREG32(AVIVO_D2VGA_CONTROL);
|
|
|
|
vga_render_control = RREG32(AVIVO_VGA_RENDER_CONTROL);
|
|
|
|
rom_cntl = RREG32(R600_ROM_CNTL);
|
|
|
|
|
|
|
|
/* disable VIP */
|
|
|
|
WREG32(RADEON_VIPH_CONTROL, (viph_control & ~RADEON_VIPH_EN));
|
|
|
|
/* enable the rom */
|
2010-12-01 08:11:45 +08:00
|
|
|
WREG32(R600_BUS_CNTL, (bus_cntl & ~R600_BIOS_ROM_DIS));
|
2009-06-05 20:42:42 +08:00
|
|
|
/* Disable VGA mode */
|
|
|
|
WREG32(AVIVO_D1VGA_CONTROL,
|
|
|
|
(d1vga_control & ~(AVIVO_DVGA_CONTROL_MODE_ENABLE |
|
|
|
|
AVIVO_DVGA_CONTROL_TIMING_SELECT)));
|
|
|
|
WREG32(AVIVO_D2VGA_CONTROL,
|
|
|
|
(d2vga_control & ~(AVIVO_DVGA_CONTROL_MODE_ENABLE |
|
|
|
|
AVIVO_DVGA_CONTROL_TIMING_SELECT)));
|
|
|
|
WREG32(AVIVO_VGA_RENDER_CONTROL,
|
|
|
|
(vga_render_control & ~AVIVO_VGA_VSTATUS_CNTL_MASK));
|
|
|
|
|
|
|
|
if (rdev->family == CHIP_RV730) {
|
|
|
|
cg_spll_func_cntl = RREG32(R600_CG_SPLL_FUNC_CNTL);
|
|
|
|
|
|
|
|
/* enable bypass mode */
|
|
|
|
WREG32(R600_CG_SPLL_FUNC_CNTL, (cg_spll_func_cntl |
|
|
|
|
R600_SPLL_BYPASS_EN));
|
|
|
|
|
|
|
|
/* wait for SPLL_CHG_STATUS to change to 1 */
|
|
|
|
cg_spll_status = 0;
|
|
|
|
while (!(cg_spll_status & R600_SPLL_CHG_STATUS))
|
|
|
|
cg_spll_status = RREG32(R600_CG_SPLL_STATUS);
|
|
|
|
|
|
|
|
WREG32(R600_ROM_CNTL, (rom_cntl & ~R600_SCK_OVERWRITE));
|
|
|
|
} else
|
|
|
|
WREG32(R600_ROM_CNTL, (rom_cntl | R600_SCK_OVERWRITE));
|
|
|
|
|
|
|
|
r = radeon_read_bios(rdev);
|
|
|
|
|
|
|
|
/* restore regs */
|
|
|
|
if (rdev->family == CHIP_RV730) {
|
|
|
|
WREG32(R600_CG_SPLL_FUNC_CNTL, cg_spll_func_cntl);
|
|
|
|
|
|
|
|
/* wait for SPLL_CHG_STATUS to change to 1 */
|
|
|
|
cg_spll_status = 0;
|
|
|
|
while (!(cg_spll_status & R600_SPLL_CHG_STATUS))
|
|
|
|
cg_spll_status = RREG32(R600_CG_SPLL_STATUS);
|
|
|
|
}
|
|
|
|
WREG32(RADEON_VIPH_CONTROL, viph_control);
|
2010-12-01 08:11:45 +08:00
|
|
|
WREG32(R600_BUS_CNTL, bus_cntl);
|
2009-06-05 20:42:42 +08:00
|
|
|
WREG32(AVIVO_D1VGA_CONTROL, d1vga_control);
|
|
|
|
WREG32(AVIVO_D2VGA_CONTROL, d2vga_control);
|
|
|
|
WREG32(AVIVO_VGA_RENDER_CONTROL, vga_render_control);
|
|
|
|
WREG32(R600_ROM_CNTL, rom_cntl);
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool r600_read_disabled_bios(struct radeon_device *rdev)
|
|
|
|
{
|
|
|
|
uint32_t viph_control;
|
|
|
|
uint32_t bus_cntl;
|
|
|
|
uint32_t d1vga_control;
|
|
|
|
uint32_t d2vga_control;
|
|
|
|
uint32_t vga_render_control;
|
|
|
|
uint32_t rom_cntl;
|
|
|
|
uint32_t general_pwrmgt;
|
|
|
|
uint32_t low_vid_lower_gpio_cntl;
|
|
|
|
uint32_t medium_vid_lower_gpio_cntl;
|
|
|
|
uint32_t high_vid_lower_gpio_cntl;
|
|
|
|
uint32_t ctxsw_vid_lower_gpio_cntl;
|
|
|
|
uint32_t lower_gpio_enable;
|
|
|
|
bool r;
|
|
|
|
|
|
|
|
viph_control = RREG32(RADEON_VIPH_CONTROL);
|
2010-12-01 08:11:45 +08:00
|
|
|
bus_cntl = RREG32(R600_BUS_CNTL);
|
2009-06-05 20:42:42 +08:00
|
|
|
d1vga_control = RREG32(AVIVO_D1VGA_CONTROL);
|
|
|
|
d2vga_control = RREG32(AVIVO_D2VGA_CONTROL);
|
|
|
|
vga_render_control = RREG32(AVIVO_VGA_RENDER_CONTROL);
|
|
|
|
rom_cntl = RREG32(R600_ROM_CNTL);
|
|
|
|
general_pwrmgt = RREG32(R600_GENERAL_PWRMGT);
|
|
|
|
low_vid_lower_gpio_cntl = RREG32(R600_LOW_VID_LOWER_GPIO_CNTL);
|
|
|
|
medium_vid_lower_gpio_cntl = RREG32(R600_MEDIUM_VID_LOWER_GPIO_CNTL);
|
|
|
|
high_vid_lower_gpio_cntl = RREG32(R600_HIGH_VID_LOWER_GPIO_CNTL);
|
|
|
|
ctxsw_vid_lower_gpio_cntl = RREG32(R600_CTXSW_VID_LOWER_GPIO_CNTL);
|
|
|
|
lower_gpio_enable = RREG32(R600_LOWER_GPIO_ENABLE);
|
|
|
|
|
|
|
|
/* disable VIP */
|
|
|
|
WREG32(RADEON_VIPH_CONTROL, (viph_control & ~RADEON_VIPH_EN));
|
|
|
|
/* enable the rom */
|
2010-12-01 08:11:45 +08:00
|
|
|
WREG32(R600_BUS_CNTL, (bus_cntl & ~R600_BIOS_ROM_DIS));
|
2009-06-05 20:42:42 +08:00
|
|
|
/* Disable VGA mode */
|
|
|
|
WREG32(AVIVO_D1VGA_CONTROL,
|
|
|
|
(d1vga_control & ~(AVIVO_DVGA_CONTROL_MODE_ENABLE |
|
|
|
|
AVIVO_DVGA_CONTROL_TIMING_SELECT)));
|
|
|
|
WREG32(AVIVO_D2VGA_CONTROL,
|
|
|
|
(d2vga_control & ~(AVIVO_DVGA_CONTROL_MODE_ENABLE |
|
|
|
|
AVIVO_DVGA_CONTROL_TIMING_SELECT)));
|
|
|
|
WREG32(AVIVO_VGA_RENDER_CONTROL,
|
|
|
|
(vga_render_control & ~AVIVO_VGA_VSTATUS_CNTL_MASK));
|
|
|
|
|
|
|
|
WREG32(R600_ROM_CNTL,
|
|
|
|
((rom_cntl & ~R600_SCK_PRESCALE_CRYSTAL_CLK_MASK) |
|
|
|
|
(1 << R600_SCK_PRESCALE_CRYSTAL_CLK_SHIFT) |
|
|
|
|
R600_SCK_OVERWRITE));
|
|
|
|
|
|
|
|
WREG32(R600_GENERAL_PWRMGT, (general_pwrmgt & ~R600_OPEN_DRAIN_PADS));
|
|
|
|
WREG32(R600_LOW_VID_LOWER_GPIO_CNTL,
|
|
|
|
(low_vid_lower_gpio_cntl & ~0x400));
|
|
|
|
WREG32(R600_MEDIUM_VID_LOWER_GPIO_CNTL,
|
|
|
|
(medium_vid_lower_gpio_cntl & ~0x400));
|
|
|
|
WREG32(R600_HIGH_VID_LOWER_GPIO_CNTL,
|
|
|
|
(high_vid_lower_gpio_cntl & ~0x400));
|
|
|
|
WREG32(R600_CTXSW_VID_LOWER_GPIO_CNTL,
|
|
|
|
(ctxsw_vid_lower_gpio_cntl & ~0x400));
|
|
|
|
WREG32(R600_LOWER_GPIO_ENABLE, (lower_gpio_enable | 0x400));
|
|
|
|
|
|
|
|
r = radeon_read_bios(rdev);
|
|
|
|
|
|
|
|
/* restore regs */
|
|
|
|
WREG32(RADEON_VIPH_CONTROL, viph_control);
|
2010-12-01 08:11:45 +08:00
|
|
|
WREG32(R600_BUS_CNTL, bus_cntl);
|
2009-06-05 20:42:42 +08:00
|
|
|
WREG32(AVIVO_D1VGA_CONTROL, d1vga_control);
|
|
|
|
WREG32(AVIVO_D2VGA_CONTROL, d2vga_control);
|
|
|
|
WREG32(AVIVO_VGA_RENDER_CONTROL, vga_render_control);
|
|
|
|
WREG32(R600_ROM_CNTL, rom_cntl);
|
|
|
|
WREG32(R600_GENERAL_PWRMGT, general_pwrmgt);
|
|
|
|
WREG32(R600_LOW_VID_LOWER_GPIO_CNTL, low_vid_lower_gpio_cntl);
|
|
|
|
WREG32(R600_MEDIUM_VID_LOWER_GPIO_CNTL, medium_vid_lower_gpio_cntl);
|
|
|
|
WREG32(R600_HIGH_VID_LOWER_GPIO_CNTL, high_vid_lower_gpio_cntl);
|
|
|
|
WREG32(R600_CTXSW_VID_LOWER_GPIO_CNTL, ctxsw_vid_lower_gpio_cntl);
|
|
|
|
WREG32(R600_LOWER_GPIO_ENABLE, lower_gpio_enable);
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool avivo_read_disabled_bios(struct radeon_device *rdev)
|
|
|
|
{
|
|
|
|
uint32_t seprom_cntl1;
|
|
|
|
uint32_t viph_control;
|
|
|
|
uint32_t bus_cntl;
|
|
|
|
uint32_t d1vga_control;
|
|
|
|
uint32_t d2vga_control;
|
|
|
|
uint32_t vga_render_control;
|
|
|
|
uint32_t gpiopad_a;
|
|
|
|
uint32_t gpiopad_en;
|
|
|
|
uint32_t gpiopad_mask;
|
|
|
|
bool r;
|
|
|
|
|
|
|
|
seprom_cntl1 = RREG32(RADEON_SEPROM_CNTL1);
|
|
|
|
viph_control = RREG32(RADEON_VIPH_CONTROL);
|
2011-07-12 04:22:33 +08:00
|
|
|
bus_cntl = RREG32(RV370_BUS_CNTL);
|
2009-06-05 20:42:42 +08:00
|
|
|
d1vga_control = RREG32(AVIVO_D1VGA_CONTROL);
|
|
|
|
d2vga_control = RREG32(AVIVO_D2VGA_CONTROL);
|
|
|
|
vga_render_control = RREG32(AVIVO_VGA_RENDER_CONTROL);
|
|
|
|
gpiopad_a = RREG32(RADEON_GPIOPAD_A);
|
|
|
|
gpiopad_en = RREG32(RADEON_GPIOPAD_EN);
|
|
|
|
gpiopad_mask = RREG32(RADEON_GPIOPAD_MASK);
|
|
|
|
|
|
|
|
WREG32(RADEON_SEPROM_CNTL1,
|
|
|
|
((seprom_cntl1 & ~RADEON_SCK_PRESCALE_MASK) |
|
|
|
|
(0xc << RADEON_SCK_PRESCALE_SHIFT)));
|
|
|
|
WREG32(RADEON_GPIOPAD_A, 0);
|
|
|
|
WREG32(RADEON_GPIOPAD_EN, 0);
|
|
|
|
WREG32(RADEON_GPIOPAD_MASK, 0);
|
|
|
|
|
|
|
|
/* disable VIP */
|
|
|
|
WREG32(RADEON_VIPH_CONTROL, (viph_control & ~RADEON_VIPH_EN));
|
|
|
|
|
|
|
|
/* enable the rom */
|
2011-07-12 04:22:33 +08:00
|
|
|
WREG32(RV370_BUS_CNTL, (bus_cntl & ~RV370_BUS_BIOS_DIS_ROM));
|
2009-06-05 20:42:42 +08:00
|
|
|
|
|
|
|
/* Disable VGA mode */
|
|
|
|
WREG32(AVIVO_D1VGA_CONTROL,
|
|
|
|
(d1vga_control & ~(AVIVO_DVGA_CONTROL_MODE_ENABLE |
|
|
|
|
AVIVO_DVGA_CONTROL_TIMING_SELECT)));
|
|
|
|
WREG32(AVIVO_D2VGA_CONTROL,
|
|
|
|
(d2vga_control & ~(AVIVO_DVGA_CONTROL_MODE_ENABLE |
|
|
|
|
AVIVO_DVGA_CONTROL_TIMING_SELECT)));
|
|
|
|
WREG32(AVIVO_VGA_RENDER_CONTROL,
|
|
|
|
(vga_render_control & ~AVIVO_VGA_VSTATUS_CNTL_MASK));
|
|
|
|
|
|
|
|
r = radeon_read_bios(rdev);
|
|
|
|
|
|
|
|
/* restore regs */
|
|
|
|
WREG32(RADEON_SEPROM_CNTL1, seprom_cntl1);
|
|
|
|
WREG32(RADEON_VIPH_CONTROL, viph_control);
|
2011-07-12 04:22:33 +08:00
|
|
|
WREG32(RV370_BUS_CNTL, bus_cntl);
|
2009-06-05 20:42:42 +08:00
|
|
|
WREG32(AVIVO_D1VGA_CONTROL, d1vga_control);
|
|
|
|
WREG32(AVIVO_D2VGA_CONTROL, d2vga_control);
|
|
|
|
WREG32(AVIVO_VGA_RENDER_CONTROL, vga_render_control);
|
|
|
|
WREG32(RADEON_GPIOPAD_A, gpiopad_a);
|
|
|
|
WREG32(RADEON_GPIOPAD_EN, gpiopad_en);
|
|
|
|
WREG32(RADEON_GPIOPAD_MASK, gpiopad_mask);
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool legacy_read_disabled_bios(struct radeon_device *rdev)
|
|
|
|
{
|
|
|
|
uint32_t seprom_cntl1;
|
|
|
|
uint32_t viph_control;
|
|
|
|
uint32_t bus_cntl;
|
|
|
|
uint32_t crtc_gen_cntl;
|
|
|
|
uint32_t crtc2_gen_cntl;
|
|
|
|
uint32_t crtc_ext_cntl;
|
|
|
|
uint32_t fp2_gen_cntl;
|
|
|
|
bool r;
|
|
|
|
|
|
|
|
seprom_cntl1 = RREG32(RADEON_SEPROM_CNTL1);
|
|
|
|
viph_control = RREG32(RADEON_VIPH_CONTROL);
|
2011-07-12 04:22:33 +08:00
|
|
|
if (rdev->flags & RADEON_IS_PCIE)
|
|
|
|
bus_cntl = RREG32(RV370_BUS_CNTL);
|
|
|
|
else
|
|
|
|
bus_cntl = RREG32(RADEON_BUS_CNTL);
|
2009-06-05 20:42:42 +08:00
|
|
|
crtc_gen_cntl = RREG32(RADEON_CRTC_GEN_CNTL);
|
|
|
|
crtc2_gen_cntl = 0;
|
|
|
|
crtc_ext_cntl = RREG32(RADEON_CRTC_EXT_CNTL);
|
|
|
|
fp2_gen_cntl = 0;
|
|
|
|
|
2013-10-04 19:53:40 +08:00
|
|
|
if (rdev->ddev->pdev->device == PCI_DEVICE_ID_ATI_RADEON_QY) {
|
2009-06-05 20:42:42 +08:00
|
|
|
fp2_gen_cntl = RREG32(RADEON_FP2_GEN_CNTL);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!(rdev->flags & RADEON_SINGLE_CRTC)) {
|
|
|
|
crtc2_gen_cntl = RREG32(RADEON_CRTC2_GEN_CNTL);
|
|
|
|
}
|
|
|
|
|
|
|
|
WREG32(RADEON_SEPROM_CNTL1,
|
|
|
|
((seprom_cntl1 & ~RADEON_SCK_PRESCALE_MASK) |
|
|
|
|
(0xc << RADEON_SCK_PRESCALE_SHIFT)));
|
|
|
|
|
|
|
|
/* disable VIP */
|
|
|
|
WREG32(RADEON_VIPH_CONTROL, (viph_control & ~RADEON_VIPH_EN));
|
|
|
|
|
|
|
|
/* enable the rom */
|
2011-07-12 04:22:33 +08:00
|
|
|
if (rdev->flags & RADEON_IS_PCIE)
|
|
|
|
WREG32(RV370_BUS_CNTL, (bus_cntl & ~RV370_BUS_BIOS_DIS_ROM));
|
|
|
|
else
|
|
|
|
WREG32(RADEON_BUS_CNTL, (bus_cntl & ~RADEON_BUS_BIOS_DIS_ROM));
|
2009-06-05 20:42:42 +08:00
|
|
|
|
|
|
|
/* Turn off mem requests and CRTC for both controllers */
|
|
|
|
WREG32(RADEON_CRTC_GEN_CNTL,
|
|
|
|
((crtc_gen_cntl & ~RADEON_CRTC_EN) |
|
|
|
|
(RADEON_CRTC_DISP_REQ_EN_B |
|
|
|
|
RADEON_CRTC_EXT_DISP_EN)));
|
|
|
|
if (!(rdev->flags & RADEON_SINGLE_CRTC)) {
|
|
|
|
WREG32(RADEON_CRTC2_GEN_CNTL,
|
|
|
|
((crtc2_gen_cntl & ~RADEON_CRTC2_EN) |
|
|
|
|
RADEON_CRTC2_DISP_REQ_EN_B));
|
|
|
|
}
|
|
|
|
/* Turn off CRTC */
|
|
|
|
WREG32(RADEON_CRTC_EXT_CNTL,
|
|
|
|
((crtc_ext_cntl & ~RADEON_CRTC_CRT_ON) |
|
|
|
|
(RADEON_CRTC_SYNC_TRISTAT |
|
|
|
|
RADEON_CRTC_DISPLAY_DIS)));
|
|
|
|
|
2013-10-04 19:53:40 +08:00
|
|
|
if (rdev->ddev->pdev->device == PCI_DEVICE_ID_ATI_RADEON_QY) {
|
2009-06-05 20:42:42 +08:00
|
|
|
WREG32(RADEON_FP2_GEN_CNTL, (fp2_gen_cntl & ~RADEON_FP2_ON));
|
|
|
|
}
|
|
|
|
|
|
|
|
r = radeon_read_bios(rdev);
|
|
|
|
|
|
|
|
/* restore regs */
|
|
|
|
WREG32(RADEON_SEPROM_CNTL1, seprom_cntl1);
|
|
|
|
WREG32(RADEON_VIPH_CONTROL, viph_control);
|
2011-07-12 04:22:33 +08:00
|
|
|
if (rdev->flags & RADEON_IS_PCIE)
|
|
|
|
WREG32(RV370_BUS_CNTL, bus_cntl);
|
|
|
|
else
|
|
|
|
WREG32(RADEON_BUS_CNTL, bus_cntl);
|
2009-06-05 20:42:42 +08:00
|
|
|
WREG32(RADEON_CRTC_GEN_CNTL, crtc_gen_cntl);
|
|
|
|
if (!(rdev->flags & RADEON_SINGLE_CRTC)) {
|
|
|
|
WREG32(RADEON_CRTC2_GEN_CNTL, crtc2_gen_cntl);
|
|
|
|
}
|
|
|
|
WREG32(RADEON_CRTC_EXT_CNTL, crtc_ext_cntl);
|
2013-10-04 19:53:40 +08:00
|
|
|
if (rdev->ddev->pdev->device == PCI_DEVICE_ID_ATI_RADEON_QY) {
|
2009-06-05 20:42:42 +08:00
|
|
|
WREG32(RADEON_FP2_GEN_CNTL, fp2_gen_cntl);
|
|
|
|
}
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool radeon_read_disabled_bios(struct radeon_device *rdev)
|
|
|
|
{
|
2009-10-03 05:36:41 +08:00
|
|
|
if (rdev->flags & RADEON_IS_IGP)
|
|
|
|
return igp_read_bios_from_vram(rdev);
|
2011-01-07 10:19:23 +08:00
|
|
|
else if (rdev->family >= CHIP_BARTS)
|
|
|
|
return ni_read_disabled_bios(rdev);
|
2009-10-03 05:36:41 +08:00
|
|
|
else if (rdev->family >= CHIP_RV770)
|
2009-06-05 20:42:42 +08:00
|
|
|
return r700_read_disabled_bios(rdev);
|
|
|
|
else if (rdev->family >= CHIP_R600)
|
|
|
|
return r600_read_disabled_bios(rdev);
|
|
|
|
else if (rdev->family >= CHIP_RS600)
|
|
|
|
return avivo_read_disabled_bios(rdev);
|
|
|
|
else
|
|
|
|
return legacy_read_disabled_bios(rdev);
|
|
|
|
}
|
|
|
|
|
2012-08-17 03:45:20 +08:00
|
|
|
#ifdef CONFIG_ACPI
|
|
|
|
static bool radeon_acpi_vfct_bios(struct radeon_device *rdev)
|
|
|
|
{
|
|
|
|
bool ret = false;
|
|
|
|
struct acpi_table_header *hdr;
|
2012-08-20 23:06:21 +08:00
|
|
|
acpi_size tbl_size;
|
2012-08-17 03:45:20 +08:00
|
|
|
UEFI_ACPI_VFCT *vfct;
|
|
|
|
GOP_VBIOS_CONTENT *vbios;
|
|
|
|
VFCT_IMAGE_HEADER *vhdr;
|
|
|
|
|
2012-08-20 23:06:21 +08:00
|
|
|
if (!ACPI_SUCCESS(acpi_get_table_with_size("VFCT", 1, &hdr, &tbl_size)))
|
2012-08-17 03:45:20 +08:00
|
|
|
return false;
|
|
|
|
if (tbl_size < sizeof(UEFI_ACPI_VFCT)) {
|
|
|
|
DRM_ERROR("ACPI VFCT table present but broken (too short #1)\n");
|
|
|
|
goto out_unmap;
|
|
|
|
}
|
|
|
|
|
|
|
|
vfct = (UEFI_ACPI_VFCT *)hdr;
|
|
|
|
if (vfct->VBIOSImageOffset + sizeof(VFCT_IMAGE_HEADER) > tbl_size) {
|
|
|
|
DRM_ERROR("ACPI VFCT table present but broken (too short #2)\n");
|
|
|
|
goto out_unmap;
|
|
|
|
}
|
|
|
|
|
|
|
|
vbios = (GOP_VBIOS_CONTENT *)((char *)hdr + vfct->VBIOSImageOffset);
|
|
|
|
vhdr = &vbios->VbiosHeader;
|
|
|
|
DRM_INFO("ACPI VFCT contains a BIOS for %02x:%02x.%d %04x:%04x, size %d\n",
|
|
|
|
vhdr->PCIBus, vhdr->PCIDevice, vhdr->PCIFunction,
|
|
|
|
vhdr->VendorID, vhdr->DeviceID, vhdr->ImageLength);
|
|
|
|
|
|
|
|
if (vhdr->PCIBus != rdev->pdev->bus->number ||
|
|
|
|
vhdr->PCIDevice != PCI_SLOT(rdev->pdev->devfn) ||
|
|
|
|
vhdr->PCIFunction != PCI_FUNC(rdev->pdev->devfn) ||
|
|
|
|
vhdr->VendorID != rdev->pdev->vendor ||
|
|
|
|
vhdr->DeviceID != rdev->pdev->device) {
|
|
|
|
DRM_INFO("ACPI VFCT table is not for this card\n");
|
|
|
|
goto out_unmap;
|
2014-06-09 21:21:08 +08:00
|
|
|
}
|
2012-08-17 03:45:20 +08:00
|
|
|
|
|
|
|
if (vfct->VBIOSImageOffset + sizeof(VFCT_IMAGE_HEADER) + vhdr->ImageLength > tbl_size) {
|
|
|
|
DRM_ERROR("ACPI VFCT image truncated\n");
|
|
|
|
goto out_unmap;
|
|
|
|
}
|
|
|
|
|
|
|
|
rdev->bios = kmemdup(&vbios->VbiosContent, vhdr->ImageLength, GFP_KERNEL);
|
|
|
|
ret = !!rdev->bios;
|
|
|
|
|
|
|
|
out_unmap:
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
static inline bool radeon_acpi_vfct_bios(struct radeon_device *rdev)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
#endif
|
2010-02-01 13:38:10 +08:00
|
|
|
|
2009-06-05 20:42:42 +08:00
|
|
|
bool radeon_get_bios(struct radeon_device *rdev)
|
|
|
|
{
|
|
|
|
bool r;
|
|
|
|
uint16_t tmp;
|
|
|
|
|
2010-02-01 13:38:10 +08:00
|
|
|
r = radeon_atrm_get_bios(rdev);
|
2012-08-17 03:45:20 +08:00
|
|
|
if (r == false)
|
|
|
|
r = radeon_acpi_vfct_bios(rdev);
|
2010-02-01 13:38:10 +08:00
|
|
|
if (r == false)
|
2009-10-03 05:36:41 +08:00
|
|
|
r = igp_read_bios_from_vram(rdev);
|
2010-02-01 13:38:10 +08:00
|
|
|
if (r == false)
|
2009-10-03 05:36:41 +08:00
|
|
|
r = radeon_read_bios(rdev);
|
2009-06-05 20:42:42 +08:00
|
|
|
if (r == false) {
|
|
|
|
r = radeon_read_disabled_bios(rdev);
|
|
|
|
}
|
2013-03-27 05:25:56 +08:00
|
|
|
if (r == false) {
|
|
|
|
r = radeon_read_platform_bios(rdev);
|
|
|
|
}
|
2009-06-05 20:42:42 +08:00
|
|
|
if (r == false || rdev->bios == NULL) {
|
|
|
|
DRM_ERROR("Unable to locate a BIOS ROM\n");
|
|
|
|
rdev->bios = NULL;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (rdev->bios[0] != 0x55 || rdev->bios[1] != 0xaa) {
|
2010-02-01 13:38:10 +08:00
|
|
|
printk("BIOS signature incorrect %x %x\n", rdev->bios[0], rdev->bios[1]);
|
2009-06-05 20:42:42 +08:00
|
|
|
goto free_bios;
|
|
|
|
}
|
|
|
|
|
2010-02-11 13:38:23 +08:00
|
|
|
tmp = RBIOS16(0x18);
|
|
|
|
if (RBIOS8(tmp + 0x14) != 0x0) {
|
|
|
|
DRM_INFO("Not an x86 BIOS ROM, not using.\n");
|
|
|
|
goto free_bios;
|
|
|
|
}
|
|
|
|
|
2009-06-05 20:42:42 +08:00
|
|
|
rdev->bios_header_start = RBIOS16(0x48);
|
|
|
|
if (!rdev->bios_header_start) {
|
|
|
|
goto free_bios;
|
|
|
|
}
|
|
|
|
tmp = rdev->bios_header_start + 4;
|
|
|
|
if (!memcmp(rdev->bios + tmp, "ATOM", 4) ||
|
|
|
|
!memcmp(rdev->bios + tmp, "MOTA", 4)) {
|
|
|
|
rdev->is_atom_bios = true;
|
|
|
|
} else {
|
|
|
|
rdev->is_atom_bios = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
DRM_DEBUG("%sBIOS detected\n", rdev->is_atom_bios ? "ATOM" : "COM");
|
|
|
|
return true;
|
|
|
|
free_bios:
|
|
|
|
kfree(rdev->bios);
|
|
|
|
rdev->bios = NULL;
|
|
|
|
return false;
|
|
|
|
}
|