* clean up style
* remove some un-needed log messages * memset area from create_area just incase * add enabled bios read in addition to disabled one git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42566 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -64,13 +64,7 @@ radeon_hd_getbios(radeon_info &info)
|
|||||||
|
|
||||||
uint32 flags = get_pci_config(info.pci, PCI_rom_base, 4);
|
uint32 flags = get_pci_config(info.pci, PCI_rom_base, 4);
|
||||||
if (flags & PCI_rom_enable)
|
if (flags & PCI_rom_enable)
|
||||||
dprintf(DEVICE_NAME ": PCI ROM decode enabled\n");
|
TRACE("%s: PCI ROM decode enabled successfully\n", __func__);
|
||||||
if (flags & PCI_rom_shadow)
|
|
||||||
dprintf(DEVICE_NAME ": PCI ROM shadowed\n");
|
|
||||||
if (flags & PCI_rom_copy)
|
|
||||||
dprintf(DEVICE_NAME ": PCI ROM allocated copy\n");
|
|
||||||
if (flags & PCI_rom_bios)
|
|
||||||
dprintf(DEVICE_NAME ": PCI ROM BIOS copy\n");
|
|
||||||
|
|
||||||
uint32 rom_base = info.shared_info->rom_phys;
|
uint32 rom_base = info.shared_info->rom_phys;
|
||||||
uint32 rom_size = info.shared_info->rom_size;
|
uint32 rom_size = info.shared_info->rom_size;
|
||||||
@@ -94,16 +88,17 @@ radeon_hd_getbios(radeon_info &info)
|
|||||||
} else {
|
} else {
|
||||||
if (bios[0] != 0x55 || bios[1] != 0xAA) {
|
if (bios[0] != 0x55 || bios[1] != 0xAA) {
|
||||||
uint16 id = bios[0] + (bios[1] << 8);
|
uint16 id = bios[0] + (bios[1] << 8);
|
||||||
dprintf(DEVICE_NAME ": not a PCI rom (%X)!\n", id);
|
TRACE("%s: this isn't a PCI rom (%X)\n", __func__, id);
|
||||||
result = B_ERROR;
|
result = B_ERROR;
|
||||||
} else {
|
} else {
|
||||||
TRACE("%s: found a valid VGA bios!\n", __func__);
|
|
||||||
memcpy(info.atom_buffer, (void *)bios, rom_size);
|
memcpy(info.atom_buffer, (void *)bios, rom_size);
|
||||||
if (isAtomBIOS(info.atom_buffer)) {
|
if (isAtomBIOS(info.atom_buffer)) {
|
||||||
dprintf(DEVICE_NAME ": AtomBIOS found and mapped!\n");
|
dprintf(DEVICE_NAME ": %s: AtomBIOS found and mapped!\n",
|
||||||
|
__func__);
|
||||||
result = B_OK;
|
result = B_OK;
|
||||||
} else {
|
} else {
|
||||||
dprintf(DEVICE_NAME ": AtomBIOS not mapped!\n");
|
dprintf(DEVICE_NAME ": %s: AtomBIOS not mapped!\n",
|
||||||
|
__func__);
|
||||||
result = B_ERROR;
|
result = B_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -209,13 +204,14 @@ radeon_hd_init(radeon_info &info)
|
|||||||
(void **)&info.shared_info, B_ANY_KERNEL_ADDRESS,
|
(void **)&info.shared_info, B_ANY_KERNEL_ADDRESS,
|
||||||
ROUND_TO_PAGE_SIZE(sizeof(radeon_shared_info)), B_FULL_LOCK, 0);
|
ROUND_TO_PAGE_SIZE(sizeof(radeon_shared_info)), B_FULL_LOCK, 0);
|
||||||
if (info.shared_area < B_OK) {
|
if (info.shared_area < B_OK) {
|
||||||
|
dprintf(DEVICE_NAME ": card (%ld): couldn't map shared area!\n",
|
||||||
|
info.id);
|
||||||
return info.shared_area;
|
return info.shared_area;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset((void *)info.shared_info, 0, sizeof(radeon_shared_info));
|
memset((void *)info.shared_info, 0, sizeof(radeon_shared_info));
|
||||||
|
|
||||||
// *** Map Memory mapped IO
|
// *** Map Memory mapped IO
|
||||||
// R6xx_R7xx_3D.pdf, 5.3.3.1 SET_CONFIG_REG
|
|
||||||
AreaKeeper mmioMapper;
|
AreaKeeper mmioMapper;
|
||||||
info.registers_area = mmioMapper.Map("radeon hd mmio",
|
info.registers_area = mmioMapper.Map("radeon hd mmio",
|
||||||
(void *)info.pci->u.h0.base_registers[RHD_MMIO_BAR],
|
(void *)info.pci->u.h0.base_registers[RHD_MMIO_BAR],
|
||||||
@@ -223,7 +219,7 @@ radeon_hd_init(radeon_info &info)
|
|||||||
B_ANY_KERNEL_ADDRESS, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA,
|
B_ANY_KERNEL_ADDRESS, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA,
|
||||||
(void **)&info.registers);
|
(void **)&info.registers);
|
||||||
if (mmioMapper.InitCheck() < B_OK) {
|
if (mmioMapper.InitCheck() < B_OK) {
|
||||||
dprintf(DEVICE_NAME ": card (%ld): could not map memory I/O!\n",
|
dprintf(DEVICE_NAME ": card (%ld): couldn't map memory I/O!\n",
|
||||||
info.id);
|
info.id);
|
||||||
return info.registers_area;
|
return info.registers_area;
|
||||||
}
|
}
|
||||||
@@ -236,12 +232,12 @@ radeon_hd_init(radeon_info &info)
|
|||||||
B_ANY_KERNEL_ADDRESS, B_READ_AREA | B_WRITE_AREA,
|
B_ANY_KERNEL_ADDRESS, B_READ_AREA | B_WRITE_AREA,
|
||||||
(void **)&info.shared_info->frame_buffer);
|
(void **)&info.shared_info->frame_buffer);
|
||||||
if (frambufferMapper.InitCheck() < B_OK) {
|
if (frambufferMapper.InitCheck() < B_OK) {
|
||||||
dprintf(DEVICE_NAME ": card(%ld): could not map framebuffer!\n",
|
dprintf(DEVICE_NAME ": card(%ld): couldn't map framebuffer!\n",
|
||||||
info.id);
|
info.id);
|
||||||
return info.framebuffer_area;
|
return info.framebuffer_area;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Turn on write combining for the area
|
// Turn on write combining for the frame buffer area
|
||||||
vm_set_area_memory_type(info.framebuffer_area,
|
vm_set_area_memory_type(info.framebuffer_area,
|
||||||
info.pci->u.h0.base_registers[RHD_FB_BAR], B_MTR_WC);
|
info.pci->u.h0.base_registers[RHD_FB_BAR], B_MTR_WC);
|
||||||
|
|
||||||
@@ -249,6 +245,18 @@ radeon_hd_init(radeon_info &info)
|
|||||||
mmioMapper.Detach();
|
mmioMapper.Detach();
|
||||||
frambufferMapper.Detach();
|
frambufferMapper.Detach();
|
||||||
|
|
||||||
|
// Pass common information to accelerant
|
||||||
|
info.shared_info->device_id = info.device_id;
|
||||||
|
info.shared_info->device_chipset = info.device_chipset;
|
||||||
|
info.shared_info->registers_area = info.registers_area;
|
||||||
|
strcpy(info.shared_info->device_identifier, info.device_identifier);
|
||||||
|
|
||||||
|
info.shared_info->frame_buffer_area = info.framebuffer_area;
|
||||||
|
info.shared_info->frame_buffer_phys
|
||||||
|
= info.pci->u.h0.base_registers[RHD_FB_BAR];
|
||||||
|
info.shared_info->frame_buffer_int
|
||||||
|
= read32(info.registers + R6XX_CONFIG_FB_BASE);
|
||||||
|
|
||||||
// *** AtomBIOS mapping
|
// *** AtomBIOS mapping
|
||||||
uint32 rom_base = info.pci->u.h0.rom_base;
|
uint32 rom_base = info.pci->u.h0.rom_base;
|
||||||
uint32 rom_size = info.pci->u.h0.rom_size;
|
uint32 rom_size = info.pci->u.h0.rom_size;
|
||||||
@@ -272,44 +280,38 @@ radeon_hd_init(radeon_info &info)
|
|||||||
status_t biosStatus = B_ERROR;
|
status_t biosStatus = B_ERROR;
|
||||||
if (info.rom_area < 0) {
|
if (info.rom_area < 0) {
|
||||||
dprintf("%s: failed to create kernel AtomBIOS area!\n", __func__);
|
dprintf("%s: failed to create kernel AtomBIOS area!\n", __func__);
|
||||||
|
dprintf(DEVICE_NAME ": card(%ld): couldn't map kernel AtomBIOS area!\n",
|
||||||
|
info.id);
|
||||||
biosStatus = B_ERROR;
|
biosStatus = B_ERROR;
|
||||||
} else {
|
} else {
|
||||||
//memset(&info.atom_buffer, 0, info.shared_info->rom_size);
|
memset((void*)info.atom_buffer, 0, info.shared_info->rom_size);
|
||||||
biosStatus = radeon_hd_getbios_r600(info);
|
// First we try an active bios read
|
||||||
|
biosStatus = radeon_hd_getbios(info);
|
||||||
|
if (biosStatus != B_OK) {
|
||||||
|
// If the active read fails, we do a disabled read
|
||||||
|
if (info.device_chipset > RADEON_R600)
|
||||||
|
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;
|
|
||||||
info.shared_info->registers_area = info.registers_area;
|
|
||||||
info.shared_info->frame_buffer_area = info.framebuffer_area;
|
|
||||||
info.shared_info->frame_buffer_phys
|
|
||||||
= info.pci->u.h0.base_registers[RHD_FB_BAR];
|
|
||||||
info.shared_info->frame_buffer_int
|
|
||||||
= read32(info.registers + R6XX_CONFIG_FB_BASE);
|
|
||||||
|
|
||||||
// populate VGA rom info into shared_info
|
|
||||||
info.shared_info->has_rom = (biosStatus == B_OK) ? true : false;
|
info.shared_info->has_rom = (biosStatus == B_OK) ? true : false;
|
||||||
info.shared_info->rom_area = info.rom_area;
|
info.shared_info->rom_area = info.rom_area;
|
||||||
|
|
||||||
// Copy device name into shared_info
|
// *** Pull active monitor VESA EDID from boot loader
|
||||||
strcpy(info.shared_info->device_identifier, info.device_identifier);
|
edid1_info* edidInfo
|
||||||
|
= (edid1_info*)get_boot_item(EDID_BOOT_INFO, NULL);
|
||||||
|
|
||||||
// Pull active monitor VESA EDID from boot loader
|
|
||||||
edid1_info* edidInfo = (edid1_info*)get_boot_item(EDID_BOOT_INFO,
|
|
||||||
NULL);
|
|
||||||
if (edidInfo != NULL) {
|
if (edidInfo != NULL) {
|
||||||
TRACE("card(%ld): %s found BIOS EDID information.\n", info.id,
|
TRACE("card(%ld): %s found VESA EDID information.\n", info.id,
|
||||||
__func__);
|
__func__);
|
||||||
info.shared_info->has_edid = true;
|
info.shared_info->has_edid = true;
|
||||||
memcpy(&info.shared_info->edid_info, edidInfo, sizeof(edid1_info));
|
memcpy(&info.shared_info->edid_info, edidInfo, sizeof(edid1_info));
|
||||||
} else {
|
} else {
|
||||||
TRACE("card(%ld): %s didn't find BIOS EDID modes.\n", info.id,
|
TRACE("card(%ld): %s didn't find VESA EDID modes.\n", info.id,
|
||||||
__func__);
|
__func__);
|
||||||
info.shared_info->has_edid = false;
|
info.shared_info->has_edid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Populate graphics_memory/aperture_size with KB
|
// *** Populate graphics_memory/aperture_size with KB
|
||||||
if (info.shared_info->device_chipset >= RADEON_R800) {
|
if (info.shared_info->device_chipset >= RADEON_R800) {
|
||||||
// R800+ has memory stored in MB
|
// R800+ has memory stored in MB
|
||||||
info.shared_info->graphics_memory_size
|
info.shared_info->graphics_memory_size
|
||||||
|
|||||||
Reference in New Issue
Block a user