RADEON card works mainly, the IO-space does not get properly detected yet, however

This commit is contained in:
Markus Fröschle
2013-12-31 13:13:25 +00:00
parent ff3dd28cb4
commit d0a2c3bf21
7 changed files with 164 additions and 134 deletions

View File

@@ -76,6 +76,7 @@ erase 0xE0000000 9
erase 0xE0000000 10 erase 0xE0000000 10
erase 0xE0000000 11 erase 0xE0000000 11
erase 0xE0000000 12 erase 0xE0000000 12
erase 0xE0000000 13
#erase 0xE0000000 0x2000 #erase 0xE0000000 0x2000
#erase 0xE0000000 0x3000 #erase 0xE0000000 0x3000
#erase 0xE0000000 0x4000 #erase 0xE0000000 0x4000

View File

@@ -37,14 +37,14 @@
****************************************************************************/ ****************************************************************************/
/* $XFree86: xc/extras/x86emu/src/x86emu/x86emu/debug.h,v 1.4 2000/11/21 23:10:27 tsi Exp $ */ /* $XFree86: xc/extras/x86emu/src/x86emu/x86emu/debug.h,v 1.4 2000/11/21 23:10:27 tsi Exp $ */
#include <stdint.h>
#include "bas_printf.h"
/* /*
* for the X86 emulator, debug cannot be enabled and disabled on a per-file mode * for the X86 emulator, debug cannot be enabled and disabled on a per-file mode
* as with all the other modules. It must be centrally enabled here. * as with all the other modules. It must be centrally enabled here.
*/ */
#include <stdint.h>
#include "bas_printf.h"
#define DBG_X86EMU #define DBG_X86EMU
#ifdef DBG_X86EMU #ifdef DBG_X86EMU

View File

@@ -33,11 +33,11 @@
#include "interrupts.h" #include "interrupts.h"
#include "wait.h" #include "wait.h"
//#define DEBUG_PCI #define DEBUG_PCI
#ifdef DEBUG_PCI #ifdef DEBUG_PCI
#define debug_printf(format, arg...) do { xprintf("DEBUG: " format "", ##arg); } while (0) #define dbg(format, arg...) do { xprintf("DEBUG: " format "", ##arg); } while (0)
#else #else
#define debug_printf(format, arg...) do { ; } while (0) #define dbg(format, arg...) do { ; } while (0)
#endif /* DEBUG_PCI */ #endif /* DEBUG_PCI */
#if MACHINE_FIREBEE #if MACHINE_FIREBEE
@@ -137,18 +137,18 @@ __attribute__((aligned(16))) void chip_errata_135(void)
__attribute__((interrupt)) void pci_arb_interrupt(void) __attribute__((interrupt)) void pci_arb_interrupt(void)
{ {
debug_printf("XLBARB slave error interrupt\r\n"); dbg("XLBARB slave error interrupt\r\n");
MCF_XLB_XARB_SR |= ~MCF_XLB_XARB_SR_SEA; MCF_XLB_XARB_SR |= ~MCF_XLB_XARB_SR_SEA;
} }
__attribute__((interrupt)) void xlb_pci_interrupt(void) __attribute__((interrupt)) void xlb_pci_interrupt(void)
{ {
debug_printf("XLBPCI interrupt\r\n"); dbg("XLBPCI interrupt\r\n");
} }
__attribute__((interrupt)) void pci_interrupt(void) __attribute__((interrupt)) void pci_interrupt(void)
{ {
debug_printf("PCI interrupt\r\n"); dbg("PCI interrupt\r\n");
} }
static int32_t pci_get_interrupt_cause(int32_t *handles) static int32_t pci_get_interrupt_cause(int32_t *handles)
@@ -166,7 +166,7 @@ static int32_t pci_get_interrupt_cause(int32_t *handles)
return handle; return handle;
} }
} }
debug_printf("%s: no interrupt cause found\r\n", __FUNCTION__); dbg("%s: no interrupt cause found\r\n", __FUNCTION__);
return -1; return -1;
} }
@@ -193,7 +193,7 @@ void irq5_handler(void)
newvalue = pci_call_interrupt_chain(handle, value); newvalue = pci_call_interrupt_chain(handle, value);
if (newvalue == value) if (newvalue == value)
{ {
debug_printf("%s: interrupt not handled!\r\n", __FUNCTION__); dbg("%s: interrupt not handled!\r\n", __FUNCTION__);
} }
} }
} }
@@ -209,13 +209,13 @@ void irq7_handler(void)
int32_t newvalue; int32_t newvalue;
MCF_EPORT_EPFR |= (1 << 7); MCF_EPORT_EPFR |= (1 << 7);
debug_printf("IRQ7!\r\n"); dbg("IRQ7!\r\n");
if ((handle = pci_get_interrupt_cause(handles)) > 0) if ((handle = pci_get_interrupt_cause(handles)) > 0)
{ {
newvalue = pci_call_interrupt_chain(handle, value); newvalue = pci_call_interrupt_chain(handle, value);
if (newvalue == value) if (newvalue == value)
{ {
debug_printf("%s: interrupt not handled!\r\n", __FUNCTION__); dbg("%s: interrupt not handled!\r\n", __FUNCTION__);
} }
} }
} }
@@ -425,7 +425,7 @@ struct pci_rd *pci_get_resource(int32_t handle)
else else
ret = &resource_descriptors[index][0]; ret = &resource_descriptors[index][0];
debug_printf("pci_get_resource: resource struct for handle %lx (index %d) is at %p\r\n", handle, index, ret); dbg("pci_get_resource: resource struct for handle %lx (index %d) is at %p\r\n", handle, index, ret);
return ret; return ret;
} }
@@ -579,7 +579,7 @@ int32_t pci_find_classcode(uint32_t classcode, int index)
int32_t pci_hook_interrupt(int32_t handle, void *handler, void *parameter) int32_t pci_hook_interrupt(int32_t handle, void *handler, void *parameter)
{ {
/* FIXME: implement */ /* FIXME: implement */
debug_printf("pci_hook_interrupt() still not implemented\r\n"); dbg("pci_hook_interrupt() still not implemented\r\n");
return PCI_SUCCESSFUL; return PCI_SUCCESSFUL;
} }
@@ -587,7 +587,7 @@ int32_t pci_unhook_interrupt(int32_t handle)
{ {
/* FIXME: implement */ /* FIXME: implement */
debug_printf("pci_unhook_interrupt() still not implemented\r\n"); dbg("pci_unhook_interrupt() still not implemented\r\n");
return PCI_SUCCESSFUL; return PCI_SUCCESSFUL;
} }
@@ -619,7 +619,7 @@ static void pci_device_config(uint16_t bus, uint16_t device, uint16_t function)
if (index == -1) if (index == -1)
{ {
debug_printf("cannot find index for handle %d\r\n", handle); dbg("cannot find index for handle %d\r\n", handle);
return; return;
} }
@@ -662,7 +662,7 @@ static void pci_device_config(uint16_t bus, uint16_t device, uint16_t function)
{ {
/* adjust base address to card's alignment requirements */ /* adjust base address to card's alignment requirements */
int size = ~(address & 0xfffffff0) + 1; int size = ~(address & 0xfffffff0) + 1;
debug_printf("device 0x%x: BAR[%d] requests %d bytes of memory\r\n", handle, i / 4, size); dbg("device 0x%x: BAR[%d] requests %d bytes of memory\r\n", handle, i / 4, size);
/* calculate a valid map adress with alignment requirements */ /* calculate a valid map adress with alignment requirements */
address = (mem_address + size - 1) & ~(size - 1); address = (mem_address + size - 1) & ~(size - 1);
@@ -673,7 +673,7 @@ static void pci_device_config(uint16_t bus, uint16_t device, uint16_t function)
/* read it back, just to be sure */ /* read it back, just to be sure */
value = swpl(pci_read_config_longword(handle, PCIBAR0 + i)) & ~1; value = swpl(pci_read_config_longword(handle, PCIBAR0 + i)) & ~1;
debug_printf("set PCIBAR%d on device 0x%02x to 0x%08x\r\n", dbg("set PCIBAR%d on device 0x%02x to 0x%08x\r\n",
i / 4, handle, value); i / 4, handle, value);
/* fill resource descriptor */ /* fill resource descriptor */
@@ -695,13 +695,13 @@ static void pci_device_config(uint16_t bus, uint16_t device, uint16_t function)
else if (IS_PCI_IO_BAR(value)) /* same as above for I/O resources */ else if (IS_PCI_IO_BAR(value)) /* same as above for I/O resources */
{ {
int size = ~(address & 0xfffffffc) + 1; int size = ~(address & 0xfffffffc) + 1;
debug_printf("device 0x%x: BAR[%d] requests %d bytes of I/O space\r\n", handle, i, size); dbg("device 0x%x: BAR[%d] requests %d bytes of I/O space\r\n", handle, i, size);
address = (io_address + size - 1) & ~(size - 1); address = (io_address + size - 1) & ~(size - 1);
pci_write_config_longword(handle, PCIBAR0 + i, swpl(address | 1)); pci_write_config_longword(handle, PCIBAR0 + i, swpl(address | 1));
value = swpl(pci_read_config_longword(handle, PCIBAR0 + i)); value = swpl(pci_read_config_longword(handle, PCIBAR0 + i));
debug_printf("set PCIBAR%d on device 0x%02x to 0x%08x\r\n", dbg("set PCIBAR%d on device 0x%02x to 0x%08x\r\n",
i / 4, handle, value); i / 4, handle, value);
rd->next = sizeof(struct pci_rd); rd->next = sizeof(struct pci_rd);
@@ -737,15 +737,19 @@ static void pci_device_config(uint16_t bus, uint16_t device, uint16_t function)
if (address & 1) if (address & 1)
{ {
struct pci_rd *rd = &descriptors[barnum]; struct pci_rd *rd = &descriptors[barnum];
int size = ~(address & 0xfffff800); int size = ~(address & ~0x7ff);
/* expansion ROM active and mapped */ /* expansion ROM active and mapped */
/* calculate a valid map adress with alignment requirements */ /* calculate a valid map adress with alignment requirements */
address = (mem_address + size - 1) & ~(size - 1); address = (mem_address + size - 1) & ~(size - 1);
/* write it to PCIERBAR */ /* write it to PCIERBAR and enable ROM */
pci_write_config_longword(handle, PCIERBAR, swpl(address)); pci_write_config_longword(handle, PCIERBAR, swpl(address | 1));
dbg("%s: set PCIERBAR on device 0x%02x to 0x%08x\r\n", __FUNCTION__, handle, address | 1);
/* read value back just to be sure */
dbg("%s: PCIERBAR = %p\r\n", __FUNCTION__, swpl(pci_read_config_longword(handle, PCIERBAR)));
rd->next = sizeof(struct pci_rd); rd->next = sizeof(struct pci_rd);
@@ -755,6 +759,7 @@ static void pci_device_config(uint16_t bus, uint16_t device, uint16_t function)
rd->length = size; rd->length = size;
rd->dmaoffset = 0; rd->dmaoffset = 0;
mem_address += size;
barnum++; barnum++;
} }
@@ -764,7 +769,7 @@ static void pci_device_config(uint16_t bus, uint16_t device, uint16_t function)
/* check if device requests an interrupt */ /* check if device requests an interrupt */
il = pci_read_config_byte(handle, PCIIPR); il = pci_read_config_byte(handle, PCIIPR);
debug_printf("device requests interrupts on interrupt pin %d\r\n", il); dbg("device requests interrupts on interrupt pin %d\r\n", il);
/* if so, register interrupts */ /* if so, register interrupts */
@@ -782,7 +787,7 @@ static void pci_bridge_config(uint16_t bus, uint16_t device, uint16_t function)
if (function != 0) if (function != 0)
{ {
debug_printf("trying to configure a multi-function bridge. Cancelled\r\n"); dbg("trying to configure a multi-function bridge. Cancelled\r\n");
return; return;
} }
handle = PCI_HANDLE(bus, device, function); handle = PCI_HANDLE(bus, device, function);
@@ -908,10 +913,10 @@ void init_pci(void)
(void) res; /* for now */ (void) res; /* for now */
res = register_interrupt_handler(0, INT_SOURCE_PCIARB, 5, 5, pci_arb_interrupt); res = register_interrupt_handler(0, INT_SOURCE_PCIARB, 5, 5, pci_arb_interrupt);
debug_printf("registered interrupt handler for PCI arbiter: %s\r\n", dbg("registered interrupt handler for PCI arbiter: %s\r\n",
(res < 0 ? "failed" : "succeeded")); (res < 0 ? "failed" : "succeeded"));
register_interrupt_handler(0, INT_SOURCE_XLBPCI, 5, 5, xlb_pci_interrupt); register_interrupt_handler(0, INT_SOURCE_XLBPCI, 5, 5, xlb_pci_interrupt);
debug_printf("registered interrupt handler for XLB PCI: %s\r\n", dbg("registered interrupt handler for XLB PCI: %s\r\n",
(res < 0 ? "failed" : "succeeded")); (res < 0 ? "failed" : "succeeded"));
init_eport(); init_eport();
@@ -968,7 +973,7 @@ void init_pci(void)
MCF_PCI_PCIIW0BTAR = (PCI_MEMORY_OFFSET | (((PCI_MEMORY_SIZE - 1) >> 8) & 0xffff0000)) MCF_PCI_PCIIW0BTAR = (PCI_MEMORY_OFFSET | (((PCI_MEMORY_SIZE - 1) >> 8) & 0xffff0000))
| ((PCI_MEMORY_OFFSET >> 16) & 0xff00); | ((PCI_MEMORY_OFFSET >> 16) & 0xff00);
debug_printf("PCIIW0BTAR=0x%08x\r\n", MCF_PCI_PCIIW0BTAR); dbg("PCIIW0BTAR=0x%08x\r\n", MCF_PCI_PCIIW0BTAR);
/* initiator window 1 base / translation adress register */ /* initiator window 1 base / translation adress register */
MCF_PCI_PCIIW1BTAR = (PCI_IO_OFFSET | ((PCI_IO_SIZE - 1) >> 8)) & 0xffff0000; MCF_PCI_PCIIW1BTAR = (PCI_IO_OFFSET | ((PCI_IO_SIZE - 1) >> 8)) & 0xffff0000;
@@ -1009,7 +1014,7 @@ void init_pci(void)
pci_scan(); pci_scan();
#ifdef DEBUG_PCI #ifdef _NOT_USED_
int index = 0; int index = 0;
int handle; int handle;
@@ -1041,7 +1046,7 @@ void init_pci(void)
handle = pci_find_device(0x0, 0xFFFF, ++index); handle = pci_find_device(0x0, 0xFFFF, ++index);
} }
#endif /* DEBUG_PCI */ #endif /* _NOT_USED_ */
} }
@@ -1054,7 +1059,7 @@ void pci_print_device_abilities(int32_t handle)
saved_value = pci_read_config_word(handle, PCICSR); saved_value = pci_read_config_word(handle, PCICSR);
pci_write_config_word(handle, PCICSR, 0xffff); pci_write_config_word(handle, PCICSR, 0xffff);
value = swpw(pci_read_config_word(handle, PCICSR)); value = swpw(pci_read_config_word(handle, PCICSR));
debug_printf("IO: %1d MEM: %1d MSTR:%1d SPCC: %1d MEMW: %1d VGAS: %1d PERR: %1d STEP: %1d SERR: %1d FBTB: %1d\r\n", dbg("IO: %1d MEM: %1d MSTR:%1d SPCC: %1d MEMW: %1d VGAS: %1d PERR: %1d STEP: %1d SERR: %1d FBTB: %1d\r\n",
value & PCICSR_IO ? 1 : 0, value & PCICSR_IO ? 1 : 0,
value & PCICSR_MEMORY ? 1 : 0, value & PCICSR_MEMORY ? 1 : 0,
value & PCICSR_MASTER ? 1 : 0, value & PCICSR_MASTER ? 1 : 0,
@@ -1074,7 +1079,7 @@ void pci_print_device_config(int32_t handle)
uint16_t value; uint16_t value;
value = swpw(pci_read_config_word(handle, PCICSR + 2)); value = swpw(pci_read_config_word(handle, PCICSR + 2));
debug_printf("66M: %1d UDF: %1d FB2B:%1d PERR: %1d TABR: %1d DABR: %1d SERR: %1d PPER: %1d\r\n", dbg("66M: %1d UDF: %1d FB2B:%1d PERR: %1d TABR: %1d DABR: %1d SERR: %1d PPER: %1d\r\n",
value & PCICSR_66MHZ ? 1 : 0, value & PCICSR_66MHZ ? 1 : 0,
value & PCICSR_UDF ? 1 : 0, value & PCICSR_UDF ? 1 : 0,
value & PCICSR_FAST_BTOB ? 1 : 0, value & PCICSR_FAST_BTOB ? 1 : 0,

View File

@@ -412,7 +412,7 @@ static int radeon_map_ROM(struct radeonfb_info *rinfo)
dbg("%s: Found Intel x86 BIOS ROM Image\r\n", __FUNCTION__); dbg("%s: Found Intel x86 BIOS ROM Image\r\n", __FUNCTION__);
break; break;
case 1: case 1:
dbg("%s: radeonfb: Found Open Firmware ROM Image\r\n", __FUNCTION__); dbg("%s: Found Open Firmware ROM Image\r\n", __FUNCTION__);
goto failed; goto failed;
case 2: case 2:
dbg("%s: Found HP PA-RISC ROM Image\r\n", __FUNCTION__); dbg("%s: Found HP PA-RISC ROM Image\r\n", __FUNCTION__);
@@ -424,15 +424,13 @@ static int radeon_map_ROM(struct radeonfb_info *rinfo)
anyway: anyway:
/* Locate the flat panel infos, do some sanity checking !!! */ /* Locate the flat panel infos, do some sanity checking !!! */
rinfo->fp_bios_start = BIOS_IN16(0x48); rinfo->fp_bios_start = BIOS_IN16(0x48);
dbg("%s: BIOS start offset: %p\r\n", __FUNCTION__, BIOS_IN16(0x48));
// DPRINTVALHEX("radeonfb: BIOS start offset: ", BIOS_IN16(0x48));
// DPRINT("\r\n");
/* Save BIOS PLL informations */ /* Save BIOS PLL informations */
{ {
uint16_t pll_info_block = BIOS_IN16(rinfo->fp_bios_start + 0x30); uint16_t pll_info_block = BIOS_IN16(rinfo->fp_bios_start + 0x30);
dbg("radeonfb: BIOS PLL info block offset: %p\r\n", BIOS_IN16(rinfo->fp_bios_start + 0x30)); dbg("%s: BIOS PLL info block offset: %p\r\n", __FUNCTION__, BIOS_IN16(rinfo->fp_bios_start + 0x30));
rinfo->bios_pll.sclk = BIOS_IN16(pll_info_block + 0x08); rinfo->bios_pll.sclk = BIOS_IN16(pll_info_block + 0x08);
rinfo->bios_pll.mclk = BIOS_IN16(pll_info_block + 0x0a); rinfo->bios_pll.mclk = BIOS_IN16(pll_info_block + 0x0a);
rinfo->bios_pll.ref_clk = BIOS_IN16(pll_info_block + 0x0e); rinfo->bios_pll.ref_clk = BIOS_IN16(pll_info_block + 0x0e);
@@ -511,13 +509,13 @@ static int radeon_probe_pll_params(struct radeonfb_info *rinfo)
set_ipl(ipl); set_ipl(ipl);
hz = US_TO_TIMER(1000000.0) / (double)(stop_tv - start_tv); hz = US_TO_TIMER(1000000.0) / (double)(stop_tv - start_tv);
dbg("%s: radeon_probe_pll_params hz %d\r\n", __FUNCTION__, (int32_t) hz); dbg("%s:hz %d\r\n", __FUNCTION__, (int32_t) hz);
hTotal = ((INREG(CRTC_H_TOTAL_DISP) & 0x1ff) + 1) * 8; hTotal = ((INREG(CRTC_H_TOTAL_DISP) & 0x1ff) + 1) * 8;
vTotal = ((INREG(CRTC_V_TOTAL_DISP) & 0x3ff) + 1); vTotal = ((INREG(CRTC_V_TOTAL_DISP) & 0x3ff) + 1);
dbg(" hTotal=%d\r\n", hTotal); dbg("%s:hTotal=%d\r\n", __FUNCTION__, hTotal);
dbg(" vTotal=%d\r\n", vTotal); dbg("%s:vTotal=%d\r\n", __FUNCTION__, vTotal);
vclk = (double) hTotal * (double) vTotal * hz; vclk = (double) hTotal * (double) vTotal * hz;
dbg("vclk=0x%x\r\n", (int) vclk); dbg("%s:vclk=%d\r\n", __FUNCTION__, (int) vclk);
switch ((INPLL(PPLL_REF_DIV) & 0x30000) >> 16) switch ((INPLL(PPLL_REF_DIV) & 0x30000) >> 16)
{ {
@@ -1964,8 +1962,8 @@ static void radeon_identify_vram(struct radeonfb_info *rinfo)
case CHIP_FAMILY_R420: dbg("R420"); break; case CHIP_FAMILY_R420: dbg("R420"); break;
default: dbg("UNKNOW"); break; default: dbg("UNKNOW"); break;
} }
dbg(" found %d", rinfo->video_ram / 1024); dbg("%s: found %d KB of %s %d bits wide video RAM\r\n", __FUNCTION__, rinfo->video_ram / 1024,
dbg("KB of %s %d bits wide video RAM\r\n", rinfo->vram_ddr ? "DDR " : "SDRAM ", rinfo->vram_width); rinfo->vram_ddr ? "DDR " : "SDRAM ", rinfo->vram_width);
} }
int32_t radeonfb_pci_register(int32_t handle, const struct pci_device_id *ent) int32_t radeonfb_pci_register(int32_t handle, const struct pci_device_id *ent)
@@ -1995,22 +1993,22 @@ int32_t radeonfb_pci_register(int32_t handle, const struct pci_device_id *ent)
rinfo->is_IGP = (ent->driver_data & CHIP_IS_IGP) != 0; rinfo->is_IGP = (ent->driver_data & CHIP_IS_IGP) != 0;
/* Set base addrs */ /* Set base addrs */
dbg("radeonfb: radeonfb_pci_register: Set base addrs\r\n"); dbg("%s: Set base addrs\r\n", __FUNCTION__);
rinfo->fb_base_phys = rinfo->mmio_base_phys = rinfo->io_base_phys = 0xFFFFFFFF; rinfo->fb_base_phys = rinfo->mmio_base_phys = rinfo->io_base_phys = 0xFFFFFFFF;
rinfo->mapped_vram = 0; rinfo->mapped_vram = 0;
rinfo->mmio_base = rinfo->io_base = NULL; rinfo->mmio_base = rinfo->io_base = NULL;
rinfo->bios_seg = NULL; rinfo->bios_seg = NULL;
pci_rsc_desc = pci_get_resource(handle); pci_rsc_desc = pci_get_resource(handle);
if ((int32_t)pci_rsc_desc >= 0) if ((int32_t) pci_rsc_desc >= 0)
{ {
uint16_t flags; uint16_t flags;
do do
{ {
dbg("%s: flags %p\r\n", __FUNCTION__, pci_rsc_desc->flags); dbg("%s: flags %p\r\n", __FUNCTION__, pci_rsc_desc->flags);
dbg("%s: start %p\r\n", __FUNCTION__, pci_rsc_desc->start); dbg("%s: start %p\r\n", __FUNCTION__, pci_rsc_desc->start);
dbg("%s: offset %x\r\n", __FUNCTION__, pci_rsc_desc->offset); dbg("%s: offset 0x%x\r\n", __FUNCTION__, pci_rsc_desc->offset);
dbg("%s: length %x\r\n", __FUNCTION__, pci_rsc_desc->length); dbg("%s: length 0x%x\r\n", __FUNCTION__, pci_rsc_desc->length);
if (!(pci_rsc_desc->flags & FLG_IO)) if (!(pci_rsc_desc->flags & FLG_IO))
{ {
@@ -2023,12 +2021,12 @@ int32_t radeonfb_pci_register(int32_t handle, const struct pci_device_id *ent)
if ((pci_rsc_desc->flags & FLG_ENDMASK) == ORD_MOTOROLA) if ((pci_rsc_desc->flags & FLG_ENDMASK) == ORD_MOTOROLA)
{ {
rinfo->big_endian = 0; /* host bridge make swapping intel -> motorola */ rinfo->big_endian = 0; /* host bridge make swapping intel -> motorola */
dbg("%s: radeonfb: host bridge is big endian\r\n", __FUNCTION__); dbg("%s: host bridge is big endian\r\n", __FUNCTION__);
} }
else else
{ {
rinfo->big_endian = 1; /* radeon make swapping intel -> motorola */ rinfo->big_endian = 1; /* radeon make swapping intel -> motorola */
dbg("%s: radeonfb: host bridge is little endian\r\n", __FUNCTION__); dbg("%s: host bridge is little endian\r\n", __FUNCTION__);
} }
} }
else if ((pci_rsc_desc->length >= RADEON_REGSIZE) && (pci_rsc_desc->length < 0x100000)) else if ((pci_rsc_desc->length >= RADEON_REGSIZE) && (pci_rsc_desc->length < 0x100000))
@@ -2036,14 +2034,21 @@ int32_t radeonfb_pci_register(int32_t handle, const struct pci_device_id *ent)
if (pci_rsc_desc->flags & FLG_ROM) if (pci_rsc_desc->flags & FLG_ROM)
{ {
dbg("%s: FLG_ROM resource descriptor found\r\n", __FUNCTION__); dbg("%s: FLG_ROM resource descriptor found\r\n", __FUNCTION__);
dbg("%s: start = %p, size = 0x%x\r\n", __FUNCTION__, pci_rsc_desc->start, pci_rsc_desc->length); dbg("%s: start = %p, size = 0x%x\r\n", __FUNCTION__, pci_rsc_desc->start, pci_rsc_desc->length);
dbg("%s: bios_seg = %p\r\n", __FUNCTION__, rinfo->bios_seg);
if (rinfo->bios_seg == NULL) if (rinfo->bios_seg == NULL)
{ {
rinfo->bios_seg_phys = pci_rsc_desc->start; rinfo->bios_seg_phys = pci_rsc_desc->start;
if (BIOS_IN16(0) == 0xaa55) if (BIOS_IN16(0) == 0xaa55)
rinfo->bios_seg = (void *) (pci_rsc_desc->offset + pci_rsc_desc->start); rinfo->bios_seg = (void *) (pci_rsc_desc->offset + pci_rsc_desc->start);
else else
rinfo->bios_seg_phys = 0; {
dbg("%s: BIOS_IN16(0) was %x (expected 0xaa55)\r\n", __FUNCTION__, BIOS_IN16(0));
rinfo->bios_seg_phys = pci_rsc_desc->offset + pci_rsc_desc->start;
hexdump(rinfo->bios_seg_phys, 512);
//rinfo->bios_seg_phys = 0;
}
} }
} }
else else
@@ -2065,7 +2070,7 @@ int32_t radeonfb_pci_register(int32_t handle, const struct pci_device_id *ent)
} }
} }
flags = pci_rsc_desc->flags; flags = pci_rsc_desc->flags;
pci_rsc_desc = (struct pci_rd *)((uint32_t)pci_rsc_desc->next + (uint32_t)pci_rsc_desc); pci_rsc_desc = (struct pci_rd *) ((uint32_t) pci_rsc_desc->next + (uint32_t) pci_rsc_desc);
} }
while (!(flags & FLG_LAST)); while (!(flags & FLG_LAST));
} }
@@ -2073,21 +2078,21 @@ int32_t radeonfb_pci_register(int32_t handle, const struct pci_device_id *ent)
dbg("%s: get_resource error\r\n", __FUNCTION__); dbg("%s: get_resource error\r\n", __FUNCTION__);
/* map the regions */ /* map the regions */
dbg("radeonfb: radeonfb_pci_register: map memory regions\r\n"); dbg("%s: map memory regions\r\n", __FUNCTION__);
if (rinfo->mmio_base == NULL) if (rinfo->mmio_base == NULL)
{ {
dbg("radeonfb: cannot map MMIO\r\n"); dbg("%s: cannot map MMIO\r\n", __FUNCTION__);
framebuffer_release(info); framebuffer_release(info);
return -2; //(-EIO); return -2; //(-EIO);
} }
dbg("radeonfb: %s: mmio_base_phys %p, mmio_base %p\r\n", __FUNCTION__, rinfo->mmio_base_phys, rinfo->mmio_base); dbg("%s: mmio_base_phys %p, mmio_base %p\r\n", __FUNCTION__, rinfo->mmio_base_phys, rinfo->mmio_base);
dbg("radeonfb: %s: io_base_phys %p, io_base %p\r\n", __FUNCTION__, rinfo->io_base_phys, rinfo->io_base); dbg("%s: io_base_phys %p, io_base %p\r\n", __FUNCTION__, rinfo->io_base_phys, rinfo->io_base);
dbg("radeonfb: %s: fb_base_phys %p, fb_base %p\r\n", __FUNCTION__, rinfo->fb_base_phys, rinfo->fb_base); dbg("%s: fb_base_phys %p, fb_base %p\r\n", __FUNCTION__, rinfo->fb_base_phys, rinfo->fb_base);
/* /*
* Check for errata * Check for errata
*/ */
dbg("radeonfb: radeonfb_pci_register: check for errata\r\n"); dbg("%s: check for errata\r\n", __FUNCTION__);
rinfo->errata = 0; rinfo->errata = 0;
if (rinfo->family == CHIP_FAMILY_R300 if (rinfo->family == CHIP_FAMILY_R300
&& (INREG(CONFIG_CNTL) & CFG_ATI_REV_ID_MASK) == CFG_ATI_REV_A11) && (INREG(CONFIG_CNTL) & CFG_ATI_REV_ID_MASK) == CFG_ATI_REV_A11)
@@ -2103,16 +2108,20 @@ int32_t radeonfb_pci_register(int32_t handle, const struct pci_device_id *ent)
* Map the BIOS ROM if any and retreive PLL parameters from * Map the BIOS ROM if any and retreive PLL parameters from
* the BIOS. * the BIOS.
*/ */
dbg("radeonfb: %s: bios_seg_phys %p\r\n", __FUNCTION__, rinfo->bios_seg_phys); dbg("%s: bios_seg_phys %p\r\n", __FUNCTION__, rinfo->bios_seg_phys);
dbg("radeonfb: %s: map the BIOS ROM\r\n", __FUNCTION__); dbg("%s: map the BIOS ROM\r\n", __FUNCTION__);
radeon_map_ROM(rinfo); radeon_map_ROM(rinfo);
/* Run VGA BIOS */ /* Run VGA BIOS */
if ((rinfo->bios_seg != NULL)) if ((rinfo->bios_seg != NULL))
{ {
dbg("radeonfb: %s: run VGA BIOS\r\n", __FUNCTION__); dbg("%s: run VGA BIOS\r\n", __FUNCTION__);
run_bios(rinfo); run_bios(rinfo);
} }
else
{
dbg("%s: could not run VGA bios - rinfo->bios_seg is NULL\r\n", __FUNCTION__);
}
dbg("%s: fixup display base address \r\n", __FUNCTION__); dbg("%s: fixup display base address \r\n", __FUNCTION__);
@@ -2129,41 +2138,45 @@ int32_t radeonfb_pci_register(int32_t handle, const struct pci_device_id *ent)
OUTREG(OV0_BASE_ADDR, 0); OUTREG(OV0_BASE_ADDR, 0);
/* Get VRAM size and type */ /* Get VRAM size and type */
dbg("radeonfb: radeonfb_pci_register: get VRAM size\r\n"); dbg("%s: get VRAM size\r\n", __FUNCTION__);
radeon_identify_vram(rinfo); radeon_identify_vram(rinfo);
if ((rinfo->fb_base == NULL) if ((rinfo->fb_base == NULL)
|| ((rinfo->video_ram > rinfo->mapped_vram) && (rinfo->mapped_vram < MIN_MAPPED_VRAM*2))) || ((rinfo->video_ram > rinfo->mapped_vram) && (rinfo->mapped_vram < MIN_MAPPED_VRAM * 2)))
{ {
dbg("radeonfb: cannot map FB, video ram: %d KB\r\n", rinfo->mapped_vram / 1024); dbg("%s: cannot map FB, video ram: %d KB\r\n", __FUNCTION__, rinfo->mapped_vram / 1024);
framebuffer_release(info); framebuffer_release(info);
return -2; //(-EIO); return -2; //(-EIO);
} }
else
{
dbg("%s: %d KB of VRAM mapped to %p\r\n", __FUNCTION__, rinfo->mapped_vram / 1024, rinfo->fb_base);
}
/* Get informations about the board's PLL */ /* Get informations about the board's PLL */
dbg("radeonfb: radeonfb_pci_register: get informations about the board's PLL\r\n"); dbg("%s: get informations about the board's PLL\r\n", __FUNCTION__);
radeon_get_pllinfo(rinfo); radeon_get_pllinfo(rinfo);
#ifdef CONFIG_FB_RADEON_I2C #ifdef CONFIG_FB_RADEON_I2C
/* Register I2C bus */ /* Register I2C bus */
dbg("radeonfb: radeonfb_pci_register: register I2C bus\r\n"); dbg("%s: register I2C bus\r\n", __FUNCTION__);
radeon_create_i2c_busses(rinfo); radeon_create_i2c_busses(rinfo);
#endif /* CONFIG_FB_RADEON_I2C */ #endif /* CONFIG_FB_RADEON_I2C */
/* set all the vital stuff */ /* set all the vital stuff */
dbg("radeonfb: radeonfb_pci_register: set all the vital stuff\r\n"); dbg("%s: set all the vital stuff\r\n", __FUNCTION__);
radeon_set_fbinfo(rinfo); radeon_set_fbinfo(rinfo);
/* set offscreen memory descriptor */ /* set offscreen memory descriptor */
dbg("radeonfb: radeonfb_pci_register: set offscreen memory descriptor\r\n"); dbg("%s: set offscreen memory descriptor\r\n", __FUNCTION__);
offscreen_init(info); offscreen_init(info);
/* Probe screen types */ /* Probe screen types */
dbg("radeonfb: radeonfb_pci_register: probe screen types, monitor_layout: 0x%x\r\n", monitor_layout); dbg("%s: probe screen types, monitor_layout: 0x%x\r\n", __FUNCTION__, monitor_layout);
radeon_probe_screens(rinfo, monitor_layout, (int) ignore_edid); radeon_probe_screens(rinfo, monitor_layout, (int) ignore_edid);
/* Build mode list, check out panel native model */ /* Build mode list, check out panel native model */
dbg("radeonfb: radeonfb_pci_register: build mode list\r\n"); dbg("%s: build mode list\r\n", __FUNCTION__);
radeon_check_modes(rinfo, &resolution); radeon_check_modes(rinfo, &resolution);
/* save current mode regs before we switch into the new one /* save current mode regs before we switch into the new one
@@ -2177,7 +2190,7 @@ int32_t radeonfb_pci_register(int32_t handle, const struct pci_device_id *ent)
// DPRINT("radeonfb: radeonfb_pci_register: setup power management\r\n"); // DPRINT("radeonfb: radeonfb_pci_register: setup power management\r\n");
// radeonfb_pm_init(rinfo, (int)default_dynclk); // radeonfb_pm_init(rinfo, (int)default_dynclk);
dbg("radeonfb: radeonfb_pci_register: install VBL timer\r\n"); dbg("%s: install VBL timer\r\n", __FUNCTION__);
rinfo->lvds_timer = 0; rinfo->lvds_timer = 0;
#ifndef DRIVER_IN_ROM #ifndef DRIVER_IN_ROM
install_vbl_timer(radeon_timer_func, 1); /* remove old vector */ install_vbl_timer(radeon_timer_func, 1); /* remove old vector */

View File

@@ -13,29 +13,30 @@
#endif /* DBG_MONITOR */ #endif /* DBG_MONITOR */
#ifndef INT_MAX #ifndef INT_MAX
#define INT_MAX ((int)(~0U>>1)) #define INT_MAX ((int) (~0U >> 1))
#endif #endif
static struct fb_var_screeninfo radeonfb_default_var = { static struct fb_var_screeninfo radeonfb_default_var =
.xres = 640, {
.yres = 480, .xres = 640,
.xres_virtual = 640, .yres = 480,
.yres_virtual = 480, .xres_virtual = 640,
.yres_virtual = 480,
.bits_per_pixel = 8, .bits_per_pixel = 8,
.red = { .length = 8 }, .red = { .length = 8 },
.green = { .length = 8 }, .green = { .length = 8 },
.blue = { .length = 8 }, .blue = { .length = 8 },
.activate = FB_ACTIVATE_NOW, .activate = FB_ACTIVATE_NOW,
.height = -1, .height = -1,
.width = -1, .width = -1,
.pixclock = 39721, .pixclock = 39721,
.left_margin = 40, .left_margin = 40,
.right_margin = 24, .right_margin = 24,
.upper_margin = 32, .upper_margin = 32,
.lower_margin = 11, .lower_margin = 11,
.hsync_len = 96, .hsync_len = 96,
.vsync_len = 2, .vsync_len = 2,
.vmode = FB_VMODE_NONINTERLACED .vmode = FB_VMODE_NONINTERLACED
}; };
static char *radeon_get_mon_name(int type) static char *radeon_get_mon_name(int type)
@@ -73,9 +74,10 @@ static char *radeon_get_mon_name(int type)
static int radeon_crt_is_connected(struct radeonfb_info *rinfo, int is_crt_dac) static int radeon_crt_is_connected(struct radeonfb_info *rinfo, int is_crt_dac)
{ {
int connected = 0; int connected = 0;
/* the monitor either wasn't connected or it is a non-DDC CRT. /*
* the monitor either wasn't connected or it is a non-DDC CRT.
* try to probe it * try to probe it
*/ */
if (is_crt_dac) if (is_crt_dac)
{ {
unsigned long ulOrigVCLK_ECP_CNTL; unsigned long ulOrigVCLK_ECP_CNTL;
@@ -84,12 +86,13 @@ static int radeon_crt_is_connected(struct radeonfb_info *rinfo, int is_crt_dac)
unsigned long ulOrigCRTC_EXT_CNTL; unsigned long ulOrigCRTC_EXT_CNTL;
unsigned long ulData; unsigned long ulData;
unsigned long ulMask; unsigned long ulMask;
ulOrigVCLK_ECP_CNTL = INPLL(VCLK_ECP_CNTL); ulOrigVCLK_ECP_CNTL = INPLL(VCLK_ECP_CNTL);
ulData = ulOrigVCLK_ECP_CNTL; ulData = ulOrigVCLK_ECP_CNTL;
ulData &= ~(PIXCLK_ALWAYS_ONb | PIXCLK_DAC_ALWAYS_ONb); ulData &= ~(PIXCLK_ALWAYS_ONb | PIXCLK_DAC_ALWAYS_ONb);
ulMask = ~(PIXCLK_ALWAYS_ONb | PIXCLK_DAC_ALWAYS_ONb); ulMask = ~(PIXCLK_ALWAYS_ONb | PIXCLK_DAC_ALWAYS_ONb);
OUTPLLP(VCLK_ECP_CNTL, ulData, ulMask); OUTPLLP(VCLK_ECP_CNTL, ulData, ulMask);
ulOrigCRTC_EXT_CNTL = INREG(CRTC_EXT_CNTL); ulOrigCRTC_EXT_CNTL = INREG(CRTC_EXT_CNTL);
ulData = ulOrigCRTC_EXT_CNTL; ulData = ulOrigCRTC_EXT_CNTL;
ulData |= CRTC_CRT_ON; ulData |= CRTC_CRT_ON;
OUTREG(CRTC_EXT_CNTL, ulData); OUTREG(CRTC_EXT_CNTL, ulData);
@@ -98,11 +101,11 @@ static int radeon_crt_is_connected(struct radeonfb_info *rinfo, int is_crt_dac)
ulData &= ~DAC_FORCE_DATA_MASK; ulData &= ~DAC_FORCE_DATA_MASK;
ulData |= (DAC_FORCE_BLANK_OFF_EN | DAC_FORCE_DATA_EN | DAC_FORCE_DATA_SEL_MASK); ulData |= (DAC_FORCE_BLANK_OFF_EN | DAC_FORCE_DATA_EN | DAC_FORCE_DATA_SEL_MASK);
if ((rinfo->family == CHIP_FAMILY_RV250) || (rinfo->family == CHIP_FAMILY_RV280)) if ((rinfo->family == CHIP_FAMILY_RV250) || (rinfo->family == CHIP_FAMILY_RV280))
ulData |= (0x01b6 << DAC_FORCE_DATA_SHIFT); ulData |= (0x01b6 << DAC_FORCE_DATA_SHIFT);
else else
ulData |= (0x01ac << DAC_FORCE_DATA_SHIFT); ulData |= (0x01ac << DAC_FORCE_DATA_SHIFT);
OUTREG(DAC_EXT_CNTL, ulData); OUTREG(DAC_EXT_CNTL, ulData);
ulOrigDAC_CNTL = INREG(DAC_CNTL); ulOrigDAC_CNTL = INREG(DAC_CNTL);
ulData = ulOrigDAC_CNTL; ulData = ulOrigDAC_CNTL;
ulData |= DAC_CMP_EN; ulData |= DAC_CMP_EN;
ulData &= ~(DAC_RANGE_CNTL_MASK | DAC_PDWN); ulData &= ~(DAC_RANGE_CNTL_MASK | DAC_PDWN);
@@ -224,25 +227,25 @@ void radeon_probe_screens(struct radeonfb_info *rinfo, const char *monitor_layou
* a layout for each card ? * a layout for each card ?
*/ */
#ifdef CONFIG_FB_RADEON_I2C #ifdef CONFIG_FB_RADEON_I2C
dbg("radeonfb: radeon_probe_screens: use monitor layout\r\n"); dbg("%s: use monitor layout\r\n", __FUNCTION__);
if (!ignore_edid) if (!ignore_edid)
{ {
if (rinfo->mon1_type != MT_NONE) if (rinfo->mon1_type != MT_NONE)
{ {
dbg("radeonfb: radeon_probe_screens: probe ddc_dvi on MON1\r\n"); dbg("%s: probe ddc_dvi on MON1\r\n", __FUNCTION__);
if (!radeon_probe_i2c_connector(rinfo, ddc_dvi, &rinfo->mon1_EDID)) if (!radeon_probe_i2c_connector(rinfo, ddc_dvi, &rinfo->mon1_EDID))
{ {
dbg("radeonfb: radeon_probe_screens: probe ddc_crt2 on MON1\r\n"); dbg("%s: probe ddc_crt2 on MON1\r\n", __FUNCTION__);
radeon_probe_i2c_connector(rinfo, ddc_crt2, &rinfo->mon1_EDID); radeon_probe_i2c_connector(rinfo, ddc_crt2, &rinfo->mon1_EDID);
ddc_crt2_used = 1; ddc_crt2_used = 1;
} }
} }
if (rinfo->mon2_type != MT_NONE) if (rinfo->mon2_type != MT_NONE)
{ {
dbg("radeonfb: radeon_probe_screens: probe ddc_vga on MON2\r\n"); dbg("%s: probe ddc_vga on MON2\r\n", __FUNCTION__);
if (!radeon_probe_i2c_connector(rinfo, ddc_vga, &rinfo->mon2_EDID) && !ddc_crt2_used) if (!radeon_probe_i2c_connector(rinfo, ddc_vga, &rinfo->mon2_EDID) && !ddc_crt2_used)
{ {
dbg("radeonfb: radeon_probe_screens: probe ddc_crt2 on MON2\r\n"); dbg("%s: probe ddc_crt2 on MON2\r\n", __FUNCTION__);
radeon_probe_i2c_connector(rinfo, ddc_crt2, &rinfo->mon2_EDID); radeon_probe_i2c_connector(rinfo, ddc_crt2, &rinfo->mon2_EDID);
} }
} }
@@ -258,7 +261,7 @@ void radeon_probe_screens(struct radeonfb_info *rinfo, const char *monitor_layou
else else
{ {
rinfo->mon1_type = MT_CRT; rinfo->mon1_type = MT_CRT;
dbg("radeonfb: No valid monitor, assuming CRT on first port\r\n"); dbg("%s: No valid monitor, assuming CRT on first port\r\n", __FUNCTION__);
} }
rinfo->mon2_type = MT_NONE; rinfo->mon2_type = MT_NONE;
rinfo->mon2_EDID = NULL; rinfo->mon2_EDID = NULL;
@@ -270,7 +273,7 @@ void radeon_probe_screens(struct radeonfb_info *rinfo, const char *monitor_layou
* Auto-detecting display type (well... trying to ...) * Auto-detecting display type (well... trying to ...)
*/ */
#ifdef CONFIG_FB_RADEON_I2C #ifdef CONFIG_FB_RADEON_I2C
dbg("radeonfb: radeon_probe_screens: Auto-detecting\r\n"); dbg("%s: Auto-detecting\r\n", __FUNCTION__);
#endif #endif
#if 0 //#if DEBUG && defined(CONFIG_FB_RADEON_I2C) #if 0 //#if DEBUG && defined(CONFIG_FB_RADEON_I2C)
{ {
@@ -289,17 +292,17 @@ void radeon_probe_screens(struct radeonfb_info *rinfo, const char *monitor_layou
#ifdef CONFIG_FB_RADEON_I2C #ifdef CONFIG_FB_RADEON_I2C
if (rinfo->mon1_type == MT_NONE) if (rinfo->mon1_type == MT_NONE)
{ {
dbg("radeonfb: radeon_probe_screens: probe ddc_dvi on MON1\r\n"); dbg("%s: probe ddc_dvi on MON1\r\n", __FUNCTION__);
rinfo->mon1_type = radeon_probe_i2c_connector(rinfo, ddc_dvi, &rinfo->mon1_EDID); rinfo->mon1_type = radeon_probe_i2c_connector(rinfo, ddc_dvi, &rinfo->mon1_EDID);
} }
if (rinfo->mon1_type == MT_NONE) if (rinfo->mon1_type == MT_NONE)
{ {
dbg("radeonfb: radeon_probe_screens: probe ddc_vga on MON1\r\n"); dbg("%s: probe ddc_vga on MON1\r\n", __FUNCTION__);
rinfo->mon1_type = radeon_probe_i2c_connector(rinfo, ddc_vga, &rinfo->mon1_EDID); rinfo->mon1_type = radeon_probe_i2c_connector(rinfo, ddc_vga, &rinfo->mon1_EDID);
} }
if (rinfo->mon1_type == MT_NONE) if (rinfo->mon1_type == MT_NONE)
{ {
dbg("radeonfb: radeon_probe_screens: probe ddc_crt2 on MON1\r\n"); dbg("%s: probe ddc_crt2 on MON1\r\n", __FUNCTION__);
rinfo->mon1_type = radeon_probe_i2c_connector(rinfo, ddc_crt2, &rinfo->mon1_EDID); rinfo->mon1_type = radeon_probe_i2c_connector(rinfo, ddc_crt2, &rinfo->mon1_EDID);
} }
#endif /* CONFIG_FB_RADEON_I2C */ #endif /* CONFIG_FB_RADEON_I2C */
@@ -313,22 +316,22 @@ void radeon_probe_screens(struct radeonfb_info *rinfo, const char *monitor_layou
#ifdef CONFIG_FB_RADEON_I2C #ifdef CONFIG_FB_RADEON_I2C
if (rinfo->mon1_type == MT_NONE) if (rinfo->mon1_type == MT_NONE)
{ {
dbg("radeonfb: radeon_probe_screens: probe ddc_dvi on MON1\r\n"); dbg("%s: probe ddc_dvi on MON1\r\n", __FUNCTION__);
rinfo->mon1_type = radeon_probe_i2c_connector(rinfo, ddc_dvi, &rinfo->mon1_EDID); rinfo->mon1_type = radeon_probe_i2c_connector(rinfo, ddc_dvi, &rinfo->mon1_EDID);
} }
if (rinfo->mon1_type == MT_NONE) if (rinfo->mon1_type == MT_NONE)
{ {
dbg("radeonfb: radeon_probe_screens: probe ddc_crt2 on MON1\r\n"); dbg("%s: probe ddc_crt2 on MON1\r\n", __FUNCTION__);
rinfo->mon1_type = radeon_probe_i2c_connector(rinfo, ddc_crt2, &rinfo->mon1_EDID); rinfo->mon1_type = radeon_probe_i2c_connector(rinfo, ddc_crt2, &rinfo->mon1_EDID);
if (rinfo->mon1_type != MT_NONE) if (rinfo->mon1_type != MT_NONE)
ddc_crt2_used = 1; ddc_crt2_used = 1;
} }
#endif /* CONFIG_FB_RADEON_I2C */ #endif /* CONFIG_FB_RADEON_I2C */
if (rinfo->mon1_type == MT_NONE && rinfo->is_mobility if (rinfo->mon1_type == MT_NONE && rinfo->is_mobility
&& (INREG(LVDS_GEN_CNTL) & LVDS_ON)) && (INREG(LVDS_GEN_CNTL) & LVDS_ON))
{ {
rinfo->mon1_type = MT_LCD; rinfo->mon1_type = MT_LCD;
dbg("Non-DDC laptop panel detected\r\n"); dbg("%s: Non-DDC laptop panel detected\r\n", __FUNCTION__);
} }
if (rinfo->mon1_type == MT_NONE) if (rinfo->mon1_type == MT_NONE)
rinfo->mon1_type = radeon_crt_is_connected(rinfo, rinfo->reversed_DAC); rinfo->mon1_type = radeon_crt_is_connected(rinfo, rinfo->reversed_DAC);
@@ -338,12 +341,12 @@ void radeon_probe_screens(struct radeonfb_info *rinfo, const char *monitor_layou
#ifdef CONFIG_FB_RADEON_I2C #ifdef CONFIG_FB_RADEON_I2C
if (rinfo->mon2_type == MT_NONE) if (rinfo->mon2_type == MT_NONE)
{ {
dbg("radeonfb: radeon_probe_screens: probe ddc_vga on MON2\r\n"); dbg("%s: probe ddc_vga on MON2\r\n", __FUNCTION__);
rinfo->mon2_type = radeon_probe_i2c_connector(rinfo, ddc_vga, &rinfo->mon2_EDID); rinfo->mon2_type = radeon_probe_i2c_connector(rinfo, ddc_vga, &rinfo->mon2_EDID);
} }
if (rinfo->mon2_type == MT_NONE && !ddc_crt2_used) if (rinfo->mon2_type == MT_NONE && !ddc_crt2_used)
{ {
dbg("radeonfb: radeon_probe_screens: probe ddc_crt2 on MON2\r\n"); dbg("%s: probe ddc_crt2 on MON2\r\n", __FUNCTION__);
rinfo->mon2_type = radeon_probe_i2c_connector(rinfo, ddc_crt2, &rinfo->mon2_EDID); rinfo->mon2_type = radeon_probe_i2c_connector(rinfo, ddc_crt2, &rinfo->mon2_EDID);
} }
#endif /* CONFIG_FB_RADEON_I2C */ #endif /* CONFIG_FB_RADEON_I2C */
@@ -396,18 +399,18 @@ void radeon_probe_screens(struct radeonfb_info *rinfo, const char *monitor_layou
} }
bail: bail:
dbg("radeonfb: Monitor 1 type %s found\r\n", radeon_get_mon_name(rinfo->mon1_type)); dbg("%s: Monitor 1 type %s found\r\n", __FUNCTION__, radeon_get_mon_name(rinfo->mon1_type));
if (rinfo->mon1_EDID) if (rinfo->mon1_EDID)
{ {
dbg("radeonfb: EDID probed\r\n"); dbg("%s: EDID probed\r\n", __FUNCTION__);
} }
if (!rinfo->has_CRTC2) if (!rinfo->has_CRTC2)
return; return;
dbg("radeonfb: Monitor 2 type %s\r\n", radeon_get_mon_name(rinfo->mon2_type)); dbg("%s: Monitor 2 type %s\r\n", __FUNCTION__, radeon_get_mon_name(rinfo->mon2_type));
if (rinfo->mon2_EDID) if (rinfo->mon2_EDID)
{ {
dbg("radeonfb: EDID probed\r\n"); dbg("%s: EDID probed\r\n", __FUNCTION__);
} }
} }
@@ -439,7 +442,7 @@ static void radeon_var_to_panel_info(struct radeonfb_info *rinfo, struct fb_var_
} }
static void radeon_videomode_to_var(struct fb_var_screeninfo *var, static void radeon_videomode_to_var(struct fb_var_screeninfo *var,
const struct fb_videomode *mode) const struct fb_videomode *mode)
{ {
var->xres = mode->xres; var->xres = mode->xres;
var->yres = mode->yres; var->yres = mode->yres;
@@ -467,7 +470,7 @@ void radeon_check_modes(struct radeonfb_info *rinfo, struct mode_option *resolut
struct fb_info *info = rinfo->info; struct fb_info *info = rinfo->info;
int has_default_mode = 0; int has_default_mode = 0;
struct mode_option xres_yres; struct mode_option xres_yres;
dbg("radeonfb: radeon_check_modes\r\n"); dbg("%s: radeon_check_modes\r\n", __FUNCTION__);
/* /*
* Fill default var first * Fill default var first
@@ -569,7 +572,7 @@ void radeon_check_modes(struct radeonfb_info *rinfo, struct mode_option *resolut
xres_yres.height = rinfo->panel_info.yres; xres_yres.height = rinfo->panel_info.yres;
xres_yres.bpp = xres_yres.freq = 0; xres_yres.bpp = xres_yres.freq = 0;
if (fb_find_mode(&info->var, info, &xres_yres, modedb, dbsize, NULL, if (fb_find_mode(&info->var, info, &xres_yres, modedb, dbsize, NULL,
(resolution->bpp >= 8) ? (unsigned int)resolution->bpp : 8) == 0) (resolution->bpp >= 8) ? (unsigned int)resolution->bpp : 8) == 0)
{ {
rinfo->mon1_type = MT_CRT; rinfo->mon1_type = MT_CRT;
goto pickup_default; goto pickup_default;
@@ -584,9 +587,9 @@ pickup_default:
if (resolution->used) if (resolution->used)
{ {
if (fb_find_mode(&info->var, info, resolution, info->monspecs.modedb, if (fb_find_mode(&info->var, info, resolution, info->monspecs.modedb,
info->monspecs.modedb_len, NULL, (resolution->bpp >= 8) ? (unsigned int)resolution->bpp : 8) != 0) info->monspecs.modedb_len, NULL, (resolution->bpp >= 8) ? (unsigned int)resolution->bpp : 8) != 0)
has_default_mode = 1; has_default_mode = 1;
} }
/* /*
* Still no mode, let's pick up a default from the db * Still no mode, let's pick up a default from the db
*/ */
@@ -636,7 +639,7 @@ pickup_default:
* the current fbcon doesn't quite mind ;) * the current fbcon doesn't quite mind ;)
*/ */
static int radeon_compare_modes(const struct fb_var_screeninfo *var, static int radeon_compare_modes(const struct fb_var_screeninfo *var,
const struct fb_videomode *mode) const struct fb_videomode *mode)
{ {
int distance = 0; int distance = 0;
@@ -652,8 +655,8 @@ static int radeon_compare_modes(const struct fb_var_screeninfo *var,
* We need something better ultimately. * We need something better ultimately.
*/ */
int radeon_match_mode(struct radeonfb_info *rinfo, int radeon_match_mode(struct radeonfb_info *rinfo,
struct fb_var_screeninfo *dest, struct fb_var_screeninfo *dest,
const struct fb_var_screeninfo *src) const struct fb_var_screeninfo *src)
{ {
const struct fb_videomode *db = vesa_modes; const struct fb_videomode *db = vesa_modes;
int i, dbsize = 34; int i, dbsize = 34;
@@ -684,7 +687,7 @@ int radeon_match_mode(struct radeonfb_info *rinfo,
|| (src->activate & FB_ACTIVATE_MASK) == FB_ACTIVATE_NOW) || (src->activate & FB_ACTIVATE_MASK) == FB_ACTIVATE_NOW)
{ {
/* We don't have an RMX, validate timings. If we don't have /* We don't have an RMX, validate timings. If we don't have
* monspecs, we should be paranoid and not let use go above * monspecs, we should be paranoid and not let use go above
* 640x480-60, but I assume userland knows what it's doing here * 640x480-60, but I assume userland knows what it's doing here
* (though I may be proven wrong...) * (though I may be proven wrong...)
*/ */

View File

@@ -288,6 +288,9 @@ void install_vbl_timer(void *func, int remove)
dbg("%s: not implemented\r\n", __FUNCTION__); dbg("%s: not implemented\r\n", __FUNCTION__);
} }
/*
* detect and initialise PCI graphics cards
*/
void video_init(void) void video_init(void)
{ {
/* /*
@@ -298,6 +301,7 @@ void video_init(void)
int32_t handle; int32_t handle;
struct pci_device_id *board; struct pci_device_id *board;
int32_t id; int32_t id;
bool radeon_found = false;
dbg("%s\r\n", __FUNCTION__); dbg("%s\r\n", __FUNCTION__);
do do
@@ -321,6 +325,8 @@ void video_init(void)
dbg("%s: check %x %x against %08x\r\n", __FUNCTION__, board->device, board->vendor, id); dbg("%s: check %x %x against %08x\r\n", __FUNCTION__, board->device, board->vendor, id);
if ((board->device == (id >> 16)) && (board->vendor == (id & 0xffff))) if ((board->device == (id >> 16)) && (board->vendor == (id & 0xffff)))
{ {
radeon_found = true;
dbg("%s: matched\r\n", __FUNCTION__); dbg("%s: matched\r\n", __FUNCTION__);
if (radeonfb_pci_register(handle, board) >= 0) if (radeonfb_pci_register(handle, board) >= 0)
{ {
@@ -337,6 +343,8 @@ void video_init(void)
} }
index++; index++;
} while (handle > 0); } while (handle > 0);
dbg("%s: RADEON video card %sfound and %sregistered\r\n", __FUNCTION__,
(radeon_found ? "" : "not "), (radeon_found ? "" : "not "));
} }

View File

@@ -105,10 +105,10 @@ uint8_t inb(uint16_t port)
if ((port >= offset_port) && (port <= offset_port + 0xFF)) if ((port >= offset_port) && (port <= offset_port + 0xFF))
{ {
dbg("inb("); dbg("%s:\r\n", __FUNCTION__);
val = *(uint8_t *)(offset_io+(uint32_t)port); val = *(uint8_t *)(offset_io+(uint32_t)port);
dbg("0x%x) = 0x%x\r\n", port, val); dbg("%s: inb(0x%x) = 0x%x\r\n", __FUNCTION__, port, val);
} }
return val; return val;
} }
@@ -537,7 +537,7 @@ void run_bios(struct radeonfb_info *rinfo)
if ((rinfo->mmio_base == NULL) || (rinfo->io_base == NULL)) if ((rinfo->mmio_base == NULL) || (rinfo->io_base == NULL))
{ {
dbg("%s: rinfo->mmio_base = %p, rinfo->io_base = %p\r\n", __FUNCTION__); dbg("%s: rinfo->mmio_base = %p, rinfo->io_base = %p\r\n", __FUNCTION__, rinfo->mmio_base, rinfo->io_base);
return; return;
} }
rinfo_biosemu = rinfo; rinfo_biosemu = rinfo;
@@ -573,7 +573,7 @@ void run_bios(struct radeonfb_info *rinfo)
} }
memset((char *) biosmem, 0, SIZE_EMU); memset((char *) biosmem, 0, SIZE_EMU);
setup_system_bios((char *) biosmem); setup_system_bios((char *) biosmem);
dbg("Copying VGA ROM Image from %p to %p (0x%lx bytes)\r\n", (long) rinfo->bios_seg + (long) rom_header, dbg("%s: Copying VGA ROM Image from %p to %p (0x%lx bytes)\r\n", __FUNCTION__, (long) rinfo->bios_seg + (long) rom_header,
biosmem + PCI_VGA_RAM_IMAGE_START, rom_size); biosmem + PCI_VGA_RAM_IMAGE_START, rom_size);
{ {
long bytes_align = (long) rom_header & 3; long bytes_align = (long) rom_header & 3;
@@ -605,7 +605,7 @@ void run_bios(struct radeonfb_info *rinfo)
#endif /* USE_SDRAM */ #endif /* USE_SDRAM */
setup_system_bios((char *)biosmem); setup_system_bios((char *)biosmem);
memset((char *)biosmem, 0, SIZE_EMU); memset((char *)biosmem, 0, SIZE_EMU);
dbg("Copying non-VGA ROM Image from %p to %p (0x%lx bytes)\r\n", dbg("%s: Copying non-VGA ROM Image from %p to %p (0x%lx bytes)\r\n", __FUNCTION__,
(long) rinfo->bios_seg + (long) rom_header, (long) rinfo->bios_seg + (long) rom_header,
biosmem + PCI_RAM_IMAGE_START, biosmem + PCI_RAM_IMAGE_START,
rom_size); rom_size);
@@ -660,11 +660,11 @@ void run_bios(struct radeonfb_info *rinfo)
X86EMU_trace_on(); X86EMU_trace_on();
X86EMU_set_debug(DEBUG_DECODE_F | DEBUG_TRACE_F); X86EMU_set_debug(DEBUG_DECODE_F | DEBUG_TRACE_F);
#endif #endif
dbg("X86EMU entering emulator\r\n"); dbg("%s: X86EMU entering emulator\r\n", __FUNCTION__);
//*vblsem = 0; //*vblsem = 0;
X86EMU_exec(); X86EMU_exec();
//*vblsem = 1; //*vblsem = 1;
dbg("X86EMU halted\r\n"); dbg("%s: X86EMU halted\r\n", __FUNCTION__);
// biosfn_set_video_mode(0x13); /* 320 x 200 x 256 colors */ // biosfn_set_video_mode(0x13); /* 320 x 200 x 256 colors */
#ifdef USE_SDRAM #ifdef USE_SDRAM
#if 0 #if 0