diff --git a/BaS_gcc/include/fb.h b/BaS_gcc/include/fb.h index 8083c2b..4d0e9f6 100644 --- a/BaS_gcc/include/fb.h +++ b/BaS_gcc/include/fb.h @@ -536,17 +536,18 @@ struct fb_videomode { extern const struct fb_videomode vesa_modes[]; /* timer */ -#ifdef COLDFIRE -#ifdef MCF5445X + +#if defined(MACHINE_FIREBEE) +#define US_TO_TIMER(a) (((a) * 256) / 5000) +#define TIMER_TO_US(a) (((a) * 5000) / 256) +#elif defined(MACHINE_M5484LITE) +#define US_TO_TIMER(a) ((a) * 100) +#define TIMER_TO_US(a) ((a) / 100) +#elif defined(MACHINE_M54455) #define US_TO_TIMER(a) (a) #define TIMER_TO_US(a) (a) -#else /* MCF548X */ -#define US_TO_TIMER(a) ((a)*100) -#define TIMER_TO_US(a) ((a)/100) -#endif #else -#define US_TO_TIMER(a) (((a)*256)/5000) -#define TIMER_TO_US(a) (((a)*5000)/256) +#error Unknown machine! #endif extern void start_timeout(void); diff --git a/BaS_gcc/radeon/radeon_base.c b/BaS_gcc/radeon/radeon_base.c index c73bba9..21bc691 100644 --- a/BaS_gcc/radeon/radeon_base.c +++ b/BaS_gcc/radeon/radeon_base.c @@ -332,12 +332,12 @@ void __OUTPLLP(struct radeonfb_info *rinfo, uint32_t index, uint32_t val, uint32 __OUTPLL(rinfo, index, tmp); } -static int round_div(int num, int den) +static __inline int round_div(int num, int den) { return(num + (den / 2)) / den; } -static uint32_t read_vline_crnt(struct radeonfb_info *rinfo) +static __inline uint32_t read_vline_crnt(struct radeonfb_info *rinfo) { return((INREG(CRTC_VLINE_CRNT_VLINE) >> 16) & 0x3FF); } @@ -357,10 +357,6 @@ static int radeon_map_ROM(struct radeonfb_info *rinfo) uint32_t temp; - dbg("mmio_base=%p\r\n", rinfo->mmio_base); - dbg("bios_seg=%p\r\n", rinfo->bios_seg); - dbg("bios_seg_phys=%p\r\n", rinfo->bios_seg_phys); - temp = inreg(MPP_TB_CONFIG); dbg("temp=%d\r\n", temp); @@ -371,14 +367,14 @@ static int radeon_map_ROM(struct radeonfb_info *rinfo) if (rinfo->bios_seg == NULL) { - dbg("ROM failed to map\r\n"); + err("no ROM found on ATI card\r\n"); return -1; } /* Very simple test to make sure it appeared */ if (BIOS_IN16(0) != 0xaa55) { - dbg("Invalid ROM signature"); + dbg("Invalid ROM signature 0x%04x instead of 0x%04x found\r\n", BIOS_IN16(0), 0xaa55); goto failed; } @@ -394,27 +390,30 @@ static int radeon_map_ROM(struct radeonfb_info *rinfo) * them all, and we should use fb_bios_start relative to start of image and not * relative start of ROM, but so far, I never found a dual-image ATI card * - * typedef struct { - * u32 signature; + 0x00 - * u16 vendor; + 0x04 - * u16 device; + 0x06 - * u16 reserved_1; + 0x08 - * u16 dlen; + 0x0a - * u8 drevision; + 0x0c - * u8 class_hi; + 0x0d - * u16 class_lo; + 0x0e - * u16 ilen; + 0x10 - * u16 irevision; + 0x12 - * u8 type; + 0x14 - * u8 indicator; + 0x15 - * u16 reserved_2; + 0x16 + * typedef struct + * { + * u32 signature; + 0x00 + * u16 vendor; + 0x04 + * u16 device; + 0x06 + * u16 reserved_1; + 0x08 + * u16 dlen; + 0x0a + * u8 drevision; + 0x0c + * u8 class_hi; + 0x0d + * u16 class_lo; + 0x0e + * u16 ilen; + 0x10 + * u16 irevision; + 0x12 + * u8 type; + 0x14 + * u8 indicator; + 0x15 + * u16 reserved_2; + 0x16 * } pci_data_t; */ + if (BIOS_IN32(dptr) != (('R' << 24) | ('I' << 16) | ('C' << 8) | 'P')) { dbg("PCI DATA signature in ROM incorrect: %p\r\n", BIOS_IN32(dptr)); goto anyway; } + rom_type = BIOS_IN8(dptr + 0x14); switch(rom_type) { @@ -431,23 +430,24 @@ static int radeon_map_ROM(struct radeonfb_info *rinfo) dbg("Found unknown type %d ROM Image\r\n", rom_type); goto failed; } + anyway: /* Locate the flat panel infos, do some sanity checking !!! */ rinfo->fp_bios_start = BIOS_IN16(0x48); dbg("BIOS start offset: %p\r\n", BIOS_IN16(0x48)); /* Save BIOS PLL informations */ - { - uint16_t pll_info_block = BIOS_IN16(rinfo->fp_bios_start + 0x30); - dbg("BIOS PLL info block offset: %p\r\n", BIOS_IN16(rinfo->fp_bios_start + 0x30)); - rinfo->bios_pll.sclk = BIOS_IN16(pll_info_block + 0x08); - 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_div = BIOS_IN16(pll_info_block + 0x10); - rinfo->bios_pll.ppll_min = BIOS_IN32(pll_info_block + 0x12); - rinfo->bios_pll.ppll_max = BIOS_IN32(pll_info_block + 0x16); - } + uint16_t pll_info_block = BIOS_IN16(rinfo->fp_bios_start + 0x30); + + dbg("BIOS PLL info block offset: %p\r\n", BIOS_IN16(rinfo->fp_bios_start + 0x30)); + rinfo->bios_pll.sclk = BIOS_IN16(pll_info_block + 0x08); + 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_div = BIOS_IN16(pll_info_block + 0x10); + rinfo->bios_pll.ppll_min = BIOS_IN32(pll_info_block + 0x12); + rinfo->bios_pll.ppll_max = BIOS_IN32(pll_info_block + 0x16); + return 0; failed: @@ -461,12 +461,24 @@ failed: static int radeon_probe_pll_params(struct radeonfb_info *rinfo) { uint8_t ppll_div_sel; - unsigned Ns, Nm, M; - unsigned sclk, mclk, tmp, ref_div; - int hTotal, vTotal, num, denom, m, n; - double hz, vclk; + unsigned Ns; + unsigned Nm; + unsigned M; + unsigned sclk; + unsigned mclk; + unsigned tmp; + unsigned ref_div; + int hTotal; + int vTotal; + int num; + int denom; + int m; + int n; + double hz; + double vclk; int32_t xtal; - uint32_t start_tv, stop_tv; + uint32_t start_tv; + uint32_t stop_tv; int timeout = 0; int ipl; @@ -474,13 +486,13 @@ static int radeon_probe_pll_params(struct radeonfb_info *rinfo) * Ugh, we cut interrupts, bad bad bad, but we want some precision * here, so... --BenH */ + ipl = set_ipl(0); + dbg("radeon_probe_pll_params\r\n"); /* Flush PCI buffers ? */ tmp = INREG16(DEVICE_ID); - ipl = set_ipl(0); - start_tv = get_timer(); while (read_vline_crnt(rinfo) != 0) { @@ -504,6 +516,7 @@ static int radeon_probe_pll_params(struct radeonfb_info *rinfo) break; } } + if (!timeout) { while (read_vline_crnt(rinfo) != 0) diff --git a/BaS_gcc/x86emu/x86pcibios.c b/BaS_gcc/x86emu/x86pcibios.c index 41b81c8..f3e556f 100644 --- a/BaS_gcc/x86emu/x86pcibios.c +++ b/BaS_gcc/x86emu/x86pcibios.c @@ -18,18 +18,18 @@ int x86_pcibios_handler(struct X86EMU *emu) { case PCI_BIOS_PRESENT: dbg("PCI_BIOS_PRESENT\r\n"); - emu->x86.R_AH = 0x00; /* no config space/special cycle support */ - emu->x86.R_AL = 0x01; /* config mechanism 1 */ + emu->x86.R_AH = 0x00; /* no config space/special cycle support */ + emu->x86.R_AL = 0x01; /* config mechanism 1 */ emu->x86.R_EDX = 'P' | 'C' << 8 | 'I' << 16 | ' ' << 24; - emu->x86.R_EBX = 0x0210; /* Version 2.10 */ - emu->x86.R_ECX = 0xFF00; /* FixME: Max bus number */ + emu->x86.R_EBX = 0x0210; /* Version 2.10 */ + emu->x86.R_ECX = 0xFF00; /* FixME: Max bus number */ emu->x86.R_EFLG &= ~FB_CF; /* clear carry flag */ ret = 1; break; case FIND_PCI_DEVICE: dbg("FIND_PCI_DEVICE vendor = %04x, device = %04x\r\n", emu->x86.R_DX, emu->x86.R_CX); - dev = pci_find_device((unsigned long) emu->x86.R_DX, ((unsigned long) emu->x86.R_CX), 0); + dev = pci_find_device((uintptr_t) emu->x86.R_DX, ((unsigned long) emu->x86.R_CX), 0); if (dev != 0) {