From f0b0d6cb37165d71817c17d35329adb266420ba2 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Thu, 4 Aug 2011 03:55:01 +0000 Subject: [PATCH] * use create_area correctly * AtomBIOS is now loaded and passed into the radeon_hd accelerant * correct pointer passing in bios_init * AtomBIOS is now read and initialized by AtomBIOS parser * feel free to start testing the driver again :-) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42564 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- build/jam/HaikuImage | 4 +- .../accelerants/radeon_hd/accelerant.cpp | 4 +- src/add-ons/accelerants/radeon_hd/bios.cpp | 2 +- .../drivers/graphics/radeon_hd/radeon_hd.cpp | 78 +++++++++---------- 4 files changed, 44 insertions(+), 44 deletions(-) diff --git a/build/jam/HaikuImage b/build/jam/HaikuImage index 081ce99546..f647e13889 100644 --- a/build/jam/HaikuImage +++ b/build/jam/HaikuImage @@ -119,7 +119,7 @@ SYSTEM_ADD_ONS_ACCELERANTS = $(X86_ONLY)radeon.accelerant $(X86_ONLY)s3.accelerant $(X86_ONLY)vesa.accelerant $(X86_ONLY)ati.accelerant $(X86_ONLY)3dfx.accelerant - #$(X86_ONLY)radeon_hd.accelerant + $(X86_ONLY)radeon_hd.accelerant #$(X86_ONLY)via.accelerant #$(X86_ONLY)vmware.accelerant ; @@ -165,7 +165,7 @@ SYSTEM_ADD_ONS_DRIVERS_AUDIO_OLD = ; #cmedia usb_audio ; SYSTEM_ADD_ONS_DRIVERS_GRAPHICS = $(X86_ONLY)radeon $(X86_ONLY)nvidia $(X86_ONLY)neomagic $(X86_ONLY)matrox $(X86_ONLY)intel_extreme $(X86_ONLY)s3 $(X86_ONLY)vesa #$(X86_ONLY)via #$(X86_ONLY)vmware - $(X86_ONLY)ati $(X86_ONLY)3dfx #$(X86_ONLY)radeon_hd + $(X86_ONLY)ati $(X86_ONLY)3dfx $(X86_ONLY)radeon_hd ; SYSTEM_ADD_ONS_DRIVERS_MIDI = emuxki usb_midi ; SYSTEM_ADD_ONS_DRIVERS_NET = $(X86_ONLY)3com $(X86_ONLY)atheros813x diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.cpp b/src/add-ons/accelerants/radeon_hd/accelerant.cpp index 3e2e55b67c..35c2d25fee 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.cpp +++ b/src/add-ons/accelerants/radeon_hd/accelerant.cpp @@ -160,8 +160,10 @@ init_common(int device, bool isClone) (void **)&gInfo->rom, B_ANY_ADDRESS, B_READ_AREA | B_WRITE_AREA, gInfo->shared_info->rom_area); - if (gInfo->rom_area < 0) + if (gInfo->rom_area < 0) { TRACE("%s: Clone of AtomBIOS failed!\n", __func__); + gInfo->shared_info->has_rom = false; + } if (gInfo->rom[0] != 0x55 || gInfo->rom[1] != 0xAA) TRACE("%s: didn't find a VGA bios in cloned region!\n", __func__); diff --git a/src/add-ons/accelerants/radeon_hd/bios.cpp b/src/add-ons/accelerants/radeon_hd/bios.cpp index ac43694f19..20428a33e5 100644 --- a/src/add-ons/accelerants/radeon_hd/bios.cpp +++ b/src/add-ons/accelerants/radeon_hd/bios.cpp @@ -62,7 +62,7 @@ radeon_init_bios(uint8* bios) atom_card_info->pll_write = _write32; // Point AtomBIOS parser to card bios and malloc gAtomContext - gAtomContext = atom_parse(atom_card_info, &bios); + gAtomContext = atom_parse(atom_card_info, bios); if (gAtomContext == NULL) { TRACE("%s: couldn't parse system AtomBIOS\n", __func__); diff --git a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp index f78d37dda1..4a0b585a48 100644 --- a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp +++ b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp @@ -72,26 +72,14 @@ radeon_hd_getbios(radeon_info &info) if (flags & PCI_rom_bios) dprintf(DEVICE_NAME ": PCI ROM BIOS copy\n"); - uint32 rom_base = info.pci->u.h0.rom_base; - uint32 rom_size = info.pci->u.h0.rom_size; - - if (rom_base == 0) { - TRACE("%s: no PCI rom, trying shadow rom\n", __func__); - // ROM has been copied by BIOS - rom_base = 0xC0000; - if (rom_size == 0) { - rom_size = 0x7FFF; - // Maximum shadow bios size - // TODO : This is a guess at best - } - } + uint32 rom_base = info.shared_info->rom_phys; + uint32 rom_size = info.shared_info->rom_size; TRACE("%s: seeking rom at 0x%" B_PRIX32 " [size: 0x%" B_PRIX32 "]\n", __func__, rom_base, rom_size); uint8* bios; status_t result = B_ERROR; - if (rom_base == 0 || rom_size == 0) { TRACE("%s: no VGA rom located, disabling AtomBIOS\n", __func__); result = B_ERROR; @@ -110,19 +98,13 @@ radeon_hd_getbios(radeon_info &info) result = B_ERROR; } else { TRACE("%s: found a valid VGA bios!\n", __func__); - info.atom_buffer = (uint8*)malloc(rom_size); - if (info.atom_buffer == NULL) { - dprintf(DEVICE_NAME ": failed to clone atombios!\n"); - result = B_ERROR; + memcpy(info.atom_buffer, (void *)bios, rom_size); + if (isAtomBIOS(info.atom_buffer)) { + dprintf(DEVICE_NAME ": AtomBIOS found and mapped!\n"); + result = B_OK; } else { - memcpy(info.atom_buffer, (void *)bios, rom_size); - if (isAtomBIOS(info.atom_buffer)) { - dprintf(DEVICE_NAME ": AtomBIOS found and mapped!\n"); - result = B_OK; - } else { - dprintf(DEVICE_NAME ": AtomBIOS not mapped!\n"); - result = B_ERROR; - } + dprintf(DEVICE_NAME ": AtomBIOS not mapped!\n"); + result = B_ERROR; } } delete_area(rom_area); @@ -133,9 +115,6 @@ radeon_hd_getbios(radeon_info &info) rom_config &= ~PCI_rom_enable; set_pci_config(info.pci, PCI_rom_base, 4, rom_config); - info.shared_info->rom_phys = rom_base; - info.shared_info->rom_size = rom_size; - return result; } @@ -262,17 +241,6 @@ radeon_hd_init(radeon_info &info) return info.framebuffer_area; } - // *** VGA rom / AtomBIOS mapping - status_t biosStatus = radeon_hd_getbios_r600(info); - - // *** AtomBIOS mapping - info.rom_area = create_area("radeon hd AtomBIOS", - (void **)&info.atom_buffer, B_ANY_KERNEL_ADDRESS, - info.shared_info->rom_size, B_READ_AREA | B_WRITE_AREA, B_NO_LOCK); - - if (info.rom_area < 0) - dprintf("%s: failed to create kernel AtomBIOS area!\n", __func__); - // Turn on write combining for the area vm_set_area_memory_type(info.framebuffer_area, info.pci->u.h0.base_registers[RHD_FB_BAR], B_MTR_WC); @@ -281,6 +249,35 @@ radeon_hd_init(radeon_info &info) mmioMapper.Detach(); frambufferMapper.Detach(); + // *** AtomBIOS mapping + uint32 rom_base = info.pci->u.h0.rom_base; + uint32 rom_size = info.pci->u.h0.rom_size; + if (rom_base == 0) { + TRACE("%s: no PCI rom, trying shadow rom\n", __func__); + // ROM has been copied by BIOS + rom_base = 0xC0000; + if (rom_size == 0) { + rom_size = 0x7FFF; + // A guess at maximum shadow bios size + } + } + info.shared_info->rom_phys = rom_base; + info.shared_info->rom_size = rom_size; + + info.rom_area = create_area("radeon hd AtomBIOS", + (void **)&info.atom_buffer, B_ANY_KERNEL_ADDRESS, + info.shared_info->rom_size, B_FULL_LOCK, + B_READ_AREA | B_WRITE_AREA); + + status_t biosStatus = B_ERROR; + if (info.rom_area < 0) { + dprintf("%s: failed to create kernel AtomBIOS area!\n", __func__); + biosStatus = B_ERROR; + } else { + //memset(&info.atom_buffer, 0, info.shared_info->rom_size); + biosStatus = radeon_hd_getbios_r600(info); + } + // Pass common information to accelerant info.shared_info->device_id = info.device_id; info.shared_info->device_chipset = info.device_chipset; @@ -358,5 +355,6 @@ radeon_hd_uninit(radeon_info &info) delete_area(info.shared_area); delete_area(info.registers_area); delete_area(info.framebuffer_area); + delete_area(info.rom_area); }