diff options
author | Ralf Baechle <ralf@linux-mips.org> | 1998-08-25 09:12:35 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 1998-08-25 09:12:35 +0000 |
commit | c7fc24dc4420057f103afe8fc64524ebc25c5d37 (patch) | |
tree | 3682407a599b8f9f03fc096298134cafba1c9b2f /drivers/sbus/char | |
parent | 1d793fade8b063fde3cf275bf1a5c2d381292cd9 (diff) |
o Merge with Linux 2.1.116.
o New Newport console code.
o New G364 console code.
Diffstat (limited to 'drivers/sbus/char')
31 files changed, 309 insertions, 8470 deletions
diff --git a/drivers/sbus/char/Config.in b/drivers/sbus/char/Config.in index 4a8832678..6312709e1 100644 --- a/drivers/sbus/char/Config.in +++ b/drivers/sbus/char/Config.in @@ -1,44 +1,3 @@ -comment 'SBUS Frame Buffer support' -bool 'Sun FB drivers appear in PROCFS' SUN_FBS_IN_PROCFS -bool 'Load All Supported Drivers' CONFIG_SUN_FB_DISPLAY - -if [ "$CONFIG_SUN_FB_DISPLAY" = "n" ]; then - bool 'cgsix support' SUN_FB_CGSIX - bool 'tcx support' SUN_FB_TCX - bool 'cgthree support' SUN_FB_CGTHREE - bool 'cgfourteen support' SUN_FB_CGFOURTEEN - bool 'bwtwo support' SUN_FB_BWTWO - bool 'leo/zx support' SUN_FB_LEO - bool 'weitek P9X00 support' TADPOLE_FB_WEITEK - bool 'creator support' SUN_FB_CREATOR - if [ "$TADPOLE_FB_WEITEK" = "n" ]; then - fbs=$SUN_FB_CGSIX - fbs=$fbs$SUN_FB_TCX - fbs=$fbs$SUN_FB_CGTHREE - fbs=$fbs$SUN_FB_BWTWO - fbs=$fbs$SUN_FB_CGFOURTEEN - fbs=$fbs$SUN_FB_LEO - fbs=$fbs$TADPOLE_FB_WEITEK - fbs=$fbs$SUN_FB_CREATOR - if [ "$fbs" = "nnnnnnnn" ]; then - echo "Warning: You have excluded ALL FB Support" - echo "Notice: Enabling Generic AutoResolution" - define_bool SUN_FB_GENERIC y - fi - else - define_bool SUN_FB_GENERIC y - fi -else - define_bool SUN_FB_CGSIX y - define_bool SUN_FB_TCX y - define_bool SUN_FB_CGTHREE y - define_bool SUN_FB_CGFOURTEEN y - define_bool SUN_FB_BWTWO y - define_bool SUN_FB_LEO y - define_bool TADPOLE_FB_WEITEK y - define_bool SUN_FB_CREATOR y -fi - comment 'Misc Linux/SPARC drivers' tristate '/dev/openprom device support' CONFIG_SUN_OPENPROMIO tristate 'Mostek real time clock support' CONFIG_SUN_MOSTEK_RTC diff --git a/drivers/sbus/char/Makefile b/drivers/sbus/char/Makefile index 84253cf03..9ad88d157 100644 --- a/drivers/sbus/char/Makefile +++ b/drivers/sbus/char/Makefile @@ -10,47 +10,8 @@ # Dave Redman Frame Buffer tuning support. # OK this is kind of ugly but it does allow drivers to be added fairly # easily. and you can even choose what sort of support you want. -ifdef SUN_FB_CGSIX - FB_OBJS += cgsix.o -endif -ifdef SUN_FB_CGTHREE - FB_OBJS += cgthree.o -endif -ifdef SUN_FB_TCX - FB_OBJS += tcx.o -endif -ifdef SUN_FB_BWTWO - FB_OBJS += bwtwo.o -endif -ifdef SUN_FB_LEO - FB_OBJS += leo.o -endif -ifdef SUN_FB_CGFOURTEEN - FB_OBJS += cgfourteen.o -endif -ifdef TADPOLE_FB_WEITEK - FB_OBJS += weitek.o -endif -ifdef SUN_FB_CREATOR - ifeq ($(ARCH),sparc64) - FB_OBJS += creator.o - endif -endif -#ifdef SUN_FB_FAST_ONE -# FB_OBJS += sun_8bit_fast1.o -#endif -#ifdef SUN_FB_FAST_TWO -# FB_OBJS += sun_8bit_fast2.o -#endif -#ifdef SUN_FB_FAST_MONO -# FB_OBJS += sun_mono_fast1.o -#endif -#ifdef SUN_FB_GENERIC -# FB_OBJS += sun_8bit_generic.o -#endif O_TARGET := sunchar.o -O_OBJ := ${FB_OBJS} suncons.o sbuscons.o pcicons.o sunfb.o O_OBJS := ${O_OBJ} sunkbd.o sunkbdmap.o sunmouse.o sunserial.o zs.o M_OBJS := @@ -120,12 +81,6 @@ else endif endif -# Add PCI console/fb drivers here. -# -ifeq ($(CONFIG_PCI),y) -O_OBJS += mach64.o -endif - include $(TOPDIR)/Rules.make sunkbdmap.o: sunkeymap.c diff --git a/drivers/sbus/char/bpp.c b/drivers/sbus/char/bpp.c index 2fd138748..983e3893f 100644 --- a/drivers/sbus/char/bpp.c +++ b/drivers/sbus/char/bpp.c @@ -45,7 +45,7 @@ static const unsigned BPP_MAJOR = LP_MAJOR; static const char* dev_name = "bpp"; -/* When switching from compatability to a mode where I can read, try +/* When switching from compatibility to a mode where I can read, try the following mode first. */ /* const unsigned char DEFAULT_ECP = 0x10; */ @@ -957,7 +957,7 @@ static volatile struct bpp_regs *map_bpp(struct linux_sbus_device *dev, int idx) areg = dev->reg_addrs[0]; printk("bpp%d.map_bpp: 0x%x.%p[0x%x] i=%d\n", idx, areg.which_io, areg.phys_addr, areg.reg_size, - dev->irqs[0].pri); + dev->irqs[0]); /* IPC Zebra 1.fa200000[1c] i=2 */ /** prom_apply_sbus_ranges (&areg, 1); **/ diff --git a/drivers/sbus/char/bwtwo.c b/drivers/sbus/char/bwtwo.c deleted file mode 100644 index c8b8a04d7..000000000 --- a/drivers/sbus/char/bwtwo.c +++ /dev/null @@ -1,220 +0,0 @@ -/* $Id: bwtwo.c,v 1.20 1998/03/10 20:18:22 jj Exp $ - * bwtwo.c: bwtwo console driver - * - * Copyright (C) 1996 Miguel de Icaza (miguel@nuclecu.unam.mx) - * Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be) - * Copyright (C) 1998 Pavel Machek (pavel@ucw.cz) - */ - -#include <linux/config.h> -#include <linux/kd.h> -#include <linux/tty.h> -#include <linux/malloc.h> -#include <linux/proc_fs.h> - -#include <asm/sbus.h> -#include <asm/io.h> -#include <asm/fbio.h> -#include <asm/pgtable.h> - -/* These must be included after asm/fbio.h */ -#include <linux/vt_kern.h> -#include <linux/selection.h> -#include <linux/console_struct.h> - -#include "fb.h" -#include "cg_common.h" - -/* OBio addresses for the bwtwo registers */ -#define BWTWO_REGISTER_OFFSET 0x400000 - -struct bwtwo_regs { - __volatile__ struct bt_regs bt; - __volatile__ __u8 control; - __volatile__ __u8 status; - __volatile__ __u8 cursor_start; - __volatile__ __u8 cursor_end; - __volatile__ __u8 h_blank_start; - __volatile__ __u8 h_blank_end; - __volatile__ __u8 h_sync_start; - __volatile__ __u8 h_sync_end; - __volatile__ __u8 comp_sync_end; - __volatile__ __u8 v_blank_start_high; - __volatile__ __u8 v_blank_start_low; - __volatile__ __u8 v_blank_end; - __volatile__ __u8 v_sync_start; - __volatile__ __u8 v_sync_end; - __volatile__ __u8 xfer_holdoff_start; - __volatile__ __u8 xfer_holdoff_end; -}; - -/* Status Register Constants */ -#define BWTWO_SR_RES_MASK 0x70 -#define BWTWO_SR_1600_1280 0x50 -#define BWTWO_SR_1152_900_76_A 0x40 -#define BWTWO_SR_1152_900_76_B 0x60 -#define BWTWO_SR_ID_MASK 0x0f -#define BWTWO_SR_ID_MONO 0x02 -#define BWTWO_SR_ID_MONO_ECL 0x03 -#define BWTWO_SR_ID_MSYNC 0x04 - -/* Control Register Constants */ -#define BWTWO_CTL_ENABLE_INTS 0x80 -#define BWTWO_CTL_ENABLE_VIDEO 0x40 -#define BWTWO_CTL_ENABLE_TIMING 0x20 -#define BWTWO_CTL_ENABLE_CURCMP 0x10 -#define BWTWO_CTL_XTAL_MASK 0x0C -#define BWTWO_CTL_DIVISOR_MASK 0x03 - -/* Status Register Constants */ -#define BWTWO_STAT_PENDING_INT 0x80 -#define BWTWO_STAT_MSENSE_MASK 0x70 -#define BWTWO_STAT_ID_MASK 0x0f - - -static int -bwtwo_mmap (struct inode *inode, struct file *file, struct vm_area_struct *vma, - long base, fbinfo_t *fb) -{ - uint size, r; - unsigned long map_offset; - int map_size; - - map_size = size = vma->vm_end - vma->vm_start; - - if (vma->vm_offset & ~PAGE_MASK) - return -ENXIO; - - /* To stop the swapper from even considering these pages */ - vma->vm_flags |= FB_MMAP_VM_FLAGS; - - /* This routine should also map the register if asked for, - * but we don't do that yet. - */ - map_offset = get_phys ((unsigned long) fb->base); - r = io_remap_page_range (vma->vm_start, map_offset, map_size, - vma->vm_page_prot, fb->space); - if (r) - return -EAGAIN; - - vma->vm_file = file; - file->f_count++; - return 0; -} - -static void -bwtwo_blank (fbinfo_t *fb) -{ - fb->info.bwtwo.regs->control &= ~BWTWO_CTL_ENABLE_VIDEO; -} - -static void -bwtwo_unblank (fbinfo_t *fb) -{ - fb->info.bwtwo.regs->control |= BWTWO_CTL_ENABLE_VIDEO; -} - - -static u8 bw2regs_1600[] __initdata = { - 0x14, 0x8b, 0x15, 0x28, 0x16, 0x03, 0x17, 0x13, - 0x18, 0x7b, 0x19, 0x05, 0x1a, 0x34, 0x1b, 0x2e, - 0x1c, 0x00, 0x1d, 0x0a, 0x1e, 0xff, 0x1f, 0x01, - 0x10, 0x21, 0 -}; - -static u8 bw2regs_ecl[] __initdata = { - 0x14, 0x65, 0x15, 0x1e, 0x16, 0x04, 0x17, 0x0c, - 0x18, 0x5e, 0x19, 0x03, 0x1a, 0xa7, 0x1b, 0x23, - 0x1c, 0x00, 0x1d, 0x08, 0x1e, 0xff, 0x1f, 0x01, - 0x10, 0x20, 0 -}; - -static u8 bw2regs_analog[] __initdata = { - 0x14, 0xbb, 0x15, 0x2b, 0x16, 0x03, 0x17, 0x13, - 0x18, 0xb0, 0x19, 0x03, 0x1a, 0xa6, 0x1b, 0x22, - 0x1c, 0x01, 0x1d, 0x05, 0x1e, 0xff, 0x1f, 0x01, - 0x10, 0x20, 0 -}; - -static u8 bw2regs_76hz[] __initdata = { - 0x14, 0xb7, 0x15, 0x27, 0x16, 0x03, 0x17, 0x0f, - 0x18, 0xae, 0x19, 0x03, 0x1a, 0xae, 0x1b, 0x2a, - 0x1c, 0x01, 0x1d, 0x09, 0x1e, 0xff, 0x1f, 0x01, - 0x10, 0x24, 0 -}; - -static u8 bw2regs_66hz[] __initdata = { - 0x14, 0xbb, 0x15, 0x2b, 0x16, 0x04, 0x17, 0x14, - 0x18, 0xae, 0x19, 0x03, 0x1a, 0xa8, 0x1b, 0x24, - 0x1c, 0x01, 0x1d, 0x05, 0x1e, 0xff, 0x1f, 0x01, - 0x10, 0x20, 0 -}; - -__initfunc(void bwtwo_setup (fbinfo_t *fb, int slot, u32 bwtwo, int bw2_io, - struct linux_sbus_device *sbdp)) -{ - printk ("bwtwo%d at 0x%8.8x\n", slot, bwtwo); - fb->type.fb_cmsize = 0; - fb->mmap = bwtwo_mmap; - fb->loadcmap = 0; - fb->ioctl = 0; - fb->reset = 0; -#ifndef CONFIG_SUN4 - fb->blank = bwtwo_blank; - fb->unblank = bwtwo_unblank; -#endif - - fb->info.bwtwo.regs = - sparc_alloc_io (bwtwo + BWTWO_REGISTER_OFFSET, - 0, sizeof (struct bwtwo_regs), - "bwtwo_regs", bw2_io, 0); - - if (sbdp && !prom_getbool(sbdp->prom_node, "width")) { - /* Ugh, broken PROM didn't initialize us. - * Let's deal with this ourselves. - */ - u8 status, mon; - u8 *p; - - status = fb->info.bwtwo.regs->status; - mon = status & BWTWO_SR_RES_MASK; - switch (status & BWTWO_SR_ID_MASK) { - case BWTWO_SR_ID_MONO_ECL: - if (mon == BWTWO_SR_1600_1280) { - p = bw2regs_1600; - fb->type.fb_width = 1600; - fb->type.fb_height = 1280; - } else { - p = bw2regs_ecl; - } - break; - case BWTWO_SR_ID_MONO: - p = bw2regs_analog; - break; - case BWTWO_SR_ID_MSYNC: - if (mon == BWTWO_SR_1152_900_76_A || - mon == BWTWO_SR_1152_900_76_B) { - p = bw2regs_76hz; - } else { - p = bw2regs_66hz; - } - break; - default: - prom_printf("bwtwo: can't handle SR %02x\n", - status); - prom_halt(); - return; /* fool gcc. */ - } - for ( ; *p; p += 2) - ((u8 *)fb->info.bwtwo.regs)[p[0]] = p[1]; - } - - if(!fb->base) - fb->base = (unsigned long) sparc_alloc_io(bwtwo, 0, - ((fb->type.fb_depth*fb->type.fb_height*fb->type.fb_width)/8), - "bwtwo_fbase", bw2_io, 0); - - if (slot && sun_prom_console_id != slot) - bwtwo_blank (fb); -} - diff --git a/drivers/sbus/char/cg_common.h b/drivers/sbus/char/cg_common.h deleted file mode 100644 index c4376f66c..000000000 --- a/drivers/sbus/char/cg_common.h +++ /dev/null @@ -1,28 +0,0 @@ -/* sun_cg_common.h - * contains the definitions of the structures that various sun - * frame buffer can use to do console driver stuff. - * - * This is not in sun_framebuffer.h because you may not want cgXX - * support so you wont require this. - * - */ - -#define BT_D4M3(x) ((((x) >> 2) << 1) + ((x) >> 2)) /* (x / 4) * 3 */ -#define BT_D4M4(x) ((x) & ~3) /* (x / 4) * 4 */ - -#define D4M3(x) ((((x)>>2)<<1) + ((x)>>2)) /* (x/4)*3 */ -#define D4M4(x) ((x)&~0x3) /* (x/4)*4 */ - -struct bt_regs { - volatile unsigned int addr; /* address register */ - volatile unsigned int color_map; /* color map */ - volatile unsigned int control; /* control register */ - volatile unsigned int cursor; /* cursor map register */ -}; - -/* The cg3 driver, obio space addresses for mapping the cg3 stuff */ -/* We put these constants here, because the cg14 driver initially will emulate a cg3 */ -#define CG3_REGS 0x400000 -#define CG3_RAM 0x800000 - - diff --git a/drivers/sbus/char/cgfourteen.c b/drivers/sbus/char/cgfourteen.c deleted file mode 100644 index 315d9561f..000000000 --- a/drivers/sbus/char/cgfourteen.c +++ /dev/null @@ -1,475 +0,0 @@ -/* $Id: cgfourteen.c,v 1.26 1998/03/10 20:18:23 jj Exp $ - * cgfourteen.c: Sun SparcStation console support. - * - * Copyright (C) 1995 Miguel de Icaza (miguel@nuclecu.unam.mx) - * Copyright (C) 1996 Jakub Jelinek (jj@sunsite.mff.cuni.cz) - * - * TODO: - * - * Add the ioctls for CLUT manipulation. - * Map only the amount requested, not a constant amount. - * XBGR mapping. - * Add the interrupt handler. -*/ - -#include <linux/kd.h> -#include <linux/tty.h> -#include <linux/malloc.h> -#include <linux/proc_fs.h> - -#include <asm/sbus.h> -#include <asm/io.h> -#include <asm/fbio.h> -#include <asm/pgtable.h> -#include <asm/uaccess.h> - -/* These must be included after asm/fbio.h */ -#include <linux/vt_kern.h> -#include <linux/selection.h> -#include <linux/console_struct.h> -#include "fb.h" - -#define CG14_MCR_INTENABLE_SHIFT 7 -#define CG14_MCR_INTENABLE_MASK 0x80 -#define CG14_MCR_VIDENABLE_SHIFT 6 -#define CG14_MCR_VIDENABLE_MASK 0x40 -#define CG14_MCR_PIXMODE_SHIFT 4 -#define CG14_MCR_PIXMODE_MASK 0x30 -#define CG14_MCR_TMR_SHIFT 2 -#define CG14_MCR_TMR_MASK 0x0c -#define CG14_MCR_TMENABLE_SHIFT 1 -#define CG14_MCR_TMENABLE_MASK 0x02 -#define CG14_MCR_RESET_SHIFT 0 -#define CG14_MCR_RESET_MASK 0x01 -#define CG14_REV_REVISION_SHIFT 4 -#define CG14_REV_REVISION_MASK 0xf0 -#define CG14_REV_IMPL_SHIFT 0 -#define CG14_REV_IMPL_MASK 0x0f -#define CG14_VBR_FRAMEBASE_SHIFT 12 -#define CG14_VBR_FRAMEBASE_MASK 0x00fff000 -#define CG14_VMCR1_SETUP_SHIFT 0 -#define CG14_VMCR1_SETUP_MASK 0x000001ff -#define CG14_VMCR1_VCONFIG_SHIFT 9 -#define CG14_VMCR1_VCONFIG_MASK 0x00000e00 -#define CG14_VMCR2_REFRESH_SHIFT 0 -#define CG14_VMCR2_REFRESH_MASK 0x00000001 -#define CG14_VMCR2_TESTROWCNT_SHIFT 1 -#define CG14_VMCR2_TESTROWCNT_MASK 0x00000002 -#define CG14_VMCR2_FBCONFIG_SHIFT 2 -#define CG14_VMCR2_FBCONFIG_MASK 0x0000000c -#define CG14_VCR_REFRESHREQ_SHIFT 0 -#define CG14_VCR_REFRESHREQ_MASK 0x000003ff -#define CG14_VCR1_REFRESHENA_SHIFT 10 -#define CG14_VCR1_REFRESHENA_MASK 0x00000400 -#define CG14_VCA_CAD_SHIFT 0 -#define CG14_VCA_CAD_MASK 0x000003ff -#define CG14_VCA_VERS_SHIFT 10 -#define CG14_VCA_VERS_MASK 0x00000c00 -#define CG14_VCA_RAMSPEED_SHIFT 12 -#define CG14_VCA_RAMSPEED_MASK 0x00001000 -#define CG14_VCA_8MB_SHIFT 13 -#define CG14_VCA_8MB_MASK 0x00002000 - -#define CG14_MCR_PIXMODE_8 0 -#define CG14_MCR_PIXMODE_16 2 -#define CG14_MCR_PIXMODE_32 3 - -struct cg14_regs{ - volatile u8 mcr; /* Master Control Reg */ - volatile u8 ppr; /* Packed Pixel Reg */ - volatile u8 tms[2]; /* Test Mode Status Regs */ - volatile u8 msr; /* Master Status Reg */ - volatile u8 fsr; /* Fault Status Reg */ - volatile u8 rev; /* Revision & Impl */ - volatile u8 ccr; /* Clock Control Reg */ - volatile u32 tmr; /* Test Mode Read Back */ - volatile u8 mod; /* Monitor Operation Data Reg */ - volatile u8 acr; /* Aux Control */ - u8 xxx0[6]; - volatile u16 hct; /* Hor Counter */ - volatile u16 vct; /* Vert Counter */ - volatile u16 hbs; /* Hor Blank Start */ - volatile u16 hbc; /* Hor Blank Clear */ - volatile u16 hss; /* Hor Sync Start */ - volatile u16 hsc; /* Hor Sync Clear */ - volatile u16 csc; /* Composite Sync Clear */ - volatile u16 vbs; /* Vert Blank Start */ - volatile u16 vbc; /* Vert Blank Clear */ - volatile u16 vss; /* Vert Sync Start */ - volatile u16 vsc; /* Vert Sync Clear */ - volatile u16 xcs; - volatile u16 xcc; - volatile u16 fsa; /* Fault Status Address */ - volatile u16 adr; /* Address Registers */ - u8 xxx1[0xce]; - volatile u8 pcg[0x100]; /* Pixel Clock Generator */ - volatile u32 vbr; /* Frame Base Row */ - volatile u32 vmcr; /* VBC Master Control */ - volatile u32 vcr; /* VBC refresh */ - volatile u32 vca; /* VBC Config */ -}; - -#define CG14_CCR_ENABLE 0x04 -#define CG14_CCR_SELECT 0x02 /* HW/Full screen */ - -struct cg14_cursor { - volatile u32 cpl0[32]; /* Enable plane 0 */ - volatile u32 cpl1[32]; /* Color selection plane */ - volatile u8 ccr; /* Cursor Control Reg */ - u8 xxx0[3]; - volatile u16 cursx; /* Cursor x,y position */ - volatile u16 cursy; /* Cursor x,y position */ - volatile u32 color0; - volatile u32 color1; - u32 xxx1[0x1bc]; - volatile u32 cpl0i[32]; /* Enable plane 0 autoinc */ - volatile u32 cpl1i[32]; /* Color selection autoinc */ -}; - -struct cg14_dac { - volatile u8 addr; /* Address Register */ - u8 xxx0[255]; - volatile u8 glut; /* Gamma table */ - u8 xxx1[255]; - volatile u8 select; /* Register Select */ - u8 xxx2[255]; - volatile u8 mode; /* Mode Register */ -}; - -struct cg14_xlut{ - volatile u8 x_xlut [256]; - volatile u8 x_xlutd [256]; - u8 xxx0[0x600]; - volatile u8 x_xlut_inc [256]; - volatile u8 x_xlutd_inc [256]; -}; - -/* Color look up table (clut) */ -/* Each one of these arrays hold the color lookup table (for 256 - * colors) for each MDI page (I assume then there should be 4 MDI - * pages, I still wonder what they are. I have seen NeXTStep split - * the screen in four parts, while operating in 24 bits mode. Each - * integer holds 4 values: alpha value (transparency channel, thanks - * go to John Stone (johns@umr.edu) from OpenBSD), red, green and blue - * - * I currently use the clut instead of the Xlut - */ -struct cg14_clut { - unsigned int c_clut [256]; - unsigned int c_clutd [256]; /* i wonder what the 'd' is for */ - unsigned int c_clut_inc [256]; - unsigned int c_clutd_inc [256]; -}; - -static int -cg14_mmap (struct inode *inode, struct file *file, - struct vm_area_struct *vma, long base, fbinfo_t *fb) -{ - uint size, page, r, map_size; - unsigned long map_offset = 0; - uint ram_size = fb->info.cg14.ramsize; - - printk ("RAMSIZE=%d\n", ram_size); - size = vma->vm_end - vma->vm_start; - if (vma->vm_offset & ~PAGE_MASK) - return -ENXIO; - - /* To stop the swapper from even considering these pages */ - vma->vm_flags |= FB_MMAP_VM_FLAGS; - - /* Each page, see which map applies */ - for (page = 0; page < size; ){ - switch (vma->vm_offset+page){ - case CG3_MMAP_OFFSET-0x7000: - printk ("Wee! They are mapping the register, report this to miguel@gnu.ai.mit.edu\n"); - printk ("Mapping fb->info.regs!\n"); - map_size = 0x7000; - map_offset = get_phys ((unsigned long) fb->info.cg14.regs); - break; - - case CG3_MMAP_OFFSET: - map_size = size-page; - map_offset = get_phys ((unsigned long) fb->base); - break; - - case MDI_PLANAR_X16_MAP: - map_size = ram_size/2; - map_offset = get_phys ((unsigned long) fb->base) | 0x2000000; - break; - - case MDI_PLANAR_C16_MAP: - map_size = ram_size/2; - map_offset = get_phys ((unsigned long) fb->base) | 0x2800000; - break; - - case MDI_CHUNKY_XBGR_MAP: - map_size = 0; - printk ("Woo Woo: XBGR not there yet\n"); - break; - - case MDI_CHUNKY_BGR_MAP: - map_size = ram_size; - map_offset = get_phys ((unsigned long) fb->base) | 0x1000000; - break; - - case MDI_PLANAR_X32_MAP: - map_size = ram_size/4; - map_offset = get_phys ((unsigned long) fb->base) | 0x3000000; - break; - case MDI_PLANAR_B32_MAP: - map_size = ram_size/4; - map_offset = get_phys ((unsigned long) fb->base) | 0x3400000; - break; - case MDI_PLANAR_G32_MAP: - map_size = ram_size/4; - map_offset = get_phys ((unsigned long) fb->base) | 0x3800000; - break; - case MDI_PLANAR_R32_MAP: - map_size = ram_size/4; - map_offset = get_phys ((unsigned long) fb->base) | 0x3c00000; - break; - - case MDI_CURSOR_MAP: - map_size = PAGE_SIZE; - map_offset = get_phys ((unsigned long) fb->info.cg14.cursor_regs); - break; - - case CG14_REGS: - printk ("Wee! They are mapping the register, report this to miguel@gnu.ai.mit.edu\n"); - map_size = PAGE_SIZE; - map_offset = get_phys ((unsigned long) fb->info.cg14.regs); - break; - - case CG14_XLUT: - map_size = PAGE_SIZE; - map_offset = get_phys ((unsigned long) fb->info.cg14.regs+0x3000); - break; - - case CG14_CLUT1: - map_size = PAGE_SIZE; - map_offset = get_phys ((unsigned long) fb->info.cg14.regs+0x4000); - break; - - case CG14_CLUT2: - map_size = PAGE_SIZE; - map_offset = get_phys ((unsigned long) fb->info.cg14.regs+0x5000); - break; - - default: - map_size = 0; - break; - } - if (!map_size){ - page += PAGE_SIZE; - continue; - } - if (page + map_size > size) - map_size = size - page; - r = io_remap_page_range (vma->vm_start+page, - map_offset, - map_size, vma->vm_page_prot, - fb->space); - if (r) - return -EAGAIN; - page += map_size; - } - - vma->vm_file = file; - file->f_count++; - return 0; -} - -static void -cg14_cmap (fbinfo_t *fb, int index, int count) -{ - struct cg14_clut *clut = fb->info.cg14.clut; - int i; - - for (i = index; count--; i++){ - clut->c_clut [i] = - (fb->color_map CM(i,2) << 16) | - (fb->color_map CM(i,1) << 8) | - (fb->color_map CM(i,0)); - } -} - -static void -cg14_setcursormap (fbinfo_t *fb, unsigned char *red, - unsigned char *green, - unsigned char *blue) -{ - struct cg14_cursor *cur = fb->info.cg14.cursor_regs; - - cur->color0 = ((red[0]) | (green[0] << 8) | (blue[0] << 16)); - cur->color1 = ((red[1]) | (green[1] << 8) | (blue[1] << 16)); -} - -/* Load cursor information */ -static void -cg14_setcursor (fbinfo_t *fb) -{ - struct cg_cursor *c = &fb->cursor; - struct cg14_cursor *cur = fb->info.cg14.cursor_regs; - - if (c->enable) - cur->ccr |= CG14_CCR_ENABLE; - cur->cursx = ((c->cpos.fbx - c->chot.fbx) & 0xfff); - cur->cursy = ((c->cpos.fby - c->chot.fby) & 0xfff); -} - -/* Set cursor shape */ -static void -cg14_setcurshape (fbinfo_t *fb) -{ - struct cg14_cursor *cur = fb->info.cg14.cursor_regs; - int i; - - for (i = 0; i < 32; i++){ - cur->cpl0 [i] = fb->cursor.bits[0][i]; - cur->cpl1 [i] = fb->cursor.bits[1][i]; - } -} - -/* These ones are for putting the video card on 16/32 bpp */ -static int -cg14_ioctl (struct inode *inode, struct file *file, unsigned cmd, unsigned long arg, fbinfo_t *fb) -{ - switch (cmd){ - case MDI_RESET: { - volatile unsigned char *control = &(fb->info.cg14.regs->mcr); - *control = (*control & ~CG14_MCR_PIXMODE_MASK); - } - break; - - case MDI_GET_CFGINFO: { - int error; - struct mdi_cfginfo *mdii; - - error = verify_area (VERIFY_WRITE, (void *) arg, - sizeof (struct mdi_cfginfo)); - if (error) - return error; - - mdii = (struct mdi_cfginfo *) arg; -#if 0 - __put_user_ret(2, &mdii->mdi_ncluts, -EFAULT); - switch (fb->info.cg14.regs->rev & CG14_REV_IMPL_MASK){ - case 0: - case 2: - break; - - case 1: - case 3: - __put_user_ret(3, &mdii->mdi_ncluts, -EFAULT); - break; - default: - printk ("Unknown implementation number\n"); - } -#endif - __put_user_ret(FBTYPE_MDICOLOR, &mdii->mdi_type, -EFAULT); - __put_user_ret(fb->type.fb_height, &mdii->mdi_height, -EFAULT); - __put_user_ret(fb->type.fb_width, &mdii->mdi_width, -EFAULT); - __put_user_ret(fb->info.cg14.video_mode, &mdii->mdi_mode, -EFAULT); - __put_user_ret(72, &mdii->mdi_pixfreq, -EFAULT); /* FIXME */ - __put_user_ret(fb->info.cg14.ramsize, &mdii->mdi_size, -EFAULT); - } - break; - - case MDI_SET_PIXELMODE: { - int newmode; - volatile u8 *control; - - get_user_ret(newmode, (int *)arg, -EFAULT); - control = &(fb->info.cg14.regs->mcr); - switch (newmode){ - case MDI_32_PIX: - *control = (*control & ~CG14_MCR_PIXMODE_MASK) | - (CG14_MCR_PIXMODE_32 << CG14_MCR_PIXMODE_SHIFT); - break; - case MDI_16_PIX: - *control = (*control & ~CG14_MCR_PIXMODE_MASK) | 0x20; - break; - case MDI_8_PIX: - *control = (*control & ~CG14_MCR_PIXMODE_MASK); - break; - - default: - return -ENOSYS; - } - fb->info.cg14.video_mode = newmode; - } - break; - - } /* switch */ - return 0; -} - -static void -cg14_switch_from_graph (void) -{ - fbinfo_t *fb = &(fbinfo [0]); - struct cg14_info *cg14info = (struct cg14_info *) &fb->info.cg14; - - /* Set the 8-bpp mode */ - if (fb->open && fb->mmaped){ - volatile char *mcr = (char *)(&cg14info->regs->mcr); - - fb->info.cg14.video_mode = 8; - *mcr = (*mcr & ~(CG14_MCR_PIXMODE_MASK)); - } -} - -void -cg14_reset (fbinfo_t *fb) -{ - volatile char *mcr = &(fb->info.cg14.regs->mcr); - - *mcr = (*mcr & ~(CG14_MCR_PIXMODE_MASK)); -} - -__initfunc(void cg14_setup (fbinfo_t *fb, int slot, int con_node, u32 cg14, int cg14_io)) -{ - struct cg14_info *cg14info; - uint bases [2]; - unsigned long cg14regs = 0; - struct cg14_regs *regs = 0; - - if (!cg14) { - prom_getproperty (con_node, "address", (char *) &bases[0], 8); - cg14 = bases[1]; - cg14regs = bases[0]; - fb->base = cg14; - fb->info.cg14.regs = (struct cg14_regs *) cg14regs; - regs = (struct cg14_regs *) cg14regs; - } - - if (!cg14regs){ - printk ("The PROM does not have mapped the frame buffer or the registers\n" - "Mr. Penguin can't use that"); - prom_halt (); - } - - fb->type.fb_cmsize = 256; - fb->mmap = cg14_mmap; - fb->loadcmap = cg14_cmap; - fb->setcursor = cg14_setcursor; - fb->setcursormap = cg14_setcursormap; - fb->setcurshape = cg14_setcurshape; - fb->ioctl = cg14_ioctl; - fb->switch_from_graph = cg14_switch_from_graph; - fb->postsetup = cg_postsetup; - fb->reset = cg14_reset; - fb->blank = 0; - fb->unblank = 0; - fb->info.cg14.video_mode = 8; - fb->emulations [1] = FBTYPE_SUN3COLOR; - fb->type.fb_depth = 24; - cg14info = (struct cg14_info *) &fb->info.cg14; - cg14info->clut = (void *) (cg14regs + CG14_CLUT1); - cg14info->cursor_regs = (void *) (cg14regs + CG14_CURSORREGS); - - /* If the bit is turned on, the card has 8 mb of ram, otherwise just 4 */ - cg14info->ramsize = (regs->vca & CG14_VCA_8MB_MASK ? 8 : 4) * 1024 * 1024; - printk ("cgfourteen%d at 0x%8.8x with %d megs of RAM rev=%d, impl=%d\n", - slot, cg14, cg14info->ramsize/(1024*1024), regs->rev >> 4, regs->rev & 0xf); -} diff --git a/drivers/sbus/char/cgsix.c b/drivers/sbus/char/cgsix.c deleted file mode 100644 index ca328ee53..000000000 --- a/drivers/sbus/char/cgsix.c +++ /dev/null @@ -1,688 +0,0 @@ -/* $Id: cgsix.c,v 1.39 1998/03/10 20:18:25 jj Exp $ - * cgsix.c: cgsix frame buffer driver - * - * Copyright (C) 1996 Miguel de Icaza (miguel@nuclecu.unam.mx) - * Copyright (C) 1996 Jakub Jelinek (jj@sunsite.mff.cuni.cz) - * Copyright (C) 1996 Eddie C. Dost (ecd@skynet.be) - */ -#include <linux/kd.h> -#include <linux/tty.h> -#include <linux/malloc.h> -#include <linux/proc_fs.h> - -#include <asm/sbus.h> -#include <asm/io.h> -#include <asm/fbio.h> -#include <asm/pgtable.h> - -/* These must be included after asm/fbio.h */ -#include <linux/vt_kern.h> -#include <linux/selection.h> -#include <linux/console_struct.h> -#include "fb.h" -#include "cg_common.h" - -/* Offset of interesting structures in the OBIO space */ -/* - * Brooktree is the video dac and is funny to program on the cg6. - * (it's even funnier on the cg3) - * The FBC could be the the frame buffer control - * The FHC could is the frame buffer hardware control. - */ -#define CG6_ROM_OFFSET 0x0 -#define CG6_BROOKTREE_OFFSET 0x200000 -#define CG6_DHC_OFFSET 0x240000 -#define CG6_ALT_OFFSET 0x280000 -#define CG6_FHC_OFFSET 0x300000 -#define CG6_THC_OFFSET 0x301000 -#define CG6_FBC_OFFSET 0x700000 -#define CG6_TEC_OFFSET 0x701000 -#define CG6_RAM_OFFSET 0x800000 - -/* FHC definitions */ -#define CG6_FHC_FBID_SHIFT 24 -#define CG6_FHC_FBID_MASK 255 -#define CG6_FHC_REV_SHIFT 20 -#define CG6_FHC_REV_MASK 15 -#define CG6_FHC_FROP_DISABLE (1 << 19) -#define CG6_FHC_ROW_DISABLE (1 << 18) -#define CG6_FHC_SRC_DISABLE (1 << 17) -#define CG6_FHC_DST_DISABLE (1 << 16) -#define CG6_FHC_RESET (1 << 15) -#define CG6_FHC_LITTLE_ENDIAN (1 << 13) -#define CG6_FHC_RES_MASK (3 << 11) -#define CG6_FHC_1024 (0 << 11) -#define CG6_FHC_1152 (1 << 11) -#define CG6_FHC_1280 (2 << 11) -#define CG6_FHC_1600 (3 << 11) -#define CG6_FHC_CPU_MASK (3 << 9) -#define CG6_FHC_CPU_SPARC (0 << 9) -#define CG6_FHC_CPU_68020 (1 << 9) -#define CG6_FHC_CPU_386 (2 << 9) -#define CG6_FHC_TEST (1 << 8) -#define CG6_FHC_TEST_X_SHIFT 4 -#define CG6_FHC_TEST_X_MASK 15 -#define CG6_FHC_TEST_Y_SHIFT 0 -#define CG6_FHC_TEST_Y_MASK 15 - -/* FBC mode definitions */ -#define CG6_FBC_BLIT_IGNORE 0x00000000 -#define CG6_FBC_BLIT_NOSRC 0x00100000 -#define CG6_FBC_BLIT_SRC 0x00200000 -#define CG6_FBC_BLIT_ILLEGAL 0x00300000 -#define CG6_FBC_BLIT_MASK 0x00300000 - -#define CG6_FBC_VBLANK 0x00080000 - -#define CG6_FBC_MODE_IGNORE 0x00000000 -#define CG6_FBC_MODE_COLOR8 0x00020000 -#define CG6_FBC_MODE_COLOR1 0x00040000 -#define CG6_FBC_MODE_HRMONO 0x00060000 -#define CG6_FBC_MODE_MASK 0x00060000 - -#define CG6_FBC_DRAW_IGNORE 0x00000000 -#define CG6_FBC_DRAW_RENDER 0x00008000 -#define CG6_FBC_DRAW_PICK 0x00010000 -#define CG6_FBC_DRAW_ILLEGAL 0x00018000 -#define CG6_FBC_DRAW_MASK 0x00018000 - -#define CG6_FBC_BWRITE0_IGNORE 0x00000000 -#define CG6_FBC_BWRITE0_ENABLE 0x00002000 -#define CG6_FBC_BWRITE0_DISABLE 0x00004000 -#define CG6_FBC_BWRITE0_ILLEGAL 0x00006000 -#define CG6_FBC_BWRITE0_MASK 0x00006000 - -#define CG6_FBC_BWRITE1_IGNORE 0x00000000 -#define CG6_FBC_BWRITE1_ENABLE 0x00000800 -#define CG6_FBC_BWRITE1_DISABLE 0x00001000 -#define CG6_FBC_BWRITE1_ILLEGAL 0x00001800 -#define CG6_FBC_BWRITE1_MASK 0x00001800 - -#define CG6_FBC_BREAD_IGNORE 0x00000000 -#define CG6_FBC_BREAD_0 0x00000200 -#define CG6_FBC_BREAD_1 0x00000400 -#define CG6_FBC_BREAD_ILLEGAL 0x00000600 -#define CG6_FBC_BREAD_MASK 0x00000600 - -#define CG6_FBC_BDISP_IGNORE 0x00000000 -#define CG6_FBC_BDISP_0 0x00000080 -#define CG6_FBC_BDISP_1 0x00000100 -#define CG6_FBC_BDISP_ILLEGAL 0x00000180 -#define CG6_FBC_BDISP_MASK 0x00000180 - -#define CG6_FBC_INDEX_MOD 0x00000040 -#define CG6_FBC_INDEX_MASK 0x00000030 - -/* THC definitions */ -#define CG6_THC_MISC_REV_SHIFT 16 -#define CG6_THC_MISC_REV_MASK 15 -#define CG6_THC_MISC_RESET (1 << 12) -#define CG6_THC_MISC_VIDEO (1 << 10) -#define CG6_THC_MISC_SYNC (1 << 9) -#define CG6_THC_MISC_VSYNC (1 << 8) -#define CG6_THC_MISC_SYNC_ENAB (1 << 7) -#define CG6_THC_MISC_CURS_RES (1 << 6) -#define CG6_THC_MISC_INT_ENAB (1 << 5) -#define CG6_THC_MISC_INT (1 << 4) -#define CG6_THC_MISC_INIT 0x9f - -/* The contents are unknown */ -struct cg6_tec { - volatile int tec_matrix; - volatile int tec_clip; - volatile int tec_vdc; -}; - -struct cg6_thc { - uint thc_pad0[512]; - volatile uint thc_hs; /* hsync timing */ - volatile uint thc_hsdvs; - volatile uint thc_hd; - volatile uint thc_vs; /* vsync timing */ - volatile uint thc_vd; - volatile uint thc_refresh; - volatile uint thc_misc; - uint thc_pad1[56]; - volatile uint thc_cursxy; /* cursor x,y position (16 bits each) */ - volatile uint thc_cursmask[32]; /* cursor mask bits */ - volatile uint thc_cursbits[32]; /* what to show where mask enabled */ -}; - -struct cg6_fbc { - u32 xxx0[1]; - volatile u32 mode; - volatile u32 clip; - u32 xxx1[1]; - volatile u32 s; - volatile u32 draw; - volatile u32 blit; - volatile u32 font; - u32 xxx2[24]; - volatile u32 x0, y0, z0, color0; - volatile u32 x1, y1, z1, color1; - volatile u32 x2, y2, z2, color2; - volatile u32 x3, y3, z3, color3; - volatile u32 offx, offy; - u32 xxx3[2]; - volatile u32 incx, incy; - u32 xxx4[2]; - volatile u32 clipminx, clipminy; - u32 xxx5[2]; - volatile u32 clipmaxx, clipmaxy; - u32 xxx6[2]; - volatile u32 fg; - volatile u32 bg; - volatile u32 alu; - volatile u32 pm; - volatile u32 pixelm; - u32 xxx7[2]; - volatile u32 patalign; - volatile u32 pattern[8]; - u32 xxx8[432]; - volatile u32 apointx, apointy, apointz; - u32 xxx9[1]; - volatile u32 rpointx, rpointy, rpointz; - u32 xxx10[5]; - volatile u32 pointr, pointg, pointb, pointa; - volatile u32 alinex, aliney, alinez; - u32 xxx11[1]; - volatile u32 rlinex, rliney, rlinez; - u32 xxx12[5]; - volatile u32 liner, lineg, lineb, linea; - volatile u32 atrix, atriy, atriz; - u32 xxx13[1]; - volatile u32 rtrix, rtriy, rtriz; - u32 xxx14[5]; - volatile u32 trir, trig, trib, tria; - volatile u32 aquadx, aquady, aquadz; - u32 xxx15[1]; - volatile u32 rquadx, rquady, rquadz; - u32 xxx16[5]; - volatile u32 quadr, quadg, quadb, quada; - volatile u32 arectx, arecty, arectz; - u32 xxx17[1]; - volatile u32 rrectx, rrecty, rrectz; - u32 xxx18[5]; - volatile u32 rectr, rectg, rectb, recta; -}; - -static void -cg6_restore_palette (fbinfo_t *fbinfo) -{ - volatile struct bt_regs *bt; - - bt = fbinfo->info.cg6.bt; - bt->addr = 0; - bt->color_map = 0xffffffff; - bt->color_map = 0xffffffff; - bt->color_map = 0xffffffff; -} - -static void cg6_blitc(unsigned short, int, int); -static void cg6_setw(int, int, unsigned short, int); -static void cg6_cpyw(int, int, unsigned short *, int); - -#if 0 -static void cg6_fill(int, int, int *); -#endif - -/* Ugh: X wants to mmap a bunch of cute stuff at the same time :-( */ -/* So, we just mmap the things that are being asked for */ -static int -cg6_mmap (struct inode *inode, struct file *file, struct vm_area_struct *vma, - long base, fbinfo_t *fb) -{ - uint size, page, r, map_size; - unsigned long map_offset = 0; - - size = vma->vm_end - vma->vm_start; - if (vma->vm_offset & ~PAGE_MASK) - return -ENXIO; - -#ifdef __sparc_v9__ - /* Try to align RAM */ -#define ALIGNMENT 0x80000 - map_offset = vma->vm_offset + size; - if (vma->vm_offset <= CG6_RAM && map_offset >= CG6_RAM + fb->type.fb_size) { - struct vm_area_struct *vmm = find_vma(current->mm, vma->vm_start); - int alignment = ALIGNMENT - ((vma->vm_start + CG6_RAM - vma->vm_offset) & (ALIGNMENT - 1)); - int sz = 0, fbsz; - - if (alignment == ALIGNMENT) alignment = 0; - fbsz = ((fb->type.fb_size + ALIGNMENT - 1) & ~(ALIGNMENT - 1)); - if (map_offset < CG6_RAM + fbsz) - sz = fbsz - map_offset + CG6_RAM; - if ((sz || alignment) && (!vmm || vmm->vm_start >= vma->vm_end + sz + alignment)) { - vma->vm_start += alignment; - vma->vm_end += alignment + sz; - } - } -#undef ALIGNMENT -#endif - - /* To stop the swapper from even considering these pages */ - vma->vm_flags |= FB_MMAP_VM_FLAGS; - - /* Each page, see which map applies */ - for (page = 0; page < size; ){ - switch (vma->vm_offset+page){ - case CG6_TEC: - map_size = PAGE_SIZE; - map_offset = get_phys ((unsigned long)fb->info.cg6.tec) & PAGE_MASK; - break; - case CG6_FBC: - map_size = PAGE_SIZE; - map_offset = get_phys ((unsigned long)fb->info.cg6.fbc); - break; - case CG6_FHC: - map_size = PAGE_SIZE; - map_offset = get_phys ((unsigned long)fb->info.cg6.fhc); - break; - case CG6_THC: - map_size = PAGE_SIZE; - map_offset = get_phys ((unsigned long)fb->info.cg6.thc) & PAGE_MASK; - break; - case CG6_BTREGS: - map_size = PAGE_SIZE; - map_offset = get_phys ((unsigned long)fb->info.cg6.bt); - break; - - /* For Ultra, make sure the following two are right. - * The above two happen to work out (for example FBC and - * TEC will get mapped by one I/O page mapping because - * of the 8192 byte page size, same for FHC/THC. -DaveM - */ - - case CG6_DHC: - map_size = /* PAGE_SIZE * 40 */ (4096 * 40); - map_offset = get_phys ((unsigned long)fb->info.cg6.dhc); - break; - case CG6_ROM: - map_size = /* PAGE_SIZE * 16 */ (4096 * 16); - map_offset = get_phys ((unsigned long)fb->info.cg6.rom); - break; - case CG6_RAM: - map_size = size-page; - map_offset = get_phys ((unsigned long) fb->base); - if (map_size < fb->type.fb_size) - map_size = fb->type.fb_size; - break; - default: - map_size = 0; - break; - } - if (!map_size){ - page += PAGE_SIZE; - continue; - } - if (page + map_size > size) - map_size = size - page; - r = io_remap_page_range (vma->vm_start+page, - map_offset, - map_size, vma->vm_page_prot, - fb->space); - if (r) - return -EAGAIN; - page += map_size; - } - - vma->vm_file = file; - file->f_count++; - return 0; -} - -static void -cg6_loadcmap (fbinfo_t *fb, int index, int count) -{ - struct bt_regs *bt = fb->info.cg6.bt; - int i; - - bt->addr = index << 24; - for (i = index; count--; i++){ - bt->color_map = fb->color_map CM(i,0) << 24; - bt->color_map = fb->color_map CM(i,1) << 24; - bt->color_map = fb->color_map CM(i,2) << 24; - } -} - -static void -cg6_setcursormap (fbinfo_t *fb, unsigned char *red, - unsigned char *green, - unsigned char *blue) -{ - struct bt_regs *bt = fb->info.cg6.bt; - - bt->addr = 1 << 24; - bt->cursor = red[0] << 24; - bt->cursor = green[0] << 24; - bt->cursor = blue[0] << 24; - bt->addr = 3 << 24; - bt->cursor = red[1] << 24; - bt->cursor = green[1] << 24; - bt->cursor = blue[1] << 24; -} - -/* Load cursor information */ -static void -cg6_setcursor (fbinfo_t *fb) -{ - uint v; - struct cg_cursor *c = &fb->cursor; - - if (c->enable){ - v = ((c->cpos.fbx - c->chot.fbx) << 16) - |((c->cpos.fby - c->chot.fby) & 0xffff); - } else { - /* Magic constant to turn off the cursor */ - v = ((65536-32) << 16) | (65536-32); - } - fb->info.cg6.thc->thc_cursxy = v; -} - -/* Set cursor shape */ -static void -cg6_setcurshape (fbinfo_t *fb) -{ - struct cg6_thc *thc = fb->info.cg6.thc; - int i; - - for (i = 0; i < 32; i++){ - thc->thc_cursmask [i] = fb->cursor.bits[0][i]; - thc->thc_cursbits [i] = fb->cursor.bits[1][i]; - } -} - -static void -cg6_blank (fbinfo_t *fb) -{ - fb->info.cg6.thc->thc_misc &= ~CG6_THC_MISC_VIDEO; - /* This should put us in power-save */ - fb->info.cg6.thc->thc_misc &= ~CG6_THC_MISC_SYNC_ENAB; -} - -static void -cg6_unblank (fbinfo_t *fb) -{ - fb->info.cg6.thc->thc_misc |= CG6_THC_MISC_SYNC_ENAB; - fb->info.cg6.thc->thc_misc |= CG6_THC_MISC_VIDEO; -} - -void -cg6_reset (fbinfo_t *fb) -{ - struct cg6_info *cg6 = &(fb->info.cg6); - unsigned int rev, conf; - - if (fb == &fbinfo[0]) - sbus_hw_hide_cursor (); - /* Turn off stuff in the Transform Engine. */ - cg6->tec->tec_matrix = 0; - cg6->tec->tec_clip = 0; - cg6->tec->tec_vdc = 0; - - /* Take care of bugs in old revisions. */ - rev = (*(cg6->fhc) >> CG6_FHC_REV_SHIFT) & CG6_FHC_REV_MASK; - if (rev < 5) { - conf = (*(cg6->fhc) & CG6_FHC_RES_MASK) | - CG6_FHC_CPU_68020 | CG6_FHC_TEST | - (11 << CG6_FHC_TEST_X_SHIFT) | - (11 << CG6_FHC_TEST_Y_SHIFT); - if (rev < 2) - conf |= CG6_FHC_DST_DISABLE; - *(cg6->fhc) = conf; - } - - /* Set things in the FBC. */ - cg6->fbc->mode &= ~(CG6_FBC_BLIT_MASK | CG6_FBC_MODE_MASK | - CG6_FBC_DRAW_MASK | CG6_FBC_BWRITE0_MASK | - CG6_FBC_BWRITE1_MASK | CG6_FBC_BREAD_MASK | - CG6_FBC_BDISP_MASK); - cg6->fbc->mode |= (CG6_FBC_BLIT_SRC | CG6_FBC_MODE_COLOR8 | - CG6_FBC_DRAW_RENDER | CG6_FBC_BWRITE0_ENABLE | - CG6_FBC_BWRITE1_DISABLE | CG6_FBC_BREAD_0 | - CG6_FBC_BDISP_0); - cg6->fbc->clip = 0; - cg6->fbc->offx = 0; - cg6->fbc->offy = 0; - cg6->fbc->clipminx = 0; - cg6->fbc->clipminy = 0; - cg6->fbc->clipmaxx = fb->type.fb_width - 1; - cg6->fbc->clipmaxy = fb->type.fb_height - 1; - /* Enable cursor in Brooktree DAC. */ - cg6->bt->addr = 0x06 << 24; - cg6->bt->control |= 0x03 << 24; -} - -__initfunc(void cg6_setup (fbinfo_t *fb, int slot, u32 cg6, int cg6_io)) -{ - struct cg6_info *cg6info; - unsigned int rev, cpu, conf; - - printk ("cgsix%d at 0x%8.8x ", slot, cg6); - - /* Fill in parameters we left out */ - fb->type.fb_cmsize = 256; - fb->mmap = cg6_mmap; - fb->loadcmap = cg6_loadcmap; - fb->reset = cg6_reset; - fb->blank = cg6_blank; - fb->unblank = cg6_unblank; - fb->setcursor = cg6_setcursor; - fb->setcursormap = cg6_setcursormap; - fb->setcurshape = cg6_setcurshape; - fb->postsetup = cg_postsetup; - fb->blitc = cg6_blitc; - fb->setw = cg6_setw; - fb->cpyw = cg6_cpyw; - - cg6info = (struct cg6_info *) &fb->info.cg6; - - /* Map the hardware registers */ - cg6info->bt = sparc_alloc_io (cg6+CG6_BROOKTREE_OFFSET, 0, - sizeof (struct bt_regs), "cgsix_dac", cg6_io, 0); - cg6info->fhc = sparc_alloc_io (cg6+CG6_FHC_OFFSET, 0, - sizeof (int), "cgsix_fhc", cg6_io, 0); -#if PAGE_SHIFT <= 12 - cg6info->thc = sparc_alloc_io (cg6+CG6_THC_OFFSET, 0, - sizeof (struct cg6_thc), "cgsix_thc", cg6_io, 0); -#else - cg6info->thc = (struct cg6_thc *)(((char *)cg6info->fhc)+0x1000); -#endif - cg6info->fbc = sparc_alloc_io (cg6+CG6_FBC_OFFSET, 0, - 0x1000, "cgsix_fbc", cg6_io, 0); -#if PAGE_SHIFT <= 12 - cg6info->tec = sparc_alloc_io (cg6+CG6_TEC_OFFSET, 0, - sizeof (struct cg6_tec), "cgsix_tec", cg6_io, 0); -#else - cg6info->tec = (struct cg6_tec *)(((char *)cg6info->fbc)+0x1000); -#endif - cg6info->dhc = sparc_alloc_io (cg6+CG6_DHC_OFFSET, 0, - 0x40000, "cgsix_dhc", cg6_io, 0); - cg6info->rom = sparc_alloc_io (cg6+CG6_ROM_OFFSET, 0, - 0x10000, "cgsix_rom", cg6_io, 0); - if (!fb->base) { - fb->base = (unsigned long) - sparc_alloc_io (cg6+CG6_RAM_OFFSET, 0, - fb->type.fb_size, "cgsix_ram", cg6_io, 0); - } - if (slot == sun_prom_console_id) - fb_restore_palette = cg6_restore_palette; - - /* Initialize Brooktree DAC */ - cg6info->bt->addr = 0x04 << 24; /* color planes */ - cg6info->bt->control = 0xff << 24; - cg6info->bt->addr = 0x05 << 24; - cg6info->bt->control = 0x00 << 24; - cg6info->bt->addr = 0x06 << 24; /* overlay plane */ - cg6info->bt->control = 0x73 << 24; - cg6info->bt->addr = 0x07 << 24; - cg6info->bt->control = 0x00 << 24; - -#ifdef __sparc_v9__ - printk("VA %016lx ", fb->base); -#endif - - printk("TEC Rev %x ", - (cg6info->thc->thc_misc >> CG6_THC_MISC_REV_SHIFT) & - CG6_THC_MISC_REV_MASK); - - /* Get FHC Revision */ - conf = *(cg6info->fhc); - - cpu = conf & CG6_FHC_CPU_MASK; - printk("CPU "); - if (cpu == CG6_FHC_CPU_SPARC) - printk("sparc "); - else if (cpu == CG6_FHC_CPU_68020) - printk("68020 "); - else - printk("386 "); - - rev = conf >> CG6_FHC_REV_SHIFT & CG6_FHC_REV_MASK; - printk("Rev %x\n", rev); - - if (slot && sun_prom_console_id == slot) - return; - - /* Reset the cg6 */ - cg6_reset(fb); - - if (!slot) { - /* Enable Video */ - cg6_unblank(fb); - } else { - cg6_blank(fb); - } -} - -extern unsigned char vga_font[]; - -#define GX_BLITC_START(attr) \ - { \ - register struct cg6_fbc *gx = fbinfo[0].info.cg6.fbc; \ - register uint i; \ - do { \ - i = gx->s; \ - } while (i & 0x10000000); \ - gx->fg = attr & 0xf; \ - gx->bg = (attr>>4); \ - gx->mode = 0x140000; \ - gx->alu = 0xe880fc30; \ - gx->pixelm = ~(0); \ - gx->s = 0; \ - gx->clip = 0; \ - gx->pm = 0xff; -#define GX_BLITC_BODY4(count,x,y,start,action) \ - while (count >= 4) { \ - count -= 4; \ - gx->incx = 0; \ - gx->incy = 1; \ - gx->x0 = x; \ - gx->x1 = (x += 32) - 1; \ - gx->y0 = y; \ - start; \ - for (i = 0; i < CHAR_HEIGHT; i++) { \ - action; \ - } \ - } -#define GX_BLITC_BODY1(x,y,action) \ - gx->incx = 0; \ - gx->incy = 1; \ - gx->x0 = x; \ - gx->x1 = (x += 8) - 1; \ - gx->y0 = y; \ - for (i = 0; i < CHAR_HEIGHT; i++) { \ - action; \ - } -#define GX_BLITC_END \ - } - -static void cg6_blitc(unsigned short charattr, int xoff, int yoff) -{ - unsigned char attrib = CHARATTR_TO_SUNCOLOR(charattr); - unsigned char *p = &vga_font[((unsigned char)charattr) << 4]; - GX_BLITC_START(attrib) - GX_BLITC_BODY1(xoff, yoff, gx->font=((*p++) << 24)) - GX_BLITC_END -} - -static void cg6_setw(int xoff, int yoff, unsigned short c, int count) -{ - unsigned char attrib = CHARATTR_TO_SUNCOLOR(c); - unsigned char *p = &vga_font[((unsigned char)c) << 4]; - register unsigned char *q; - register uint l; - GX_BLITC_START(attrib) - if (count >= 4) { - GX_BLITC_BODY4(count, xoff, yoff, q = p, - l = *q++; - l |= l << 8; - l |= l << 16; - gx->font=l) - } - while (count) { - count--; - q = p; - GX_BLITC_BODY1(xoff, yoff, gx->font=((*q++) << 24)); - } - GX_BLITC_END -} - -static void cg6_cpyw(int xoff, int yoff, unsigned short *p, int count) -{ - unsigned char attrib = CHARATTR_TO_SUNCOLOR(*p); - unsigned char *p1, *p2, *p3, *p4; - GX_BLITC_START(attrib) - if (count >= 4) { - GX_BLITC_BODY4(count, xoff, yoff, - p1 = &vga_font[((unsigned char)*p++) << 4]; - p2 = &vga_font[((unsigned char)*p++) << 4]; - p3 = &vga_font[((unsigned char)*p++) << 4]; - p4 = &vga_font[((unsigned char)*p++) << 4], - gx->font=((uint)*p4++) | ((((uint)*p3++) | ((((uint)*p2++) | (((uint)*p1++) << 8)) << 8)) << 8)) - } - while (count) { - count--; - p1 = &vga_font[((unsigned char)*p++) << 4]; - GX_BLITC_BODY1(xoff, yoff, gx->font=((*p1++) << 24)); - } - GX_BLITC_END -} - -#define GX_FILL_START(attr) \ - { \ - register struct cg6_fbc *gx = fbinfo[0].info.cg6.fbc; \ - register uint i; \ - do { \ - i = gx->s; \ - } while (i & 0x10000000); \ - gx->fg = attr & 0xf; \ - gx->bg = 0; \ - gx->pixelm = ~(0); \ - gx->s = 0; \ - gx->alu = 0xea80ff00; \ - gx->pm = ~(0); \ - gx->clip = 0; -#define GX_FILL_END \ - } - -#if 0 -static void cg6_fill(int attrib, int count, int *boxes) -{ - register int r; - - attrib = 5; - GX_FILL_START(attrib) - while (count-- > 0) { - gx->arecty = boxes[1]; - gx->arectx = boxes[0]; - gx->arecty = boxes[3]; - gx->arecty = boxes[2]; - boxes += 4; - do { - r = gx->draw; - } while (r < 0 && (r & 0x20000000) ); - } - GX_FILL_END -} -#endif diff --git a/drivers/sbus/char/cgthree.c b/drivers/sbus/char/cgthree.c deleted file mode 100644 index 568ae99bf..000000000 --- a/drivers/sbus/char/cgthree.c +++ /dev/null @@ -1,268 +0,0 @@ -/* $Id: cgthree.c,v 1.25 1998/03/10 20:18:27 jj Exp $ - * cgtree.c: cg3 frame buffer driver - * - * Copyright (C) 1996 Miguel de Icaza (miguel@nuclecu.unam.mx) - * Copyright (C) 1996 Jakub Jelinek (jj@sunsite.mff.cuni.cz) - * Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be) - * - * Support for cgRDI added, Nov/96, jj. - */ - -#include <linux/kd.h> -#include <linux/tty.h> -#include <linux/malloc.h> -#include <linux/proc_fs.h> - -#include <asm/sbus.h> -#include <asm/io.h> -#include <asm/fbio.h> -#include <asm/pgtable.h> - -/* These must be included after asm/fbio.h */ -#include <linux/vt_kern.h> -#include <linux/selection.h> -#include <linux/console_struct.h> -#include "fb.h" -#include "cg_common.h" - - -/* Control Register Constants */ -#define CG3_CR_ENABLE_INTS 0x80 -#define CG3_CR_ENABLE_VIDEO 0x40 -#define CG3_CR_ENABLE_TIMING 0x20 -#define CG3_CR_ENABLE_CURCMP 0x10 -#define CG3_CR_XTAL_MASK 0x0c -#define CG3_CR_DIVISOR_MASK 0x03 - -/* Status Register Constants */ -#define CG3_SR_PENDING_INT 0x80 -#define CG3_SR_RES_MASK 0x70 -#define CG3_SR_1152_900_76_A 0x40 -#define CG3_SR_1152_900_76_B 0x60 -#define CG3_SR_ID_MASK 0x0f -#define CG3_SR_ID_COLOR 0x01 -#define CG3_SR_ID_MONO 0x02 -#define CG3_SR_ID_MONO_ECL 0x03 - - -enum cg3_type { - CG3_AT_66HZ = 0, - CG3_AT_76HZ, - CG3_RDI -}; - - -struct cg3_regs { - struct bt_regs cmap; - volatile u8 control; - volatile u8 status; - volatile u8 cursor_start; - volatile u8 cursor_end; - volatile u8 h_blank_start; - volatile u8 h_blank_end; - volatile u8 h_sync_start; - volatile u8 h_sync_end; - volatile u8 comp_sync_end; - volatile u8 v_blank_start_high; - volatile u8 v_blank_start_low; - volatile u8 v_blank_end; - volatile u8 v_sync_start; - volatile u8 v_sync_end; - volatile u8 xfer_holdoff_start; - volatile u8 xfer_holdoff_end; -}; - -/* The cg3 palette is loaded with 4 color values at each time */ -/* so you end up with: (rgb)(r), (gb)(rg), (b)(rgb), and so on */ -static void -cg3_loadcmap (fbinfo_t *fb, int index, int count) -{ - struct bt_regs *bt = &fb->info.cg3.regs->cmap; - int *i, steps; - - i = (((int *)fb->color_map) + D4M3(index)); - steps = D4M3(index+count-1) - D4M3(index)+3; - - *(volatile u8 *)&bt->addr = (u8)D4M4(index); - while (steps--) - bt->color_map = *i++; -} - -/* The cg3 is presumed to emulate a cg4, I guess older programs will want that - * addresses above 0x4000000 are for cg3, below that it's cg4 emulation. - */ -static int -cg3_mmap (struct inode *inode, struct file *file, struct vm_area_struct *vma, - long base, fbinfo_t *fb) -{ - uint size, page, r, map_size; - unsigned long map_offset = 0; - - size = vma->vm_end - vma->vm_start; - if (vma->vm_offset & ~PAGE_MASK) - return -ENXIO; - - /* To stop the swapper from even considering these pages */ - vma->vm_flags |= FB_MMAP_VM_FLAGS; - - /* Each page, see which map applies */ - for (page = 0; page < size; ){ - switch (vma->vm_offset+page){ - case CG3_MMAP_OFFSET: - map_size = size-page; - map_offset = get_phys ((unsigned long) fb->base); - if (map_size > fb->type.fb_size) - map_size = fb->type.fb_size; - break; - default: - map_size = 0; - break; - } - if (!map_size){ - page += PAGE_SIZE; - continue; - } - if (page + map_size > size) - map_size = size - page; - r = io_remap_page_range (vma->vm_start+page, - map_offset, - map_size, vma->vm_page_prot, - fb->space); - if (r) - return -EAGAIN; - page += map_size; - } - - vma->vm_file = file; - file->f_count++; - return 0; -} - -static void -cg3_blank (fbinfo_t *fb) -{ - fb->info.cg3.regs->control &= ~CG3_CR_ENABLE_VIDEO; -} - -static void -cg3_unblank (fbinfo_t *fb) -{ - fb->info.cg3.regs->control |= CG3_CR_ENABLE_VIDEO; -} - - -static u8 cg3regvals_66hz[] __initdata = { /* 1152 x 900, 66 Hz */ - 0x14, 0xbb, 0x15, 0x2b, 0x16, 0x04, 0x17, 0x14, - 0x18, 0xae, 0x19, 0x03, 0x1a, 0xa8, 0x1b, 0x24, - 0x1c, 0x01, 0x1d, 0x05, 0x1e, 0xff, 0x1f, 0x01, - 0x10, 0x20, 0 -}; - -static u8 cg3regvals_76hz[] __initdata = { /* 1152 x 900, 76 Hz */ - 0x14, 0xb7, 0x15, 0x27, 0x16, 0x03, 0x17, 0x0f, - 0x18, 0xae, 0x19, 0x03, 0x1a, 0xae, 0x1b, 0x2a, - 0x1c, 0x01, 0x1d, 0x09, 0x1e, 0xff, 0x1f, 0x01, - 0x10, 0x24, 0 -}; - -static u8 cg3regvals_rdi[] __initdata = { /* 640 x 480, cgRDI */ - 0x14, 0x70, 0x15, 0x20, 0x16, 0x08, 0x17, 0x10, - 0x18, 0x06, 0x19, 0x02, 0x1a, 0x31, 0x1b, 0x51, - 0x1c, 0x06, 0x1d, 0x0c, 0x1e, 0xff, 0x1f, 0x01, - 0x10, 0x22, 0 -}; - -static u8 *cg3_regvals[] __initdata = { - cg3regvals_66hz, cg3regvals_76hz, cg3regvals_rdi -}; - -static u_char cg3_dacvals[] __initdata = { - 4, 0xff, 5, 0x00, 6, 0x70, 7, 0x00, 0 -}; - - -__initfunc(void cg3_setup (fbinfo_t *fb, int slot, u32 cg3, int cg3_io, - struct linux_sbus_device *sbdp)) -{ - struct cg3_info *cg3info = (struct cg3_info *) &fb->info.cg3; - - if (strstr (sbdp->prom_name, "cgRDI")) { - char buffer[40]; - char *p; - int w, h; - - prom_getstring (sbdp->prom_node, "params", - buffer, sizeof(buffer)); - if (*buffer) { - w = simple_strtoul (buffer, &p, 10); - if (w && *p == 'x') { - h = simple_strtoul (p + 1, &p, 10); - if (h && *p == '-') { - fb->type.fb_width = w; - fb->type.fb_height = h; - } - } - } - printk ("cgRDI%d at 0x%8.8x\n", slot, cg3); - cg3info->cgrdi = 1; - } else { - printk ("cgthree%d at 0x%8.8x\n", slot, cg3); - cg3info->cgrdi = 0; - } - - /* Fill in parameters we left out */ - fb->type.fb_cmsize = 256; - fb->mmap = cg3_mmap; - fb->loadcmap = cg3_loadcmap; - fb->postsetup = cg_postsetup; - fb->ioctl = 0; /* no special ioctls */ - fb->reset = 0; - fb->blank = cg3_blank; - fb->unblank = cg3_unblank; - - /* Map the card registers */ - cg3info->regs = sparc_alloc_io (cg3+CG3_REGS, 0, - sizeof (struct cg3_regs),"cg3_regs", cg3_io, 0); - - if (!prom_getbool(sbdp->prom_node, "width")) { - /* Ugh, broken PROM didn't initialize us. - * Let's deal with this ourselves. - */ - u8 status, mon; - enum cg3_type type; - u8 *p; - - if (cg3info->cgrdi) { - type = CG3_RDI; - } else { - status = cg3info->regs->status; - if ((status & CG3_SR_ID_MASK) == CG3_SR_ID_COLOR) { - mon = status & CG3_SR_RES_MASK; - if (mon == CG3_SR_1152_900_76_A || - mon == CG3_SR_1152_900_76_B) - type = CG3_AT_76HZ; - else - type = CG3_AT_66HZ; - } else { - prom_printf("cgthree: can't handle SR %02x\n", - status); - prom_halt(); - return; /* fool gcc. */ - } - } - - for (p = cg3_regvals[type]; *p; p += 2) - ((u8 *)cg3info->regs)[p[0]] = p[1]; - - for (p = cg3_dacvals; *p; p += 2) { - *(volatile u8 *)&cg3info->regs->cmap.addr = p[0]; - *(volatile u8 *)&cg3info->regs->cmap.control = p[1]; - } - } - - if (!fb->base){ - fb->base=(unsigned long) sparc_alloc_io (cg3+CG3_RAM, 0, - fb->type.fb_size, "cg3_ram", cg3_io, 0); - } -} - diff --git a/drivers/sbus/char/creator.c b/drivers/sbus/char/creator.c deleted file mode 100644 index c7935f713..000000000 --- a/drivers/sbus/char/creator.c +++ /dev/null @@ -1,734 +0,0 @@ -/* $Id: creator.c,v 1.14 1998/03/10 20:18:32 jj Exp $ - * creator.c: Creator/Creator3D frame buffer driver - * - * Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz) - */ -#include <linux/kd.h> -#include <linux/tty.h> -#include <linux/malloc.h> -#include <linux/proc_fs.h> -#include <linux/config.h> - -#include <asm/sbus.h> -#include <asm/io.h> -#include <asm/fbio.h> -#include <asm/pgtable.h> -#include <asm/uaccess.h> - -/* These must be included after asm/fbio.h */ -#include <linux/vt_kern.h> -#include <linux/selection.h> -#include <linux/console_struct.h> -#include "fb.h" -#include "cg_common.h" - -#define FFB_SFB8R_VOFF 0x00000000 -#define FFB_SFB8G_VOFF 0x00400000 -#define FFB_SFB8B_VOFF 0x00800000 -#define FFB_SFB8X_VOFF 0x00c00000 -#define FFB_SFB32_VOFF 0x01000000 -#define FFB_SFB64_VOFF 0x02000000 -#define FFB_FBC_REGS_VOFF 0x04000000 -#define FFB_BM_FBC_REGS_VOFF 0x04002000 -#define FFB_DFB8R_VOFF 0x04004000 -#define FFB_DFB8G_VOFF 0x04404000 -#define FFB_DFB8B_VOFF 0x04804000 -#define FFB_DFB8X_VOFF 0x04c04000 -#define FFB_DFB24_VOFF 0x05004000 -#define FFB_DFB32_VOFF 0x06004000 -#define FFB_DFB422A_VOFF 0x07004000 /* DFB 422 mode write to A */ -#define FFB_DFB422AD_VOFF 0x07804000 /* DFB 422 mode with line doubling */ -#define FFB_DFB24B_VOFF 0x08004000 /* DFB 24bit mode write to B */ -#define FFB_DFB422B_VOFF 0x09004000 /* DFB 422 mode write to B */ -#define FFB_DFB422BD_VOFF 0x09804000 /* DFB 422 mode with line doubling */ -#define FFB_SFB16Z_VOFF 0x0a004000 /* 16bit mode Z planes */ -#define FFB_SFB8Z_VOFF 0x0a404000 /* 8bit mode Z planes */ -#define FFB_SFB422_VOFF 0x0ac04000 /* SFB 422 mode write to A/B */ -#define FFB_SFB422D_VOFF 0x0b404000 /* SFB 422 mode with line doubling */ -#define FFB_FBC_KREGS_VOFF 0x0bc04000 -#define FFB_DAC_VOFF 0x0bc06000 -#define FFB_PROM_VOFF 0x0bc08000 -#define FFB_EXP_VOFF 0x0bc18000 - -#define FFB_SFB8R_POFF 0x04000000 -#define FFB_SFB8G_POFF 0x04400000 -#define FFB_SFB8B_POFF 0x04800000 -#define FFB_SFB8X_POFF 0x04c00000 -#define FFB_SFB32_POFF 0x05000000 -#define FFB_SFB64_POFF 0x06000000 -#define FFB_FBC_REGS_POFF 0x00600000 -#define FFB_BM_FBC_REGS_POFF 0x00600000 -#define FFB_DFB8R_POFF 0x01000000 -#define FFB_DFB8G_POFF 0x01400000 -#define FFB_DFB8B_POFF 0x01800000 -#define FFB_DFB8X_POFF 0x01c00000 -#define FFB_DFB24_POFF 0x02000000 -#define FFB_DFB32_POFF 0x03000000 -#define FFB_FBC_KREGS_POFF 0x00610000 -#define FFB_DAC_POFF 0x00400000 -#define FFB_PROM_POFF 0x00000000 -#define FFB_EXP_POFF 0x00200000 - -#define FFB_Y_BYTE_ADDR_SHIFT 11 -#define FFB_Y_ADDR_SHIFT 13 - -#define FFB_PPC_ACE_DISABLE 1 -#define FFB_PPC_ACE_AUX_ADD 3 -#define FFB_PPC_ACE_SHIFT 18 -#define FFB_PPC_DCE_DISABLE 2 -#define FFB_PPC_DCE_SHIFT 16 -#define FFB_PPC_ABE_DISABLE 2 -#define FFB_PPC_ABE_SHIFT 14 -#define FFB_PPC_VCE_DISABLE 1 -#define FFB_PPC_VCE_2D 2 -#define FFB_PPC_VCE_SHIFT 12 -#define FFB_PPC_APE_DISABLE 2 -#define FFB_PPC_APE_SHIFT 10 -#define FFB_PPC_CS_VARIABLE 2 -#define FFB_PPC_CS_SHIFT 0 - -#define FFB_FBC_WB_A 1 -#define FFB_FBC_WB_SHIFT 29 -#define FFB_FBC_PGE_MASK 3 -#define FFB_FBC_BE_SHIFT 4 -#define FFB_FBC_GE_SHIFT 2 -#define FFB_FBC_RE_SHIFT 0 - -#define FFB_ROP_NEW 0x83 -#define FFB_ROP_RGB_SHIFT 0 - -#define FFB_UCSR_FIFO_MASK 0x00000fff -#define FFB_UCSR_RP_BUSY 0x02000000 - -struct ffb_fbc { - u8 xxx1[0x60]; - volatile u32 by; - volatile u32 bx; - u32 xxx2; - u32 xxx3; - volatile u32 bh; - volatile u32 bw; - u8 xxx4[0x188]; - volatile u32 ppc; - u32 xxx5; - volatile u32 fg; - volatile u32 bg; - u8 xxx6[0x44]; - volatile u32 fbc; - volatile u32 rop; - u8 xxx7[0x34]; - volatile u32 pmask; - u8 xxx8[12]; - volatile u32 clip0min; - volatile u32 clip0max; - volatile u32 clip1min; - volatile u32 clip1max; - volatile u32 clip2min; - volatile u32 clip2max; - volatile u32 clip3min; - volatile u32 clip3max; - u8 xxx9[0x3c]; - volatile u32 unk1; - volatile u32 unk2; - u8 xxx10[0x10]; - volatile u32 fontxy; - volatile u32 fontw; - volatile u32 fontinc; - volatile u32 font; - u8 xxx11[0x4dc]; - volatile u32 unk3; - u8 xxx12[0xfc]; - volatile u32 ucsr; -}; - -struct ffb_dac { - volatile u32 type; - volatile u32 value; - volatile u32 type2; - volatile u32 value2; -}; - -static void -ffb_restore_palette (fbinfo_t *fbinfo) -{ -} - -static void ffb_blitc(unsigned short, int, int); -static void ffb_setw(int, int, unsigned short, int); -static void ffb_cpyw(int, int, unsigned short *, int); -static void ffb_fill(int, int, int *); -static void ffb_penguin(int,int,int); - -static struct { - unsigned long voff; - unsigned long poff; - unsigned long size; -} ffbmmap [] = { - { FFB_SFB8R_VOFF, FFB_SFB8R_POFF, 0x0400000 }, - { FFB_SFB8G_VOFF, FFB_SFB8G_POFF, 0x0400000 }, - { FFB_SFB8B_VOFF, FFB_SFB8B_POFF, 0x0400000 }, - { FFB_SFB8X_VOFF, FFB_SFB8X_POFF, 0x0400000 }, - { FFB_SFB32_VOFF, FFB_SFB32_POFF, 0x1000000 }, - { FFB_SFB64_VOFF, FFB_SFB64_POFF, 0x2000000 }, - { FFB_FBC_REGS_VOFF, FFB_FBC_REGS_POFF, 0x0002000 }, - { FFB_BM_FBC_REGS_VOFF, FFB_BM_FBC_REGS_POFF, 0x0002000 }, - { FFB_DFB8R_VOFF, FFB_DFB8R_POFF, 0x0400000 }, - { FFB_DFB8G_VOFF, FFB_DFB8G_POFF, 0x0400000 }, - { FFB_DFB8B_VOFF, FFB_DFB8B_POFF, 0x0400000 }, - { FFB_DFB8X_VOFF, FFB_DFB8X_POFF, 0x0400000 }, - { FFB_DFB24_VOFF, FFB_DFB24_POFF, 0x1000000 }, - { FFB_DFB32_VOFF, FFB_DFB32_POFF, 0x1000000 }, - { FFB_FBC_KREGS_VOFF, FFB_FBC_KREGS_POFF, 0x0002000 }, - { FFB_DAC_VOFF, FFB_DAC_POFF, 0x0002000 }, - { FFB_PROM_VOFF, FFB_PROM_POFF, 0x0010000 }, - { FFB_EXP_VOFF, FFB_EXP_POFF, 0x0002000 } -}; - -/* Ugh: X wants to mmap a bunch of cute stuff at the same time :-( */ -/* So, we just mmap the things that are being asked for */ -static int -ffb_mmap (struct inode *inode, struct file *file, struct vm_area_struct *vma, - long base, fbinfo_t *fb) -{ - uint size, page, r, map_size; - unsigned long map_offset = 0; - int i; - int alignment; - struct vm_area_struct *vmm = NULL; - - size = vma->vm_end - vma->vm_start; - if (vma->vm_offset & ~PAGE_MASK) - return -ENXIO; - - /* Try to align RAM */ -#define ALIGNMENT 0x400000 - map_offset = vma->vm_offset + size; - alignment = 0; - if (vma->vm_offset < FFB_FBC_REGS_VOFF) { - vmm = find_vma(current->mm, vma->vm_start); - alignment = ALIGNMENT - ((vma->vm_start - vma->vm_offset) & (ALIGNMENT - 1)); - } else if (vma->vm_offset >= FFB_DFB8R_VOFF && (vma->vm_offset & (ALIGNMENT - 1)) == 0x4000) { - vmm = find_vma(current->mm, vma->vm_start); - alignment = ALIGNMENT - (vma->vm_start & (ALIGNMENT - 1)); - } - if (alignment == ALIGNMENT) alignment = 0; - if (alignment && (!vmm || vmm->vm_start >= vma->vm_end + alignment)) { - vma->vm_start += alignment; - vma->vm_end += alignment; - } -#undef ALIGNMENT - - /* To stop the swapper from even considering these pages */ - vma->vm_flags |= FB_MMAP_VM_FLAGS; - - /* Each page, see which map applies */ - for (page = 0; page < size; ){ - map_size = 0; - for (i = 0; i < sizeof (ffbmmap) / sizeof (ffbmmap[0]); i++) - if (ffbmmap[i].voff == vma->vm_offset+page) { - map_size = ffbmmap[i].size; - map_offset = (fb->info.ffb.physbase + ffbmmap[i].poff) & _PAGE_PADDR; - } - - if (!map_size){ - page += PAGE_SIZE; - continue; - } - if (page + map_size > size) - map_size = size - page; - r = io_remap_page_range (vma->vm_start+page, - map_offset, - map_size, vma->vm_page_prot, 0); - if (r) - return -EAGAIN; - page += map_size; - } - - vma->vm_file = file; - file->f_count++; - return 0; -} - -/* XXX write body of these two... */ -static inline int -ffb_wid_get (fbinfo_t *fb, struct fb_wid_list *wl) -{ - struct fb_wid_item *wi; - struct fb_wid_list wlt; - struct fb_wid_item wit[30]; - char *km = NULL; - int i, j; - int err; - -#ifdef CONFIG_SPARC32_COMPAT - if (current->tss.flags & SPARC_FLAG_32BIT) { - if (copy_from_user (&wlt, wl, 2 * sizeof (__u32)) || - __get_user ((long)wlt.wl_list, (((__u32 *)wl)+2))) - return -EFAULT; - } else -#endif - if (copy_from_user (&wlt, wl, sizeof (wlt))) - return -EFAULT; - if (wlt.wl_count <= 30) { - if (copy_from_user (wit, wlt.wl_list, wlt.wl_count * sizeof(*wi))) - return -EFAULT; - wi = wit; - } else if (wlt.wl_count > 120) - return -EINVAL; - else { - wi = (struct fb_wid_item *) km = kmalloc (wlt.wl_count * sizeof (*wi), GFP_KERNEL); - if (!wi) return -ENOMEM; - if (copy_from_user (wi, wlt.wl_list, wlt.wl_count * sizeof(*wi))) { - kfree (wi); - return -EFAULT; - } - } - for (i = 0; i < wlt.wl_count; i++, wi++) { - switch (wi->wi_type) { - case FB_WID_DBL_8: j = (wi->wi_index & 0xf) + 0x40; break; - case FB_WID_DBL_24: j = wi->wi_index & 0x3f; break; - default: return -EINVAL; - } - wi->wi_attrs = 0xffff; - for (j = 0; j < 32; j++) - wi->wi_values [j] = 0; - } - err = 0; - if (copy_to_user (wlt.wl_list, km ? km : (char *)wit, wlt.wl_count * sizeof (*wi))) - err = -EFAULT; - if (km) - kfree (km); - return err; -} - -static inline int -ffb_wid_put (fbinfo_t *fb, struct fb_wid_list *wl) -{ - struct fb_wid_item *wi; - struct fb_wid_list wlt; - struct fb_wid_item wit[30]; - char *km = NULL; - int i, j; - -#ifdef CONFIG_SPARC32_COMPAT - if (current->tss.flags & SPARC_FLAG_32BIT) { - if (copy_from_user (&wlt, wl, 2 * sizeof (__u32)) || - __get_user ((long)wlt.wl_list, (((__u32 *)wl)+2))) - return -EFAULT; - } else -#endif - if (copy_from_user (&wlt, wl, sizeof (wlt))) - return -EFAULT; - if (wlt.wl_count <= 30) { - if (copy_from_user (wit, wlt.wl_list, wlt.wl_count * sizeof(*wi))) - return -EFAULT; - wi = wit; - } else if (wlt.wl_count > 120) - return -EINVAL; - else { - wi = (struct fb_wid_item *) km = kmalloc (wlt.wl_count * sizeof (*wi), GFP_KERNEL); - if (!wi) return -ENOMEM; - if (copy_from_user (wi, wlt.wl_list, wlt.wl_count * sizeof(*wi))) { - kfree (wi); - return -EFAULT; - } - } - for (i = 0; i < wlt.wl_count; i++, wi++) { - switch (wi->wi_type) { - case FB_WID_DBL_8: j = (wi->wi_index & 0xf) + 0x40; break; - case FB_WID_DBL_24: j = wi->wi_index & 0x3f; break; - default: return -EINVAL; - } - /* x = wi->wi_values [j] */; - } - if (km) - kfree (km); - return 0; -} - -static inline void -ffb_curs_enable (fbinfo_t *fb, int enable) -{ - struct ffb_dac *dac = fb->info.ffb.dac; - - dac->type2 = 0x100; - if (fb->info.ffb.dac_rev <= 2) - dac->value2 = enable ? 3 : 0; - else - dac->value2 = enable ? 0 : 3; -} - -static void -ffb_setcursormap (fbinfo_t *fb, unsigned char *red, - unsigned char *green, - unsigned char *blue) -{ - struct ffb_dac *dac = fb->info.ffb.dac; - - ffb_curs_enable (fb, 0); - dac->type2 = 0x102; - dac->value2 = (red[0] | (green[0]<<8) | (blue[0]<<16)); - dac->value2 = (red[1] | (green[1]<<8) | (blue[1]<<16)); -} - -/* Set cursor shape */ -static void -ffb_setcurshape (fbinfo_t *fb) -{ - struct ffb_dac *dac = fb->info.ffb.dac; - int i, j; - - ffb_curs_enable (fb, 0); - for (j = 0; j < 2; j++) { - dac->type2 = j ? 0 : 0x80; - for (i = 0; i < 0x40; i++) { - if (fb->cursor.size.fbx <= 32) { - dac->value2 = fb->cursor.bits [j][i]; - dac->value2 = 0; - } else { - dac->value2 = fb->cursor.bits [j][2*i]; - dac->value2 = fb->cursor.bits [j][2*i+1]; - } - } - } -} - -/* Load cursor information */ -static void -ffb_setcursor (fbinfo_t *fb) -{ - struct ffb_dac *dac = fb->info.ffb.dac; - struct cg_cursor *c = &fb->cursor; - - dac->type2 = 0x104; -/* Should this be just 0x7ff?? Should I do some margin handling and setcurshape - in that case? */ - dac->value2 = (((c->cpos.fby - c->chot.fby) & 0xffff) << 16) - |((c->cpos.fbx - c->chot.fbx) & 0xffff); - ffb_curs_enable (fb, fb->cursor.enable); -} - -static void -ffb_blank (fbinfo_t *fb) -{ -/* XXX Write this */ -} - -static void -ffb_unblank (fbinfo_t *fb) -{ -/* XXX Write this */ -} - -static int ffb_clutstore (fbinfo_t *fb, int offset, int count) -{ - int i; - u32 *clut = fb->info.ffb.clut + offset; - struct ffb_dac *dac = fb->info.ffb.dac; - - dac->type = 0x2000 | offset; - for (i = 0; i < count; i++) - dac->value = *clut++; /* Feed the colors in :)) */ - return 0; -} - -static int ffb_clutpost (fbinfo_t *fb, struct fb_clut *fc) -{ - int i; - u32 *clut; - struct fb_clut fct; - u8 red[256], green[256], blue[256]; - -#ifdef CONFIG_SPARC32_COMPAT - if (current->tss.flags & SPARC_FLAG_32BIT) { - if (copy_from_user (&fct, fc, 3 * sizeof (__u32)) || - __get_user ((long)fct.red, &(((struct fb_clut32 *)fc)->red)) || - __get_user ((long)fct.green, &(((struct fb_clut32 *)fc)->green)) || - __get_user ((long)fct.blue, &(((struct fb_clut32 *)fc)->blue))) - return -EFAULT; - } else -#endif - if (copy_from_user (&fct, fc, sizeof (struct fb_clut))) - return -EFAULT; - i = fct.offset + fct.count; - if (fct.clutid || i <= 0 || i > 256) return -EINVAL; - if (copy_from_user (red, fct.red, fct.count) || - copy_from_user (green, fct.green, fct.count) || - copy_from_user (blue, fct.blue, fct.count)) - return -EFAULT; - clut = fb->info.ffb.clut + fct.offset; - for (i = 0; i < fct.count; i++) - *clut++ = ((red[i])|(green[i]<<8)|(blue[i]<<16)); - return ffb_clutstore (fb, fct.offset, fct.count); -} - -static int ffb_clutread (fbinfo_t *fb, struct fb_clut *fc) -{ -/* XXX write this */ - return 0; -} - -static void -ffb_loadcmap (fbinfo_t *fb, int index, int count) -{ - u32 *clut = fb->info.ffb.clut + index; - int i, j = count; - - for (i = index; j--; i++) - *clut++ = ((fb->color_map CM(i,0))) | - ((fb->color_map CM(i,1)) << 8) | - ((fb->color_map CM(i,2)) << 16); - ffb_clutstore (fb, index, count); -} - -/* Handle ffb-specific ioctls */ -static int -ffb_ioctl (struct inode *inode, struct file *file, unsigned cmd, unsigned long arg, fbinfo_t *fb) -{ - switch (cmd) { - case FBIO_WID_GET: - return ffb_wid_get (fb, (struct fb_wid_list *)arg); - case FBIO_WID_PUT: - return ffb_wid_put (fb, (struct fb_wid_list *)arg); - case FFB_CLUTPOST: - return ffb_clutpost (fb, (struct fb_clut *)arg); - case FFB_CLUTREAD: - return ffb_clutread (fb, (struct fb_clut *)arg); - - default: - return -ENOSYS; - } -} - -void -ffb_reset (fbinfo_t *fb) -{ - if (fb == &fbinfo[0]) - sbus_hw_hide_cursor (); -} - -__initfunc(static unsigned long ffb_postsetup (fbinfo_t *fb, unsigned long memory_start)) -{ - fb->info.ffb.clut = (u32 *)(memory_start); - fb->color_map = (u8 *)(memory_start+256*4); - return memory_start + 256*4 + 256*3; -} - -__initfunc(void creator_setup (fbinfo_t *fb, int slot, int ffb_node, unsigned long ffb, int ffb_io)) -{ - struct ffb_info *ffbinfo; - struct linux_prom64_registers regs[2*PROMREG_MAX]; - int type; - - if (prom_getproperty(ffb_node, "reg", (void *) regs, sizeof(regs)) <= 0) - return; - ffb = (long)__va(regs[0].phys_addr); - printk ("creator%d at 0x%016lx ", slot, ffb); - - fb->base = ffb; /* ??? */ - - /* Fill in parameters we left out */ - fb->type.fb_cmsize = 256; - fb->mmap = ffb_mmap; - fb->loadcmap = ffb_loadcmap; - fb->reset = ffb_reset; - fb->blank = ffb_blank; - fb->unblank = ffb_unblank; - fb->setcursor = ffb_setcursor; - fb->setcursormap = ffb_setcursormap; - fb->setcurshape = ffb_setcurshape; - fb->postsetup = ffb_postsetup; - fb->blitc = ffb_blitc; - fb->setw = ffb_setw; - fb->cpyw = ffb_cpyw; - fb->fill = ffb_fill; - fb->draw_penguin = ffb_penguin; - fb->ioctl = ffb_ioctl; - fb->cursor.hwsize.fbx = 64; - fb->cursor.hwsize.fby = 64; - fb->type.fb_depth = 24; - - ffbinfo = (struct ffb_info *) &fb->info.ffb; - - ffbinfo->physbase = ffb; - - ffbinfo->fbc = (struct ffb_fbc *)(ffb + FFB_FBC_REGS_POFF); - ffbinfo->dac = (struct ffb_dac *)(ffb + FFB_DAC_POFF); - - ffbinfo->dac->type = 0x8000; - ffbinfo->dac_rev = (ffbinfo->dac->value >> 0x1c); - - if (slot == sun_prom_console_id) - fb_restore_palette = ffb_restore_palette; - - type = prom_getintdefault (ffb_node, "board_type", 8); - - /* Initialize Brooktree DAC */ - - printk("TYPE %d DAC %d\n", type, ffbinfo->dac_rev); - - if (slot && sun_prom_console_id == slot) - return; - - /* Reset the ffb */ - ffb_reset(fb); - - if (!slot) { - /* Enable Video */ - ffb_unblank(fb); - } else { - ffb_blank(fb); - } -} - -extern unsigned char vga_font[]; - -#define FFB_BLITC_START(attr) \ - { \ - register struct ffb_fbc *ffb = fbinfo[0].info.ffb.fbc; \ - register u32 *clut = fbinfo[0].info.ffb.clut; \ - int i; \ - ffb->ppc = 0x203; \ - ffb->fg = clut[attr & 0xf]; \ - ffb->fbc = 0x2000707f; \ - ffb->rop = 0x83; \ - ffb->pmask = 0xffffffff; \ - ffb->bg = clut[attr>>4]; -#define FFB_BLITC_BODY4(count,x,y,start,action) \ - while (count >= 4) { \ - count -= 4; \ - ffb->fontw = 32; \ - ffb->fontinc = 0x10000; \ - ffb->fontxy = (y << 16) + x; \ - x += 32; \ - start; \ - for (i = 0; i < CHAR_HEIGHT; i++) { \ - action; \ - } \ - } -#define FFB_BLITC_BODY1(x,y,action) \ - ffb->fontw = 8; \ - ffb->fontinc = 0x10000; \ - ffb->fontxy = (y << 16) + x; \ - x += 8; \ - for (i = 0; i < CHAR_HEIGHT; i++) { \ - action; \ - } -#define FFB_BLITC_END \ - } - -static void ffb_blitc(unsigned short charattr, int xoff, int yoff) -{ - unsigned char attrib = CHARATTR_TO_SUNCOLOR(charattr); - unsigned char *p = &vga_font[((unsigned char)charattr) << 4]; - FFB_BLITC_START(attrib) - FFB_BLITC_BODY1(xoff, yoff, ffb->font=((*p++) << 24)) - FFB_BLITC_END -} - -static void ffb_setw(int xoff, int yoff, unsigned short c, int count) -{ - unsigned char attrib = CHARATTR_TO_SUNCOLOR(c); - unsigned char *p = &vga_font[((unsigned char)c) << 4]; - register unsigned char *q; - register uint l; - FFB_BLITC_START(attrib) - if (count >= 4) { - FFB_BLITC_BODY4(count, xoff, yoff, q = p, - l = *q++; - l |= l << 8; - l |= l << 16; - ffb->font=l) - } - while (count) { - count--; - q = p; - FFB_BLITC_BODY1(xoff, yoff, ffb->font=((*q++) << 24)); - } - FFB_BLITC_END -} - -static void ffb_cpyw(int xoff, int yoff, unsigned short *p, int count) -{ - unsigned char attrib = CHARATTR_TO_SUNCOLOR(*p); - unsigned char *p1, *p2, *p3, *p4; - FFB_BLITC_START(attrib) - if (count >= 4) { - FFB_BLITC_BODY4(count, xoff, yoff, - p1 = &vga_font[((unsigned char)*p++) << 4]; - p2 = &vga_font[((unsigned char)*p++) << 4]; - p3 = &vga_font[((unsigned char)*p++) << 4]; - p4 = &vga_font[((unsigned char)*p++) << 4], - ffb->font=((uint)*p4++) | ((((uint)*p3++) | ((((uint)*p2++) | (((uint)*p1++) << 8)) << 8)) << 8)) - } - while (count) { - count--; - p1 = &vga_font[((unsigned char)*p++) << 4]; - FFB_BLITC_BODY1(xoff, yoff, ffb->font=((*p1++) << 24)); - } - FFB_BLITC_END -} - -#if 0 -#define FFB_FILL_START(attr) \ - { \ - register struct ffb_fbc *ffb = fbinfo[0].info.ffb.fbc; \ - register u32 *clut = fbinfo[0].info.ffb.clut; \ - ffb->ppc =0x1803; \ - ffb->fg = clut[attr & 0xf]; \ - ffb->fbc = 0x2000707f; \ - ffb->rop = 0x83; \ - ffb->pmask = 0xffffffff; \ - ffb->unk2 = 8; -#define FFB_FILL_END \ - } -#else -#define FFB_FILL_START(attr) \ - { \ - register struct ffb_fbc *ffb = fbinfo[0].info.ffb.fbc; \ - ffb->ppc = 0x1803; \ - ffb->fg = 0; \ - ffb->fbc = 0x2000707f; \ - ffb->rop = 0x83; \ - ffb->pmask = 0xffffffff; \ - ffb->unk2 = 8; -#define FFB_FILL_END \ - } -#endif - -static void ffb_fill(int attrib, int count, int *boxes) -{ - attrib = 5; - FFB_FILL_START(attrib) - while (count-- > 0) { - ffb->by = boxes[1]; - ffb->bx = boxes[0]; - ffb->bh = boxes[3]; - ffb->bw = boxes[2]; - boxes += 4; - } - FFB_FILL_END -} - -__initfunc(void ffb_penguin(int x_margin, int y_margin, int ncpus)) -{ - int i, j, k; - u32 *p, *q; - unsigned char *r; - unsigned char c; - - p = (u32 *)(fbinfo[0].info.ffb.physbase + FFB_DFB24_POFF + y_margin*8192 + x_margin*4); - for (i = 0; i < 80; i++, p += 2048) { - q = p; - for (j = 0; j < ncpus; j++) { - r = linux_logo + 80 * i; - for (k = 0; k < 80; k++, r++) { - c = *r - 32; - *q++ = (linux_logo_red[c]) | - (linux_logo_green[c]<<8) | - (linux_logo_blue[c]<<16); - } - q += 8; - } - } -} diff --git a/drivers/sbus/char/envctrl.c b/drivers/sbus/char/envctrl.c index be5bafb07..b957ce81c 100644 --- a/drivers/sbus/char/envctrl.c +++ b/drivers/sbus/char/envctrl.c @@ -1,4 +1,4 @@ -/* $Id: envctrl.c,v 1.3 1998/04/10 08:42:24 jj Exp $ +/* $Id: envctrl.c,v 1.7 1998/06/10 07:25:28 davem Exp $ * envctrl.c: Temperature and Fan monitoring on Machines providing it. * * Copyright (C) 1998 Eddie C. Dost (ecd@skynet.be) @@ -11,8 +11,17 @@ #include <linux/delay.h> #include <linux/ioport.h> #include <linux/init.h> +#include <linux/miscdevice.h> #include <asm/ebus.h> +#include <asm/uaccess.h> +#include <asm/envctrl.h> + +#define ENVCTRL_MINOR 162 + + +#undef DEBUG_BUS_SCAN + #define PCF8584_ADDRESS 0x55 @@ -61,6 +70,7 @@ struct pcf8584_reg static struct pcf8584_reg *i2c; +#ifdef DEBUG_BUS_SCAN struct i2c_addr_map { unsigned char addr; unsigned char mask; @@ -73,9 +83,34 @@ static struct i2c_addr_map devmap[] = { { 0x48, 0x78, "PCF8591" }, }; #define NR_DEVMAP (sizeof(devmap) / sizeof(devmap[0])) +#endif + +static __inline__ int +PUT_DATA(__volatile__ unsigned char *data, char *buffer, int user) +{ + if (user) { + if (put_user(*data, buffer)) + return -EFAULT; + } else { + *buffer = *data; + } + return 0; +} + +static __inline__ int +GET_DATA(__volatile__ unsigned char *data, const char *buffer, int user) +{ + if (user) { + if (get_user(*data, buffer)) + return -EFAULT; + } else { + *data = *buffer; + } + return 0; +} static int -envctrl_read(unsigned char dev, char *buffer, int len) +i2c_read(unsigned char dev, char *buffer, int len, int user) { unsigned char dummy; unsigned char stat; @@ -103,16 +138,18 @@ envctrl_read(unsigned char dev, char *buffer, int len) if (count == (len - 2)) goto final; - if (++count > 0) - *buffer++ = i2c->data; - else + if (++count > 0) { + error = PUT_DATA(&i2c->data, buffer++, user); + if (error) + goto final; + } else dummy = i2c->data; } while (1); final: i2c->csr = CONTROL_ES0; - if (++count > 0) - *buffer++ = i2c->data; + if (!error && (++count > 0)) + error = PUT_DATA(&i2c->data, buffer++, user); else dummy = i2c->data; @@ -122,8 +159,8 @@ final: stop: i2c->csr = CONTROL_PIN | CONTROL_ES0 | CONTROL_STO | CONTROL_ACK; - if (++count > 0) - *buffer++ = i2c->data; + if (!error && (++count > 0)) + error = PUT_DATA(&i2c->data, buffer++, user); else dummy = i2c->data; @@ -133,7 +170,7 @@ stop: } static int -envctrl_write(unsigned char dev, char *buffer, int len) +i2c_write(unsigned char dev, const char *buffer, int len, int user) { int error = -ENODEV; int count = 0; @@ -157,7 +194,10 @@ envctrl_write(unsigned char dev, char *buffer, int len) if (count == len) goto stop; - i2c->data = *buffer++; + error = GET_DATA(&i2c->data, buffer++, user); + if (error) + goto stop; + count++; } while (1); @@ -166,31 +206,107 @@ stop: return error; } -__initfunc(static int scan_bus(void)) +__initfunc(static int i2c_scan_bus(void)) { unsigned char dev; int count = 0; - int i; - /* scan */ - for (dev = 1; dev < 128; dev++) - if (envctrl_write(dev, 0, 0) == 0) { + for (dev = 1; dev < 128; dev++) { + if (i2c_write(dev, 0, 0, 0) == 0) { +#ifdef DEBUG_BUS_SCAN + int i; for (i = 0; i < NR_DEVMAP; i++) if ((dev & devmap[i].mask) == devmap[i].addr) break; printk("envctrl: i2c device at %02x: %s\n", dev, i < NR_DEVMAP ? devmap[i].name : "unknown"); -{ - unsigned char buf[4]; - if (envctrl_read(dev, buf, 4) == 4) - printk("envctrl: read %02x %02x %02x %02x\n", - buf[0], buf[1], buf[2], buf[3]); -} +#endif count++; } + } return count ? 0 : -ENODEV; } +static loff_t +envctrl_llseek(struct file *file, loff_t offset, int type) +{ + return -ESPIPE; +} + +static ssize_t +envctrl_read(struct file *file, char *buf, size_t count, loff_t *ppos) +{ + unsigned long addr = (unsigned long)file->private_data; + + return i2c_read(addr, buf, count, 1); +} + +static ssize_t +envctrl_write(struct file *file, const char *buf, size_t count, loff_t *ppos) +{ + unsigned long addr = (unsigned long)file->private_data; + + return i2c_write(addr, buf, count, 1); +} + +static int +envctrl_ioctl(struct inode *inode, struct file *file, + unsigned int cmd, unsigned long arg) +{ + unsigned long data; + int addr; + + switch (cmd) { + case I2CIOCSADR: + if (get_user(addr, (int *)arg)) + return -EFAULT; + data = addr & 0x7f; + file->private_data = (void *)data; + break; + case I2CIOCGADR: + addr = (unsigned long)file->private_data; + if (put_user(addr, (int *)arg)) + return -EFAULT; + break; + default: + return -EINVAL; + } + return 0; +} + +static int +envctrl_open(struct inode *inode, struct file *file) +{ + file->private_data = 0; + MOD_INC_USE_COUNT; + return 0; +} + +static int +envctrl_release(struct inode *inode, struct file *file) +{ + MOD_DEC_USE_COUNT; + return 0; +} + +static struct file_operations envctrl_fops = { + envctrl_llseek, + envctrl_read, + envctrl_write, + NULL, /* readdir */ + NULL, /* poll */ + envctrl_ioctl, + NULL, /* mmap */ + envctrl_open, + envctrl_release +}; + +static struct miscdevice envctrl_dev = { + ENVCTRL_MINOR, + "envctrl", + &envctrl_fops +}; + #ifdef MODULE int init_module(void) #else @@ -199,35 +315,44 @@ __initfunc(int envctrl_init(void)) { #ifdef CONFIG_PCI struct linux_ebus *ebus; - struct linux_ebus_device *edev; - - for_all_ebusdev(edev, ebus) - if (!strcmp(edev->prom_name, "SUNW,envctrl")) - break; - + struct linux_ebus_device *edev = 0; + + for_each_ebus(ebus) { + for_each_ebusdev(edev, ebus) { + if (!strcmp(edev->prom_name, "SUNW,envctrl")) + goto ebus_done; + if (!strcmp(edev->prom_name, "SUNW,rasctrl")) + goto ebus_done; + } + } +ebus_done: if (!edev) return -ENODEV; if (check_region(edev->base_address[0], sizeof(*i2c))) { - prom_printf("%s: Can't get region %lx, %d\n", - __FUNCTION__, edev->base_address[0], - sizeof(*i2c)); - prom_halt(); + printk("%s: Can't get region %lx, %d\n", + __FUNCTION__, edev->base_address[0], (int)sizeof(*i2c)); + return -ENODEV; } - request_region(edev->base_address[0], - sizeof(*i2c), "i2c"); - i2c = (struct pcf8584_reg *)edev->base_address[0]; + request_region((unsigned long)i2c, sizeof(*i2c), "i2c"); + i2c->csr = CONTROL_PIN; i2c->data = PCF8584_ADDRESS; i2c->csr = CONTROL_PIN | CONTROL_ES1; i2c->data = CLK_4_43 | BUS_CLK_90; i2c->csr = CONTROL_PIN | CONTROL_ES0 | CONTROL_ACK; - udelay(10000); + mdelay(10); + + if (misc_register(&envctrl_dev)) { + printk("%s: unable to get misc minor %d\n", + __FUNCTION__, envctrl_dev.minor); + release_region((unsigned long)i2c, sizeof(*i2c)); + } - return scan_bus(); + return i2c_scan_bus(); #else return -ENODEV; #endif @@ -237,5 +362,7 @@ __initfunc(int envctrl_init(void)) #ifdef MODULE void cleanup_module(void) { + misc_deregister(&envctrl_dev); + release_region((unsigned long)i2c, sizeof(*i2c)); } #endif diff --git a/drivers/sbus/char/fb.h b/drivers/sbus/char/fb.h deleted file mode 100644 index ea58a6346..000000000 --- a/drivers/sbus/char/fb.h +++ /dev/null @@ -1,233 +0,0 @@ -/* $Id: fb.h,v 1.33 1997/08/25 07:50:29 jj Exp $ - * fb.h: contains the definitions of the structures that various sun - * frame buffer can use to do console driver stuff. - * - * (C) 1996 Dave Redman (djhr@tadpole.co.uk) - * (C) 1996 Miguel de Icaza (miguel@nuclecu.unam.mx) - * (C) 1996 David Miller (davem@rutgers.edu) - * (C) 1996 Peter Zaitcev (zaitcev@lab.ipmce.su) - * (C) 1996 Eddie C. Dost (ecd@skynet.be) - * (C) 1996 Jakub Jelinek (jj@sunsite.mff.cuni.cz) - */ - -#ifndef __SPARC_FB_H_ -#define __SPARC_FB_H_ - -#include <linux/init.h> - -#define FRAME_BUFFERS 8 -#define CHAR_WIDTH 8 -#define CHAR_HEIGHT 16 - -/* Change this if we run into problems if the kernel want's to free or - * use our frame buffer pages, never seen it though. - */ -#define FB_MMAP_VM_FLAGS (VM_SHM| VM_LOCKED) - -#undef color - -/* cursor status, kernel tracked copy */ -struct cg_cursor { - short enable; /* cursor is enabled */ - struct fbcurpos cpos; /* position */ - struct fbcurpos chot; /* hot-spot */ - struct fbcurpos size; /* size of mask & image fields */ - struct fbcurpos hwsize; /* hw max size */ - int bits[2][128]; /* space for mask & image bits */ - char color [6]; /* cursor colors */ -}; - -struct cg6_info { - struct bt_regs *bt; /* color control */ - struct cg6_fbc *fbc; - unsigned int *fhc; - struct cg6_tec *tec; - struct cg6_thc *thc; - void *dhc; - unsigned char *rom; -}; - -struct tcx_info { - struct bt_regs *bt; /* color control */ - struct tcx_tec *tec; - struct tcx_thc *thc; - void *tcx_cplane; - int tcx_sizes[13]; - long tcx_offsets[13]; - int lowdepth; -}; - -struct ffb_info { - unsigned long physbase; - struct ffb_fbc *fbc; - struct ffb_dac *dac; - int dac_rev; - u32 *clut; -}; - -struct leo_info { - struct leo_cursor *cursor; - struct leo_lc_ss0_krn *lc_ss0_krn; - struct leo_lc_ss0_usr *lc_ss0_usr; - struct leo_lc_ss1_krn *lc_ss1_krn; - struct leo_lc_ss1_usr *lc_ss1_usr; - struct leo_ld_ss0 *ld_ss0; - struct leo_ld_ss1 *ld_ss1; - struct leo_ld_gbl *ld_gbl; - struct leo_lx_krn *lx_krn; - u32 *cluts[3]; - u8 *xlut; - unsigned long offset; -}; - -struct bwtwo_info { - struct bwtwo_regs *regs; -}; - -struct cg3_info { - struct cg3_regs *regs; /* brooktree (color) registers, and more */ - int cgrdi; /* 1 if this is a cgRDI */ -}; - -struct cg14_info { - struct cg14_regs *regs; - struct cg14_cursor *cursor_regs; - struct cg14_dac *dac; - struct cg14_xlut *xlut; - struct cg14_clut *clut; - int ramsize; - int video_mode; -}; - -typedef union -{ - unsigned int bt[8]; - unsigned char ibm[8]; -} dacptr; - -struct weitek_info -{ - int p9000; /* p9000? or p9100 */ - dacptr *dac; /* dac structures */ - unsigned int fbsize; /* size of frame buffer */ -}; - -/* Array holding the information for the frame buffers */ -typedef struct fbinfo { - union { - struct bwtwo_info bwtwo; - struct cg3_info cg3; - struct cg6_info cg6; - struct cg14_info cg14; - struct tcx_info tcx; - struct leo_info leo; - struct ffb_info ffb; - void *private; - } info; /* per frame information */ - int space; /* I/O space this card resides in */ - int blanked; /* true if video blanked */ - int open; /* is this fb open? */ - int mmaped; /* has this fb been mmapped? */ - int vtconsole; /* virtual console where it is opened */ - long base; /* frame buffer base */ - struct fbtype type; /* frame buffer type */ - int real_type; /* real frame buffer FBTYPE* */ - int emulations[4]; /* possible emulations (-1 N/A) */ - int prom_node; /* node of the device in prom tree */ - int base_depth; /* depth of fb->base piece */ - int linebytes; /* number of bytes in a row */ - struct cg_cursor cursor; /* kernel state of hw cursor */ - int (*mmap)(struct inode *, struct file *, struct vm_area_struct *, - long fb_base, struct fbinfo *); - void (*loadcmap)(struct fbinfo *fb, int index, int count); - void (*blank)(struct fbinfo *fb); - void (*unblank)(struct fbinfo *fb); - int (*ioctl)(struct inode *, struct file *, uint, unsigned long, - struct fbinfo *); - void (*reset)(struct fbinfo *fb); - void (*switch_from_graph)(void); - void (*setcursor)(struct fbinfo *); - void (*setcurshape)(struct fbinfo *); - void (*setcursormap)(struct fbinfo *, unsigned char *, - unsigned char *, unsigned char *); - unsigned long (*postsetup)(struct fbinfo *, unsigned long); - void (*clear_fb)(int); - void (*set_other_palette)(int); - void (*blitc)(unsigned short, int, int); - void (*setw)(int, int, unsigned short, int); - void (*cpyw)(int, int, unsigned short *, int); - void (*fill)(int, int, int *); - void (*draw_penguin)(int,int,int); - unsigned char *color_map; - struct openpromfs_dev proc_entry; -} fbinfo_t; - -#define CM(i, j) [3*(i)+(j)] - -extern unsigned char sparc_color_table[]; -extern unsigned char reverse_color_table[]; - -#define CHARATTR_TO_SUNCOLOR(attr) \ - ((reverse_color_table[(attr) >> 12] << 4) | \ - reverse_color_table[((attr) >> 8) & 0x0f]) - -extern fbinfo_t *fbinfo; -extern int fbinfos; - -struct { - char *name; /* prom name */ - int width, height; /* prefered w,h match */ - void (*fbtype)(fbinfo_t *); /* generic device type */ - /* device specific init routine */ - unsigned long (*fbinit)(fbinfo_t *fbinfo, unsigned int addr); -} fb_entry; - -extern int fb_init(void); - -extern void (*fb_restore_palette)(fbinfo_t *fbinfo); -extern void (*fb_hide_cursor)(int cursor_pos); -extern void (*fb_set_cursor)(int oldpos, int idx); -extern void (*fb_clear_screen)( void ); -extern void (*fb_blitc)(unsigned char *, int, unsigned int *, unsigned int); -extern void (*fb_font_init)(unsigned char *font); -/* All framebuffers are likely to require this info */ - -/* Screen dimensions and color depth. */ -extern int con_depth, con_width; -extern int con_height, con_linebytes; -extern int ints_per_line; - -/* used in the mmap routines */ -extern unsigned long get_phys (unsigned long addr); -extern int get_iospace (unsigned long addr); -extern void render_screen(void); - -extern void sbus_hw_hide_cursor(void); -extern void sbus_hw_set_cursor(int, int); -extern int sbus_hw_scursor(struct fbcursor *,fbinfo_t *); -extern int sbus_hw_cursor_shown; -extern int sun_prom_console_id; - -extern unsigned long cg_postsetup(fbinfo_t *, unsigned long); - -#define FB_DEV(x) (MINOR(x) / 32) - -extern void cg3_setup (fbinfo_t *, int, u32, int, struct linux_sbus_device *); -extern void cg6_setup (fbinfo_t *, int, u32, int); -extern void cg14_setup (fbinfo_t *, int, int, u32, int); -extern void bwtwo_setup (fbinfo_t *, int, u32, int, - struct linux_sbus_device *); -extern void leo_setup (fbinfo_t *, int, u32, int); -extern void tcx_setup (fbinfo_t *, int, int, u32, struct linux_sbus_device *); -extern void creator_setup (fbinfo_t *, int, int, unsigned long, int); -extern int io_remap_page_range(unsigned long from, unsigned long offset, unsigned long size, pgprot_t prot, int space); - -extern unsigned char linux_logo_red[]; -extern unsigned char linux_logo_green[]; -extern unsigned char linux_logo_blue[]; -extern unsigned char linux_logo[]; -extern unsigned char linux_logo_bw[]; -extern unsigned int linux_logo_colors; -extern char logo_banner[]; - -#endif __SPARC_FB_H_ diff --git a/drivers/sbus/char/flash.c b/drivers/sbus/char/flash.c index 435a0f57b..0a09e07e2 100644 --- a/drivers/sbus/char/flash.c +++ b/drivers/sbus/char/flash.c @@ -1,4 +1,4 @@ -/* $Id: flash.c,v 1.7 1998/03/10 20:19:05 jj Exp $ +/* $Id: flash.c,v 1.9 1998/05/17 06:33:39 ecd Exp $ * flash.c: Allow mmap access to the OBP Flash, for OBP updates. * * Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be) @@ -161,7 +161,7 @@ __initfunc(int flash_init(void)) struct linux_ebus *ebus; struct linux_ebus_device *edev = 0; struct linux_prom_registers regs[2]; - int len, err; + int len, err, nregs; for_all_sbusdev(sdev, sbus) { if (!strcmp(sdev->prom_name, "flashprom")) { @@ -190,22 +190,38 @@ __initfunc(int flash_init(void)) } if (!sdev) { #ifdef CONFIG_PCI - for_all_ebusdev(edev, ebus) - if (!strcmp(edev->prom_name, "flashprom")) - break; + for_each_ebus(ebus) { + for_each_ebusdev(edev, ebus) { + if (!strcmp(edev->prom_name, "flashprom")) + goto ebus_done; + } + } + ebus_done: if (!edev) return -ENODEV; len = prom_getproperty(edev->prom_node, "reg", (void *)regs, sizeof(regs)); - if (len != sizeof(regs)) { + if ((len % sizeof(regs[0])) != 0) { printk("flash: Strange reg property size %d\n", len); return -ENODEV; } + nregs = len / sizeof(regs[0]); + flash.read_base = edev->base_address[0]; flash.read_size = regs[0].reg_size; - flash.write_base = edev->base_address[1]; - flash.write_size = regs[1].reg_size; + + if (nregs == 1) { + flash.write_base = edev->base_address[0]; + flash.write_size = regs[0].reg_size; + } else if (nregs == 2) { + flash.write_base = edev->base_address[1]; + flash.write_size = regs[1].reg_size; + } else { + printk("flash: Strange number of regs %d\n", nregs); + return -ENODEV; + } + flash.busy = 0; #else diff --git a/drivers/sbus/char/leo.c b/drivers/sbus/char/leo.c deleted file mode 100644 index fcbbd3e53..000000000 --- a/drivers/sbus/char/leo.c +++ /dev/null @@ -1,703 +0,0 @@ -/* $Id: leo.c,v 1.26 1998/03/10 20:18:29 jj Exp $ - * leo.c: SUNW,leo 24/8bit frame buffer driver - * - * Copyright (C) 1996,1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz) - * Copyright (C) 1997 Michal Rehacek (Michal.Rehacek@st.mff.cuni.cz) - */ - -#include <linux/kd.h> -#include <linux/tty.h> -#include <linux/malloc.h> -#include <linux/proc_fs.h> -#include <linux/delay.h> - -#include <asm/sbus.h> -#include <asm/io.h> -#include <asm/fbio.h> -#include <asm/pgtable.h> -#include <asm/uaccess.h> - -/* These must be included after asm/fbio.h */ -#include <linux/vt_kern.h> -#include <linux/selection.h> -#include <linux/console_struct.h> -#include "fb.h" -#include "cg_common.h" - -#define LEO_OFF_LC_SS0_KRN 0x00200000 -#define LEO_OFF_LC_SS0_USR 0x00201000 -#define LEO_OFF_LC_SS1_KRN 0x01200000 -#define LEO_OFF_LC_SS1_USR 0x01201000 -#define LEO_OFF_LD_SS0 0x00400000 -#define LEO_OFF_LD_SS1 0x01400000 -#define LEO_OFF_LD_GBL 0x00401000 -#define LEO_OFF_LX_KRN 0x00600000 -#define LEO_OFF_LX_CURSOR 0x00601000 -#define LEO_OFF_SS0 0x00800000 -#define LEO_OFF_SS1 0x01800000 -#define LEO_OFF_UNK 0x00602000 -#define LEO_OFF_UNK2 0x00000000 - -#define LEO_CUR_ENABLE 0x00000080 -#define LEO_CUR_UPDATE 0x00000030 -#define LEO_CUR_PROGRESS 0x00000006 -#define LEO_CUR_UPDATECMAP 0x00000003 - -#define LEO_CUR_TYPE_MASK 0x00000000 -#define LEO_CUR_TYPE_IMAGE 0x00000020 -#define LEO_CUR_TYPE_CMAP 0x00000050 - -struct leo_cursor { - u8 xxx0[16]; - volatile u32 cur_type; - volatile u32 cur_misc; - volatile u32 cur_cursxy; - volatile u32 cur_data; -}; - -#define LEO_KRN_TYPE_CLUT0 0x00001000 -#define LEO_KRN_TYPE_CLUT1 0x00001001 -#define LEO_KRN_TYPE_CLUT2 0x00001002 -#define LEO_KRN_TYPE_WID 0x00001003 -#define LEO_KRN_TYPE_UNK 0x00001006 -#define LEO_KRN_TYPE_VIDEO 0x00002003 -#define LEO_KRN_TYPE_CLUTDATA 0x00004000 -#define LEO_KRN_CSR_ENABLE 0x00000008 -#define LEO_KRN_CSR_PROGRESS 0x00000004 -#define LEO_KRN_CSR_UNK 0x00000002 -#define LEO_KRN_CSR_UNK2 0x00000001 - -struct leo_lx_krn { - volatile u32 krn_type; - volatile u32 krn_csr; - volatile u32 krn_value; -}; - -struct leo_lc_ss0_krn { - volatile u32 misc; - u8 xxx0[0x800-4]; - volatile u32 rev; -}; - -struct leo_lc_ss0_usr { - volatile u32 csr; - volatile u32 attrs; - volatile u32 fontc; - volatile u32 fontc2; - volatile u32 extent; - volatile u32 src; - u32 xxx1[1]; - volatile u32 copy; - volatile u32 fill; -}; - -struct leo_lc_ss1_krn { - u8 unknown; -}; - -struct leo_lc_ss1_usr { - u8 unknown; -}; - -struct leo_ld_ss0 { - u8 xxx0[0xe00]; - u32 xxx1[2]; - volatile u32 unk; - u32 xxx2[1]; - volatile u32 unk2; - volatile u32 unk3; - u32 xxx3[2]; - volatile u32 fg; - volatile u32 bg; - u8 xxx4[0x05c]; - volatile u32 planemask; - volatile u32 rop; -}; - -#define LEO_SS1_MISC_ENABLE 0x00000001 -#define LEO_SS1_MISC_STEREO 0x00000002 -struct leo_ld_ss1 { - u8 xxx0[0xef4]; - volatile u32 ss1_misc; -}; - -struct leo_ld_gbl { - u8 unknown; -}; - -static void leo_blitc(unsigned short, int, int); -static void leo_setw(int, int, unsigned short, int); -static void leo_cpyw(int, int, unsigned short *, int); -static void leo_fill(int, int, int *); -static void leo_penguin(int,int,int); - -static void -leo_restore_palette (fbinfo_t *fb) -{ - fb->info.leo.ld_ss1->ss1_misc &= ~(LEO_SS1_MISC_ENABLE); -} - -/* Ugh: X wants to mmap a bunch of cute stuff at the same time :-( */ -/* So, we just mmap the things that are being asked for */ -static int -leo_mmap (struct inode *inode, struct file *file, struct vm_area_struct *vma, - long base, fbinfo_t *fb) -{ - uint size, page, r, map_size = 0; - unsigned long map_offset = 0; - - size = vma->vm_end - vma->vm_start; - if (vma->vm_offset & ~PAGE_MASK) - return -ENXIO; - - /* To stop the swapper from even considering these pages */ - vma->vm_flags |= FB_MMAP_VM_FLAGS; - - /* Each page, see which map applies */ - for (page = 0; page < size; ){ - switch (vma->vm_offset+page){ - case LEO_SS0_MAP: - map_size = 0x800000; - map_offset = get_phys ((unsigned long)fb->base); - break; - case LEO_LC_SS0_USR_MAP: - map_size = PAGE_SIZE; - map_offset = get_phys ((unsigned long)fb->info.leo.lc_ss0_usr); - break; - case LEO_LD_SS0_MAP: - map_size = PAGE_SIZE; - map_offset = get_phys ((unsigned long)fb->info.leo.ld_ss0); - break; - case LEO_LX_CURSOR_MAP: - map_size = PAGE_SIZE; - map_offset = get_phys ((unsigned long)fb->info.leo.cursor); - break; - case LEO_SS1_MAP: - map_size = 0x800000; - map_offset = fb->info.leo.offset + LEO_OFF_SS1; - break; - case LEO_LC_SS1_USR_MAP: - map_size = PAGE_SIZE; - map_offset = get_phys ((unsigned long)fb->info.leo.lc_ss1_usr); - break; - case LEO_LD_SS1_MAP: - map_size = PAGE_SIZE; - map_offset = get_phys ((unsigned long)fb->info.leo.ld_ss1); - break; - case LEO_UNK_MAP: - map_size = PAGE_SIZE; - map_offset = fb->info.leo.offset + LEO_OFF_UNK; - break; - case LEO_LX_KRN_MAP: - map_size = PAGE_SIZE; - map_offset = get_phys ((unsigned long)fb->info.leo.lx_krn); - break; - case LEO_LC_SS0_KRN_MAP: - map_size = PAGE_SIZE; - map_offset = get_phys ((unsigned long)fb->info.leo.lc_ss0_krn); - break; - case LEO_LC_SS1_KRN_MAP: - map_size = PAGE_SIZE; - map_offset = get_phys ((unsigned long)fb->info.leo.lc_ss1_krn); - break; - case LEO_LD_GBL_MAP: - map_size = PAGE_SIZE; - map_offset = get_phys ((unsigned long)fb->info.leo.ld_gbl); - break; - case LEO_UNK2_MAP: - map_size = 0x100000; - map_offset = fb->info.leo.offset + LEO_OFF_UNK2; - break; - } - if (!map_size){ - page += PAGE_SIZE; - continue; - } - if (page + map_size > size) - map_size = size - page; - r = io_remap_page_range (vma->vm_start+page, - map_offset, - map_size, vma->vm_page_prot, - fb->space); - if (r) - return -EAGAIN; - page += map_size; - } - - vma->vm_file = file; - file->f_count++; - return 0; -} - -static void -leo_setcursormap (fbinfo_t *fb, unsigned char *red, - unsigned char *green, - unsigned char *blue) -{ - struct leo_cursor *l = fb->info.leo.cursor; - int i; - - for (i = 0; (l->cur_misc & LEO_CUR_PROGRESS) && i < 300000; i++) - udelay (1); /* Busy wait at most 0.3 sec */ - if (i == 300000) return; /* Timed out - should we print some message? */ - l->cur_type = LEO_CUR_TYPE_CMAP; - l->cur_data = (red[0] | (green[0]<<8) | (blue[0]<<16)); - l->cur_data = (red[1] | (green[1]<<8) | (blue[1]<<16)); - l->cur_misc = LEO_CUR_UPDATECMAP; -} - -/* Load cursor information */ -static void -leo_setcursor (fbinfo_t *fb) -{ - struct cg_cursor *c = &fb->cursor; - struct leo_cursor *l = fb->info.leo.cursor; - - l->cur_misc &= ~LEO_CUR_ENABLE; - l->cur_cursxy = ((c->cpos.fbx - c->chot.fbx) & 0x7ff) - |(((c->cpos.fby - c->chot.fby) & 0x7ff) << 11); - l->cur_misc |= LEO_CUR_UPDATE; - if (c->enable) - l->cur_misc |= LEO_CUR_ENABLE; -} - -/* Set cursor shape */ -static void -leo_setcurshape (fbinfo_t *fb) -{ - int i, j, k; - u32 m, n, mask; - struct leo_cursor *l = fb->info.leo.cursor; - - l->cur_misc &= ~LEO_CUR_ENABLE; - for (k = 0; k < 2; k ++) { - l->cur_type = (k * LEO_CUR_TYPE_IMAGE); /* LEO_CUR_TYPE_MASK is 0 */ - for (i = 0; i < 32; i++) { - mask = 0; - m = fb->cursor.bits[k][i]; - /* mask = m with reversed bit order */ - for (j = 0, n = 1; j < 32; j++, n <<= 1) - if (m & n) - mask |= (0x80000000 >> j); - l->cur_data = mask; - } - } - l->cur_misc |= LEO_CUR_ENABLE; -} - -static void -leo_blank (fbinfo_t *fb) -{ - fb->info.leo.lx_krn->krn_type = LEO_KRN_TYPE_VIDEO; - fb->info.leo.lx_krn->krn_csr &= ~LEO_KRN_CSR_ENABLE; -} - -static void -leo_unblank (fbinfo_t *fb) -{ - fb->info.leo.lx_krn->krn_type = LEO_KRN_TYPE_VIDEO; - if (!(fb->info.leo.lx_krn->krn_csr & LEO_KRN_CSR_ENABLE)) - fb->info.leo.lx_krn->krn_csr |= LEO_KRN_CSR_ENABLE; -} - -static int leo_wait (struct leo_lx_krn *lx_krn) -{ - int i; - for (i = 0; (lx_krn->krn_csr & LEO_KRN_CSR_PROGRESS) && i < 300000; i++) - udelay (1); /* Busy wait at most 0.3 sec */ - if (i == 300000) return -EFAULT; /* Timed out - should we print some message? */ - return 0; -} - -static int -leo_wid_get (fbinfo_t *fb, struct fb_wid_list *wl) -{ - struct leo_lx_krn *lx_krn = fb->info.leo.lx_krn; - struct fb_wid_item *wi; - int i, j; - u32 l; - - lx_krn->krn_type = LEO_KRN_TYPE_WID; - i = leo_wait (lx_krn); - if (i) return i; - lx_krn->krn_csr &= ~LEO_KRN_CSR_UNK2; - lx_krn->krn_csr |= LEO_KRN_CSR_UNK; - lx_krn->krn_type = LEO_KRN_TYPE_WID; - i = leo_wait (lx_krn); - if (i) return i; - for (i = 0, wi = wl->wl_list; i < wl->wl_count; i++, wi++) { - switch (wi->wi_type) { - case FB_WID_DBL_8: j = (wi->wi_index & 0xf) + 0x40; break; - case FB_WID_DBL_24: j = wi->wi_index & 0x3f; break; - default: return -EINVAL; - } - wi->wi_attrs = 0xffff; - lx_krn->krn_type = 0x5800 + j; - l = lx_krn->krn_value; - for (j = 0; j < 32; j++) - wi->wi_values [j] = l; - } - return 0; -} - -static int -leo_wid_put (fbinfo_t *fb, struct fb_wid_list *wl) -{ - struct leo_lx_krn *lx_krn = fb->info.leo.lx_krn; - struct fb_wid_item *wi; - int i, j; - - lx_krn->krn_type = LEO_KRN_TYPE_WID; - i = leo_wait (lx_krn); - if (i) return i; - for (i = 0, wi = wl->wl_list; i < wl->wl_count; i++, wi++) { - switch (wi->wi_type) { - case FB_WID_DBL_8: j = (wi->wi_index & 0xf) + 0x40; break; - case FB_WID_DBL_24: j = wi->wi_index & 0x3f; break; - default: return -EINVAL; - } - lx_krn->krn_type = 0x5800 + j; - lx_krn->krn_value = wi->wi_values[0]; - } - return 0; -} - -static int leo_clutstore (fbinfo_t *fb, int clutid) -{ - int i; - u32 *clut = fb->info.leo.cluts [clutid]; - struct leo_lx_krn *lx_krn = fb->info.leo.lx_krn; - - lx_krn->krn_type = LEO_KRN_TYPE_CLUT0 + clutid; - i = leo_wait (lx_krn); - if (i) return i; - lx_krn->krn_type = LEO_KRN_TYPE_CLUTDATA; - for (i = 0; i < 256; i++) - lx_krn->krn_value = *clut++; /* Throw colors there :)) */ - lx_krn->krn_type = LEO_KRN_TYPE_CLUT0 + clutid; - lx_krn->krn_csr |= (LEO_KRN_CSR_UNK|LEO_KRN_CSR_UNK2); - return 0; -} - -static int leo_clutpost (fbinfo_t *fb, struct fb_clut *lc) -{ - int xlate = 0, i; - u32 *clut; - u8 *xlut = fb->info.leo.xlut; - - switch (lc->clutid) { - case 0: - case 1: - case 2: break; - case 3: return -EINVAL; /* gamma clut - not yet implemented */ - case 4: return -EINVAL; /* degamma clut - not yet implemented */ - default: return -EINVAL; - } - clut = fb->info.leo.cluts [lc->clutid] + lc->offset; - for (i = 0; i < lc->count; i++) - *clut++ = xlate ? - ((xlut[(u8)(lc->red[i])])|(xlut[(u8)(lc->green[i])]<<8)|(xlut[(u8)(lc->blue[i])]<<16)) : - (((u8)(lc->red[i]))|(((u8)(lc->green[i]))<<8)|(((u8)(lc->blue[i]))<<16)); - return leo_clutstore (fb, lc->clutid); -} - -static int leo_clutread (fbinfo_t *fb, struct fb_clut *lc) -{ - int i; - u32 u; - struct leo_lx_krn *lx_krn = fb->info.leo.lx_krn; - - if (lc->clutid >= 3) return -EINVAL; - lx_krn->krn_type = LEO_KRN_TYPE_CLUT0 + lc->clutid; - i = leo_wait (lx_krn); - if (i) return i; - lx_krn->krn_csr &= ~LEO_KRN_CSR_UNK2; - lx_krn->krn_csr |= LEO_KRN_CSR_UNK; - i = leo_wait (lx_krn); - if (i) return i; - lx_krn->krn_type = LEO_KRN_TYPE_CLUTDATA; - for (i = 0; i < lc->offset; i++) - u = lx_krn->krn_value; - for (i = 0; i < lc->count; i++) { - u = lx_krn->krn_value; - lc->red [i] = u; - lc->green [i] = (u >> 8); - lc->blue [i] = (u >> 16); - } - return 0; -} - -static void -leo_loadcmap (fbinfo_t *fb, int index, int count) -{ - u32 *clut = ((u32 *)fb->info.leo.cluts [0]) + index; - int i; - - for (i = index; count--; i++) - *clut++ = ((fb->color_map CM(i,0))) | - ((fb->color_map CM(i,1)) << 8) | - ((fb->color_map CM(i,2)) << 16); - leo_clutstore (fb, 0); -} - -/* Handle leo-specific ioctls */ -static int -leo_ioctl (struct inode *inode, struct file *file, unsigned cmd, unsigned long arg, fbinfo_t *fb) -{ - int i; - - switch (cmd) { - case FBIO_WID_GET: - i = verify_area (VERIFY_READ, (void *)arg, sizeof (struct fb_wid_list)); - if (i) return i; - if (((struct fb_wid_list *)arg)->wl_count != 1 || - !((struct fb_wid_list *)arg)->wl_list) return -EINVAL; - i = verify_area (VERIFY_WRITE, (void *)(((struct fb_wid_list *)arg)->wl_list), - ((struct fb_wid_list *)arg)->wl_count * sizeof (struct fb_wid_item)); - if (i) return i; - return leo_wid_get (fb, (struct fb_wid_list *)arg); - case FBIO_WID_PUT: - i = verify_area (VERIFY_READ, (void *)arg, sizeof (struct fb_wid_list)); - if (i) return i; - if (((struct fb_wid_list *)arg)->wl_count != 1 || - !((struct fb_wid_list *)arg)->wl_list) return -EINVAL; - i = verify_area (VERIFY_WRITE, (void *)(((struct fb_wid_list *)arg)->wl_list), - ((struct fb_wid_list *)arg)->wl_count * sizeof (struct fb_wid_item)); - if (i) return i; - return leo_wid_put (fb, (struct fb_wid_list *)arg); - case LEO_CLUTPOST: - i = verify_area (VERIFY_READ, (void *)arg, sizeof (struct fb_clut)); - if (i) return i; - i = ((struct fb_clut *)arg)->offset + ((struct fb_clut *)arg)->count; - if (i <= 0 || i > 256) return -EINVAL; - i = verify_area (VERIFY_READ, ((struct fb_clut *)arg)->red, ((struct fb_clut *)arg)->count); - if (i) return i; - i = verify_area (VERIFY_READ, ((struct fb_clut *)arg)->green, ((struct fb_clut *)arg)->count); - if (i) return i; - i = verify_area (VERIFY_READ, ((struct fb_clut *)arg)->blue, ((struct fb_clut *)arg)->count); - if (i) return i; - return leo_clutpost (fb, (struct fb_clut *)arg); - case LEO_CLUTREAD: - i = verify_area (VERIFY_READ, (void *)arg, sizeof (struct fb_clut)); - if (i) return i; - i = ((struct fb_clut *)arg)->offset + ((struct fb_clut *)arg)->count; - if (i <= 0 || i > 256) return -EINVAL; - i = verify_area (VERIFY_WRITE, ((struct fb_clut *)arg)->red, ((struct fb_clut *)arg)->count); - if (i) return i; - i = verify_area (VERIFY_WRITE, ((struct fb_clut *)arg)->green, ((struct fb_clut *)arg)->count); - if (i) return i; - i = verify_area (VERIFY_WRITE, ((struct fb_clut *)arg)->blue, ((struct fb_clut *)arg)->count); - if (i) return i; - return leo_clutread (fb, (struct fb_clut *)arg); - - default: - return -ENOSYS; - } -} - -static void -leo_reset (fbinfo_t *fb) -{ - if (fb == &fbinfo[0]) - sbus_hw_hide_cursor (); -} - - -__initfunc(static unsigned long leo_postsetup (fbinfo_t *fb, unsigned long memory_start)) -{ - fb->info.leo.cluts[0] = (u32 *)(memory_start); - fb->info.leo.cluts[1] = (u32 *)(memory_start+256*4); - fb->info.leo.cluts[2] = (u32 *)(memory_start+256*4*2); - fb->info.leo.xlut = (u8 *)(memory_start+256*4*3); - fb->color_map = (u8 *)(memory_start+256*4*3+256); - return memory_start + (256*4*3) + 256 + 256*3; -} - -__initfunc(void leo_setup (fbinfo_t *fb, int slot, u32 leo, int leo_io)) -{ - struct leo_info *leoinfo; - int i; - struct fb_wid_item wi; - struct fb_wid_list wl; - - printk ("leo%d at 0x%8.8x ", slot, leo); - - /* Fill in parameters we left out */ - fb->type.fb_size = 0x800000; /* 8MB */ - fb->type.fb_cmsize = 256; - fb->mmap = leo_mmap; - fb->loadcmap = leo_loadcmap; - fb->postsetup = leo_postsetup; - fb->ioctl = (void *)leo_ioctl; - fb->reset = leo_reset; - fb->blank = leo_blank; - fb->unblank = leo_unblank; - fb->setcursor = leo_setcursor; - fb->setcursormap = leo_setcursormap; - fb->setcurshape = leo_setcurshape; - fb->blitc = leo_blitc; - fb->setw = leo_setw; - fb->cpyw = leo_cpyw; - fb->fill = leo_fill; - fb->draw_penguin = leo_penguin; - fb->base_depth = 0; - - leoinfo = (struct leo_info *) &fb->info.leo; - - memset (leoinfo, 0, sizeof(struct leo_info)); - - leoinfo->offset = leo; - /* Map the hardware registers */ - leoinfo->lc_ss0_krn = sparc_alloc_io(leo + LEO_OFF_LC_SS0_KRN, 0, - PAGE_SIZE,"leo_lc_ss0_krn", fb->space, 0); - leoinfo->lc_ss0_usr = sparc_alloc_io(leo + LEO_OFF_LC_SS0_USR, 0, - PAGE_SIZE,"leo_lc_ss0_usr", fb->space, 0); - leoinfo->lc_ss1_krn = sparc_alloc_io(leo + LEO_OFF_LC_SS1_KRN, 0, - PAGE_SIZE,"leo_lc_ss1_krn", fb->space, 0); - leoinfo->lc_ss1_usr = sparc_alloc_io(leo + LEO_OFF_LC_SS1_USR, 0, - PAGE_SIZE,"leo_lc_ss1_usr", fb->space, 0); - leoinfo->ld_ss0 = sparc_alloc_io(leo + LEO_OFF_LD_SS0, 0, - PAGE_SIZE,"leo_ld_ss0", fb->space, 0); - leoinfo->ld_ss1 = sparc_alloc_io(leo + LEO_OFF_LD_SS1, 0, - PAGE_SIZE,"leo_ld_ss1", fb->space, 0); - leoinfo->ld_gbl = sparc_alloc_io(leo + LEO_OFF_LD_GBL, 0, - PAGE_SIZE,"leo_ld_gbl", fb->space, 0); - leoinfo->lx_krn = sparc_alloc_io(leo + LEO_OFF_LX_KRN, 0, - PAGE_SIZE,"leo_lx_krn", fb->space, 0); - leoinfo->cursor = sparc_alloc_io(leo + LEO_OFF_LX_CURSOR, 0, - sizeof(struct leo_cursor),"leo_lx_crsr", fb->space, 0); - fb->base = (long)sparc_alloc_io(leo + LEO_OFF_SS0, 0, - 0x800000,"leo_ss0", fb->space, 0); - - leoinfo->ld_ss0->unk = 0xffff; - leoinfo->ld_ss0->unk2 = 0; - leoinfo->ld_ss0->unk3 = (fb->type.fb_width - 1) | ((fb->type.fb_height - 1) << 16); - wl.wl_count = 1; - wl.wl_list = &wi; - wi.wi_type = FB_WID_DBL_8; - wi.wi_index = 0; - wi.wi_values [0] = 0x2c0; - leo_wid_put (fb, &wl); - wi.wi_index = 1; - wi.wi_values [0] = 0x30; - leo_wid_put (fb, &wl); - wi.wi_index = 2; - wi.wi_values [0] = 0x20; - leo_wid_put (fb, &wl); - - leoinfo->ld_ss1->ss1_misc |= LEO_SS1_MISC_ENABLE; - - leoinfo->ld_ss0->fg = 0x30703; - leoinfo->ld_ss0->planemask = 0xff000000; - leoinfo->ld_ss0->rop = 0xd0840; - leoinfo->lc_ss0_usr->extent = (fb->type.fb_width-1) | ((fb->type.fb_height-1) << 11); - i = leoinfo->lc_ss0_usr->attrs; - leoinfo->lc_ss0_usr->fill = (0) | ((0) << 11) | ((i & 3) << 29) | ((i & 8) ? 0x80000000 : 0); - do { - i = leoinfo->lc_ss0_usr->csr; - } while (i & 0x20000000); - - if (slot == sun_prom_console_id) - fb_restore_palette = leo_restore_palette; - - printk("Cmd Rev %d\n", - (leoinfo->lc_ss0_krn->rev >> 28)); - - /* Reset the leo */ - leo_reset(fb); - - if (!slot) - /* Enable Video */ - leo_unblank (fb); - else if (slot != sun_prom_console_id) - leo_blank (fb); -} - -extern unsigned char vga_font []; - -#define GX_BLITC_START(attr,x,y,count) \ - { \ - register struct leo_lc_ss0_usr *us = fbinfo[0].info.leo.lc_ss0_usr; \ - register struct leo_ld_ss0 *ss = fbinfo[0].info.leo.ld_ss0; \ - register u32 i; \ - do { \ - i = us->csr; \ - } while (i & 0x20000000); \ - ss->fg = (attr & 0xf) << 24; \ - ss->bg = (attr >> 4) << 24; \ - ss->rop = 0x310040; \ - ss->planemask = 0xff000000; \ - us->fontc2 = 0xFFFFFFFE; \ - us->attrs = 4; \ - us->fontc = 0xFF000000; -#define GX_BLITC_END \ - } - -static void leo_blitc(unsigned short charattr, int xoff, int yoff) -{ - unsigned char attrib = CHARATTR_TO_SUNCOLOR(charattr); - unsigned char *p = &vga_font[((unsigned char)charattr) << 4]; - u32 *u = ((u32 *)fbinfo[0].base) + (yoff << 11) + xoff; - GX_BLITC_START(attrib, xoff, yoff, 1) - for (i = 0; i < CHAR_HEIGHT; i++, u += 2048) - *u = (*p++) << 24; - GX_BLITC_END -} - -static void leo_setw(int xoff, int yoff, unsigned short c, int count) -{ - unsigned char attrib = CHARATTR_TO_SUNCOLOR(c); - unsigned char *p = &vga_font[((unsigned char)c) << 4]; - register unsigned char *q; - u32 *u = ((u32 *)fbinfo[0].base) + (yoff << 11) + xoff; - GX_BLITC_START(attrib, xoff, yoff, count) - while (count-- > 0) { - q = p; - for (i = 0; i < CHAR_HEIGHT; i++, u += 2048) - *u = (*q++) << 24; - u += 8 - (CHAR_HEIGHT * 2048); - } - GX_BLITC_END -} - -static void leo_cpyw(int xoff, int yoff, unsigned short *p, int count) -{ - unsigned char attrib = CHARATTR_TO_SUNCOLOR(*p); - register unsigned char *q; - u32 *u = ((u32 *)fbinfo[0].base) + (yoff << 11) + xoff; - GX_BLITC_START(attrib, xoff, yoff, count) - while (count-- > 0) { - q = &vga_font[((unsigned char)*p++) << 4]; - for (i = 0; i < CHAR_HEIGHT; i++, u += 2048) - *u = (*q++) << 24; - u += 8 - (CHAR_HEIGHT * 2048); - } - GX_BLITC_END -} - -static void leo_fill(int attrib, int count, int *boxes) -{ - register struct leo_lc_ss0_usr *us = fbinfo[0].info.leo.lc_ss0_usr; - register struct leo_ld_ss0 *ss = fbinfo[0].info.leo.ld_ss0; - register u32 i; - do { - i = us->csr; - } while (i & 0x20000000); - ss->unk = 0xffff; - ss->unk2 = 0; - ss->unk3 = (fbinfo[0].type.fb_width - 1) | ((fbinfo[0].type.fb_height - 1) << 16); - ss->fg = ((attrib & 0xf)<<24) | 0x030703; - ss->planemask = 0xff000000; - ss->rop = 0xd0840; - while (count-- > 0) { - us->extent = ((boxes[2] - boxes[0] - 1) & 0x7ff) | (((boxes[3] - boxes[1] - 1) & 0x7ff) << 11); - i = us->attrs; - us->fill = (boxes[0] & 0x7ff) | ((boxes[1] & 0x7ff) << 11) | ((i & 3) << 29) | ((i & 8) ? 0x80000000 : 0); - } -} - -__initfunc(void leo_penguin(int x_margin, int y_margin, int ncpus)) -{ - suncons_ops.clear_screen(); - /* FIXME: Write this */ -} diff --git a/drivers/sbus/char/mach64.c b/drivers/sbus/char/mach64.c deleted file mode 100644 index fcce8887d..000000000 --- a/drivers/sbus/char/mach64.c +++ /dev/null @@ -1,321 +0,0 @@ -/* $Id: mach64.c,v 1.17 1998/04/06 06:42:23 davem Exp $ - * mach64.c: Ultra/PCI Mach64 console driver. - * - * Just about all of this is from the PPC/mac driver, see that for - * author info. I'm only responsible for grafting it into working - * on PCI Ultra's. The two drivers should be merged. - * - * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu) - */ - -#include <linux/config.h> /* for CONFIG_CHIP_ID */ -#include <linux/kernel.h> -#include <linux/types.h> -#include <linux/pci.h> -#include <linux/string.h> -#include <linux/tty.h> -#include <linux/console.h> -#include <linux/selection.h> -#include <linux/proc_fs.h> - -#include <asm/oplib.h> -#include <asm/pbm.h> -#include <asm/fbio.h> -#include <asm/sbus.h> -#include <asm/pgtable.h> - -#include "pcicons.h" -#include "mach64.h" -#include "fb.h" - -static unsigned int mach64_pci_membase; -static unsigned int mach64_pci_iobase; - -#define MACH64_LE_FBOFF 0x000000 -#define MACH64_REGOFF 0x7ffc00 -#define MACH64_BE_FBOFF 0x800000 - -static inline void mach64_waitq(int entries) -{ - unsigned short base = (0x8000 >> entries); - - while((pcivga_readl(MACH64_REGOFF + FIFO_STAT) & 0xffff) > base) - barrier(); -} - -static inline void mach64_idle(void) -{ - mach64_waitq(16); - while(pcivga_readl(MACH64_REGOFF + GUI_STAT) & 1) - barrier(); -} - -#if 0 /* not used yet */ -static void mach64_st_514(int offset, char val) -{ - mach64_waitq(5); - pcivga_writeb(1, MACH64_REGOFF + DAC_CNTL); - pcivga_writeb((offset & 0xff), MACH64_REGOFF + DAC_W_INDEX); - pcivga_writeb(((offset>>8)&0xff), MACH64_REGOFF + DAC_DATA); - pcivga_writeb(val, MACH64_REGOFF + DAC_MASK); - pcivga_writeb(0, MACH64_REGOFF + DAC_CNTL); -} - -static void mach64_st_pll(int offset, char val) -{ - mach64_waitq(3); - pcivga_writeb(((offset<<2)|PLL_WR_EN), MACH64_REGOFF + CLOCK_CNTL + 1); - pcivga_writeb(val, MACH64_REGOFF + CLOCK_CNTL + 2); - pcivga_writeb(((offset<<2)&~PLL_WR_EN), MACH64_REGOFF + CLOCK_CNTL + 1); -} -#endif - -static int -mach64_mmap(struct inode *inode, struct file *file, struct vm_area_struct *vma, - long base, fbinfo_t *fb) -{ - unsigned long addr, size; - - size = vma->vm_end - vma->vm_start; - if (vma->vm_offset & ~PAGE_MASK) - return -ENXIO; - - if (vma->vm_offset == (mach64_pci_iobase & PAGE_MASK)) { - addr = __pa((pcivga_iobase & PAGE_MASK)); - size = PAGE_SIZE; - } else if (vma->vm_offset >= (mach64_pci_membase + 0x800000)) { - addr = __pa(pcivga_membase) - mach64_pci_membase - + vma->vm_offset; - pgprot_val(vma->vm_page_prot) |= _PAGE_IE; - } else if (vma->vm_offset >= mach64_pci_membase) { - addr = __pa(pcivga_membase) - mach64_pci_membase - + vma->vm_offset; - } else { - return -EINVAL; - } - - pgprot_val(vma->vm_page_prot) &= ~(_PAGE_CACHE); - pgprot_val(vma->vm_page_prot) |= _PAGE_E; - vma->vm_flags |= (VM_SHM | VM_LOCKED); - - if (remap_page_range(vma->vm_start, addr, size, vma->vm_page_prot)) - return -EAGAIN; - - vma->vm_file = file; - file->f_count++; - return 0; -} - -static void -mach64_loadcmap(fbinfo_t *fb, int index, int count) -{ - unsigned char tmp; - int i; - - mach64_waitq(2); - tmp = pcivga_readb(MACH64_REGOFF + DAC_CNTL); - pcivga_writeb(tmp & 0xfc, MACH64_REGOFF + DAC_CNTL); - pcivga_writeb(0xff, MACH64_REGOFF + DAC_MASK); - for(i = index; count--; i++) { - mach64_waitq(4); - pcivga_writeb(i, MACH64_REGOFF + DAC_W_INDEX); - pcivga_writeb(fb->color_map CM(i, 0), MACH64_REGOFF + DAC_DATA); - pcivga_writeb(fb->color_map CM(i, 1), MACH64_REGOFF + DAC_DATA); - pcivga_writeb(fb->color_map CM(i, 2), MACH64_REGOFF + DAC_DATA); - } - mach64_idle(); -} - -static void -mach64_blank(fbinfo_t *fb) -{ - unsigned char gen_cntl; - - gen_cntl = pcivga_readb(MACH64_REGOFF + CRTC_GEN_CNTL); - gen_cntl |= 0x40; - pcivga_writeb(gen_cntl, MACH64_REGOFF + CRTC_GEN_CNTL); -} - -static void -mach64_unblank(fbinfo_t *fb) -{ - unsigned char gen_cntl; - - gen_cntl = pcivga_readb(MACH64_REGOFF + CRTC_GEN_CNTL); - gen_cntl &= ~(0x4c); - pcivga_writeb(gen_cntl, MACH64_REGOFF + CRTC_GEN_CNTL); -} - -static struct mach64_info mach64; - -void mach64_test(fbinfo_t *fb) -{ - unsigned int x; - int i; - - for (i = 0; i < mach64.total_vram; i += 4) - writel(i, pcivga_membase + i); - - for (i = 0; i < mach64.total_vram; i += 4) - if ((x = readl(pcivga_membase + i)) != i) { - printk("vga mem read error @ %08x: exp %x, rd %x\n", - i, i, x); - i = (i & ~(0xffff)) + 0x10000; - } -} - -int mach64_init(fbinfo_t *fb) -{ - struct pci_dev *pdev; - struct pcidev_cookie *cookie; - struct linux_pbm_info *pbm; - unsigned long addr; - unsigned int tmp; - - memset(&mach64, 0, sizeof(mach64)); - - pdev = pci_find_device(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_264VT, 0); - if(!pdev) - pdev = pci_find_device(PCI_VENDOR_ID_ATI, - PCI_DEVICE_ID_ATI_215GT, 0); - if(!pdev) - return -1; - - addr = pdev->base_address[0]; - pcivga_iobase = pcivga_membase = 0; - if((addr & PCI_BASE_ADDRESS_SPACE) == PCI_BASE_ADDRESS_SPACE_IO) - pcivga_iobase = addr & PCI_BASE_ADDRESS_IO_MASK; - else - pcivga_membase = addr & PCI_BASE_ADDRESS_MEM_MASK; - - addr = pdev->base_address[1]; - if((addr & PCI_BASE_ADDRESS_SPACE) == PCI_BASE_ADDRESS_SPACE_IO) - pcivga_iobase = addr & PCI_BASE_ADDRESS_IO_MASK; - else - pcivga_membase = addr & PCI_BASE_ADDRESS_MEM_MASK; - - if(!pcivga_iobase || !pcivga_membase) { - prom_printf("mach64_init: I/O or MEM baseaddr is missing\n"); - prom_printf("mach64_init: ba[0]=%016lx ba[1]=%016lx\n", - pdev->base_address[0], pdev->base_address[1]); - prom_halt(); - } - - pcibios_read_config_dword(pdev->bus->number, pdev->devfn, - PCI_BASE_ADDRESS_0, &mach64_pci_membase); - mach64_pci_membase &= PCI_BASE_ADDRESS_MEM_MASK; - - pcibios_read_config_dword(pdev->bus->number, pdev->devfn, - PCI_BASE_ADDRESS_1, &mach64_pci_iobase); - mach64_pci_iobase &= PCI_BASE_ADDRESS_IO_MASK; - - printk("mach64_init: IOBASE[%016lx] MEMBASE[%016lx]\n", - pcivga_iobase, pcivga_membase); - - cookie = pdev->sysdata; - pbm = cookie->pbm; - - fb->prom_node = cookie->prom_node; - fb->proc_entry.node = pbm->prom_node; - - fb->type.fb_type = FBTYPE_PCI_MACH64; - fb->type.fb_cmsize = 256; - fb->info.private = (void *)&mach64; - fb->base = pcivga_membase + MACH64_BE_FBOFF; - - mach64.chip_type = pcivga_readl(MACH64_REGOFF + CONFIG_CHIP_ID) - & CFG_CHIP_TYPE; - - if (mach64.chip_type == MACH64_VT_ID) { - /* - * Fix the PROM's idea of MEM_CNTL settings... - */ - tmp = pcivga_readl(MACH64_REGOFF + MEM_CNTL); - switch (tmp & 0xf) { - case 3: - tmp = (tmp & ~(0xf)) | 2; - break; - case 7: - tmp = (tmp & ~(0xf)) | 3; - break; - case 9: - tmp = (tmp & ~(0xf)) | 4; - break; - case 11: - tmp = (tmp & ~(0xf)) | 5; - break; - default: - break; - } - tmp &= ~(0x00f00000); - pcivga_writel(tmp, MACH64_REGOFF + MEM_CNTL); - } - - tmp = pcivga_readl(MACH64_REGOFF + MEM_CNTL); - if (mach64.chip_type != MACH64_GT_ID) { - switch(tmp & MEM_SIZE_ALIAS) { - case MEM_SIZE_512K: - mach64.total_vram = 0x80000; - break; - case MEM_SIZE_1M: - mach64.total_vram = 0x100000; - break; - case MEM_SIZE_2M: - mach64.total_vram = 0x200000; - break; - case MEM_SIZE_4M: - mach64.total_vram = 0x400000; - break; - case MEM_SIZE_6M: - mach64.total_vram = 0x600000; - break; - case MEM_SIZE_8M: - mach64.total_vram = 0x800000; - break; - default: - mach64.total_vram = 0x80000; - break; - } - } else { - switch(tmp & MEM_SIZE_ALIAS_GTB) { - case MEM_SIZE_512K_GTB: - mach64.total_vram = 0x80000; - break; - case MEM_SIZE_1M_GTB: - mach64.total_vram = 0x100000; - break; - case MEM_SIZE_2M_GTB: - mach64.total_vram = 0x200000; - break; - case MEM_SIZE_4M_GTB: - mach64.total_vram = 0x400000; - break; - case MEM_SIZE_6M_GTB: - mach64.total_vram = 0x600000; - break; - case MEM_SIZE_8M_GTB: - mach64.total_vram = 0x800000; - break; - default: - mach64.total_vram = 0x80000; - break; - } - } - - printk("mach64_init: chip_type[%04x], total_vram[%08x]\n", - mach64.chip_type, mach64.total_vram); - -#if 0 - mach64_test(fb); -#endif - - fb->mmap = mach64_mmap; - fb->loadcmap = mach64_loadcmap; - fb->ioctl = 0; - fb->reset = 0; - fb->blank = mach64_blank; - fb->unblank = mach64_unblank; - fb->setcursor = 0; - - return 0; -} diff --git a/drivers/sbus/char/mach64.h b/drivers/sbus/char/mach64.h deleted file mode 100644 index 2b30888e8..000000000 --- a/drivers/sbus/char/mach64.h +++ /dev/null @@ -1,582 +0,0 @@ -/* $Id: mach64.h,v 1.5 1998/04/01 05:52:58 ecd Exp $ - * mach64.h: Ultra/PCI mach64 driver constants etc. - * - * Copyright 1997 David S. Miller (davem@caip.rutgers.edu) - */ - -#ifndef _MACH64_H -#define _MACH64_H 1 - -struct mach64_info { - unsigned int color_mode; - unsigned int chip_type; - unsigned int total_vram; -}; - - -/* NON-GUI MEMORY MAPPED Registers - expressed in BYTE offsets */ - -#define CRTC_H_TOTAL_DISP 0x0000 /* Dword offset 00 */ -#define CRTC_H_SYNC_STRT_WID 0x0004 /* Dword offset 01 */ -#define CRTC_H_SYNC_STRT 0x0004 -#define CRTC_H_SYNC_DLY 0x0005 -#define CRTC_H_SYNC_WID 0x0006 - -#define CRTC_V_TOTAL_DISP 0x0008 /* Dword offset 02 */ -#define CRTC_V_TOTAL 0x0008 -#define CRTC_V_DISP 0x000a -#define CRTC_V_SYNC_STRT_WID 0x000C /* Dword offset 03 */ -#define CRTC_V_SYNC_STRT 0x000c -#define CRTC_V_SYNC_WID 0x000e - -#define CRTC_VLINE_CRNT_VLINE 0x0010 /* Dword offset 04 */ -#define CRTC_OFF_PITCH 0x0014 /* Dword offset 05 */ -#define CRTC_OFFSET 0x0014 -#define CRTC_PITCH 0x0016 - -#define CRTC_INT_CNTL 0x0018 /* Dword offset 06 */ -#define CRTC_GEN_CNTL 0x001C /* Dword offset 07 */ -#define CRTC_PIX_WIDTH 0x001d -#define CRTC_FIFO 0x001e -#define CRTC_EXT_DISP 0x001f - -#define SHARED_CNTL 0x0030 /* Dword offset 0C */ -#define SHARED_MEM_CONFIG 0x0034 /* Dword offset 0D */ - -#define OVR_CLR 0x0040 /* Dword offset 10 */ -#define OVR_WID_LEFT_RIGHT 0x0044 /* Dword offset 11 */ -#define OVR_WID_TOP_BOTTOM 0x0048 /* Dword offset 12 */ - -#define CUR_CLR0 0x0060 /* Dword offset 18 */ -#define CUR_CLR1 0x0064 /* Dword offset 19 */ -#define CUR_OFFSET 0x0068 /* Dword offset 1A */ -#define CUR_HORZ_VERT_POSN 0x006C /* Dword offset 1B */ -#define CUR_HORZ_VERT_OFF 0x0070 /* Dword offset 1C */ - -#define SCRATCH_REG0 0x0080 /* Dword offset 20 */ -#define SCRATCH_REG1 0x0084 /* Dword offset 21 */ - -#define CLOCK_CNTL 0x0090 /* Dword offset 24 */ -#define CLOCK_SEL_CNTL 0x0090 // Dword offset 24 - -#define BUS_CNTL 0x00A0 /* Dword offset 28 */ - -#define EXT_MEM_CNTL 0x00AC /* Dword offset 2B */ -#define MEM_CNTL 0x00B0 /* Dword offset 2C */ - -#define MEM_VGA_WP_SEL 0x00B4 /* Dword offset 2D */ -#define MEM_VGA_RP_SEL 0x00B8 /* Dword offset 2E */ - -#define DAC_REGS 0x00C0 /* Dword offset 30 */ -#define DAC_W_INDEX 0x00C0 /* Dword offset 30 */ -#define DAC_DATA 0x00C1 /* Dword offset 30 */ -#define DAC_MASK 0x00C2 /* Dword offset 30 */ -#define DAC_R_INDEX 0x00C3 /* Dword offset 30 */ -#define DAC_CNTL 0x00C4 /* Dword offset 31 */ - -#define GEN_TEST_CNTL 0x00D0 /* Dword offset 34 */ - -#define CONFIG_CNTL 0x00DC /* Dword offset 37 (CT, ET, VT) */ -#define CONFIG_CHIP_ID 0x00E0 /* Dword offset 38 */ -#define CONFIG_STAT0 0x00E4 /* Dword offset 39 */ -#define CONFIG_STAT1 0x00E8 /* Dword offset 3A */ - - -/* GUI MEMORY MAPPED Registers */ - -#define DST_OFF_PITCH 0x0100 /* Dword offset 40 */ -#define DST_X 0x0104 /* Dword offset 41 */ -#define DST_Y 0x0108 /* Dword offset 42 */ -#define DST_Y_X 0x010C /* Dword offset 43 */ -#define DST_WIDTH 0x0110 /* Dword offset 44 */ -#define DST_HEIGHT 0x0114 /* Dword offset 45 */ -#define DST_HEIGHT_WIDTH 0x0118 /* Dword offset 46 */ -#define DST_X_WIDTH 0x011C /* Dword offset 47 */ -#define DST_BRES_LNTH 0x0120 /* Dword offset 48 */ -#define DST_BRES_ERR 0x0124 /* Dword offset 49 */ -#define DST_BRES_INC 0x0128 /* Dword offset 4A */ -#define DST_BRES_DEC 0x012C /* Dword offset 4B */ -#define DST_CNTL 0x0130 /* Dword offset 4C */ - -#define SRC_OFF_PITCH 0x0180 /* Dword offset 60 */ -#define SRC_X 0x0184 /* Dword offset 61 */ -#define SRC_Y 0x0188 /* Dword offset 62 */ -#define SRC_Y_X 0x018C /* Dword offset 63 */ -#define SRC_WIDTH1 0x0190 /* Dword offset 64 */ -#define SRC_HEIGHT1 0x0194 /* Dword offset 65 */ -#define SRC_HEIGHT1_WIDTH1 0x0198 /* Dword offset 66 */ -#define SRC_X_START 0x019C /* Dword offset 67 */ -#define SRC_Y_START 0x01A0 /* Dword offset 68 */ -#define SRC_Y_X_START 0x01A4 /* Dword offset 69 */ -#define SRC_WIDTH2 0x01A8 /* Dword offset 6A */ -#define SRC_HEIGHT2 0x01AC /* Dword offset 6B */ -#define SRC_HEIGHT2_WIDTH2 0x01B0 /* Dword offset 6C */ -#define SRC_CNTL 0x01B4 /* Dword offset 6D */ - -#define HOST_DATA0 0x0200 /* Dword offset 80 */ -#define HOST_DATA1 0x0204 /* Dword offset 81 */ -#define HOST_DATA2 0x0208 /* Dword offset 82 */ -#define HOST_DATA3 0x020C /* Dword offset 83 */ -#define HOST_DATA4 0x0210 /* Dword offset 84 */ -#define HOST_DATA5 0x0214 /* Dword offset 85 */ -#define HOST_DATA6 0x0218 /* Dword offset 86 */ -#define HOST_DATA7 0x021C /* Dword offset 87 */ -#define HOST_DATA8 0x0220 /* Dword offset 88 */ -#define HOST_DATA9 0x0224 /* Dword offset 89 */ -#define HOST_DATAA 0x0228 /* Dword offset 8A */ -#define HOST_DATAB 0x022C /* Dword offset 8B */ -#define HOST_DATAC 0x0230 /* Dword offset 8C */ -#define HOST_DATAD 0x0234 /* Dword offset 8D */ -#define HOST_DATAE 0x0238 /* Dword offset 8E */ -#define HOST_DATAF 0x023C /* Dword offset 8F */ -#define HOST_CNTL 0x0240 /* Dword offset 90 */ - -#define PAT_REG0 0x0280 /* Dword offset A0 */ -#define PAT_REG1 0x0284 /* Dword offset A1 */ -#define PAT_CNTL 0x0288 /* Dword offset A2 */ - -#define SC_LEFT 0x02A0 /* Dword offset A8 */ -#define SC_RIGHT 0x02A4 /* Dword offset A9 */ -#define SC_LEFT_RIGHT 0x02A8 /* Dword offset AA */ -#define SC_TOP 0x02AC /* Dword offset AB */ -#define SC_BOTTOM 0x02B0 /* Dword offset AC */ -#define SC_TOP_BOTTOM 0x02B4 /* Dword offset AD */ - -#define DP_BKGD_CLR 0x02C0 /* Dword offset B0 */ -#define DP_FRGD_CLR 0x02C4 /* Dword offset B1 */ -#define DP_WRITE_MASK 0x02C8 /* Dword offset B2 */ -#define DP_CHAIN_MASK 0x02CC /* Dword offset B3 */ -#define DP_PIX_WIDTH 0x02D0 /* Dword offset B4 */ -#define DP_MIX 0x02D4 /* Dword offset B5 */ -#define DP_SRC 0x02D8 /* Dword offset B6 */ - -#define CLR_CMP_CLR 0x0300 /* Dword offset C0 */ -#define CLR_CMP_MASK 0x0304 /* Dword offset C1 */ -#define CLR_CMP_CNTL 0x0308 /* Dword offset C2 */ - -#define FIFO_STAT 0x0310 /* Dword offset C4 */ - -#define CONTEXT_MASK 0x0320 /* Dword offset C8 */ -#define CONTEXT_LOAD_CNTL 0x032C /* Dword offset CB */ - -#define GUI_TRAJ_CNTL 0x0330 /* Dword offset CC */ -#define GUI_STAT 0x0338 /* Dword offset CE */ - - -/* CRTC control values (mostly CRTC_GEN_CNTL) */ - -#define CRTC_H_SYNC_NEG 0x00200000 -#define CRTC_V_SYNC_NEG 0x00200000 - -#define CRTC_DBL_SCAN_EN 0x00000001 -#define CRTC_INTERLACE_EN 0x00000002 -#define CRTC_HSYNC_DIS 0x00000004 -#define CRTC_VSYNC_DIS 0x00000008 -#define CRTC_CSYNC_EN 0x00000010 -#define CRTC_PIX_BY_2_EN 0x00000020 -#define CRTC_BLANK 0x00000040 - -#define CRTC_PIX_WIDTH_MASK 0x00000700 -#define CRTC_PIX_WIDTH_4BPP 0x00000100 -#define CRTC_PIX_WIDTH_8BPP 0x00000200 -#define CRTC_PIX_WIDTH_15BPP 0x00000300 -#define CRTC_PIX_WIDTH_16BPP 0x00000400 -#define CRTC_PIX_WIDTH_24BPP 0x00000500 -#define CRTC_PIX_WIDTH_32BPP 0x00000600 - -#define CRTC_BYTE_PIX_ORDER 0x00000800 -#define CRTC_PIX_ORDER_MSN_LSN 0x00000000 -#define CRTC_PIX_ORDER_LSN_MSN 0x00000800 - -#define CRTC_FIFO_LWM 0x000f0000 -#define CRTC_EXT_DISP_EN 0x01000000 -#define CRTC_EXT_EN 0x02000000 - -#define CRTC_CRNT_VLINE 0x07f00000 -#define CRTC_VBLANK 0x00000001 - -/* DAC control values */ - -#define DAC_EXT_SEL_RS2 0x01 -#define DAC_EXT_SEL_RS3 0x02 -#define DAC_8BIT_EN 0x00000100 -#define DAC_PIX_DLY_MASK 0x00000600 -#define DAC_PIX_DLY_0NS 0x00000000 -#define DAC_PIX_DLY_2NS 0x00000200 -#define DAC_PIX_DLY_4NS 0x00000400 -#define DAC_BLANK_ADJ_MASK 0x00001800 -#define DAC_BLANK_ADJ_0 0x00000000 -#define DAC_BLANK_ADJ_1 0x00000800 -#define DAC_BLANK_ADJ_2 0x00001000 - - -/* Mix control values */ - -#define MIX_NOT_DST 0x0000 -#define MIX_0 0x0001 -#define MIX_1 0x0002 -#define MIX_DST 0x0003 -#define MIX_NOT_SRC 0x0004 -#define MIX_XOR 0x0005 -#define MIX_XNOR 0x0006 -#define MIX_SRC 0x0007 -#define MIX_NAND 0x0008 -#define MIX_NOT_SRC_OR_DST 0x0009 -#define MIX_SRC_OR_NOT_DST 0x000a -#define MIX_OR 0x000b -#define MIX_AND 0x000c -#define MIX_SRC_AND_NOT_DST 0x000d -#define MIX_NOT_SRC_AND_DST 0x000e -#define MIX_NOR 0x000f - -/* Maximum engine dimensions */ -#define ENGINE_MIN_X 0 -#define ENGINE_MIN_Y 0 -#define ENGINE_MAX_X 4095 -#define ENGINE_MAX_Y 16383 - -/* Mach64 engine bit constants - these are typically ORed together */ - -/* BUS_CNTL register constants */ -#define BUS_FIFO_ERR_ACK 0x00200000 -#define BUS_HOST_ERR_ACK 0x00800000 - -/* GEN_TEST_CNTL register constants */ -#define GEN_OVR_OUTPUT_EN 0x20 -#define HWCURSOR_ENABLE 0x80 -#define GUI_ENGINE_ENABLE 0x100 -#define BLOCK_WRITE_ENABLE 0x200 - -/* CLOCK_CNTL register constants */ -#define CLOCK_SEL 0x0f -#define CLOCK_DIV 0x30 -#define CLOCK_DIV1 0x00 -#define CLOCK_DIV2 0x10 -#define CLOCK_DIV4 0x20 -#define CLOCK_STROBE 0x40 -#define PLL_WR_EN 0x02 - -/* PLL registers */ -#define PLL_MACRO_CNTL 0x01 -#define PLL_REF_DIV 0x02 -#define PLL_GEN_CNTL 0x03 -#define MCLK_FB_DIV 0x04 -#define PLL_VCLK_CNTL 0x05 -#define VCLK_POST_DIV 0x06 -#define VCLK0_FB_DIV 0x07 -#define VCLK1_FB_DIV 0x08 -#define VCLK2_FB_DIV 0x09 -#define VCLK3_FB_DIV 0x0A -#define PLL_XCLK_CNTL 0x0B -#define PLL_TEST_CTRL 0x0E -#define PLL_TEST_COUNT 0x0F - -/* Fields in PLL registers */ -#define PLL_PC_GAIN 0x07 -#define PLL_VC_GAIN 0x18 -#define PLL_DUTY_CYC 0xE0 -#define PLL_OVERRIDE 0x01 -#define PLL_MCLK_RST 0x02 -#define OSC_EN 0x04 -#define EXT_CLK_EN 0x08 -#define MCLK_SRC_SEL 0x70 -#define EXT_CLK_CNTL 0x80 -#define VCLK_SRC_SEL 0x03 -#define PLL_VCLK_RST 0x04 -#define VCLK_INVERT 0x08 -#define VCLK0_POST 0x03 -#define VCLK1_POST 0x0C -#define VCLK2_POST 0x30 -#define VCLK3_POST 0xC0 - -/* CONFIG_CNTL register constants */ -#define APERTURE_4M_ENABLE 1 -#define APERTURE_8M_ENABLE 2 -#define VGA_APERTURE_ENABLE 4 - -/* CONFIG_STAT0 register constants (GX, CX) */ -#define CFG_BUS_TYPE 0x00000007 -#define CFG_MEM_TYPE 0x00000038 -#define CFG_INIT_DAC_TYPE 0x00000e00 - -/* CONFIG_STAT0 register constants (CT, ET, VT) */ -#define CFG_MEM_TYPE_xT 0x00000007 - -#define ISA 0 -#define EISA 1 -#define LOCAL_BUS 6 -#define PCI 7 - -/* Memory types for GX, CX */ -#define DRAMx4 0 -#define VRAMx16 1 -#define VRAMx16ssr 2 -#define DRAMx16 3 -#define GraphicsDRAMx16 4 -#define EnhancedVRAMx16 5 -#define EnhancedVRAMx16ssr 6 - -/* Memory types for CT, ET, VT, GT */ -#define DRAM 0 -#define EDO_DRAM 1 -#define PSEUDO_EDO 2 -#define SDRAM 3 - -#define DAC_INTERNAL 0x00 -#define DAC_IBMRGB514 0x01 -#define DAC_ATI68875 0x02 -#define DAC_TVP3026_A 0x72 -#define DAC_BT476 0x03 -#define DAC_BT481 0x04 -#define DAC_ATT20C491 0x14 -#define DAC_SC15026 0x24 -#define DAC_MU9C1880 0x34 -#define DAC_IMSG174 0x44 -#define DAC_ATI68860_B 0x05 -#define DAC_ATI68860_C 0x15 -#define DAC_TVP3026_B 0x75 -#define DAC_STG1700 0x06 -#define DAC_ATT498 0x16 -#define DAC_STG1702 0x07 -#define DAC_SC15021 0x17 -#define DAC_ATT21C498 0x27 -#define DAC_STG1703 0x37 -#define DAC_CH8398 0x47 -#define DAC_ATT20C408 0x57 - -#define CLK_ATI18818_0 0 -#define CLK_ATI18818_1 1 -#define CLK_STG1703 2 -#define CLK_CH8398 3 -#define CLK_INTERNAL 4 -#define CLK_ATT20C408 5 -#define CLK_IBMRGB514 6 - -/* MEM_CNTL register constants */ -#define MEM_SIZE_ALIAS 0x00000007 -#define MEM_SIZE_512K 0x00000000 -#define MEM_SIZE_1M 0x00000001 -#define MEM_SIZE_2M 0x00000002 -#define MEM_SIZE_4M 0x00000003 -#define MEM_SIZE_6M 0x00000004 -#define MEM_SIZE_8M 0x00000005 -#define MEM_SIZE_ALIAS_GTB 0x0000000F -#define MEM_SIZE_512K_GTB 0x00000000 -#define MEM_SIZE_1M_GTB 0x00000001 -#define MEM_SIZE_2M_GTB 0x00000003 -#define MEM_SIZE_4M_GTB 0x00000007 -#define MEM_SIZE_6M_GTB 0x00000009 -#define MEM_SIZE_8M_GTB 0x0000000B -#define MEM_BNDRY 0x00030000 -#define MEM_BNDRY_0K 0x00000000 -#define MEM_BNDRY_256K 0x00010000 -#define MEM_BNDRY_512K 0x00020000 -#define MEM_BNDRY_1M 0x00030000 -#define MEM_BNDRY_EN 0x00040000 - -/* CONFIG_CHIP_ID register constants */ -#define CFG_CHIP_TYPE 0x0000FFFF -#define CFG_CHIP_CLASS 0x00FF0000 -#define CFG_CHIP_REV 0xFF000000 -#define CFG_CHIP_VERSION 0x07000000 -#define CFG_CHIP_FOUNDRY 0x38000000 -#define CFG_CHIP_REVISION 0xC0000000 - -/* Chip IDs read from CONFIG_CHIP_ID */ -#define MACH64_GX_ID 0xD7 -#define MACH64_CX_ID 0x57 -#define MACH64_CT_ID 0x4354 -#define MACH64_ET_ID 0x4554 -#define MACH64_VT_ID 0x5654 -#define MACH64_GT_ID 0x4754 - -/* Mach64 chip types */ -#define MACH64_UNKNOWN 0 -#define MACH64_GX 1 -#define MACH64_CX 2 -#define MACH64_CT 3 -#define MACH64_ET 4 -#define MACH64_VT 5 -#define MACH64_GT 6 - -/* DST_CNTL register constants */ -#define DST_X_RIGHT_TO_LEFT 0 -#define DST_X_LEFT_TO_RIGHT 1 -#define DST_Y_BOTTOM_TO_TOP 0 -#define DST_Y_TOP_TO_BOTTOM 2 -#define DST_X_MAJOR 0 -#define DST_Y_MAJOR 4 -#define DST_X_TILE 8 -#define DST_Y_TILE 0x10 -#define DST_LAST_PEL 0x20 -#define DST_POLYGON_ENABLE 0x40 -#define DST_24_ROTATION_ENABLE 0x80 - -/* SRC_CNTL register constants */ -#define SRC_PATTERN_ENABLE 1 -#define SRC_ROTATION_ENABLE 2 -#define SRC_LINEAR_ENABLE 4 -#define SRC_BYTE_ALIGN 8 -#define SRC_LINE_X_RIGHT_TO_LEFT 0 -#define SRC_LINE_X_LEFT_TO_RIGHT 0x10 - -/* HOST_CNTL register constants */ -#define HOST_BYTE_ALIGN 1 - -/* GUI_TRAJ_CNTL register constants */ -#define PAT_MONO_8x8_ENABLE 0x01000000 -#define PAT_CLR_4x2_ENABLE 0x02000000 -#define PAT_CLR_8x1_ENABLE 0x04000000 - -/* DP_CHAIN_MASK register constants */ -#define DP_CHAIN_4BPP 0x8888 -#define DP_CHAIN_7BPP 0xD2D2 -#define DP_CHAIN_8BPP 0x8080 -#define DP_CHAIN_8BPP_RGB 0x9292 -#define DP_CHAIN_15BPP 0x4210 -#define DP_CHAIN_16BPP 0x8410 -#define DP_CHAIN_24BPP 0x8080 -#define DP_CHAIN_32BPP 0x8080 - -/* DP_PIX_WIDTH register constants */ -#define DST_1BPP 0 -#define DST_4BPP 1 -#define DST_8BPP 2 -#define DST_15BPP 3 -#define DST_16BPP 4 -#define DST_32BPP 6 -#define SRC_1BPP 0 -#define SRC_4BPP 0x100 -#define SRC_8BPP 0x200 -#define SRC_15BPP 0x300 -#define SRC_16BPP 0x400 -#define SRC_32BPP 0x600 -#define HOST_1BPP 0 -#define HOST_4BPP 0x10000 -#define HOST_8BPP 0x20000 -#define HOST_15BPP 0x30000 -#define HOST_16BPP 0x40000 -#define HOST_32BPP 0x60000 -#define BYTE_ORDER_MSB_TO_LSB 0 -#define BYTE_ORDER_LSB_TO_MSB 0x1000000 - -/* DP_MIX register constants */ -#define BKGD_MIX_NOT_D 0 -#define BKGD_MIX_ZERO 1 -#define BKGD_MIX_ONE 2 -#define BKGD_MIX_D 3 -#define BKGD_MIX_NOT_S 4 -#define BKGD_MIX_D_XOR_S 5 -#define BKGD_MIX_NOT_D_XOR_S 6 -#define BKGD_MIX_S 7 -#define BKGD_MIX_NOT_D_OR_NOT_S 8 -#define BKGD_MIX_D_OR_NOT_S 9 -#define BKGD_MIX_NOT_D_OR_S 10 -#define BKGD_MIX_D_OR_S 11 -#define BKGD_MIX_D_AND_S 12 -#define BKGD_MIX_NOT_D_AND_S 13 -#define BKGD_MIX_D_AND_NOT_S 14 -#define BKGD_MIX_NOT_D_AND_NOT_S 15 -#define BKGD_MIX_D_PLUS_S_DIV2 0x17 -#define FRGD_MIX_NOT_D 0 -#define FRGD_MIX_ZERO 0x10000 -#define FRGD_MIX_ONE 0x20000 -#define FRGD_MIX_D 0x30000 -#define FRGD_MIX_NOT_S 0x40000 -#define FRGD_MIX_D_XOR_S 0x50000 -#define FRGD_MIX_NOT_D_XOR_S 0x60000 -#define FRGD_MIX_S 0x70000 -#define FRGD_MIX_NOT_D_OR_NOT_S 0x80000 -#define FRGD_MIX_D_OR_NOT_S 0x90000 -#define FRGD_MIX_NOT_D_OR_S 0xa0000 -#define FRGD_MIX_D_OR_S 0xb0000 -#define FRGD_MIX_D_AND_S 0xc0000 -#define FRGD_MIX_NOT_D_AND_S 0xd0000 -#define FRGD_MIX_D_AND_NOT_S 0xe0000 -#define FRGD_MIX_NOT_D_AND_NOT_S 0xf0000 -#define FRGD_MIX_D_PLUS_S_DIV2 0x170000 - -/* DP_SRC register constants */ -#define BKGD_SRC_BKGD_CLR 0 -#define BKGD_SRC_FRGD_CLR 1 -#define BKGD_SRC_HOST 2 -#define BKGD_SRC_BLIT 3 -#define BKGD_SRC_PATTERN 4 -#define FRGD_SRC_BKGD_CLR 0 -#define FRGD_SRC_FRGD_CLR 0x100 -#define FRGD_SRC_HOST 0x200 -#define FRGD_SRC_BLIT 0x300 -#define FRGD_SRC_PATTERN 0x400 -#define MONO_SRC_ONE 0 -#define MONO_SRC_PATTERN 0x10000 -#define MONO_SRC_HOST 0x20000 -#define MONO_SRC_BLIT 0x30000 - -/* CLR_CMP_CNTL register constants */ -#define COMPARE_FALSE 0 -#define COMPARE_TRUE 1 -#define COMPARE_NOT_EQUAL 4 -#define COMPARE_EQUAL 5 -#define COMPARE_DESTINATION 0 -#define COMPARE_SOURCE 0x1000000 - -/* FIFO_STAT register constants */ -#define FIFO_ERR 0x80000000 - -/* CONTEXT_LOAD_CNTL constants */ -#define CONTEXT_NO_LOAD 0 -#define CONTEXT_LOAD 0x10000 -#define CONTEXT_LOAD_AND_DO_FILL 0x20000 -#define CONTEXT_LOAD_AND_DO_LINE 0x30000 -#define CONTEXT_EXECUTE 0 -#define CONTEXT_CMD_DISABLE 0x80000000 - -/* GUI_STAT register constants */ -#define ENGINE_IDLE 0 -#define ENGINE_BUSY 1 -#define SCISSOR_LEFT_FLAG 0x10 -#define SCISSOR_RIGHT_FLAG 0x20 -#define SCISSOR_TOP_FLAG 0x40 -#define SCISSOR_BOTTOM_FLAG 0x80 - -/* ATI VGA Extended Regsiters */ -#define sioATIEXT 0x1ce -#define bioATIEXT 0x3ce - -#define ATI2E 0xae -#define ATI32 0xb2 -#define ATI36 0xb6 - -/* VGA Graphics Controller Registers */ -#define VGAGRA 0x3ce -#define GRA06 0x06 - -/* VGA Seququencer Registers */ -#define VGASEQ 0x3c4 -#define SEQ02 0x02 -#define SEQ04 0x04 - -#define MACH64_MAX_X ENGINE_MAX_X -#define MACH64_MAX_Y ENGINE_MAX_Y - -#define INC_X 0x0020 -#define INC_Y 0x0080 - -#define RGB16_555 0x0000 -#define RGB16_565 0x0040 -#define RGB16_655 0x0080 -#define RGB16_664 0x00c0 - -#define POLY_TEXT_TYPE 0x0001 -#define IMAGE_TEXT_TYPE 0x0002 -#define TEXT_TYPE_8_BIT 0x0004 -#define TEXT_TYPE_16_BIT 0x0008 -#define POLY_TEXT_TYPE_8 (POLY_TEXT_TYPE | TEXT_TYPE_8_BIT) -#define IMAGE_TEXT_TYPE_8 (IMAGE_TEXT_TYPE | TEXT_TYPE_8_BIT) -#define POLY_TEXT_TYPE_16 (POLY_TEXT_TYPE | TEXT_TYPE_16_BIT) -#define IMAGE_TEXT_TYPE_16 (IMAGE_TEXT_TYPE | TEXT_TYPE_16_BIT) - -#define MACH64_NUM_CLOCKS 16 -#define MACH64_NUM_FREQS 50 - -#endif /* !(_MACH64_H) */ diff --git a/drivers/sbus/char/pcicons.c b/drivers/sbus/char/pcicons.c deleted file mode 100644 index 5117c2c8e..000000000 --- a/drivers/sbus/char/pcicons.c +++ /dev/null @@ -1,729 +0,0 @@ -/* $Id: pcicons.c,v 1.13 1998/04/01 06:55:11 ecd Exp $ - * pcicons.c: PCI specific probing and console operations layer. - * - * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu) - */ - -#include <linux/config.h> - -#ifdef CONFIG_PCI - -#include <linux/kernel.h> -#include <linux/types.h> -#include <linux/tty.h> -#include <linux/console.h> -#include <linux/init.h> -#include <linux/proc_fs.h> -#include <linux/major.h> -#include <linux/timer.h> -#include <linux/version.h> - -#include <asm/uaccess.h> -#include <asm/oplib.h> -#include <asm/sbus.h> -#include <asm/pbm.h> -#include <asm/fbio.h> -#include <asm/smp.h> - -#include <linux/kd.h> -#include <linux/console_struct.h> -#include <linux/selection.h> -#include <linux/vt_kern.h> - -#include "pcicons.h" -#include "fb.h" - -static int x_margin = 0; -static int y_margin = 0; -static int skip_bytes; - -static __u64 *cursor_screen_pos; -static __u64 cursor_bits[2]; -static int cursor_pos = -1; - -extern int serial_console; -extern struct console vt_console_driver; - -static void pci_install_consops(void); -static int (*fbuf_offset)(int); - -static int color_fbuf_offset_1152_128(int cindex) -{ - register int i = (cindex >> 7); - /* (1152 * CHAR_HEIGHT) == 100.1000.0000.0000 */ - return skip_bytes + (i << 14) + (i << 11) + ((cindex & 127) << 3); -} - -static int color_fbuf_offset_1024_128(int cindex) -{ - register int i = (cindex >> 7); - /* (1024 * CHAR_HEIGHT) == 100.0000.0000.0000 */ - return skip_bytes + (i << 14) + ((cindex & 127) << 3); -} - -static __u32 expand_bits_8[16] = { - 0x00000000, - 0x000000ff, - 0x0000ff00, - 0x0000ffff, - 0x00ff0000, - 0x00ff00ff, - 0x00ffff00, - 0x00ffffff, - 0xff000000, - 0xff0000ff, - 0xff00ff00, - 0xff00ffff, - 0xffff0000, - 0xffff00ff, - 0xffffff00, - 0xffffffff -}; - -static void pci_blitc(unsigned int charattr, unsigned long addr) -{ - static int cached_attr = -1; - static __u32 fg, bg; - fbinfo_t *fb = &fbinfo[0]; - __u32 *screen; - unsigned char attrib; - unsigned char *fp; - unsigned long flags; - int i, idx; - - if ((charattr & 0xff00) != cached_attr) { - cached_attr = charattr; - attrib = CHARATTR_TO_SUNCOLOR(charattr); - fg = attrib & 0x0f; - fg |= fg << 8; - fg |= fg << 16; - bg = attrib >> 4; - bg |= bg << 8; - bg |= bg << 16; - fg ^= bg; - } - - idx = (addr - video_mem_base) >> 1; - save_flags(flags); cli(); - if (cursor_pos == idx) - cursor_pos = -1; - restore_flags(flags); - - screen = (__u32 *)(fb->base + fbuf_offset(idx)); - fp = &vga_font[(charattr & 0xff) << 4]; - - for(i = 0; i < 16; i++) { - int bits = *fp++; - - screen[0] = (expand_bits_8[bits >> 4] & fg) ^ bg; - screen[1] = (expand_bits_8[bits & 0x0f] & fg) ^ bg; - screen = (__u32 *) (((unsigned long)screen) + fb->linebytes); - } -} - - -static void pci_memsetw(void *s, unsigned short c, unsigned int count) -{ - unsigned short *p = (unsigned short *)s; - - count >>= 1; - if (vt_cons[fg_console]->vc_mode == KD_GRAPHICS) { - while (count) { - --count; - *p++ = c; - } - return; - } - if ((unsigned long)(p + count) > video_mem_base && - (unsigned long)p < video_mem_term) { - for (; p < (unsigned short *)video_mem_base && count; count--) - *p++ = c; - for (; p < (unsigned short *)video_mem_term && count; count--) { - if (*p != c) { - *p = c; - pci_blitc(c, (unsigned long)p); - } - ++p; - } - } - for (; count; count--) - *p++ = c; -} - -static void pci_memcpyw(unsigned short *dst, unsigned short *src, - unsigned int count) -{ - unsigned short c; - - count >>= 1; - if ((unsigned long)(dst + count) > video_mem_base && - (unsigned long)dst < video_mem_term) { - for (; dst < (unsigned short *)video_mem_base && count; count--) - *dst++ = *src++; - for (; dst < (unsigned short *)video_mem_term && count; - count--) { - c = *src++; - if (*dst != c) { - *dst = c; - pci_blitc(c, (unsigned long)dst); - } - ++dst; - } - } - for (; count; count--) - *dst++ = *src++; -} - -static void pci_scr_writew(unsigned short val, unsigned short *addr) -{ - if (*addr != val) { - *addr = val; - if ((unsigned long)addr < video_mem_term && - (unsigned long)addr >= video_mem_base && - vt_cons[fg_console]->vc_mode == KD_TEXT) - pci_blitc(val, (unsigned long) addr); - } -} - -static unsigned short pci_scr_readw(unsigned short *addr) -{ - return *addr; -} - -static void pci_get_scrmem(int currcons) -{ - struct vc_data *vcd = vc_cons[currcons].d; - - memcpyw((unsigned short *)vc_scrbuf[currcons], - (unsigned short *)vcd->vc_origin, video_screen_size); - vcd->vc_origin = vcd->vc_video_mem_start = - (unsigned long)vc_scrbuf[currcons]; - vcd->vc_scr_end = vcd->vc_video_mem_end = - vcd->vc_video_mem_start + video_screen_size; - vcd->vc_pos = - vcd->vc_origin + vcd->vc_y * video_size_row + (vcd->vc_x << 1); -} - -static void pci_set_scrmem(int currcons, long offset) -{ - struct vc_data *vcd = vc_cons[currcons].d; - - if (video_mem_term - video_mem_base < offset + video_screen_size) - offset = 0; - memcpyw((unsigned short *)(video_mem_base + offset), - (unsigned short *) vcd->vc_origin, video_screen_size); - vcd->vc_video_mem_start = video_mem_base; - vcd->vc_video_mem_end = video_mem_term; - vcd->vc_origin = video_mem_base + offset; - vcd->vc_scr_end = vcd->vc_origin + video_screen_size; - vcd->vc_pos = - vcd->vc_origin + vcd->vc_y * video_size_row + (vcd->vc_x << 1); -} - -static void pci_invert_cursor(int cpos) -{ - fbinfo_t *fb = &fbinfo[0]; - __u64 *screen; - - if (cpos == -1) { - screen = cursor_screen_pos; - *screen = cursor_bits[0]; - screen = (__u64 *)((unsigned long)screen + fb->linebytes); - *screen = cursor_bits[1]; - return; - } - - screen = (__u64 *)(fb->base + fbuf_offset(cpos) + 14 * fb->linebytes); - cursor_screen_pos = screen; - - cursor_bits[0] = *screen; - *screen = 0x0000000000000000; - screen = (__u64 *)((unsigned long)screen + fb->linebytes); - cursor_bits[1] = *screen; - *screen = 0x0000000000000000; -} - -static void pci_hide_cursor(void) -{ - unsigned long flags; - - if (vt_cons[fg_console]->vc_mode == KD_GRAPHICS) - return; - - save_flags(flags); cli(); - if (cursor_pos != -1) - pci_invert_cursor(-1); - restore_flags(flags); -} - -static void pci_set_cursor(int currcons) -{ - unsigned long flags; - int old_cursor; - - if (currcons != fg_console || console_blanked || - vt_cons[currcons]->vc_mode == KD_GRAPHICS) - return; - - save_flags(flags); cli(); - if (!vc_cons[currcons].d->vc_deccm) { - pci_hide_cursor(); - } else { - old_cursor = cursor_pos; - cursor_pos = - (vc_cons[currcons].d->vc_pos - video_mem_base) >> 1; - if (old_cursor != -1) - pci_invert_cursor(-1); - pci_invert_cursor(cursor_pos); - } - restore_flags(flags); -} - -static void pci_set_palette(void) -{ - fbinfo_t *fb = &fbinfo[0]; - - if (console_blanked || vt_cons[fg_console]->vc_mode == KD_GRAPHICS) - return; - - if (fb->loadcmap) { - int i, j; - - for (i = 0; i < 16; i++) { - j = sparc_color_table[i]; - fb->color_map CM(i, 0) = default_red[j]; - fb->color_map CM(i, 1) = default_grn[j]; - fb->color_map CM(i, 2) = default_blu[j]; - } - fb->loadcmap(fb, 0, 16); - } -} - -static void pci_set_other_palette(int n) -{ - fbinfo_t *fb = &fbinfo[n]; - - if (!n) { - pci_set_palette(); - return; - } - - if (fb->loadcmap) { - fb->color_map CM(0, 0) = 0; - fb->color_map CM(0, 1) = 0; - fb->color_map CM(0, 2) = 0; - fb->loadcmap(fb, 0, 1); - } -} - -static void pci_restore_palette(void) -{ - if (fb_restore_palette) - fb_restore_palette(&fbinfo[0]); -} - -static int pci_set_get_font(char *arg, int set, int ch512) -{ - int i, line; - - if (!arg) - return -EINVAL; - - if (!set) { - if (clear_user(arg, sizeof(vga_font))) - return -EFAULT; - for (i = 0; i < 256; i++) { - for (line = 0; line < CHAR_HEIGHT; line++) { - unsigned char value; - - value = vga_font[i * CHAR_HEIGHT + line]; - __put_user_ret(value, (arg + (i * 32 + line)), - -EFAULT); - } - } - return 0; - } - - if (verify_area(VERIFY_READ, arg, 256 * CHAR_HEIGHT)) - return -EFAULT; - for (i = 0; i < 256; i++) { - for (line = 0; line < CHAR_HEIGHT; line++) { - unsigned char value; - __get_user_ret(value, (arg + (i + 32 + line)), -EFAULT); - vga_font[i * CHAR_HEIGHT + line] = value; - } - } - return 0; -} - -static int pci_con_adjust_height(unsigned long fontheight) -{ - return -EINVAL; -} - -static int pci_set_get_cmap(unsigned char *arg, int set) -{ - int i; - - if (set) - i = VERIFY_READ; - else - i = VERIFY_WRITE; - - if (verify_area(i, arg, (16 * 3 * sizeof(unsigned char)))) - return -EFAULT; - - for (i = 0; i < 16; i++) { - if (set) { - __get_user_ret(default_red[i], (arg + 0), -EFAULT); - __get_user_ret(default_grn[i], (arg + 1), -EFAULT); - __get_user_ret(default_blu[i], (arg + 2), -EFAULT); - } else { - __put_user_ret(default_red[i], (arg + 0), -EFAULT); - __put_user_ret(default_grn[i], (arg + 1), -EFAULT); - __put_user_ret(default_blu[i], (arg + 2), -EFAULT); - } - arg += 3; - } - - if (set) { - for (i = 0; i < MAX_NR_CONSOLES; i++) { - if (vc_cons_allocated(i)) { - int j, k; - - for (j = k = 0; j < 16; j++) { - vc_cons[i].d->vc_palette[k++] = - default_red[i]; - vc_cons[i].d->vc_palette[k++] = - default_grn[i]; - vc_cons[i].d->vc_palette[k++] = - default_blu[i]; - } - } - } - pci_set_palette(); - } - return -EINVAL; -} - -static void pci_clear_screen(void) -{ - fbinfo_t *fb = &fbinfo[0]; - - if (fb->base) - memset((void *)fb->base, - (fb->type.fb_depth == 1) ? - ~(0) : reverse_color_table[0], - (fb->type.fb_depth * fb->type.fb_height - * fb->type.fb_width) / 8); - memset((char *)video_mem_base, 0, (video_mem_term - video_mem_base)); -} - -static void pci_clear_fb(int n) -{ - fbinfo_t *fb = &fbinfo[n]; - -#if 0 - if (!n) { - pci_clear_screen(); - } else -#endif - if (fb->base) { - memset((void *)fb->base, - (fb->type.fb_depth == 1) ? - ~(0) : reverse_color_table[0], - (fb->type.fb_depth * fb->type.fb_height - * fb->type.fb_width) / 8); - } -} - -static void pci_render_screen(void) -{ - int count; - unsigned short *p; - - count = video_num_columns * video_num_lines; - p = (unsigned short *)video_mem_base; - - for (; count--; p++) - pci_blitc(*p, (unsigned long)p); -} - -static void pci_clear_margin(void) -{ - fbinfo_t *fb = &fbinfo[0]; - unsigned long p; - int h, he; - - memset((void *)fb->base, - (fb->type.fb_depth == 1) ? ~(0) : reverse_color_table[0], - skip_bytes - (x_margin << 1)); - memset((void *)(fb->base + fb->linebytes * fb->type.fb_height - - skip_bytes + (x_margin << 1)), - (fb->type.fb_depth == 1) ? ~(0) : reverse_color_table[0], - skip_bytes - (x_margin << 1)); - he = fb->type.fb_height - 2 * y_margin; - if (fb->type.fb_depth == 1) { - for (p = fb->base + skip_bytes - (x_margin << 1), h = 0; - h < he; p += fb->linebytes, h++) - memset((void *)p, ~(0), (x_margin << 1)); - } else { - for (p = fb->base + skip_bytes - (x_margin << 1), h = 0; - h < he; p += fb->linebytes, h++) - memset((void *)p, reverse_color_table[0], - (x_margin << 1)); - } - - if (fb->switch_from_graph) - fb->switch_from_graph(); -} - -static unsigned long -pci_postsetup(fbinfo_t *fb, unsigned long memory_start) -{ - fb->color_map = (char *)memory_start; - pci_set_palette(); - return memory_start + fb->type.fb_cmsize * 3; -} - -__initfunc(static unsigned long -pci_con_type_init(unsigned long kmem_start, const char **display_desc)) -{ - can_do_color = 1; - - video_type = VIDEO_TYPE_SUNPCI; - *display_desc = "SUNPCI"; - - if(!serial_console) { - /* If we fall back to PROM then our output - * have to remain readable. - */ - prom_putchar('\033'); - prom_putchar('['); - prom_putchar('H'); - - /* - * Fake the screen memory with some CPU memory - */ - video_mem_base = kmem_start; - kmem_start += video_screen_size; - video_mem_term = kmem_start; - } - - return kmem_start; -} - -__initfunc(static void pci_con_type_init_finish(void)) -{ - fbinfo_t *fb = &fbinfo[0]; - unsigned char *p = (unsigned char *)fb->base + skip_bytes; - char q[2] = { 0, 5 }; - unsigned short *ush; - int currcons = 0; - int cpu, ncpus; - int i; - - if (serial_console) - return; - - ncpus = linux_num_cpus; - if (ncpus > 4) - ncpus = 4; - -#if 0 - if (fb->draw_penguin) - fb->draw_penguin(x_margin, y_margin, ncpus); - else -#endif - if (fb->type.fb_depth == 8 && fb->loadcmap) { - for (i = 0; i < linux_logo_colors; i++) { - fb->color_map CM(i + 32, 0) = linux_logo_red[i]; - fb->color_map CM(i + 32, 1) = linux_logo_green[i]; - fb->color_map CM(i + 32, 2) = linux_logo_blue[i]; - } - fb->loadcmap(fb, 32, linux_logo_colors); - for (i = 0; i < 80; i++, p += fb->linebytes) { - for (cpu = 0; cpu < ncpus; cpu++) - memcpy(p + (cpu * 88), linux_logo + 80 * i, 80); - } - } else if (fb->type.fb_depth == 1) { - for (i = 0; i < 80; i++, p += fb->linebytes) { - for (cpu = 0; cpu < ncpus; cpu++) - memcpy(p + (cpu * 11), - linux_logo_bw + 10 * i, 10); - } - } - putconsxy(0, q); - - ush = (unsigned short *)video_mem_base + video_num_columns * 2 + 20 - + 10 * (ncpus - 1); - - for (p = logo_banner; *p; p++, ush++) { - *ush = (vc_cons[currcons].d->vc_attr << 8) + *p; - pci_blitc(*ush, (unsigned long)ush); - } - - for (i = 0; i < 5; i++) { - ush = (unsigned short *)video_mem_base + i * video_num_columns; - memset(ush, 0xff, 20); - } - - register_console(&vt_console_driver); -} - -unsigned long pcivga_iobase = 0; -unsigned long pcivga_membase = 0; - -static struct { - int depth; - int resx, resy; - int x_margin, y_margin; -} scr_def[] = { - { 8, 1152, 900, 64, 18 }, - { 8, 1024, 768, 0, 0 }, - { 0 } -}; - -extern int mach64_init(fbinfo_t *fb); - -__initfunc(int pci_console_probe(void)) -{ - fbinfo_t *fb = &fbinfo[0]; - char *p; - int i; - - if (1 -#if 1 - && mach64_init(fb) -#endif - && 1) { - return -ENODEV; - } - fbinfos++; - - fb->clear_fb = pci_clear_fb; - fb->set_other_palette = pci_set_other_palette; - fb->postsetup = pci_postsetup; - fb->blanked = 0; - - fb->type.fb_height = prom_getintdefault(fb->prom_node, "height", 900); - fb->type.fb_width = prom_getintdefault(fb->prom_node, "width", 1152); - fb->type.fb_depth = prom_getintdefault(fb->prom_node, "depth", 8); - fb->linebytes = prom_getintdefault(fb->prom_node, "linebytes", 1152); - fb->type.fb_size = PAGE_ALIGN(fb->linebytes * fb->type.fb_height); - - fb->proc_entry.rdev = MKDEV(GRAPHDEV_MAJOR, 0); - fb->proc_entry.mode = S_IFCHR | S_IRUSR | S_IWUSR; - prom_getname(fb->prom_node, fb->proc_entry.name, 32 - 3); - p = strchr(fb->proc_entry.name, 0); - sprintf(p, ":%d", 0); - - for (i = 0; scr_def[i].depth; i++) { - if ((scr_def[i].resx != fb->type.fb_width) || - (scr_def[i].resy != fb->type.fb_height) || - (scr_def[i].depth != fb->type.fb_depth)) - continue; - x_margin = scr_def[i].x_margin; - y_margin = scr_def[i].y_margin; - skip_bytes = y_margin * fb->linebytes + x_margin; - switch (fb->type.fb_width) { - case 1152: - fbuf_offset = color_fbuf_offset_1152_128; - break; - case 1024: - fbuf_offset = color_fbuf_offset_1024_128; - break; - default: - prom_printf("can't handle console width %d\n", - fb->type.fb_width); - prom_halt(); - } - } - - pci_install_consops(); - return fb_init(); -} - -__initfunc(void pci_console_inithook(void)) -{ - extern char *console_fb_path; - char prop[16]; - int node = 0; - int width, height, depth, linebytes; - int x_margin, y_margin; - int i, len; - - if (console_fb_path) { - char *p; - for (p = console_fb_path; *p && *p != ' '; p++) ; - *p = 0; - node = prom_pathtoinode(console_fb_path); - } - if (!node) { - node = prom_inst2pkg(prom_stdout); - if (!node) { - prom_printf("can't find output-device node\n"); - prom_halt(); - } - len = prom_getproperty(node, "device_type", prop, sizeof(prop)); - if (len < 0) { - prom_printf("output-device doesn't have" - " device_type property\n"); - prom_halt(); - } - if (len != sizeof("display") || - strncmp("display", prop, sizeof("display"))) { - prom_printf("output-device is %s" - " not \"display\"\n", prop); - prom_halt(); - } - } - - depth = prom_getintdefault(node, "depth", 8); - width = prom_getintdefault(node, "width", 1152); - height = prom_getintdefault(node, "height", 900); - linebytes = prom_getintdefault(node, "linebytes", 1152); - - for (i = 0; scr_def[i].depth; i++) { - if ((scr_def[i].resx != width) || - (scr_def[i].resy != height) || - (scr_def[i].depth != depth)) - continue; - x_margin = scr_def[i].x_margin; - y_margin = scr_def[i].y_margin; - - ORIG_VIDEO_COLS = width / 8 - 2 * x_margin / depth; - ORIG_VIDEO_LINES = (height - 2 * y_margin) / 16; - } - - suncons_ops.con_type_init = pci_con_type_init; -} - -__initfunc(static void pci_install_consops(void)) -{ - suncons_ops.memsetw = pci_memsetw; - suncons_ops.memcpyw = pci_memcpyw; - suncons_ops.scr_writew = pci_scr_writew; - suncons_ops.scr_readw = pci_scr_readw; - - suncons_ops.get_scrmem = pci_get_scrmem; - suncons_ops.set_scrmem = pci_set_scrmem; - - suncons_ops.hide_cursor = pci_hide_cursor; - suncons_ops.set_cursor = pci_set_cursor; - suncons_ops.set_get_font = pci_set_get_font; - suncons_ops.con_adjust_height = pci_con_adjust_height; - suncons_ops.set_get_cmap = pci_set_get_cmap; - suncons_ops.set_palette = pci_set_palette; - suncons_ops.set_other_palette = pci_set_other_palette; - suncons_ops.console_restore_palette = pci_restore_palette; - - suncons_ops.con_type_init = pci_con_type_init; - suncons_ops.con_type_init_finish = pci_con_type_init_finish; - - suncons_ops.clear_screen = pci_clear_screen; - suncons_ops.render_screen = pci_render_screen; - suncons_ops.clear_margin = pci_clear_margin; -} - -#endif /* CONFIG_PCI */ diff --git a/drivers/sbus/char/pcicons.h b/drivers/sbus/char/pcicons.h deleted file mode 100644 index 7a351a247..000000000 --- a/drivers/sbus/char/pcicons.h +++ /dev/null @@ -1,79 +0,0 @@ -/* $Id: pcicons.h,v 1.2 1997/08/24 12:13:11 ecd Exp $ - * pcicons.h: Stuff which is generic across all PCI console drivers. - * - * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu) - */ - -#ifndef PCICONS_H -#define PCICONS_H - -#include <linux/pci.h> -#include <asm/asi.h> -#include <asm/io.h> - -extern unsigned long pcivga_iobase; -extern unsigned long pcivga_membase; - -extern unsigned char vga_font[8192]; - -extern __inline__ unsigned int pcivga_inb(unsigned long off) -{ - return inb(pcivga_iobase + off); -} - -extern __inline__ unsigned int pcivga_inw(unsigned long off) -{ - return inw(pcivga_iobase + off); -} - -extern __inline__ unsigned int pcivga_inl(unsigned long off) -{ - return inl(pcivga_iobase + off); -} - -extern __inline__ void pcivga_outb(unsigned char val, unsigned long off) -{ - outb(val, pcivga_iobase + off); -} - -extern __inline__ void pcivga_outw(unsigned short val, unsigned long off) -{ - outw(val, pcivga_iobase + off); -} - -extern __inline__ void pcivga_outl(unsigned int val, unsigned long off) -{ - outl(val, pcivga_iobase + off); -} - -extern __inline__ unsigned int pcivga_readb(unsigned long off) -{ - return readb(pcivga_membase + off); -} - -extern __inline__ unsigned int pcivga_readw(unsigned long off) -{ - return readw(pcivga_membase + off); -} - -extern __inline__ unsigned int pcivga_readl(unsigned long off) -{ - return readl(pcivga_membase + off); -} - -extern __inline__ void pcivga_writeb(unsigned char val, unsigned long off) -{ - writeb(val, pcivga_membase + off); -} - -extern __inline__ void pcivga_writew(unsigned short val, unsigned long off) -{ - writew(val, pcivga_membase + off); -} - -extern __inline__ void pcivga_writel(unsigned int val, unsigned long off) -{ - writel(val, pcivga_membase + off); -} - -#endif /* PCICONS_H */ diff --git a/drivers/sbus/char/pcikbd.c b/drivers/sbus/char/pcikbd.c index eca0149c5..06140fa68 100644 --- a/drivers/sbus/char/pcikbd.c +++ b/drivers/sbus/char/pcikbd.c @@ -1,4 +1,4 @@ -/* $Id: pcikbd.c,v 1.16 1998/04/01 04:12:40 davem Exp $ +/* $Id: pcikbd.c,v 1.18 1998/05/29 06:00:23 ecd Exp $ * pcikbd.c: Ultra/AX PC keyboard support. * * Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be) @@ -458,11 +458,13 @@ __initfunc(void pcikbd_init_hw(void)) struct linux_ebus_child *child; char *msg; - for_all_ebusdev(edev, ebus) { - if(!strcmp(edev->prom_name, "8042")) { - for_each_edevchild(edev, child) { - if (!strcmp(child->prom_name, "kb_ps2")) - goto found; + for_each_ebus(ebus) { + for_each_ebusdev(edev, ebus) { + if(!strcmp(edev->prom_name, "8042")) { + for_each_edevchild(edev, child) { + if (!strcmp(child->prom_name, "kb_ps2")) + goto found; + } } } } @@ -481,17 +483,23 @@ found: pcikbd_irq = child->irqs[0]; if (request_irq(pcikbd_irq, &pcikbd_interrupt, SA_SHIRQ, "keyboard", (void *)pcikbd_iobase)) { - printk("8042: cannot register IRQ %x\n", pcikbd_irq); + printk("8042: cannot register IRQ %s\n", + __irq_itoa(pcikbd_irq)); return; } - printk("8042(kbd): iobase[%016lx] irq[%x]\n", pcikbd_iobase, pcikbd_irq); + printk("8042(kbd) at 0x%lx (irq %s)\n", pcikbd_iobase, + __irq_itoa(pcikbd_irq)); kd_mksound = nop_kd_mksound; - for_all_ebusdev(edev, ebus) { - if(!strcmp(edev->prom_name, "beeper")) - break; + edev = 0; + for_each_ebus(ebus) { + for_each_ebusdev(edev, ebus) { + if(!strcmp(edev->prom_name, "beeper")) + goto ebus_done; + } } +ebus_done: /* * XXX: my 3.1.3 PROM does not give me the beeper node for the audio @@ -876,11 +884,13 @@ __initfunc(int pcimouse_init(void)) struct linux_ebus_device *edev; struct linux_ebus_child *child; - for_all_ebusdev(edev, ebus) { - if(!strcmp(edev->prom_name, "8042")) { - for_each_edevchild(edev, child) { - if (!strcmp(child->prom_name, "kdmouse")) - goto found; + for_each_ebus(ebus) { + for_each_ebusdev(edev, ebus) { + if(!strcmp(edev->prom_name, "8042")) { + for_each_edevchild(edev, child) { + if (!strcmp(child->prom_name,"kdmouse")) + goto found; + } } } } @@ -899,12 +909,13 @@ found: pcimouse_irq = child->irqs[0]; if (request_irq(pcimouse_irq, &pcimouse_interrupt, SA_SHIRQ, "mouse", (void *)pcimouse_iobase)) { - printk("8042: Cannot register IRQ %x\n", pcimouse_irq); + printk("8042: Cannot register IRQ %s\n", + __irq_itoa(pcimouse_irq)); return -ENODEV; } - printk("8042(mouse): iobase[%016lx] irq[%x]\n", - pcimouse_iobase, pcimouse_irq); + printk("8042(mouse) at %lx (irq %s)\n", pcimouse_iobase, + __irq_itoa(pcimouse_irq)); printk("8042: PS/2 auxiliary pointing device detected.\n"); aux_present = 1; diff --git a/drivers/sbus/char/rtc.c b/drivers/sbus/char/rtc.c index 160c7e5de..f506a7c90 100644 --- a/drivers/sbus/char/rtc.c +++ b/drivers/sbus/char/rtc.c @@ -1,4 +1,4 @@ -/* $Id: rtc.c,v 1.11 1997/09/20 20:47:26 davem Exp $ +/* $Id: rtc.c,v 1.12 1998/05/08 21:04:35 davem Exp $ * * Linux/SPARC Real Time Clock Driver * Copyright (C) 1996 Thomas K. Dyas (tdyas@eden.rutgers.edu) diff --git a/drivers/sbus/char/sab82532.c b/drivers/sbus/char/sab82532.c index 773f69f47..8f3d2a90a 100644 --- a/drivers/sbus/char/sab82532.c +++ b/drivers/sbus/char/sab82532.c @@ -1,4 +1,4 @@ -/* $Id: sab82532.c,v 1.17 1998/04/01 06:55:12 ecd Exp $ +/* $Id: sab82532.c,v 1.20 1998/05/29 06:00:24 ecd Exp $ * sab82532.c: ASYNC Driver for the SIEMENS SAB82532 DUSCC. * * Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be) @@ -30,6 +30,7 @@ #include <asm/sab82532.h> #include <asm/uaccess.h> #include <asm/ebus.h> +#include <asm/irq.h> #include "sunserial.h" @@ -2046,7 +2047,7 @@ int sab82532_read_proc(char *page, char **start, off_t off, int count, int i, len = 0; off_t begin = 0; - len += sprintf(page, "serinfo:1.0 driver:%s\n", "$Revision: 1.17 $"); + len += sprintf(page, "serinfo:1.0 driver:%s\n", "$Revision: 1.20 $"); for (i = 0; i < NR_PORTS && len < 4000; i++) { len += line_info(page + len, sab82532_table[i]); if (len+begin > off+count) @@ -2074,14 +2075,18 @@ done: __initfunc(static int get_sab82532(unsigned long *memory_start)) { struct linux_ebus *ebus; - struct linux_ebus_device *edev; + struct linux_ebus_device *edev = 0; struct sab82532 *sab; unsigned long regs, offset; int i; - for_all_ebusdev(edev, ebus) - if (!strcmp(edev->prom_name, "se")) - break; + for_each_ebus(ebus) { + for_each_ebusdev(edev, ebus) { + if (!strcmp(edev->prom_name, "se")) + goto ebus_done; + } + } +ebus_done: if (!edev) return -ENODEV; @@ -2137,7 +2142,7 @@ sab82532_kgdb_hook(int line)) __initfunc(static inline void show_serial_version(void)) { - char *revision = "$Revision: 1.17 $"; + char *revision = "$Revision: 1.20 $"; char *version, *p; version = strchr(revision, ' '); @@ -2264,9 +2269,10 @@ __initfunc(int sab82532_init(void)) } } - printk(KERN_INFO "ttyS%02d at 0x%lx (irq = %x) is a SAB82532 %s\n", - info->line, (unsigned long)info->regs, info->irq, - sab82532_version[info->type]); + printk(KERN_INFO + "ttyS%02d at 0x%lx (irq = %s) is a SAB82532 %s\n", + info->line, (unsigned long)info->regs, + __irq_itoa(info->irq), sab82532_version[info->type]); } return 0; } diff --git a/drivers/sbus/char/sbuscons.c b/drivers/sbus/char/sbuscons.c deleted file mode 100644 index 2b7822c4d..000000000 --- a/drivers/sbus/char/sbuscons.c +++ /dev/null @@ -1,1690 +0,0 @@ -/* $Id: sbuscons.c,v 1.15 1998/03/31 01:49:50 davem Exp $ - * sbuscons.c: Routines specific to SBUS frame buffer consoles. - * - * Copyright (C) 1995 Peter Zaitcev (zaitcev@lab.ipmce.su) - * Copyright (C) 1995,1996,1997 David S. Miller (davem@caip.rutgers.edu) - * Copyright (C) 1995, 1996 Miguel de Icaza (miguel@nuclecu.unam.mx) - * Copyright (C) 1996 Dave Redman (djhr@tadpole.co.uk) - * Copyright (C) 1996,1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz) - * Copyright (C) 1996 Eddie C. Dost (ecd@skynet.be) - * - * Added font loading Nov/21, Miguel de Icaza (miguel@nuclecu.unam.mx) - * Added render_screen and faster scrolling Nov/27, miguel - * Added console palette code for cg6 Dec/13/95, miguel - * Added generic frame buffer support Dec/14/95, miguel - * Added cgsix and bwtwo drivers Jan/96, miguel - * Added 4m, and cg3 driver Feb/96, miguel - * Fixed the cursor on color displays Feb/96, miguel. - * Cleaned up the detection code, generic 8bit depth display - * code, Mar/96 miguel - * Hacked support for cg14 video cards -- Apr/96, miguel. - * Color support for cg14 video cards -- May/96, miguel. - * Code split, Dave Redman, May/96 - * Be more VT change friendly, May/96, miguel. - * Support for hw cursor and graphics acceleration, Jun/96, jj. - * Added TurboGX+ detection (cgthree+), Aug/96, Iain Lea (iain@sbs.de) - * Added TCX support (8/24bit), Aug/96, jj. - * Support for multiple framebuffers, Sep/96, jj. - * Fix bwtwo inversion and handle inverse monochrome cells in - * sun_blitc, Nov/96, ecd. - * Fix sun_blitc and screen size on displays other than 1152x900, - * 128x54 chars, Nov/96, jj. - * Fix cursor spots left on some non-accelerated fbs, changed - * software cursor to be like the hw one, Nov/96, jj. - * - * Much of this driver is derived from the DEC TGA driver by - * Jay Estabrook who has done a nice job with the console - * driver abstraction btw. - * - * We try to make everything a power of two if possible to - * speed up the bit blit. Doing multiplies, divides, and - * remainder routines end up calling software library routines - * since not all Sparcs have the hardware to do it. - * - * TODO: - * do not blank the screen when frame buffer is mapped. - * - */ - -#include <linux/config.h> -#include <linux/sched.h> -#include <linux/timer.h> -#include <linux/interrupt.h> -#include <linux/tty.h> -#include <linux/tty_flip.h> -#include <linux/kernel.h> -#include <linux/string.h> -#include <linux/errno.h> -#include <linux/kd.h> -#include <linux/malloc.h> -#include <linux/major.h> -#include <linux/mm.h> -#include <linux/types.h> -#include <linux/version.h> -#include <linux/proc_fs.h> - -#include <asm/system.h> -#include <asm/uaccess.h> -#include <asm/page.h> -#include <asm/pgtable.h> -#include <asm/bitops.h> -#include <asm/oplib.h> -#include <asm/sbus.h> -#include <asm/fbio.h> -#include <asm/io.h> -#include <asm/smp.h> -#ifndef __sparc_v9__ -#include <asm/sun4paddr.h> -#endif - -#include <linux/kbd_kern.h> -#include <linux/vt_kern.h> -#include <linux/consolemap.h> -#include <linux/selection.h> -#include <linux/console_struct.h> - -#include "fb.h" - -#define cmapsz 8192 - -#include "suncons_font.h" - -#define ASM_BLITC - -int sbus_hw_cursor_shown = 0; - -void sbus_hw_hide_cursor(void); -void sbus_hw_set_cursor(int,int); - -static int sbus_blitc(uint, unsigned long); - -static void sbus_install_consops(void); - -extern void console_print(const char *); -extern void putconsxy(int, char *); -extern unsigned char vga_font[]; -extern int serial_console; -extern char *console_fb_path; - -/* The following variables describe a Sparc console. */ - -/* Screen dimensions and color depth. */ -static int con_depth, con_width, con_height, con_type; - -/* Base address of first line. */ -static unsigned char *con_fb_base; - -/* Screen parameters: we compute those at startup to make the code faster */ -static int chars_per_line; /* number of bytes per line */ -static int ints_per_line; /* number of ints per line */ -static int ints_per_cursor; /* 14 * ints_per_line */ -static int skip_bytes; /* number of bytes we skip for the y margin + x_margin */ -static int x_margin, y_margin; /* the x and y margins */ -static int bytes_per_row; /* bytes used by one screen line (of 16 scan lines) */ -int sun_prom_console_id = 0; - -/* Functions used by the SPARC dependent console code - * to perform the fb_restore_palette function. - */ -extern void (*fb_restore_palette)(fbinfo_t *fbinfo); -static void sbus_set_palette (void); - - /* Our screen looks like at 1152 X 900: - * - * 0,0 - * ------------------------------------------------------------------ - * | ^^^^^^^^^^^ | - * | 18 y-pixels | - * | ^^^^^^^^^^^ | - * 13 | <-64 pixels->| <-- 128 8x16 characters --> | <-64 pixels-> | - * .... - * 54 chars from top to bottom - * .... - * 888 | <-64 pixels->| <-- 128 8x16 characters --> | <-64 pixels-> | - * | ^^^^^^^^^^^ | - * | 18 y-pixels | - * | ^^^^^^^^^^^ | - * ------------------------------------------------------------------ - */ -/* First for MONO displays. */ -#define SCREEN_WIDTH 1152 /* Screen width in pixels */ -#define SCREEN_HEIGHT 900 /* Screen height in pixels */ -#define CHARS_PER_LINE 144 /* Make this empirical for speed */ -#define NICE_Y_MARGIN 18 /* We skip 18 y-pixels at top/bottom */ -#define NICE_X_MARGIN 8 /* We skip 64 x-pixels at left/right */ -#define FBUF_TOP_SKIP 2592 /* Empirical, (CHARS_PER_LINE * NICE_Y_MARGIN) */ -#define CHAR_HEIGHT 16 -#define ONE_ROW 2304 /* CHARS_PER_LINE * CHAR_HEIGHT */ - -/* Now we have this, to compute the base frame buffer position - * for a new character to be rendered. 1 and 8 bit depth. - */ -#define FBUF_OFFSET(cindex) \ - (((FBUF_TOP_SKIP) + (((cindex)>>7) * ONE_ROW)) + \ - ((NICE_X_MARGIN) + (((cindex)&127)))) - - -#define COLOR_FBUF_OFFSET(cindex) (*color_fbuf_offset)(cindex) - -/* These four routines are optimizations for the _generic routine for - * the most common cases. - * I guess doing twice sll is much faster than doing .mul, sra faster - * than doing .div, and the disadvantage that someone has to call it - * (it cannot be inline) runs away, 'cause otherwise it would have to - * call .mul anyway. - * The shifting + addition only routines won't eat any stack frame :)) - * Names come from width, screen_num_columns. - */ -static int color_fbuf_offset_1280_144 (int cindex) -{ - register int i = (cindex/144); - /* (1280 * CHAR_HEIGHT) == 101.0000.0000.0000 */ - return skip_bytes + (i << 14) + (i << 12) + ((cindex % 144) << 3); -} - -static int color_fbuf_offset_1152_128 (int cindex) -{ - register int i = (cindex>>7); - /* (1152 * CHAR_HEIGHT) == 100.1000.0000.0000 */ - return skip_bytes + (i << 14) + (i << 11) + ((cindex & 127) << 3); -} - -static int color_fbuf_offset_1024_128 (int cindex) -{ - register int i = (cindex>>7); - /* (1024 * CHAR_HEIGHT) == 100.0000.0000.0000 */ - return skip_bytes + (i << 14) + ((cindex & 127) << 3); -} - -static int color_fbuf_offset_800_96 (int cindex) -{ - register int i = (cindex / 96); - /* (800 * CHAR_HEIGHT) == 11.0010.0000.0000 */ - return skip_bytes + (i<<13) + (i<<12) + (i<<9) + ((cindex % 96)<<3); -} - -static int color_fbuf_offset_640_80 (int cindex) -{ - register int i = (cindex/80); - /* (640 * CHAR_HEIGHT) == 10.1000.0000.0000 */ - return skip_bytes + (i << 13) + (i << 11) + ((cindex % 80) << 3); -} - -static int color_fbuf_offset_generic (int cindex) -{ - return skip_bytes + (cindex / video_num_columns) * bytes_per_row + ((cindex % video_num_columns) << 3); -} - -static int (*color_fbuf_offset)(int) = color_fbuf_offset_generic; - -static int do_accel = 0; - -/* For the cursor, we just invert the 8x16 block at the cursor - * location. Easy enough... - * - * Hide the cursor from view, during blanking, usually... - */ -static int cursor_pos = -1; - -static unsigned int under_cursor[4]; - -static void sbus_hide_cursor(void) -{ - unsigned long flags; - int j; - - if (fbinfo[0].setcursor) { - sbus_hw_hide_cursor(); - return; - } - - if (vt_cons[fg_console]->vc_mode == KD_GRAPHICS) - return; /* Don't paint anything on fb which is not ours, - but turn off the hw cursor in such case */ - - __save_and_cli(flags); - - if(cursor_pos == -1) { - __restore_flags (flags); - return; - } - switch (con_depth){ - case 1: { - unsigned char *dst; - dst = (unsigned char *)((unsigned long)con_fb_base + - FBUF_OFFSET(cursor_pos)); - for(j = 0; j < CHAR_HEIGHT; j++, dst += CHARS_PER_LINE) - *dst = ~(*dst); - break; - } - case 8: { - unsigned int *dst; - - dst = (unsigned int *)((unsigned long)con_fb_base + - COLOR_FBUF_OFFSET(cursor_pos)) + ints_per_cursor; - dst[0] = under_cursor[0]; - dst[1] = under_cursor[1]; - dst[ints_per_line] = under_cursor[2]; - dst[ints_per_line+1] = under_cursor[3]; - break; - } - default: - break; - } - cursor_pos = -1; - __restore_flags(flags); -} - -static void sbus_set_cursor(int currcons) -{ - int j, idx, oldpos; - unsigned long flags; - - if (currcons != fg_console || console_blanked || - vt_cons[currcons]->vc_mode == KD_GRAPHICS) - return; - - if (fbinfo[0].setcursor) { - if (!vc_cons[currcons].d->vc_deccm) - sbus_hide_cursor(); - else { - idx = (vc_cons[currcons].d->vc_pos - video_mem_base) >> 1; - - sbus_hw_set_cursor(x_margin + ((idx % video_num_columns) << 3), y_margin + ((idx / video_num_columns) * CHAR_HEIGHT)); - } - return; - } - - __save_and_cli(flags); - - idx = (vc_cons[currcons].d->vc_pos - video_mem_base) >> 1; - oldpos = cursor_pos; - if (!vc_cons[currcons].d->vc_deccm) { - sbus_hide_cursor (); - __restore_flags (flags); - return; - } - cursor_pos = idx; - switch (con_depth){ - case 1: { - unsigned char *dst, *opos; - - dst = (unsigned char *)((unsigned long)con_fb_base + FBUF_OFFSET(idx)); - opos = (unsigned char *)((unsigned long)con_fb_base + FBUF_OFFSET(oldpos)); - if(oldpos != -1) { - /* Restore what was at the old position */ - for(j=0; j < CHAR_HEIGHT; j++, opos += CHARS_PER_LINE) { - *opos = ~*opos; - } - } - for(j=0; j < 16; j++, dst+=CHARS_PER_LINE) { - *dst = ~*dst; - } - break; - } - case 8: { - unsigned int *dst, *opos; - dst = (unsigned int *)((unsigned long)con_fb_base + COLOR_FBUF_OFFSET(idx)) + ints_per_cursor; - - if(oldpos != -1) { - opos = (unsigned int *)((unsigned long)con_fb_base + COLOR_FBUF_OFFSET(oldpos)) + ints_per_cursor; - opos[0] = under_cursor[0]; - opos[1] = under_cursor[1]; - opos[ints_per_line] = under_cursor[2]; - opos[ints_per_line+1] = under_cursor[3]; - } - under_cursor[0] = dst[0]; - under_cursor[1] = dst[1]; - under_cursor[2] = dst[ints_per_line]; - under_cursor[3] = dst[ints_per_line+1]; - dst[0] = 0x00000000; - dst[1] = 0x00000000; - dst[ints_per_line] = 0x00000000; - dst[ints_per_line+1] = 0x00000000; - break; - } - default: - } - __restore_flags(flags); -} - -/* - * Render the current screen - * Only used at startup and when switching from KD_GRAPHICS to KD_TEXT - * to avoid the caching that is being done in selection.h - */ - -static void sbus_render_screen(void) -{ - int count; - unsigned short *contents; - - count = video_num_columns * video_num_lines; - contents = (unsigned short *) video_mem_base; - - for (;count--; contents++) - sbus_blitc (*contents, (unsigned long) contents); -} - -__initfunc(static unsigned long -sbus_con_type_init(unsigned long kmem_start, const char **display_desc)) -{ - can_do_color = (con_type != FBTYPE_SUN2BW); - - video_type = VIDEO_TYPE_SUN; - *display_desc = "SUN"; - - if (!serial_console) { - /* If we fall back to PROM then our output have to remain readable. */ - prom_putchar('\033'); prom_putchar('['); prom_putchar('H'); - - /* - * fake the screen memory with some CPU memory - */ - video_mem_base = kmem_start; - kmem_start += video_screen_size; - video_mem_term = kmem_start; - } - return kmem_start; -} - -__initfunc(static void sbus_con_type_init_finish(void)) -{ - int i, cpu; - char *p = con_fb_base + skip_bytes; - char q[2] = {0,5}; - int currcons = 0; - unsigned short *ush; - int ncpus; - - if (serial_console) - return; - ncpus = linux_num_cpus; - if (ncpus > 4) ncpus = 4; - if (fbinfo[0].draw_penguin) { - (*fbinfo[0].draw_penguin)(x_margin, y_margin, ncpus); - } else if (con_depth == 8 && fbinfo[0].loadcmap) { - for (i = 0; i < linux_logo_colors; i++) { - fbinfo[0].color_map CM(i+32,0) = linux_logo_red [i]; - fbinfo[0].color_map CM(i+32,1) = linux_logo_green [i]; - fbinfo[0].color_map CM(i+32,2) = linux_logo_blue [i]; - } - (*fbinfo [0].loadcmap)(&fbinfo [0], 0, linux_logo_colors + 32); - for (i = 0; i < 80; i++, p += chars_per_line){ - for (cpu = 0; cpu < ncpus; cpu++){ - memcpy (p + (cpu * 88), linux_logo + 80 * i, 80); - } - } - } else if (con_depth == 1) { - for (i = 0; i < 80; i++, p += chars_per_line) - memcpy (p, linux_logo_bw + 10 * i, 10); - } - putconsxy(0, q); - ush = (unsigned short *) video_mem_base + video_num_columns * 2 + 20 + 11 * (ncpus - 1); - - p = logo_banner; - for (; *p; p++, ush++) { - *ush = (vc_cons[currcons].d->vc_attr << 8) + *p; - sbus_blitc (*ush, (unsigned long) ush); - } - for (i = 0; i < 5; i++) { - ush = (unsigned short *) video_mem_base + i * video_num_columns; - memset (ush, 0, 20); - } -} - -/* - * NOTE: get_scrmem() and set_scrmem() are here only because - * the VGA version of set_scrmem() has some direct VGA references. - */ -static void sbus_get_scrmem(int currcons) -{ - struct vc_data *vcd = vc_cons[currcons].d; - - memcpyw((unsigned short *)vc_scrbuf[currcons], - (unsigned short *)vcd->vc_origin, - video_screen_size); - vcd->vc_origin = vcd->vc_video_mem_start = - (unsigned long)vc_scrbuf[currcons]; - vcd->vc_scr_end = vcd->vc_video_mem_end = - vcd->vc_video_mem_start + video_screen_size; - vcd->vc_pos = - vcd->vc_origin + vcd->vc_y*video_size_row + (vcd->vc_x<<1); -} - -static void sbus_set_scrmem(int currcons, long offset) -{ - struct vc_data *vcd = vc_cons[currcons].d; - - if (video_mem_term - video_mem_base < offset + video_screen_size) - offset = 0; - memcpyw((unsigned short *)(video_mem_base + offset), - (unsigned short *) vcd->vc_origin, - video_screen_size); - vcd->vc_video_mem_start = video_mem_base; - vcd->vc_video_mem_end = video_mem_term; - vcd->vc_origin = video_mem_base + offset; - vcd->vc_scr_end = vcd->vc_origin + video_screen_size; - vcd->vc_pos = - vcd->vc_origin + vcd->vc_y*video_size_row + (vcd->vc_x<<1); -} - -/* - * PIO_FONT support. - */ -static int sbus_set_get_font(char * arg, int set, int ch512) -{ - int i, line; - - if (!arg) - return -EINVAL; - - /* download the current font */ - if (!set){ - if(clear_user(arg, cmapsz)) - return -EFAULT; - for (i = 0; i < 256; i++) { - for (line = 0; line < CHAR_HEIGHT; line++) { - unsigned char value = vga_font[i]; - - /* Access checked by the above clear_user */ - __put_user_ret (value, (arg + (i * 32 + line)), - -EFAULT); - } - } - return 0; - } - - /* set the font */ - - if (verify_area (VERIFY_READ, arg, 256 * CHAR_HEIGHT)) return -EFAULT; - for (i = 0; i < 256; i++) { - for (line = 0; line < CHAR_HEIGHT; line++){ - unsigned char value; - __get_user_ret(value, (arg + (i * 32 + line)),-EFAULT); - vga_font [i*CHAR_HEIGHT + line] = value; - } - } - return 0; -} - -/* - * Adjust the screen to fit a font of a certain height - * - * Returns < 0 for error, 0 if nothing changed, and the number - * of lines on the adjusted console if changed. - * - * for now, we only support the built-in font... - */ -static int sbus_con_adjust_height(unsigned long fontheight) -{ - return -EINVAL; -} - -static int sbus_set_get_cmap(unsigned char * arg, int set) -{ - int i; - - if(set) - i = VERIFY_READ; - else - i = VERIFY_WRITE; - if(verify_area(i, arg, (16 * 3 * sizeof(unsigned char)))) - return -EFAULT; - for (i=0; i<16; i++) { - if (set) { - __get_user_ret(default_red[i], (arg+0),-EFAULT); - __get_user_ret(default_grn[i], (arg+1),-EFAULT); - __get_user_ret(default_blu[i], (arg+2),-EFAULT); - } else { - __put_user_ret(default_red[i], (arg+0),-EFAULT); - __put_user_ret(default_grn[i], (arg+1),-EFAULT); - __put_user_ret(default_blu[i], (arg+2),-EFAULT); - } - arg += 3; - } - if (set) { - for (i=0; i<MAX_NR_CONSOLES; i++) - if (vc_cons_allocated(i)) { - int j, k ; - for (j=k=0; j<16; j++) { - vc_cons[i].d->vc_palette[k++] = default_red[j]; - vc_cons[i].d->vc_palette[k++] = default_grn[j]; - vc_cons[i].d->vc_palette[k++] = default_blu[j]; - } - } - sbus_set_palette(); - } - - return 0; -} - -#ifdef CONFIG_SUN4 -extern __inline__ void memset_screen(void *s, unsigned c, size_t n) -{ - unsigned *p = (unsigned *)s; - int i; - - for (i = n / 4; i > 0; i--) - *p++ = c; -} -#else -#define memset_screen memset -#endif - -void sbus_clear_screen(void) -{ - if (fbinfo[0].fill) { - int rects [4]; - - rects [0] = 0; - rects [1] = 0; - rects [2] = con_width; - rects [3] = con_height; - (*fbinfo[0].fill)(reverse_color_table[0], 1, rects); - } else if (fbinfo[0].base && fbinfo[0].base_depth) - memset_screen(con_fb_base, - (con_depth == 1) ? ~(0) : reverse_color_table[0], - (con_depth * con_height * con_width) / 8); - /* also clear out the "shadow" screen memory */ - memset((char *)video_mem_base, 0, (video_mem_term - video_mem_base)); - cursor_pos = -1; -} - -static void sbus_clear_fb(int n) -{ - if (!n) { - sbus_clear_screen (); - } else if (fbinfo[n].base && fbinfo[n].base_depth) { - memset((void *)fbinfo[n].base, - (fbinfo[n].base_depth == 1) ? - ~(0) : reverse_color_table[0], - (fbinfo[n].base_depth * fbinfo[n].type.fb_height - * fbinfo[n].type.fb_width) / 8); - } -} - -static void sbus_clear_margin(void) -{ - int h, he, i; - unsigned char *p; - - if (fbinfo[0].fill) { - int rects [16]; - - rects [0] = 0; - rects [1] = 0; - rects [2] = con_width; - rects [3] = y_margin; - rects [4] = 0; - rects [5] = y_margin; - rects [6] = x_margin; - rects [7] = con_height; - rects [8] = con_width - x_margin; - rects [9] = y_margin; - rects [10] = con_width; - rects [11] = con_height; - rects [12] = x_margin; - rects [13] = con_height - y_margin; - rects [14] = con_width - x_margin; - rects [15] = con_height; - (*fbinfo[0].fill)(reverse_color_table[0], 4, rects); - } else { - memset (con_fb_base, - (con_depth == 1) ? ~(0) : reverse_color_table[0], - skip_bytes - (x_margin<<1)); - memset (con_fb_base + chars_per_line * con_height - - skip_bytes + (x_margin<<1), - (con_depth == 1) ? ~(0) : reverse_color_table[0], - skip_bytes - (x_margin<<1)); - he = con_height - 2 * y_margin; - i = 2 * x_margin; - if (con_depth == 1) { - for (p = con_fb_base+skip_bytes-(x_margin<<1), h = 0; - h <= he; p += chars_per_line, h++) - memset (p, ~(0), i); - } else { - for (p = con_fb_base+skip_bytes-(x_margin<<1), h = 0; - h <= he; p += chars_per_line, h++) - memset (p, reverse_color_table[0], i); - } - } - if (fbinfo [0].switch_from_graph) - (*fbinfo [0].switch_from_graph)(); -} - -/* Call the frame buffer routine for setting the palette */ -static void sbus_set_palette (void) -{ - if (console_blanked || vt_cons [fg_console]->vc_mode == KD_GRAPHICS) - return; - - if (fbinfo [0].loadcmap){ - int i, j; - - /* First keep color_map with the palette colors */ - for (i = 0; i < 16; i++){ - j = sparc_color_table [i]; - fbinfo[0].color_map CM(i,0) = default_red [j]; - fbinfo[0].color_map CM(i,1) = default_grn [j]; - fbinfo[0].color_map CM(i,2) = default_blu [j]; - } - (*fbinfo [0].loadcmap)(&fbinfo [0], 0, 16); - } -} - -static void sbus_set_other_palette (int n) -{ - if (!n) { - sbus_set_palette (); - return; - } - if (fbinfo [n].loadcmap){ - fbinfo[n].color_map CM(0,0) = 0; - fbinfo[n].color_map CM(0,1) = 0; - fbinfo[n].color_map CM(0,2) = 0; - (*fbinfo [n].loadcmap)(&fbinfo [n], 0, 1); - } -} - -/* Called when returning to prom */ -static void sbus_console_restore_palette (void) -{ - if (fb_restore_palette) - (*fb_restore_palette) (&fbinfo[0]); -} - -__initfunc(unsigned long cg_postsetup(fbinfo_t *fb, unsigned long start_mem)) -{ - fb->color_map = (char *)start_mem; - return start_mem + 256*3; -} - -static char *known_cards [] __initdata = { - "cgsix", "cgthree", "cgRDI", "cgthree+", "bwtwo", "SUNW,tcx", - "cgfourteen", "SUNW,leo", "SUNW,ffb", 0 -}; -static char *v0_known_cards [] __initdata = { - "cgsix", "cgthree", "cgRDI", "cgthree+", "bwtwo", 0 -}; - -__initfunc(static int known_card (char *name, char **known_cards)) -{ - int i; - - for (i = 0; known_cards [i]; i++) - if (strcmp (name, known_cards [i]) == 0) - return 1; - return 0; -} - -static struct { - int depth; - int resx, resy; - int x_margin, y_margin; -} scr_def [] = { - { 8, 1280, 1024, 64, 80 }, - { 8, 1152, 1024, 64, 80 }, - { 8, 1152, 900, 64, 18 }, - { 8, 1024, 768, 0, 0 }, - { 8, 800, 600, 16, 12 }, - { 8, 640, 480, 0, 0 }, - { 1, 1152, 900, 8, 18 }, - { 0 }, -}; - -__initfunc(static int cg14_present(void)) -{ - int root, n; - - root = prom_getchild (prom_root_node); - if ((n = prom_searchsiblings (root, "obio")) == 0) - return 0; - - n = prom_getchild (n); - if ((n = prom_searchsiblings (n, "cgfourteen")) == 0) - return 0; - return n; -} - -__initfunc(static int creator_present (void)) -{ -#ifdef __sparc_v9__ - int root, n; - - root = prom_getchild (prom_root_node); - if ((n = prom_searchsiblings (root, "SUNW,ffb")) == 0) - return 0; - return n; -#else - return 0; -#endif -} - -__initfunc(static void - sparc_framebuffer_setup(int primary, int con_node, - int type, struct linux_sbus_device *sbdp, - uint base, unsigned long con_base, int prom_fb, - int parent_node)) -{ - static int frame_buffers = 1; - int n, i; - int linebytes; - uint io = 0; - char *p; - - if (primary) - n = 0; - else { - if (frame_buffers == FRAME_BUFFERS) - return; /* Silently ignore */ - n = frame_buffers++; - } - - if (prom_fb) sun_prom_console_id = n; - - if (sbdp) - io = sbdp->reg_addrs [0].which_io; - - /* Fill in common fb information */ - fbinfo [n].clear_fb = sbus_clear_fb; - fbinfo [n].set_other_palette = sbus_set_other_palette; - fbinfo [n].type.fb_type = type; - fbinfo [n].real_type = type; - fbinfo [n].prom_node = con_node; - memset (&(fbinfo [n].emulations), 0xff, sizeof (fbinfo [n].emulations)); - fbinfo [n].type.fb_height = prom_getintdefault(con_node, "height", 900); - fbinfo [n].type.fb_width = prom_getintdefault(con_node, "width", 1152); - fbinfo [n].type.fb_depth = (type == FBTYPE_SUN2BW) ? 1 : 8; - linebytes = prom_getintdefault(con_node, "linebytes", fbinfo[n].type.fb_width * fbinfo[n].type.fb_depth / 8); - fbinfo [n].type.fb_size = PAGE_ALIGN((linebytes) * (fbinfo [n].type.fb_height)); - fbinfo [n].space = io; - fbinfo [n].blanked = 0; - if (con_base >= PAGE_OFFSET) - fbinfo [n].base = con_base; - else - fbinfo [n].base = 0; - fbinfo [n].cursor.hwsize.fbx = 32; - fbinfo [n].cursor.hwsize.fby = 32; - fbinfo [n].proc_entry.node = parent_node; - fbinfo [n].proc_entry.rdev = MKDEV(GRAPHDEV_MAJOR, n); - fbinfo [n].proc_entry.mode = S_IFCHR | S_IRUSR | S_IWUSR; - prom_getname (con_node, fbinfo [n].proc_entry.name, 32 - 3); - p = strchr (fbinfo [n].proc_entry.name, 0); - sprintf (p, ":%d", n); - - /* Should be filled in for supported video cards */ - fbinfo [n].mmap = 0; - fbinfo [n].loadcmap = 0; - fbinfo [n].ioctl = 0; - fbinfo [n].reset = 0; - fbinfo [n].blank = 0; - fbinfo [n].unblank = 0; - fbinfo [n].setcursor = 0; - fbinfo [n].base_depth = fbinfo [n].type.fb_depth; - - /* Per card setup */ - switch (fbinfo [n].type.fb_type){ -#ifdef SUN_FB_CGTHREE - case FBTYPE_SUN3COLOR: - cg3_setup (&fbinfo [n], n, base, io, sbdp); - break; -#endif -#ifdef SUN_FB_TCX - case FBTYPE_TCXCOLOR: - tcx_setup (&fbinfo [n], n, con_node, base, sbdp); - break; -#endif -#ifdef SUN_FB_CGSIX - case FBTYPE_SUNFAST_COLOR: - cg6_setup (&fbinfo [n], n, base, io); - break; -#endif -#ifdef SUN_FB_BWTWO - case FBTYPE_SUN2BW: - bwtwo_setup (&fbinfo [n], n, base, io, sbdp); - break; -#endif -#ifdef SUN_FB_CGFOURTEEN - case FBTYPE_MDICOLOR: - cg14_setup (&fbinfo [n], n, con_node, base, io); - break; -#endif -#ifdef SUN_FB_LEO - case FBTYPE_SUNLEO: - leo_setup (&fbinfo [n], n, base, io); - break; -#endif -#if defined(SUN_FB_CREATOR) && defined(__sparc_v9__) - case FBTYPE_CREATOR: - creator_setup (&fbinfo [n], n, con_node, base, io); - break; -#endif - default: - fbinfo [n].type.fb_type = FBTYPE_NOTYPE; - return; - } - - if (n) - return; - - /* Code below here is just executed for the first frame buffer */ - con_type = type; - con_height = fbinfo [n].type.fb_height; - con_width = fbinfo [n].type.fb_width; - con_depth = (type == FBTYPE_SUN2BW) ? 1 : 8; - for (i = 0; scr_def [i].depth; i++){ - if ((scr_def [i].resx != con_width) || - (scr_def [i].resy != con_height)) - continue; - if (scr_def [i].depth != con_depth) - continue; - x_margin = scr_def [i].x_margin; - y_margin = scr_def [i].y_margin; - chars_per_line = (con_width * con_depth) / 8; - skip_bytes = chars_per_line * y_margin + x_margin; - ints_per_line = chars_per_line / 4; - ints_per_cursor = 14 * ints_per_line; - bytes_per_row = CHAR_HEIGHT * chars_per_line; - ORIG_VIDEO_COLS = con_width / 8 - - 2 * x_margin / con_depth; - ORIG_VIDEO_LINES = (con_height - 2 * y_margin) / 16; - switch (chars_per_line) { - case 1280: - if (ORIG_VIDEO_COLS == 144) - color_fbuf_offset = - color_fbuf_offset_1280_144; - break; - case 1152: - if (ORIG_VIDEO_COLS == 128) - color_fbuf_offset = - color_fbuf_offset_1152_128; - break; - case 1024: - if (ORIG_VIDEO_COLS == 128) - color_fbuf_offset = - color_fbuf_offset_1024_128; - break; - case 800: - if (ORIG_VIDEO_COLS == 96) - color_fbuf_offset = - color_fbuf_offset_800_96; - break; - case 640: - if (ORIG_VIDEO_COLS == 80) - color_fbuf_offset = - color_fbuf_offset_640_80; - break; - } - break; - } - - if (!scr_def [i].depth){ - x_margin = y_margin = 0; - prom_printf ("console: unknown video resolution %dx%d," - " depth %d\n", - con_width, con_height, con_depth); - prom_halt (); - } - - /* P3: I fear this strips 15inch 1024/768 PC-like - * monitors out. */ - if ((linebytes*8) / con_depth != con_width) { - prom_printf("console: unusual video, linebytes=%d, " - "width=%d, height=%d depth=%d\n", - linebytes, con_width, con_height, - con_depth); - prom_halt (); - } -} - -__initfunc(int sbus_console_probe(void)) -{ - int propl, con_node, default_node = 0; - char prop[16]; - struct linux_sbus_device *sbdp, *sbdprom; - struct linux_sbus *sbus; - int creator = 0, cg14 = 0; - char prom_name[40]; - int type, card_found = 0; - unsigned long con_base; - u32 tmp; - u32 prom_console_node = 0; - - if(SBus_chain == 0) { -#ifdef CONFIG_SUN4 - sparc_framebuffer_setup (1,0,FBTYPE_SUN2BW,NULL,SUN4_300_BWTWO_PHYSADDR,0,0,0); -#else - creator = creator_present(); - if (!creator) - return -1; - sparc_framebuffer_setup (1, creator, FBTYPE_CREATOR, - 0, 0, 0, 0, prom_root_node); -#endif - } else { - sbdprom = 0; - - switch(prom_vers) { - - case PROM_V0: - /* V0 proms are at sun4c only. Can skip many checks. */ - con_type = FBTYPE_NOTYPE; - for_each_sbusdev(sbdp, SBus_chain) { - /* If no "address" than it is not the PROM console. */ - if(sbdp->num_vaddrs) { - if(known_card(sbdp->prom_name, v0_known_cards)) { - sbdprom = sbdp; - strncpy(prom_name, sbdp->prom_name, sizeof (prom_name)); - break; - } - } - } - if(!sbdprom) return -1; - for_each_sbusdev(sbdp, SBus_chain) { - con_node = sbdp->prom_node; - - if(!strncmp(sbdp->prom_name, "cgsix", 5) || - !strncmp(sbdp->prom_name, "cgthree+", 8)) { - type = FBTYPE_SUNFAST_COLOR; - } else if(!strncmp(sbdp->prom_name, "cgthree", 7) || - !strncmp(sbdp->prom_name, "cgRDI", 5)) { - type = FBTYPE_SUN3COLOR; - } else if (!strncmp(sbdp->prom_name, "bwtwo", 5)) { - type = FBTYPE_SUN2BW; - } else - continue; - sparc_framebuffer_setup (sbdprom == sbdp, con_node, type, sbdp, - (uint)sbdp->reg_addrs [0].phys_addr, sbdp->sbus_vaddrs[0], 0, - sbdp->my_bus->prom_node); - /* XXX HACK */ - if (sbdprom == sbdp && !strncmp(sbdp->prom_name, "cgRDI", 5)) - break; - } - break; - - case PROM_V2: - case PROM_V3: - case PROM_P1275: - if (console_fb_path) { - char *q, c; - - for (q = console_fb_path; *q && *q != ' '; q++); - c = *q; - *q = 0; - default_node = prom_pathtoinode(console_fb_path); - if (default_node) { - prom_printf ("Using %s for console\n", console_fb_path); - prom_console_node = prom_inst2pkg(prom_stdout); - if (prom_console_node == default_node) - prom_console_node = 0; - } - } - if (!default_node) - default_node = prom_inst2pkg(prom_stdout); - propl = prom_getproperty(default_node, "device_type", - prop, sizeof (prop)); - if (propl < 0) { - prom_printf ("output-device doesn't have device_type property\n"); - prom_halt (); - } else if (propl != sizeof("display") || strncmp("display", prop, sizeof("display"))) { - prop [propl] = 0; - prom_printf ("console_probe: output-device is %s" - " (not \"display\")\n", prop); - prom_halt (); - } - for_all_sbusdev(sbdp, sbus) { - if ((sbdp->prom_node == default_node) - && known_card (sbdp->prom_name, known_cards)) { - sbdprom = sbdp; - break; - } - } - if (sbdprom) - card_found = 1; - if (!card_found) - card_found = cg14 = cg14_present (); - if (!card_found){ - card_found = creator = creator_present (); - } - if (!card_found){ - prom_printf ("Could not find a known video card on this machine\n"); - prom_halt (); - } - - for_all_sbusdev(sbdp, sbus) { - if (!known_card (sbdp->prom_name, known_cards)) - continue; - con_node = sbdp->prom_node; - prom_apply_sbus_ranges (sbdp->my_bus, &sbdp->reg_addrs [0], - sbdp->num_registers, sbdp); - - propl = prom_getproperty(con_node, "address", (char *) &tmp, 4); - con_base = tmp; - if (propl != 4) con_base = 0; - propl = prom_getproperty(con_node, "emulation", prom_name, sizeof (prom_name)); - if (propl < 0 || propl >= sizeof (prom_name)) { - /* Early cg3s had no "emulation". */ - propl = prom_getproperty(con_node, "name", prom_name, sizeof (prom_name)); - if (propl < 0) { - prom_printf("console: no device name!!\n"); - return -1; - } - } - prom_name [sizeof (prom_name) - 1] = 0; - if(!strcmp(prom_name, "cgsix") || - !strcmp(prom_name, "cgthree+")) { - type = FBTYPE_SUNFAST_COLOR; - } else if(!strcmp(prom_name, "cgthree") || - !strcmp(prom_name, "cgRDI")) { - type = FBTYPE_SUN3COLOR; - } else if(!strcmp(prom_name, "cgfourteen")) { - type = FBTYPE_MDICOLOR; - } else if(!strcmp(prom_name, "SUNW,leo")) { - type = FBTYPE_SUNLEO; - } else if(!strcmp(prom_name, "bwtwo")) { - type = FBTYPE_SUN2BW; - } else if(!strcmp(prom_name,"SUNW,tcx")){ - sparc_framebuffer_setup (sbdprom == sbdp, con_node, FBTYPE_TCXCOLOR, sbdp, - (uint)sbdp->reg_addrs [10].phys_addr, con_base, - prom_console_node == con_node, sbdp->my_bus->prom_node); - continue; - } else { - prom_printf("console: \"%s\" is unsupported\n", prom_name); - continue; - } - sparc_framebuffer_setup (sbdprom == sbdp, con_node, type, sbdp, - (uint)sbdp->reg_addrs [0].phys_addr, con_base, - prom_console_node == con_node, sbdp->my_bus->prom_node); - /* XXX HACK */ - if (sbdprom == sbdp && !strncmp(sbdp->prom_name, "cgRDI", 5)) - break; - } - if (cg14) { - sparc_framebuffer_setup (!sbdprom, cg14, FBTYPE_MDICOLOR, - 0, 0, 0, prom_console_node == cg14, - prom_searchsiblings (prom_getchild (prom_root_node), "obio")); - } - if (creator){ - sparc_framebuffer_setup (!sbdprom, creator, FBTYPE_CREATOR, - 0, 0, 0, prom_console_node == creator, - prom_root_node); - } - break; - - default: - return -1; - } - } - - if (fbinfo [0].type.fb_type == FBTYPE_NOTYPE) { - prom_printf ("Couldn't setup your primary frame buffer.\n"); - prom_halt (); - } - - if (fbinfo [0].blitc) - do_accel = 1; - - con_fb_base = (unsigned char *)fbinfo[0].base; - if (!con_fb_base){ - prom_printf ("PROM does not have an 'address' property for this\n" - "frame buffer and the Linux drivers do not know how\n" - "to map the video of this device\n"); - prom_halt (); - } - sbus_install_consops(); - return fb_init (); -} - -/* - * sbus_blitc - * - * Displays an ASCII character at a specified character cell - * position. - * - * Called from scr_writew() when the destination is - * the "shadow" screen - */ -static uint -fontmask_bits[16] = { - 0x00000000, - 0x000000ff, - 0x0000ff00, - 0x0000ffff, - 0x00ff0000, - 0x00ff00ff, - 0x00ffff00, - 0x00ffffff, - 0xff000000, - 0xff0000ff, - 0xff00ff00, - 0xff00ffff, - 0xffff0000, - 0xffff00ff, - 0xffffff00, - 0xffffffff -}; - -static int sbus_blitc(uint charattr, unsigned long addr) -{ - unsigned int fgmask, bgmask; - unsigned char attrib; - int j, idx; - unsigned char *font_row; - - if (do_accel) { - (*fbinfo[0].blitc)(charattr, - x_margin + (((addr - video_mem_base) % video_size_row)<<2), - y_margin + CHAR_HEIGHT * ((addr - video_mem_base) / video_size_row)); - return 0; - } - - /* Invalidate the cursor position if necessary. */ - idx = (addr - video_mem_base) >> 1; - - attrib = CHARATTR_TO_SUNCOLOR(charattr); - font_row = &vga_font[(j = (charattr & 0xff)) << 4]; - - switch (con_depth){ - case 1: { - register unsigned char *dst; - unsigned long flags; - - dst = (unsigned char *)(((unsigned long)con_fb_base) + FBUF_OFFSET(idx)); - - __save_and_cli(flags); - if ((!(charattr & 0xf000)) ^ (idx == cursor_pos)) { - for(j = 0; j < CHAR_HEIGHT; j++, font_row++, dst+=CHARS_PER_LINE) - *dst = ~(*font_row); - } else { - for(j = 0; j < CHAR_HEIGHT; j++, font_row++, dst+=CHARS_PER_LINE) - *dst = *font_row; - } - __restore_flags(flags); - break; - } - case 8: { -#ifdef ASM_BLITC - const int cpl = chars_per_line; - /* The register assignment is important here, do not modify without touching the assembly code as well */ - register unsigned int x1 __asm__("g4"), x2 __asm__("g5"), x3 __asm__("g2"), x4 __asm__("g3"), flags __asm__("g7"); - register unsigned int *dst; -#else - const int ipl = ints_per_line; - unsigned int data2, data3, data4; - unsigned int data, rowbits; - register unsigned int *dst; - unsigned long flags; -#endif - const uint *fontm_bits = fontmask_bits; - - dst = (unsigned int *)(((unsigned long)con_fb_base) + COLOR_FBUF_OFFSET(idx)); - if (j == ' ') /* space is quite common, so we optimize a bit */ { -#ifdef ASM_BLITC -#define BLITC_SPACE \ - "\n\t std %3, [%0]" \ - "\n\t std %3, [%0 + %1]" \ - "\n\t add %0, %2, %0" -#define BLITC_SPC \ - "\n\t std %0, [%1]" \ - "\n\t std %0, [%1 + %2]" - - x1 = attrib >> 4; - x1 |= x1 << 8; - x1 |= x1 << 16; - x3 = cpl << 1; - - __asm__ __volatile__ ( - "\n\t mov %3, %4" - BLITC_SPACE - BLITC_SPACE - BLITC_SPACE - BLITC_SPACE - BLITC_SPACE - BLITC_SPACE - BLITC_SPACE - : "=r" (dst) - : "r" (cpl), "r" (x3), "r" (x1), "r" (x2)); - __save_and_cli (flags); - if (idx != cursor_pos) - __asm__ __volatile__ ( - BLITC_SPC - : /* no outputs */ - : "r" (x1), "r" (dst), "r" (cpl)); - else - __asm__ __volatile__ (BLITC_SPC - : /* no outputs */ - : "r" (x1), "r" (under_cursor), - "i" (8)); - __restore_flags (flags); -#else - bgmask = attrib >> 4; - bgmask |= bgmask << 8; - bgmask |= bgmask << 16; - - for(j = 0; j < CHAR_HEIGHT - 2; j++, font_row++, dst += ipl) { - *dst = bgmask; - *(dst+1) = bgmask; - } - /* Prevent cursor spots left on the screen */ - __save_and_cli(flags); - if (idx != cursor_pos) { - *dst = bgmask; - *(dst+1) = bgmask; - dst += ipl; - *dst = bgmask; - *(dst+1) = bgmask; - } else { - under_cursor [0] = bgmask; - under_cursor [1] = bgmask; - under_cursor [2] = bgmask; - under_cursor [3] = bgmask; - } - __restore_flags(flags); -#endif - } else /* non-space */ { - fgmask = attrib & 0x0f; - bgmask = attrib >> 4; - fgmask |= fgmask << 8; - fgmask |= fgmask << 16; - bgmask |= bgmask << 8; - bgmask |= bgmask << 16; - -#ifdef ASM_BLITC -#define BLITC_INIT \ - "\n\t ld [%0], %%g2" -#define BLITC_BODY(ST1,SC1,ST2,SC2) \ - "\n\t " #ST1 " %%g2, " #SC1 ", %%g7" \ - "\n\t " #ST2 " %%g2, " #SC2 ", %7" \ - "\n\t and %%g7, 0x3c, %%g7" \ - "\n\t and %7, 0x3c, %7" \ - "\n\t ld [%1 + %%g7], %6" \ - "\n\t and %6, %2, %%g7" \ - "\n\t andn %3, %6, %6" \ - "\n\t or %%g7, %6, %6" \ - "\n\t ld [%1 + %7], %7" \ - "\n\t and %7, %2, %%g7" \ - "\n\t andn %3, %7, %7" \ - "\n\t or %%g7, %7, %7" -#define BLITC_BODYEND \ - "\n\t sll %3, 2, %%g7" \ - "\n\t srl %3, 2, %3" \ - "\n\t and %%g7, 0x3c, %%g7" \ - "\n\t and %3, 0x3c, %3" \ - "\n\t ld [%0 + %%g7], %4" \ - "\n\t and %4, %1, %%g7" \ - "\n\t andn %2, %4, %4" \ - "\n\t or %%g7, %4, %4" \ - "\n\t ld [%0 + %3], %3" \ - "\n\t and %3, %1, %%g7" \ - "\n\t andn %2, %3, %3" \ - "\n\t or %%g7, %3, %3" -#define BLITC_STOREIT \ - "\n\t std %6, [%5]" \ - "\n\t add %5, %4, %5" \ - "\n\t" -#define BLITC_STORE \ - "\n\t std %%g4, [%0]" \ - "\n\t std %%g2, [%0 + %1]" - - for (j = 0; j < 3; j++, font_row+=4) { - __asm__ __volatile__ (BLITC_INIT - BLITC_BODY(srl, 26, srl, 22) - BLITC_STOREIT - BLITC_BODY(srl, 18, srl, 14) - BLITC_STOREIT - BLITC_BODY(srl, 10, srl, 6) - BLITC_STOREIT - BLITC_BODY(srl, 2, sll, 2) - BLITC_STOREIT - : : "r" (font_row), "r" (fontm_bits), "r" (fgmask), "r" (bgmask), "r" (cpl), "r" (dst), - "r" (x1), "r" (x2)); - } - __asm__ __volatile__ (BLITC_INIT - BLITC_BODY(srl, 26, srl, 22) - BLITC_STOREIT - BLITC_BODY(srl, 18, srl, 14) - BLITC_STOREIT - /* Now prepare date for the 15th line, but don't put it anywhere yet (leave it in g4,g5) */ - BLITC_BODY(srl, 10, srl, 6) - : : "r" (font_row), "r" (fontm_bits), "r" (fgmask), "r" (bgmask), "r" (cpl), "r" (dst), - "r" (x1), "r" (x2)); - /* Prepare the data the bottom line (and put it into g2,g3) */ - __asm__ __volatile__ (BLITC_BODYEND : : "r" (fontm_bits), "r" (fgmask), "r" (bgmask), - "r" (x3), "r" (x4)); - __save_and_cli(flags); - if (idx != cursor_pos) - __asm__ __volatile__ (BLITC_STORE : : "r" (dst), "r" (cpl)); - else - __asm__ __volatile__ (BLITC_STORE : : "r" (under_cursor), "i" (8)); - __restore_flags (flags); -#else - for(j = 0; j < CHAR_HEIGHT - 2; j++, font_row++, dst += ipl) { - rowbits = *font_row; - data = fontm_bits[(rowbits>>4)&0xf]; - data = (data & fgmask) | (~data & bgmask); - *dst = data; - data = fontm_bits[rowbits&0xf]; - data = (data & fgmask) | (~data & bgmask); - *(dst+1) = data; - } - rowbits = *font_row; - data = fontm_bits[(rowbits>>4)&0xf]; - data = (data & fgmask) | (~data & bgmask); - data2 = fontm_bits[rowbits&0xf]; - data2 = (data2 & fgmask) | (~data2 & bgmask); - rowbits = font_row[1]; - data3 = fontm_bits[(rowbits>>4)&0xf]; - data3 = (data3 & fgmask) | (~data3 & bgmask); - data4 = fontm_bits[rowbits&0xf]; - data4 = (data4 & fgmask) | (~data4 & bgmask); - - /* Prevent cursor spots left on the screen */ - __save_and_cli(flags); - - if (idx != cursor_pos) { - *dst = data; - *(dst+1) = data2; - dst += ipl; - *dst = data3; - *(dst+1) = data4; - } else { - under_cursor [0] = data; - under_cursor [1] = data2; - under_cursor [2] = data3; - under_cursor [3] = data4; - } - - __restore_flags(flags); -#endif - } - break; - } /* case */ - } /* switch */ - return (0); -} - -static void sbus_scr_writew(unsigned short val, unsigned short * addr) -{ - /* - * always deposit the char/attr, then see if it was to "screen" mem. - * if so, then render the char/attr onto the real screen. - */ - if (*addr != val) { - *addr = val; - if ((unsigned long)addr < video_mem_term && - (unsigned long)addr >= video_mem_base && - vt_cons [fg_console]->vc_mode == KD_TEXT) - sbus_blitc(val, (unsigned long) addr); - } -} - -static unsigned short sbus_scr_readw(unsigned short * addr) -{ - return *addr; -} - -static void sbus_memsetw(void * s, unsigned short c, unsigned int count) -{ - unsigned short * addr = (unsigned short *) s; - - count >>= 1; - if (vt_cons[fg_console]->vc_mode == KD_GRAPHICS) { - while (count) { - count--; - *addr++ = c; - } - return; - } - if ((unsigned long) addr + count > video_mem_term || - (unsigned long) addr < video_mem_base) { - if ((unsigned long) addr + count <= video_mem_term || - (unsigned long) addr > video_mem_base) { - while (count) { - count--; - *addr++ = c; - } - return; - } else { - while (count) { - count--; - scr_writew(c, addr++); - } - } -#define GX_SETW (*fbinfo[0].setw)(x_margin + ((xoff - (addr - last)) << 3), y_margin + CHAR_HEIGHT * yoff, c, addr - last); - } else if (do_accel) { - int yoff = (((long)addr - (long)video_mem_base) >> 1) / video_num_columns; - int xoff = (((long)addr - (long)video_mem_base) >> 1) % video_num_columns; - unsigned short * last = addr; - - while (count) { - count--; - if (*addr != c) { - if (xoff == video_num_columns) { - if (last != addr) - GX_SETW - xoff = 0; - yoff++; - last = addr; - } - *addr++ = c; - xoff++; - } else { - if (last != addr) - GX_SETW - if (xoff == video_num_columns) { - xoff = 0; - yoff++; - } - addr++; - xoff++; - last = addr; - } - } - if (last != addr) - GX_SETW - } else { - while (count) { - count--; - if (*addr != c) { - sbus_blitc(c, (unsigned long)addr); - *addr++ = c; - } else - addr++; - } - } -} - -static void sbus_memcpyw(unsigned short *to, unsigned short *from, unsigned int count) -{ - if (vt_cons[fg_console]->vc_mode == KD_GRAPHICS) { - memcpy(to, from, count); - return; - } - if ((unsigned long) to + count > video_mem_term || - (unsigned long) to < video_mem_base) { - if ((unsigned long) to + count <= video_mem_term || - (unsigned long) to > video_mem_base) - memcpy(to, from, count); - else { - count >>= 1; - while (count) { - count--; - scr_writew(scr_readw(from++), to++); - } - } -#define GX_CPYW (*fbinfo[0].cpyw)(x_margin + ((xoff - (to - last)) << 3), y_margin + CHAR_HEIGHT * yoff, last, to - last); - } else if (do_accel) { - int yoff = (((long)to - (long)video_mem_base) >> 1) / video_num_columns; - int xoff = (((long)to - (long)video_mem_base) >> 1) % video_num_columns; - unsigned short * last = to; - - count >>=1; - while (count) { - count--; - if (*to != *from) { - if (xoff == video_num_columns) { - if (last != to) - GX_CPYW - xoff = 0; - yoff++; - last = to; - } else if (last != to && (*last & 0xff00) != (*from & 0xff00)) { - GX_CPYW - last = to; - } - *to++ = *from++; - xoff++; - } else { - if (last != to) - GX_CPYW - if (xoff == video_num_columns) { - xoff = 0; - yoff++; - } - to++; - xoff++; - last = to; - from++; - } - } - if (last != to) - GX_CPYW - } else { - count >>= 1; - while (count) { - count--; - if (*to != *from) { - sbus_blitc(*from, (unsigned long)to); - *to++ = *from++; - } else { - from++; - to++; - } - } - } -} - -#undef pos -int sbus_hw_scursor (struct fbcursor *cursor, fbinfo_t *fb) -{ - int op; - int i, bytes = 0; - struct fbcursor f; - char red[2], green[2], blue[2]; - - if (copy_from_user (&f, cursor, sizeof(struct fbcursor))) - return -EFAULT; - op = f.set; - if (op & FB_CUR_SETSHAPE){ - if ((uint) f.size.fbx > fb->cursor.hwsize.fbx) - return -EINVAL; - if ((uint) f.size.fby > fb->cursor.hwsize.fby) - return -EINVAL; - if (f.size.fbx > 32) - bytes = f.size.fby << 3; - else - bytes = f.size.fby << 2; - } - if (op & FB_CUR_SETCMAP){ - if (f.cmap.index || f.cmap.count != 2) - return -EINVAL; - if (copy_from_user (red, f.cmap.red, 2) || - copy_from_user (green, f.cmap.green, 2) || - copy_from_user (blue, f.cmap.blue, 2)) - return -EFAULT; - } - if (op & FB_CUR_SETCMAP) - (*fb->setcursormap) (fb, red, green, blue); - if (op & FB_CUR_SETSHAPE){ - uint u; - - fb->cursor.size = f.size; - memset ((void *)&fb->cursor.bits, 0, sizeof (fb->cursor.bits)); - if (copy_from_user (fb->cursor.bits [0], f.mask, bytes) || - copy_from_user (fb->cursor.bits [1], f.image, bytes)) - return -EFAULT; - if (f.size.fbx <= 32) { - u = ~(0xffffffff >> f.size.fbx); - for (i = fb->cursor.size.fby - 1; i >= 0; i--) { - fb->cursor.bits [0][i] &= u; - fb->cursor.bits [1][i] &= fb->cursor.bits [0][i]; - } - } else { - u = ~(0xffffffff >> (f.size.fbx - 32)); - for (i = fb->cursor.size.fby - 1; i >= 0; i--) { - fb->cursor.bits [0][2*i+1] &= u; - fb->cursor.bits [1][2*i] &= fb->cursor.bits [0][2*i]; - fb->cursor.bits [1][2*i+1] &= fb->cursor.bits [0][2*i+1]; - } - } - (*fb->setcurshape) (fb); - } - if (op & (FB_CUR_SETCUR | FB_CUR_SETPOS | FB_CUR_SETHOT)){ - if (op & FB_CUR_SETCUR) - fb->cursor.enable = f.enable; - if (op & FB_CUR_SETPOS) - fb->cursor.cpos = f.pos; - if (op & FB_CUR_SETHOT) - fb->cursor.chot = f.hot; - (*fb->setcursor) (fb); - } - return 0; -} - -static unsigned char hw_cursor_cmap[2] = { 0, 0xff }; - -void sbus_hw_hide_cursor (void) -{ - fbinfo[0].cursor.enable = 0; - (*fbinfo[0].setcursor)(&fbinfo[0]); - sbus_hw_cursor_shown = 0; -} - -void sbus_hw_set_cursor (int xoff, int yoff) -{ - if (!sbus_hw_cursor_shown) { - fbinfo[0].cursor.size.fbx = CHAR_WIDTH; - fbinfo[0].cursor.size.fby = CHAR_HEIGHT; - fbinfo[0].cursor.chot.fbx = 0; - fbinfo[0].cursor.chot.fby = 0; - fbinfo[0].cursor.enable = 1; - memset (fbinfo[0].cursor.bits, 0, sizeof (fbinfo[0].cursor.bits)); - fbinfo[0].cursor.bits[0][CHAR_HEIGHT - 2] = 0xff000000; - fbinfo[0].cursor.bits[1][CHAR_HEIGHT - 2] = 0xff000000; - fbinfo[0].cursor.bits[0][CHAR_HEIGHT - 1] = 0xff000000; - fbinfo[0].cursor.bits[1][CHAR_HEIGHT - 1] = 0xff000000; - (*fbinfo[0].setcursormap) (&fbinfo[0], hw_cursor_cmap, hw_cursor_cmap, hw_cursor_cmap); - (*fbinfo[0].setcurshape) (&fbinfo[0]); - sbus_hw_cursor_shown = 1; - } - fbinfo[0].cursor.cpos.fbx = xoff; - fbinfo[0].cursor.cpos.fby = yoff; - (*fbinfo[0].setcursor)(&fbinfo[0]); -} - -__initfunc(static void sbus_install_consops(void)) -{ - suncons_ops.memsetw = sbus_memsetw; - suncons_ops.memcpyw = sbus_memcpyw; - suncons_ops.scr_writew = sbus_scr_writew; - suncons_ops.scr_readw = sbus_scr_readw; - - suncons_ops.get_scrmem = sbus_get_scrmem; - suncons_ops.set_scrmem = sbus_set_scrmem; - - suncons_ops.hide_cursor = sbus_hide_cursor; - suncons_ops.set_cursor = sbus_set_cursor; - suncons_ops.set_get_font = sbus_set_get_font; - suncons_ops.con_adjust_height = sbus_con_adjust_height; - suncons_ops.set_get_cmap = sbus_set_get_cmap; - suncons_ops.set_palette = sbus_set_palette; - suncons_ops.set_other_palette = sbus_set_other_palette; - suncons_ops.console_restore_palette = sbus_console_restore_palette; - - suncons_ops.con_type_init = sbus_con_type_init; - suncons_ops.con_type_init_finish = sbus_con_type_init_finish; - - suncons_ops.clear_screen = sbus_clear_screen; - suncons_ops.render_screen = sbus_render_screen; - suncons_ops.clear_margin = sbus_clear_margin; -} diff --git a/drivers/sbus/char/su.c b/drivers/sbus/char/su.c index 42a233753..8ed6660b7 100644 --- a/drivers/sbus/char/su.c +++ b/drivers/sbus/char/su.c @@ -1,4 +1,4 @@ -/* $Id: su.c,v 1.8 1998/04/01 05:07:50 ecd Exp $ +/* $Id: su.c,v 1.10 1998/05/29 06:00:26 ecd Exp $ * su.c: Small serial driver for keyboard/mouse interface on Ultra/AX * * Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be) @@ -21,6 +21,7 @@ #include <asm/oplib.h> #include <asm/io.h> #include <asm/ebus.h> +#include <asm/irq.h> #include "sunserial.h" #include "sunkbd.h" @@ -151,7 +152,7 @@ su_interrupt(int irq, void *dev_id, struct pt_regs * regs) unsigned char status; #ifdef SERIAL_DEBUG_INTR - printk("su_interrupt(%d)...", irq); + printk("su_interrupt(%s)...", __irq_itoa(irq)); #endif if (su_inb(info, UART_IIR) & UART_IIR_NO_INT) @@ -186,7 +187,8 @@ startup(struct su_struct * info) } #ifdef SERIAL_DEBUG_OPEN - printk("starting up su%d (irq %x)...", info->line, info->irq); + printk("starting up su%d (irq %s)...", info->line, + __irq_itoa(info->irq)); #endif if (info->type == PORT_16750) @@ -405,18 +407,21 @@ static void autoconfig(struct su_struct *info) { unsigned char status1, status2, scratch, scratch2; - struct linux_ebus_device *dev; + struct linux_ebus_device *dev = 0; struct linux_ebus *ebus; unsigned long flags; - for_all_ebusdev(dev, ebus) { - if (!strncmp(dev->prom_name, "su", 2)) { - if (dev->prom_node == info->kbd_node) - break; - if (dev->prom_node == info->ms_node) - break; + for_each_ebus(ebus) { + for_each_ebusdev(dev, ebus) { + if (!strncmp(dev->prom_name, "su", 2)) { + if (dev->prom_node == info->kbd_node) + goto ebus_done; + if (dev->prom_node == info->ms_node) + goto ebus_done; + } } } +ebus_done: if (!dev) return; @@ -427,8 +432,8 @@ autoconfig(struct su_struct *info) info->irq = dev->irqs[0]; #ifdef DEBUG_SERIAL_OPEN - printk("Found 'su' at %016lx IRQ %08x\n", - dev->base_address[0], dev->irqs[0]); + printk("Found 'su' at %016lx IRQ %d,%x\n", dev->base_address[0], + __irq_itoa(dev->irqs[0])); #endif info->magic = SERIAL_MAGIC; @@ -564,8 +569,8 @@ __initfunc(int su_init(void)) if (info->type == PORT_UNKNOWN) continue; - printk(KERN_INFO "%s at %16lx (irq = %08x) is a %s\n", - info->name, info->port, info->irq, + printk(KERN_INFO "%s at %16lx (irq = %s) is a %s\n", + info->name, info->port, __irq_itoa(info->irq), uart_config[info->type].name); startup(info); diff --git a/drivers/sbus/char/suncons.c b/drivers/sbus/char/suncons.c deleted file mode 100644 index 32062371e..000000000 --- a/drivers/sbus/char/suncons.c +++ /dev/null @@ -1,386 +0,0 @@ -/* $Id: suncons.c,v 1.79 1998/01/30 10:59:23 jj Exp $ - * suncons.c: Sparc platform console generic layer. - * - * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu) - */ - -#include <linux/config.h> -#include <linux/kernel.h> -#include <linux/types.h> -#include <linux/tty.h> -#include <linux/errno.h> -#include <linux/init.h> -#include <linux/console.h> -#include <linux/vt.h> -#include <linux/selection.h> -#include <linux/proc_fs.h> - -#include <asm/page.h> -#include <asm/pgtable.h> -#include <asm/sbus.h> -#include <asm/fbio.h> - -#include "fb.h" - -#include <asm/linux_logo.h> - -fbinfo_t *fbinfo; -int fbinfos; -unsigned int linux_logo_colors __initdata = LINUX_LOGO_COLORS; -char logo_banner[] __initdata = linux_logo_banner; -#ifdef CONFIG_PCI -static int cons_type __initdata = 0; -#endif - -extern struct console vt_console_driver; - -/* Infrastructure. */ - -static void nop_memsetw(void *s, unsigned short c, unsigned int count) -{ -} - -static void nop_memcpyw(unsigned short *to, unsigned short *from, unsigned int count) -{ -} - -static void nop_scr_writew(unsigned short val, unsigned short *addr) -{ -} - -static unsigned short nop_scr_readw(unsigned short *addr) -{ - return 0; -} - -static void nop_get_scrmem(int a) -{ -} - -static void nop_set_scrmem(int a, long b) -{ -} - -static void nop_set_origin(unsigned short offset) -{ -} - -static void nop_hide_cursor(void) -{ -} - -static void nop_set_cursor(int c) -{ -} - -static int nop_set_get_font(char *a, int b, int c) -{ - return 0; -} - -static int nop_con_adjust_height(unsigned long arg) -{ - return -EINVAL; -} - -static int nop_set_get_cmap(unsigned char *arg, int a) -{ - return 0; -} - -static void nop_set_palette(void) -{ -} - -static void nop_set_other_palette(int a) -{ -} - -static void nop_console_restore_palette(void) -{ -} - -static unsigned long nop_con_type_init(unsigned long mem_start, - const char **display_desc) -{ - return mem_start; -} - -static void nop_con_type_init_finish(void) -{ -} - -static void nop_vesa_blank(void) -{ -} - -static void nop_vesa_unblank(void) -{ -} - -static void nop_set_vesa_blanking(const unsigned long arg) -{ -} - -static void nop_vesa_powerdown(void) -{ -} - -static void nop_clear_screen(void) -{ -} - -static void nop_render_screen(void) -{ -} - -static void nop_clear_margin(void) -{ -} - -struct suncons_operations suncons_ops = { - nop_memsetw, - nop_memcpyw, - nop_scr_writew, - nop_scr_readw, - nop_get_scrmem, - nop_set_scrmem, - nop_set_origin, - nop_hide_cursor, - nop_set_cursor, - nop_set_get_font, - nop_con_adjust_height, - nop_set_get_cmap, - nop_set_palette, - nop_set_other_palette, - nop_console_restore_palette, - nop_con_type_init, - nop_con_type_init_finish, - nop_vesa_blank, - nop_vesa_unblank, - nop_set_vesa_blanking, - nop_vesa_powerdown, - nop_clear_screen, - nop_render_screen, - nop_clear_margin -}; - -/* Entry points. */ - -void get_scrmem(int a) -{ - suncons_ops.get_scrmem(a); -} - -void set_scrmem(int a, long b) -{ - suncons_ops.set_scrmem(a, b); -} - -void __set_origin(unsigned short offset) -{ - suncons_ops.set_origin(offset); -} - -void hide_cursor(void) -{ - suncons_ops.hide_cursor(); -} - -void set_cursor(int currcons) -{ - suncons_ops.set_cursor(currcons); -} - -int set_get_font(char *arg, int set, int ch512) -{ - return suncons_ops.set_get_font(arg, set, ch512); -} - -int con_adjust_height(unsigned long fontheight) -{ - return suncons_ops.con_adjust_height(fontheight); -} - -int set_get_cmap(unsigned char *arg, int set) -{ - return suncons_ops.set_get_cmap(arg, set); -} - -void set_palette(void) -{ - suncons_ops.set_palette(); -} - -void set_other_palette(int n) -{ - suncons_ops.set_other_palette(n); -} - -void console_restore_palette(void) -{ - suncons_ops.console_restore_palette(); -} - -unsigned long con_type_init(unsigned long mem_start, const char **disp_desc) -{ - return suncons_ops.con_type_init(mem_start, disp_desc); -} - -void con_type_init_finish(void) -{ - suncons_ops.con_type_init_finish(); -} - -void vesa_blank(void) -{ - suncons_ops.vesa_blank(); -} - -void vesa_unblank(void) -{ - suncons_ops.vesa_unblank(); -} - -void set_vesa_blanking(const unsigned long arg) -{ - suncons_ops.set_vesa_blanking(arg); -} - -void vesa_powerdown(void) -{ - suncons_ops.vesa_powerdown(); -} - -void render_screen(void) -{ - suncons_ops.render_screen(); -} - -/* - * We permutate the colors, so we match the PROM's idea of - * black and white. - */ -unsigned char reverse_color_table[] = { - 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0 -}; - -unsigned char sparc_color_table[] = { - 15, 0, 4, 2, 6, 1, 5, 3, 7, 8, 12, 10, 14, 9, 13, 11 -}; - -/* Probing engine. */ - -char *console_fb_path = NULL; -void (*fb_restore_palette)(fbinfo_t *fbinfo) = NULL; - -unsigned long -get_phys (unsigned long addr) -{ - return __get_phys(addr); -} - -extern int sbus_console_probe(void); -extern int serial_console; - -__initfunc(static unsigned long finish_console_init(unsigned long memory_start)) -{ - static int confinish_has_run = 0; - int i, j; - - if(confinish_has_run != 0) { - printk("finish_console_init: Someone tries to run me twice.\n"); - return memory_start; - } - for(i = FRAME_BUFFERS; i > 1; i--) - if(fbinfo[i - 1].type.fb_type != FBTYPE_NOTYPE) - break; - fbinfos = i; - - for(j = 0; j < i; j++) - if (fbinfo[j].postsetup) - memory_start = (*fbinfo[j].postsetup)(fbinfo+j, memory_start); - - suncons_ops.clear_screen(); - - for(j = 1; j < i; j++) - if(fbinfo[j].type.fb_type != FBTYPE_NOTYPE) { - fbinfo[j].clear_fb(j); - fbinfo[j].set_other_palette(j); - } -#if defined(CONFIG_PROC_FS) && \ - ( defined(CONFIG_SUN_OPENPROMFS) || defined(CONFIG_SUN_OPENPROMFS_MODULE) ) - for (j = 0; j < i; j++) - if (fbinfo[j].type.fb_type != FBTYPE_NOTYPE) - proc_openprom_regdev (&fbinfo[j].proc_entry); -#endif - - confinish_has_run = 1; - - return memory_start; -} - -#ifdef CONFIG_PCI -extern void pci_console_inithook(void); -#endif - -__initfunc(int con_is_present(void)) -{ - return serial_console ? 0 : 1; -} - -__initfunc(unsigned long sun_console_init(unsigned long memory_start)) -{ - int i; - - /* Nothing to do in this case. */ - if (!con_is_present()) - return memory_start; - - fbinfo = (fbinfo_t *)memory_start; - memset(fbinfo, 0, FRAME_BUFFERS * sizeof(fbinfo_t)); - memory_start += (FRAME_BUFFERS * sizeof(fbinfo_t)); - fbinfos = 0; - - for (i = 0; i < FRAME_BUFFERS; i++) - fbinfo [i].type.fb_type = FBTYPE_NOTYPE; - - if(sbus_console_probe()) { -#ifdef CONFIG_PCI - cons_type = 1; - pci_console_inithook(); - return memory_start; -#else - /* XXX We need to write PROM console fallback driver... */ - prom_printf("Could not probe SBUS console, bailing out...\n"); - prom_halt(); -#endif - } - return finish_console_init(memory_start); -} - -#ifdef CONFIG_PCI -extern int pci_console_probe(void); - -__initfunc(unsigned long pci_console_init(unsigned long memory_start)) -{ - /* Nothing to do in this case. */ - if (!con_is_present()) - return memory_start; - - if (!cons_type) { - /* Some console was already found on SBUS or UPA */ - return memory_start; - } - - if(pci_console_probe()) { - prom_printf("Could not probe PCI console, bailing out...\n"); - prom_halt(); - } - - memory_start = finish_console_init(memory_start); - - con_type_init_finish(); - return memory_start; -} -#endif diff --git a/drivers/sbus/char/suncons_font.h b/drivers/sbus/char/suncons_font.h deleted file mode 100644 index 87a07b10d..000000000 --- a/drivers/sbus/char/suncons_font.h +++ /dev/null @@ -1,258 +0,0 @@ -unsigned char vga_font[cmapsz] = { -/* */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x7e,0x81,0xa5,0x81,0x81,0xbd,0x99,0x81,0x81,0x7e,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x7e,0xff,0xdb,0xff,0xff,0xc3,0xe7,0xff,0xff,0x7e,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x6c,0xfe,0xfe,0xfe,0xfe,0x7c,0x38,0x10,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x10,0x38,0x7c,0xfe,0x7c,0x38,0x10,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x18,0x3c,0x3c,0xe7,0xe7,0xe7,0x18,0x18,0x3c,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x18,0x3c,0x7e,0xff,0xff,0x7e,0x18,0x18,0x3c,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x3c,0x3c,0x18,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0xff,0xff,0xff,0xff,0xff,0xff,0xe7,0xc3,0xc3,0xe7,0xff,0xff,0xff,0xff,0xff,0xff, -/* */ 0x00,0x00,0x00,0x00,0x00,0x3c,0x66,0x42,0x42,0x66,0x3c,0x00,0x00,0x00,0x00,0x00, -/* */ 0xff,0xff,0xff,0xff,0xff,0xc3,0x99,0xbd,0xbd,0x99,0xc3,0xff,0xff,0xff,0xff,0xff, -/* */ 0x00,0x00,0x1e,0x0e,0x1a,0x32,0x78,0xcc,0xcc,0xcc,0xcc,0x78,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x3c,0x66,0x66,0x66,0x66,0x3c,0x18,0x7e,0x18,0x18,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x3f,0x33,0x3f,0x30,0x30,0x30,0x30,0x70,0xf0,0xe0,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x7f,0x63,0x7f,0x63,0x63,0x63,0x63,0x67,0xe7,0xe6,0xc0,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x18,0x18,0xdb,0x3c,0xe7,0x3c,0xdb,0x18,0x18,0x00,0x00,0x00,0x00, -/* */ 0x00,0x80,0xc0,0xe0,0xf0,0xf8,0xfe,0xf8,0xf0,0xe0,0xc0,0x80,0x00,0x00,0x00,0x00, -/* */ 0x00,0x02,0x06,0x0e,0x1e,0x3e,0xfe,0x3e,0x1e,0x0e,0x06,0x02,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x18,0x3c,0x7e,0x18,0x18,0x18,0x7e,0x3c,0x18,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x00,0x66,0x66,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x7f,0xdb,0xdb,0xdb,0x7b,0x1b,0x1b,0x1b,0x1b,0x1b,0x00,0x00,0x00,0x00, -/* */ 0x00,0x7c,0xc6,0x60,0x38,0x6c,0xc6,0xc6,0x6c,0x38,0x0c,0xc6,0x7c,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0xfe,0xfe,0xfe,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x18,0x3c,0x7e,0x18,0x18,0x18,0x7e,0x3c,0x18,0x7e,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x18,0x3c,0x7e,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x7e,0x3c,0x18,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x00,0x18,0x0c,0xfe,0x0c,0x18,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x00,0x30,0x60,0xfe,0x60,0x30,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0xc0,0xc0,0xfe,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x00,0x24,0x66,0xff,0x66,0x24,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x10,0x38,0x38,0x7c,0x7c,0xfe,0xfe,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0xfe,0xfe,0x7c,0x7c,0x38,0x38,0x10,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/*!*/ 0x00,0x00,0x18,0x3c,0x3c,0x3c,0x18,0x18,0x18,0x00,0x18,0x18,0x00,0x00,0x00,0x00, -/*"*/ 0x00,0x66,0x66,0x66,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/*#*/ 0x00,0x00,0x00,0x6c,0x6c,0xfe,0x6c,0x6c,0x6c,0xfe,0x6c,0x6c,0x00,0x00,0x00,0x00, -/*$*/ 0x18,0x18,0x7c,0xc6,0xc2,0xc0,0x7c,0x06,0x06,0x86,0xc6,0x7c,0x18,0x18,0x00,0x00, -/*%*/ 0x00,0x00,0x00,0x00,0xc2,0xc6,0x0c,0x18,0x30,0x60,0xc6,0x86,0x00,0x00,0x00,0x00, -/*&*/ 0x00,0x00,0x38,0x6c,0x6c,0x38,0x76,0xdc,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00, -/*'*/ 0x00,0x30,0x30,0x30,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/*(*/ 0x00,0x00,0x0c,0x18,0x30,0x30,0x30,0x30,0x30,0x30,0x18,0x0c,0x00,0x00,0x00,0x00, -/*)*/ 0x00,0x00,0x30,0x18,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x18,0x30,0x00,0x00,0x00,0x00, -/***/ 0x00,0x00,0x00,0x00,0x00,0x66,0x3c,0xff,0x3c,0x66,0x00,0x00,0x00,0x00,0x00,0x00, -/*+*/ 0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x7e,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00, -/*,*/ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x18,0x30,0x00,0x00,0x00, -/*-*/ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/*.*/ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x02,0x06,0x0c,0x18,0x30,0x60,0xc0,0x80,0x00,0x00,0x00,0x00, -/*0*/ 0x00,0x00,0x7c,0xc6,0xc6,0xce,0xde,0xf6,0xe6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00, -/*1*/ 0x00,0x00,0x18,0x38,0x78,0x18,0x18,0x18,0x18,0x18,0x18,0x7e,0x00,0x00,0x00,0x00, -/*2*/ 0x00,0x00,0x7c,0xc6,0x06,0x0c,0x18,0x30,0x60,0xc0,0xc6,0xfe,0x00,0x00,0x00,0x00, -/*3*/ 0x00,0x00,0x7c,0xc6,0x06,0x06,0x3c,0x06,0x06,0x06,0xc6,0x7c,0x00,0x00,0x00,0x00, -/*4*/ 0x00,0x00,0x0c,0x1c,0x3c,0x6c,0xcc,0xfe,0x0c,0x0c,0x0c,0x1e,0x00,0x00,0x00,0x00, -/*5*/ 0x00,0x00,0xfe,0xc0,0xc0,0xc0,0xfc,0x06,0x06,0x06,0xc6,0x7c,0x00,0x00,0x00,0x00, -/*6*/ 0x00,0x00,0x38,0x60,0xc0,0xc0,0xfc,0xc6,0xc6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00, -/*7*/ 0x00,0x00,0xfe,0xc6,0x06,0x06,0x0c,0x18,0x30,0x30,0x30,0x30,0x00,0x00,0x00,0x00, -/*8*/ 0x00,0x00,0x7c,0xc6,0xc6,0xc6,0x7c,0xc6,0xc6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00, -/*9*/ 0x00,0x00,0x7c,0xc6,0xc6,0xc6,0x7e,0x06,0x06,0x06,0x0c,0x78,0x00,0x00,0x00,0x00, -/*:*/ 0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00, -/*;*/ 0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x18,0x18,0x30,0x00,0x00,0x00,0x00, -/*<*/ 0x00,0x00,0x00,0x06,0x0c,0x18,0x30,0x60,0x30,0x18,0x0c,0x06,0x00,0x00,0x00,0x00, -/*=*/ 0x00,0x00,0x00,0x00,0x00,0x7e,0x00,0x00,0x7e,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/*>*/ 0x00,0x00,0x00,0x60,0x30,0x18,0x0c,0x06,0x0c,0x18,0x30,0x60,0x00,0x00,0x00,0x00, -/*?*/ 0x00,0x00,0x7c,0xc6,0xc6,0x0c,0x18,0x18,0x18,0x00,0x18,0x18,0x00,0x00,0x00,0x00, -/*@*/ 0x00,0x00,0x7c,0xc6,0xc6,0xc6,0xde,0xde,0xde,0xdc,0xc0,0x7c,0x00,0x00,0x00,0x00, -/*A*/ 0x00,0x00,0x10,0x38,0x6c,0xc6,0xc6,0xfe,0xc6,0xc6,0xc6,0xc6,0x00,0x00,0x00,0x00, -/*B*/ 0x00,0x00,0xfc,0x66,0x66,0x66,0x7c,0x66,0x66,0x66,0x66,0xfc,0x00,0x00,0x00,0x00, -/*C*/ 0x00,0x00,0x3c,0x66,0xc2,0xc0,0xc0,0xc0,0xc0,0xc2,0x66,0x3c,0x00,0x00,0x00,0x00, -/*D*/ 0x00,0x00,0xf8,0x6c,0x66,0x66,0x66,0x66,0x66,0x66,0x6c,0xf8,0x00,0x00,0x00,0x00, -/*E*/ 0x00,0x00,0xfe,0x66,0x62,0x68,0x78,0x68,0x60,0x62,0x66,0xfe,0x00,0x00,0x00,0x00, -/*F*/ 0x00,0x00,0xfe,0x66,0x62,0x68,0x78,0x68,0x60,0x60,0x60,0xf0,0x00,0x00,0x00,0x00, -/*G*/ 0x00,0x00,0x3c,0x66,0xc2,0xc0,0xc0,0xde,0xc6,0xc6,0x66,0x3a,0x00,0x00,0x00,0x00, -/*H*/ 0x00,0x00,0xc6,0xc6,0xc6,0xc6,0xfe,0xc6,0xc6,0xc6,0xc6,0xc6,0x00,0x00,0x00,0x00, -/*I*/ 0x00,0x00,0x3c,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x3c,0x00,0x00,0x00,0x00, -/*J*/ 0x00,0x00,0x1e,0x0c,0x0c,0x0c,0x0c,0x0c,0xcc,0xcc,0xcc,0x78,0x00,0x00,0x00,0x00, -/*K*/ 0x00,0x00,0xe6,0x66,0x66,0x6c,0x78,0x78,0x6c,0x66,0x66,0xe6,0x00,0x00,0x00,0x00, -/*L*/ 0x00,0x00,0xf0,0x60,0x60,0x60,0x60,0x60,0x60,0x62,0x66,0xfe,0x00,0x00,0x00,0x00, -/*M*/ 0x00,0x00,0xc3,0xe7,0xff,0xff,0xdb,0xc3,0xc3,0xc3,0xc3,0xc3,0x00,0x00,0x00,0x00, -/*N*/ 0x00,0x00,0xc6,0xe6,0xf6,0xfe,0xde,0xce,0xc6,0xc6,0xc6,0xc6,0x00,0x00,0x00,0x00, -/*O*/ 0x00,0x00,0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00, -/*P*/ 0x00,0x00,0xfc,0x66,0x66,0x66,0x7c,0x60,0x60,0x60,0x60,0xf0,0x00,0x00,0x00,0x00, -/*Q*/ 0x00,0x00,0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xd6,0xde,0x7c,0x0c,0x0e,0x00,0x00, -/*R*/ 0x00,0x00,0xfc,0x66,0x66,0x66,0x7c,0x6c,0x66,0x66,0x66,0xe6,0x00,0x00,0x00,0x00, -/*S*/ 0x00,0x00,0x7c,0xc6,0xc6,0x60,0x38,0x0c,0x06,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00, -/*T*/ 0x00,0x00,0xff,0xdb,0x99,0x18,0x18,0x18,0x18,0x18,0x18,0x3c,0x00,0x00,0x00,0x00, -/*U*/ 0x00,0x00,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00, -/*V*/ 0x00,0x00,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0x66,0x3c,0x18,0x00,0x00,0x00,0x00, -/*W*/ 0x00,0x00,0xc3,0xc3,0xc3,0xc3,0xc3,0xdb,0xdb,0xff,0x66,0x66,0x00,0x00,0x00,0x00, -/*X*/ 0x00,0x00,0xc3,0xc3,0x66,0x3c,0x18,0x18,0x3c,0x66,0xc3,0xc3,0x00,0x00,0x00,0x00, -/*Y*/ 0x00,0x00,0xc3,0xc3,0xc3,0x66,0x3c,0x18,0x18,0x18,0x18,0x3c,0x00,0x00,0x00,0x00, -/*Z*/ 0x00,0x00,0xff,0xc3,0x86,0x0c,0x18,0x30,0x60,0xc1,0xc3,0xff,0x00,0x00,0x00,0x00, -/*[*/ 0x00,0x00,0x3c,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x3c,0x00,0x00,0x00,0x00, -/*\*/ 0x00,0x00,0x00,0x80,0xc0,0xe0,0x70,0x38,0x1c,0x0e,0x06,0x02,0x00,0x00,0x00,0x00, -/*]*/ 0x00,0x00,0x3c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x3c,0x00,0x00,0x00,0x00, -/*^*/ 0x10,0x38,0x6c,0xc6,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/*_*/ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x00,0x00, -/*`*/ 0x30,0x30,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/*a*/ 0x00,0x00,0x00,0x00,0x00,0x78,0x0c,0x7c,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00, -/*b*/ 0x00,0x00,0xe0,0x60,0x60,0x78,0x6c,0x66,0x66,0x66,0x66,0x7c,0x00,0x00,0x00,0x00, -/*c*/ 0x00,0x00,0x00,0x00,0x00,0x7c,0xc6,0xc0,0xc0,0xc0,0xc6,0x7c,0x00,0x00,0x00,0x00, -/*d*/ 0x00,0x00,0x1c,0x0c,0x0c,0x3c,0x6c,0xcc,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00, -/*e*/ 0x00,0x00,0x00,0x00,0x00,0x7c,0xc6,0xfe,0xc0,0xc0,0xc6,0x7c,0x00,0x00,0x00,0x00, -/*f*/ 0x00,0x00,0x38,0x6c,0x64,0x60,0xf0,0x60,0x60,0x60,0x60,0xf0,0x00,0x00,0x00,0x00, -/*g*/ 0x00,0x00,0x00,0x00,0x00,0x76,0xcc,0xcc,0xcc,0xcc,0xcc,0x7c,0x0c,0xcc,0x78,0x00, -/*h*/ 0x00,0x00,0xe0,0x60,0x60,0x6c,0x76,0x66,0x66,0x66,0x66,0xe6,0x00,0x00,0x00,0x00, -/*i*/ 0x00,0x00,0x18,0x18,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x3c,0x00,0x00,0x00,0x00, -/*j*/ 0x00,0x00,0x06,0x06,0x00,0x0e,0x06,0x06,0x06,0x06,0x06,0x06,0x66,0x66,0x3c,0x00, -/*k*/ 0x00,0x00,0xe0,0x60,0x60,0x66,0x6c,0x78,0x78,0x6c,0x66,0xe6,0x00,0x00,0x00,0x00, -/*l*/ 0x00,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x3c,0x00,0x00,0x00,0x00, -/*m*/ 0x00,0x00,0x00,0x00,0x00,0xe6,0xff,0xdb,0xdb,0xdb,0xdb,0xdb,0x00,0x00,0x00,0x00, -/*n*/ 0x00,0x00,0x00,0x00,0x00,0xdc,0x66,0x66,0x66,0x66,0x66,0x66,0x00,0x00,0x00,0x00, -/*o*/ 0x00,0x00,0x00,0x00,0x00,0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00, -/*p*/ 0x00,0x00,0x00,0x00,0x00,0xdc,0x66,0x66,0x66,0x66,0x66,0x7c,0x60,0x60,0xf0,0x00, -/*q*/ 0x00,0x00,0x00,0x00,0x00,0x76,0xcc,0xcc,0xcc,0xcc,0xcc,0x7c,0x0c,0x0c,0x1e,0x00, -/*r*/ 0x00,0x00,0x00,0x00,0x00,0xdc,0x76,0x66,0x60,0x60,0x60,0xf0,0x00,0x00,0x00,0x00, -/*s*/ 0x00,0x00,0x00,0x00,0x00,0x7c,0xc6,0x60,0x38,0x0c,0xc6,0x7c,0x00,0x00,0x00,0x00, -/*t*/ 0x00,0x00,0x10,0x30,0x30,0xfc,0x30,0x30,0x30,0x30,0x36,0x1c,0x00,0x00,0x00,0x00, -/*u*/ 0x00,0x00,0x00,0x00,0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00, -/*v*/ 0x00,0x00,0x00,0x00,0x00,0xc3,0xc3,0xc3,0xc3,0x66,0x3c,0x18,0x00,0x00,0x00,0x00, -/*w*/ 0x00,0x00,0x00,0x00,0x00,0xc3,0xc3,0xc3,0xdb,0xdb,0xff,0x66,0x00,0x00,0x00,0x00, -/*x*/ 0x00,0x00,0x00,0x00,0x00,0xc3,0x66,0x3c,0x18,0x3c,0x66,0xc3,0x00,0x00,0x00,0x00, -/*y*/ 0x00,0x00,0x00,0x00,0x00,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0x7e,0x06,0x0c,0xf8,0x00, -/*z*/ 0x00,0x00,0x00,0x00,0x00,0xfe,0xcc,0x18,0x30,0x60,0xc6,0xfe,0x00,0x00,0x00,0x00, -/*{*/ 0x00,0x00,0x0e,0x18,0x18,0x18,0x70,0x18,0x18,0x18,0x18,0x0e,0x00,0x00,0x00,0x00, -/*|*/ 0x00,0x00,0x18,0x18,0x18,0x18,0x00,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00, -/*}*/ 0x00,0x00,0x70,0x18,0x18,0x18,0x0e,0x18,0x18,0x18,0x18,0x70,0x00,0x00,0x00,0x00, -/*~*/ 0x00,0x00,0x76,0xdc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x10,0x38,0x6c,0xc6,0xc6,0xc6,0xfe,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x3c,0x66,0xc2,0xc0,0xc0,0xc0,0xc2,0x66,0x3c,0x0c,0x06,0x7c,0x00,0x00, -/* */ 0x00,0x00,0xcc,0x00,0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00, -/* */ 0x00,0x0c,0x18,0x30,0x00,0x7c,0xc6,0xfe,0xc0,0xc0,0xc6,0x7c,0x00,0x00,0x00,0x00, -/* */ 0x00,0x10,0x38,0x6c,0x00,0x78,0x0c,0x7c,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0xcc,0x00,0x00,0x78,0x0c,0x7c,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00, -/* */ 0x00,0x60,0x30,0x18,0x00,0x78,0x0c,0x7c,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00, -/* */ 0x00,0x38,0x6c,0x38,0x00,0x78,0x0c,0x7c,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x3c,0x66,0x60,0x60,0x66,0x3c,0x0c,0x06,0x3c,0x00,0x00,0x00, -/* */ 0x00,0x10,0x38,0x6c,0x00,0x7c,0xc6,0xfe,0xc0,0xc0,0xc6,0x7c,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0xc6,0x00,0x00,0x7c,0xc6,0xfe,0xc0,0xc0,0xc6,0x7c,0x00,0x00,0x00,0x00, -/* */ 0x00,0x60,0x30,0x18,0x00,0x7c,0xc6,0xfe,0xc0,0xc0,0xc6,0x7c,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x66,0x00,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x3c,0x00,0x00,0x00,0x00, -/* */ 0x00,0x18,0x3c,0x66,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x3c,0x00,0x00,0x00,0x00, -/* */ 0x00,0x60,0x30,0x18,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x3c,0x00,0x00,0x00,0x00, -/* */ 0x00,0xc6,0x00,0x10,0x38,0x6c,0xc6,0xc6,0xfe,0xc6,0xc6,0xc6,0x00,0x00,0x00,0x00, -/* */ 0x38,0x6c,0x38,0x00,0x38,0x6c,0xc6,0xc6,0xfe,0xc6,0xc6,0xc6,0x00,0x00,0x00,0x00, -/* */ 0x18,0x30,0x60,0x00,0xfe,0x66,0x60,0x7c,0x60,0x60,0x66,0xfe,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x00,0x6e,0x3b,0x1b,0x7e,0xd8,0xdc,0x77,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x3e,0x6c,0xcc,0xcc,0xfe,0xcc,0xcc,0xcc,0xcc,0xce,0x00,0x00,0x00,0x00, -/* */ 0x00,0x10,0x38,0x6c,0x00,0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0xc6,0x00,0x00,0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00, -/* */ 0x00,0x60,0x30,0x18,0x00,0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00, -/* */ 0x00,0x30,0x78,0xcc,0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00, -/* */ 0x00,0x60,0x30,0x18,0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0xc6,0x00,0x00,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0x7e,0x06,0x0c,0x78,0x00, -/* */ 0x00,0xc6,0x00,0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00, -/* */ 0x00,0xc6,0x00,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00, -/* */ 0x00,0x18,0x18,0x7e,0xc3,0xc0,0xc0,0xc0,0xc3,0x7e,0x18,0x18,0x00,0x00,0x00,0x00, -/* */ 0x00,0x38,0x6c,0x64,0x60,0xf0,0x60,0x60,0x60,0x60,0xe6,0xfc,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0xc3,0x66,0x3c,0x18,0xff,0x18,0xff,0x18,0x18,0x18,0x00,0x00,0x00,0x00, -/* */ 0x00,0xfc,0x66,0x66,0x7c,0x62,0x66,0x6f,0x66,0x66,0x66,0xf3,0x00,0x00,0x00,0x00, -/* */ 0x00,0x0e,0x1b,0x18,0x18,0x18,0x7e,0x18,0x18,0x18,0x18,0x18,0xd8,0x70,0x00,0x00, -/* */ 0x00,0x18,0x30,0x60,0x00,0x78,0x0c,0x7c,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00, -/* */ 0x00,0x0c,0x18,0x30,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x3c,0x00,0x00,0x00,0x00, -/* */ 0x00,0x18,0x30,0x60,0x00,0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00, -/* */ 0x00,0x18,0x30,0x60,0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x76,0xdc,0x00,0xdc,0x66,0x66,0x66,0x66,0x66,0x66,0x00,0x00,0x00,0x00, -/* */ 0x76,0xdc,0x00,0xc6,0xe6,0xf6,0xfe,0xde,0xce,0xc6,0xc6,0xc6,0x00,0x00,0x00,0x00, -/* */ 0x00,0x3c,0x6c,0x6c,0x3e,0x00,0x7e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x38,0x6c,0x6c,0x38,0x00,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x30,0x30,0x00,0x30,0x30,0x60,0xc0,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0xc0,0xc0,0xc0,0xc0,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0x06,0x06,0x06,0x06,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0xc0,0xc0,0xc2,0xc6,0xcc,0x18,0x30,0x60,0xce,0x9b,0x06,0x0c,0x1f,0x00,0x00, -/* */ 0x00,0xc0,0xc0,0xc2,0xc6,0xcc,0x18,0x30,0x66,0xce,0x96,0x3e,0x06,0x06,0x00,0x00, -/* */ 0x00,0x00,0x18,0x18,0x00,0x18,0x18,0x18,0x3c,0x3c,0x3c,0x18,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x00,0x36,0x6c,0xd8,0x6c,0x36,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x00,0xd8,0x6c,0x36,0x6c,0xd8,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44, -/* */ 0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa, -/* */ 0xdd,0x77,0xdd,0x77,0xdd,0x77,0xdd,0x77,0xdd,0x77,0xdd,0x77,0xdd,0x77,0xdd,0x77, -/* */ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, -/* */ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xf8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, -/* */ 0x18,0x18,0x18,0x18,0x18,0xf8,0x18,0xf8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, -/* */ 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xf6,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, -/* */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, -/* */ 0x00,0x00,0x00,0x00,0x00,0xf8,0x18,0xf8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, -/* */ 0x36,0x36,0x36,0x36,0x36,0xf6,0x06,0xf6,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, -/* */ 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, -/* */ 0x00,0x00,0x00,0x00,0x00,0xfe,0x06,0xf6,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, -/* */ 0x36,0x36,0x36,0x36,0x36,0xf6,0x06,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x18,0x18,0x18,0x18,0x18,0xf8,0x18,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, -/* */ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, -/* */ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1f,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, -/* */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xff,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, -/* */ 0x18,0x18,0x18,0x18,0x18,0x1f,0x18,0x1f,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, -/* */ 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, -/* */ 0x36,0x36,0x36,0x36,0x36,0x37,0x30,0x3f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x00,0x3f,0x30,0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, -/* */ 0x36,0x36,0x36,0x36,0x36,0xf7,0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x00,0xff,0x00,0xf7,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, -/* */ 0x36,0x36,0x36,0x36,0x36,0x37,0x30,0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, -/* */ 0x00,0x00,0x00,0x00,0x00,0xff,0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x36,0x36,0x36,0x36,0x36,0xf7,0x00,0xf7,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, -/* */ 0x18,0x18,0x18,0x18,0x18,0xff,0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x00,0xff,0x00,0xff,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, -/* */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, -/* */ 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x3f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x18,0x18,0x18,0x18,0x18,0x1f,0x18,0x1f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x00,0x1f,0x18,0x1f,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, -/* */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, -/* */ 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xff,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, -/* */ 0x18,0x18,0x18,0x18,0x18,0xff,0x18,0xff,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, -/* */ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, -/* */ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, -/* */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, -/* */ 0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0, -/* */ 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, -/* */ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x00,0x76,0xdc,0xd8,0xd8,0xd8,0xdc,0x76,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x78,0xcc,0xcc,0xcc,0xd8,0xcc,0xc6,0xc6,0xc6,0xcc,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0xfe,0xc6,0xc6,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0xfe,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0xfe,0xc6,0x60,0x30,0x18,0x30,0x60,0xc6,0xfe,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x00,0x7e,0xd8,0xd8,0xd8,0xd8,0xd8,0x70,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x7c,0x60,0x60,0xc0,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x76,0xdc,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x7e,0x18,0x3c,0x66,0x66,0x66,0x3c,0x18,0x7e,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x38,0x6c,0xc6,0xc6,0xfe,0xc6,0xc6,0x6c,0x38,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x38,0x6c,0xc6,0xc6,0xc6,0x6c,0x6c,0x6c,0x6c,0xee,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x1e,0x30,0x18,0x0c,0x3e,0x66,0x66,0x66,0x66,0x3c,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x00,0x7e,0xdb,0xdb,0xdb,0x7e,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x03,0x06,0x7e,0xdb,0xdb,0xf3,0x7e,0x60,0xc0,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x1c,0x30,0x60,0x60,0x7c,0x60,0x60,0x60,0x30,0x1c,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0xfe,0x00,0x00,0xfe,0x00,0x00,0xfe,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x18,0x18,0x7e,0x18,0x18,0x00,0x00,0xff,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x30,0x18,0x0c,0x06,0x0c,0x18,0x30,0x00,0x7e,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x0c,0x18,0x30,0x60,0x30,0x18,0x0c,0x00,0x7e,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x0e,0x1b,0x1b,0x1b,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, -/* */ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xd8,0xd8,0xd8,0x70,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x7e,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x00,0x76,0xdc,0x00,0x76,0xdc,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x38,0x6c,0x6c,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x0f,0x0c,0x0c,0x0c,0x0c,0x0c,0xec,0x6c,0x6c,0x3c,0x1c,0x00,0x00,0x00,0x00, -/* */ 0x00,0xd8,0x6c,0x6c,0x6c,0x6c,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x70,0xd8,0x30,0x60,0xc8,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x7c,0x7c,0x7c,0x7c,0x7c,0x7c,0x7c,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -}; diff --git a/drivers/sbus/char/sunfb.c b/drivers/sbus/char/sunfb.c deleted file mode 100644 index cae5bacbd..000000000 --- a/drivers/sbus/char/sunfb.c +++ /dev/null @@ -1,319 +0,0 @@ -/* $Id: sunfb.c,v 1.29 1997/09/20 20:47:26 davem Exp $ - * sunfb.c: Sun generic frame buffer support. - * - * Copyright (C) 1995, 1996 Miguel de Icaza (miguel@nuclecu.unam.mx) - * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) - * - * Added getcmap ioctl, may, 96 - * Support for multiple fbs, sep, 96 - */ - -#include <linux/sched.h> -#include <linux/timer.h> -#include <linux/interrupt.h> -#include <linux/tty.h> -#include <linux/tty_flip.h> -#include <linux/kernel.h> -#include <linux/string.h> -#include <linux/errno.h> -#include <linux/kd.h> -#include <linux/malloc.h> -#include <linux/major.h> -#include <linux/mm.h> -#include <linux/types.h> -#include <linux/proc_fs.h> - -#include <asm/system.h> -#include <asm/uaccess.h> -#include <asm/page.h> -#include <asm/pgtable.h> -#include <asm/bitops.h> -#include <asm/oplib.h> -#include <asm/sbus.h> -#include <asm/fbio.h> -#include <asm/io.h> - -#include <linux/kbd_kern.h> -#include <linux/vt_kern.h> -#include <linux/consolemap.h> -#include <linux/selection.h> -#include <linux/console_struct.h> - -#include "fb.h" - -extern void set_other_palette (int); -extern void set_cursor (int); - -#define FB_SETUP(err) \ - int minor = FB_DEV (file->f_dentry->d_inode->i_rdev); \ -\ - if (minor >= fbinfos || \ - fbinfo [minor].type.fb_type == FBTYPE_NOTYPE) \ - return -(err); - -static int -fb_open (struct inode * inode, struct file * file) -{ - FB_SETUP(EBADF) - if (fbinfo [minor].open) - return -EBUSY; - fbinfo [minor].mmaped = 0; - fbinfo [minor].open = 1; - return 0; -} - -static int -fb_ioctl (struct inode *inode, struct file *file, uint cmd, unsigned long arg) -{ - fbinfo_t *fb; - struct fbcmap *cmap; - int i; - FB_SETUP(EBADF) - - fb = &fbinfo [minor]; - - switch (cmd){ - case FBIOGTYPE: /* return frame buffer type */ - copy_to_user_ret((struct fbtype *)arg, &fb->type, sizeof(struct fbtype), -EFAULT); - break; - case FBIOGATTR:{ - struct fbgattr *fba = (struct fbgattr *) arg; - - i = verify_area (VERIFY_WRITE, (void *) arg, sizeof (struct fbgattr)); - if (i) return i; - __put_user_ret(fb->real_type, &fba->real_type, -EFAULT); - __put_user_ret(0, &fba->owner, -EFAULT); - __copy_to_user_ret(&fba->fbtype, &fb->type, - sizeof(struct fbtype), -EFAULT); - __put_user_ret(0, &fba->sattr.flags, -EFAULT); - __put_user_ret(fb->type.fb_type, &fba->sattr.emu_type, -EFAULT); - __put_user_ret(-1, &fba->sattr.dev_specific[0], -EFAULT); - __put_user_ret(fb->type.fb_type, &fba->emu_types[0], -EFAULT); - for (i = 1; i < 4; i++) - put_user_ret(fb->emulations[i], &fba->emu_types[i], -EFAULT); - break; - } - case FBIOSATTR: - i = verify_area (VERIFY_READ, (void *) arg, sizeof (struct fbsattr)); - if (i) return i; - return -EINVAL; - case FBIOSVIDEO: - if (fb == fbinfo && vt_cons[fg_console]->vc_mode == KD_TEXT) - break; - get_user_ret(i, (int *)arg, -EFAULT); - if (i){ - if (!fb->blanked || !fb->unblank) - break; - if (!minor || (fb->open && fb->mmaped)) - (*fb->unblank)(fb); - fb->blanked = 0; - } else { - if (fb->blanked || !fb->blank) - break; - (*fb->blank)(fb); - fb->blanked = 1; - } - break; - case FBIOGVIDEO: - put_user_ret(fb->blanked, (int *) arg, -EFAULT); - break; - case FBIOGETCMAP: { - char *rp, *gp, *bp; - int end, count, index; - - if (!fb->loadcmap) - return -EINVAL; - i = verify_area (VERIFY_READ, (void *) arg, sizeof (struct fbcmap)); - if (i) return i; - cmap = (struct fbcmap *) arg; - __get_user_ret(count, &cmap->count, -EFAULT); - __get_user_ret(index, &cmap->index, -EFAULT); - if ((index < 0) || (index > 255)) - return -EINVAL; - if (index + count > 256) - count = 256 - index; - __get_user_ret(rp, &cmap->red, -EFAULT); - __get_user_ret(gp, &cmap->green, -EFAULT); - __get_user_ret(bp, &cmap->blue, -EFAULT); - if(verify_area (VERIFY_WRITE, rp, count)) return -EFAULT; - if(verify_area (VERIFY_WRITE, gp, count)) return -EFAULT; - if(verify_area (VERIFY_WRITE, bp, count)) return -EFAULT; - end = index + count; - for (i = index; i < end; i++){ - __put_user_ret(fb->color_map CM(i,0), rp, -EFAULT); - __put_user_ret(fb->color_map CM(i,1), gp, -EFAULT); - __put_user_ret(fb->color_map CM(i,2), bp, -EFAULT); - rp++; gp++; bp++; - } - (*fb->loadcmap)(fb, index, count); - break; - - } - case FBIOPUTCMAP: { /* load color map entries */ - char *rp, *gp, *bp; - int end, count, index; - - if (!fb->loadcmap) - return -EINVAL; - i = verify_area (VERIFY_READ, (void *) arg, sizeof (struct fbcmap)); - if (i) return i; - cmap = (struct fbcmap *) arg; - __get_user_ret(count, &cmap->count, -EFAULT); - __get_user_ret(index, &cmap->index, -EFAULT); - if ((index < 0) || (index > 255)) - return -EINVAL; - if (index + count > 256) - count = 256 - index; - __get_user_ret(rp, &cmap->red, -EFAULT); - __get_user_ret(gp, &cmap->green, -EFAULT); - __get_user_ret(bp, &cmap->blue, -EFAULT); - if(verify_area (VERIFY_READ, rp, count)) return -EFAULT; - if(verify_area (VERIFY_READ, gp, count)) return -EFAULT; - if(verify_area (VERIFY_READ, bp, count)) return -EFAULT; - - end = index + count; - for (i = index; i < end; i++){ - __get_user_ret(fb->color_map CM(i,0), rp, -EFAULT); - __get_user_ret(fb->color_map CM(i,1), gp, -EFAULT); - __get_user_ret(fb->color_map CM(i,2), bp, -EFAULT); - rp++; gp++; bp++; - } - (*fb->loadcmap)(fb, index, count); - break; - } - - case FBIOGCURMAX: { - struct fbcurpos *p = (struct fbcurpos *) arg; - if (!fb->setcursor) return -EINVAL; - if(verify_area (VERIFY_WRITE, p, sizeof (struct fbcurpos))) - return -EFAULT; - __put_user_ret(fb->cursor.hwsize.fbx, &p->fbx, -EFAULT); - __put_user_ret(fb->cursor.hwsize.fby, &p->fby, -EFAULT); - break; - } - case FBIOSCURSOR: - if (!fb->setcursor) return -EINVAL; - if (fb == fbinfo) { - if (vt_cons[fg_console]->vc_mode == KD_TEXT) - return -EINVAL; /* Don't let graphics programs hide our nice text cursor */ - sbus_hw_cursor_shown = 0; /* Forget state of our text cursor */ - } - return sbus_hw_scursor ((struct fbcursor *) arg, fb); - - case FBIOSCURPOS: - if (!fb->setcursor) return -EINVAL; - /* Don't let graphics programs move our nice text cursor */ - if (fb == fbinfo) { - if (vt_cons[fg_console]->vc_mode == KD_TEXT) - return -EINVAL; /* Don't let graphics programs move our nice text cursor */ - } - i= verify_area (VERIFY_READ, (void *) arg, sizeof (struct fbcurpos)); - if (i) return i; - fb->cursor.cpos = *(struct fbcurpos *)arg; - (*fb->setcursor) (fb); - break; - - default: - if (fb->ioctl){ - i = fb->ioctl (inode, file, cmd, arg, fb); - if (i == -ENOSYS) { - printk ("[[FBIO: %8.8x]]\n", cmd); - return -EINVAL; - } - return i; - } - printk ("[[FBIO: %8.8x]]\n", cmd); - return -EINVAL; - } - return 0; -} - -static int -fb_close (struct inode * inode, struct file *file) -{ - fbinfo_t *fb; - struct fbcursor cursor; - FB_SETUP(EBADF) - - fb = &fbinfo[minor]; - - if (!minor) - vt_cons [fb->vtconsole]->vc_mode = KD_TEXT; - - /* Leaving graphics mode, turn off the cursor */ - if (fb->mmaped) { - fb->clear_fb (minor); - if (!minor && suncons_ops.clear_margin) - suncons_ops.clear_margin(); - } - cursor.set = FB_CUR_SETCUR; - cursor.enable = 0; - - /* Reset the driver */ - if (fb->reset) - fb->reset(fb); - - if (fb->open) - fb->open = 0; - fb_ioctl (inode, file, FBIOSCURPOS, (unsigned long) &cursor); - set_other_palette (minor); - if (!minor) { - render_screen (); - set_cursor (fg_console); - } else if (fb->blank) - (*fb->blank)(fb); - return 0; -} - -static int -fb_mmap (struct file *file, struct vm_area_struct *vma) -{ - fbinfo_t *fb; - FB_SETUP(ENXIO) - - fb = &fbinfo [minor]; - - if (fb->mmap){ - int v; - - v = (*fb->mmap)(file->f_dentry->d_inode, file, vma, fb->base, fb); - if (v) - return v; - vma->vm_flags |= VM_IO; - if (!fb->mmaped) { - fb->mmaped = 1; - if (!minor) { - fb->vtconsole = fg_console; - vt_cons [fg_console]->vc_mode = KD_GRAPHICS; - } else { - if (fb->unblank && !fb->blanked) - (*fb->unblank)(fb); - } - } - return 0; - } else - return -ENXIO; -} - -static struct file_operations graphdev_fops = -{ - NULL, /* lseek */ - NULL, /* read */ - NULL, /* write */ - NULL, /* readdir */ - NULL, /* poll */ - fb_ioctl, - fb_mmap, - fb_open, /* open */ - fb_close, /* close */ -}; - -__initfunc(int fb_init (void)) -{ - /* Register the frame buffer device */ - if (register_chrdev (GRAPHDEV_MAJOR, "graphics", &graphdev_fops)){ - printk ("Could not register graphics device\n"); - return -EIO; - } - return 0; /* success */ -} diff --git a/drivers/sbus/char/sunkbd.c b/drivers/sbus/char/sunkbd.c index a0dcb6c74..63586750e 100644 --- a/drivers/sbus/char/sunkbd.c +++ b/drivers/sbus/char/sunkbd.c @@ -79,13 +79,19 @@ extern void scrollfront(int); struct l1a_kbd_state l1a_state = { 0, 0 }; +/* Dummy function for now, we need it to link. -DaveM */ +void kbd_reset_setup(char *str, int *ints) +{ +} + #ifndef CONFIG_PCI struct wait_queue * keypress_wait = NULL; #endif -void keyboard_wait_for_keypress(void) +int keyboard_wait_for_keypress(struct console *co) { sleep_on(&keypress_wait); + return 0; } /* @@ -1292,8 +1298,23 @@ kbd_read (struct file *f, char *buffer, size_t count, loff_t *ppos) /* There is data in the keyboard, fill the user buffer */ end = buffer+count; p = buffer; - for (; p < end && kbd_head != kbd_tail; p += sizeof (Firm_event)){ - copy_to_user_ret((Firm_event *)p, &kbd_queue [kbd_tail], sizeof(Firm_event), -EFAULT); + for (; p < end && kbd_head != kbd_tail;){ +#ifdef CONFIG_SPARC32_COMPAT + if (current->tss.flags & SPARC_FLAG_32BIT) { + copy_to_user_ret((Firm_event *)p, &kbd_queue [kbd_tail], + sizeof(Firm_event)-sizeof(struct timeval), -EFAULT); + p += sizeof(Firm_event)-sizeof(struct timeval); + __put_user_ret(kbd_queue[kbd_tail].time.tv_sec, (u32 *)p, -EFAULT); + p += sizeof(u32); + __put_user_ret(kbd_queue[kbd_tail].time.tv_usec, (u32 *)p, -EFAULT); + p += sizeof(u32); + } else +#endif + { + copy_to_user_ret((Firm_event *)p, &kbd_queue [kbd_tail], + sizeof(Firm_event), -EFAULT); + p += sizeof (Firm_event); + } #ifdef KBD_DEBUG printk ("[%s]", kbd_queue [kbd_tail].value == VKEY_UP ? "UP" : "DOWN"); #endif @@ -1490,14 +1511,16 @@ __initfunc(void keyboard_zsinit(void (*put_char)(unsigned char))) /* Test out the leds */ sunkbd_type = 255; + sunkbd_layout = 0; + send_cmd(SKBDCMD_RESET); send_cmd(SKBDCMD_RESET); - while((sunkbd_type==255) && timeout < 500000) { + while((sunkbd_type==255) && timeout++ < 25000) { udelay(100); - timeout += 20; + barrier(); } - if(timeout>=500000) { + if(timeout>=25000) { printk("keyboard: not present\n"); return; } @@ -1505,10 +1528,11 @@ __initfunc(void keyboard_zsinit(void (*put_char)(unsigned char))) if(sunkbd_type != SUNKBD_TYPE4) { printk("Sun TYPE %d keyboard detected ", sunkbd_type); } else { - udelay(200); timeout=0; - while(timeout++ < 500000) + while((sunkbd_layout==0) && timeout++ < 10000) { + udelay(100); barrier(); + } printk("Sun TYPE %d keyboard detected ", ((sunkbd_layout & SUNKBD_LOUT_TYP5_MASK) ? 5 : 4)); } diff --git a/drivers/sbus/char/sunmouse.c b/drivers/sbus/char/sunmouse.c index 0de65c330..70edaab36 100644 --- a/drivers/sbus/char/sunmouse.c +++ b/drivers/sbus/char/sunmouse.c @@ -457,7 +457,9 @@ sun_mouse_ioctl (struct inode *inode, struct file *file, unsigned int cmd, unsig break; default: +#ifdef DEBUG printk ("[MOUSE-ioctl: %8.8x]\n", cmd); +#endif return -1; } return 0; diff --git a/drivers/sbus/char/sunserial.c b/drivers/sbus/char/sunserial.c index 8fb203207..5a45c85ae 100644 --- a/drivers/sbus/char/sunserial.c +++ b/drivers/sbus/char/sunserial.c @@ -1,4 +1,4 @@ -/* $Id: sunserial.c,v 1.56 1997/12/19 07:33:07 ecd Exp $ +/* $Id: sunserial.c,v 1.61 1998/07/28 13:59:52 jj Exp $ * serial.c: Serial port driver infrastructure for the Sparc. * * Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be) @@ -20,6 +20,11 @@ int serial_console; +__initfunc(int con_is_present(void)) +{ + return serial_console ? 0 : 1; +} + __initfunc(static void nop_rs_kgdb_hook(int channel)) { @@ -64,24 +69,8 @@ rs_kgdb_hook(int channel)) rs_ops.rs_kgdb_hook(channel); } -__initfunc(static void sun_serial_finish_init(void)) -{ - extern unsigned char *linux_serial_image; - extern int con_is_present(void); - char buffer[2048]; - - if (con_is_present()) - return; - - sprintf (buffer, linux_serial_image, UTS_RELEASE); - printk(buffer); -} - -__initfunc(long -serial_console_init(long kmem_start, long kmem_end)) +__initfunc(void serial_console_init(void)) { - sun_serial_finish_init(); - return kmem_start; } void rs_change_mouse_baud(int baud) diff --git a/drivers/sbus/char/tcx.c b/drivers/sbus/char/tcx.c deleted file mode 100644 index 18533652d..000000000 --- a/drivers/sbus/char/tcx.c +++ /dev/null @@ -1,380 +0,0 @@ -/* $Id: tcx.c,v 1.22 1998/03/10 20:18:47 jj Exp $ - * tcx.c: SUNW,tcx 24/8bit frame buffer driver - * - * Copyright (C) 1996 Jakub Jelinek (jj@sunsite.mff.cuni.cz) - * Copyright (C) 1996 Miguel de Icaza (miguel@nuclecu.unam.mx) - * Copyright (C) 1996 Eddie C. Dost (ecd@skynet.be) - */ - -#include <linux/kd.h> -#include <linux/tty.h> -#include <linux/malloc.h> -#include <linux/proc_fs.h> - -#include <asm/sbus.h> -#include <asm/io.h> -#include <asm/fbio.h> -#include <asm/pgtable.h> - -/* These must be included after asm/fbio.h */ -#include <linux/vt_kern.h> -#include <linux/selection.h> -#include <linux/console_struct.h> -#include "fb.h" -#include "cg_common.h" - -/* Offset of interesting structures in the tcx registers */ -#define TCX_RAM8BIT_OFFSET 0 -#define TCX_CONTROLPLANE_OFFSET 4 -#define TCX_BROOKTREE_OFFSET 8 -#define TCX_THC_OFFSET 9 -#define TCX_TEC_OFFSET 7 - -/* THC definitions */ -#define TCX_THC_MISC_REV_SHIFT 16 -#define TCX_THC_MISC_REV_MASK 15 -#define TCX_THC_MISC_VSYNC_DIS (1 << 25) -#define TCX_THC_MISC_HSYNC_DIS (1 << 24) -#define TCX_THC_MISC_RESET (1 << 12) -#define TCX_THC_MISC_VIDEO (1 << 10) -#define TCX_THC_MISC_SYNC (1 << 9) -#define TCX_THC_MISC_VSYNC (1 << 8) -#define TCX_THC_MISC_SYNC_ENAB (1 << 7) -#define TCX_THC_MISC_CURS_RES (1 << 6) -#define TCX_THC_MISC_INT_ENAB (1 << 5) -#define TCX_THC_MISC_INT (1 << 4) -#define TCX_THC_MISC_INIT 0x9f -#define TCX_THC_REV_REV_SHIFT 20 -#define TCX_THC_REV_REV_MASK 15 -#define TCX_THC_REV_MINREV_SHIFT 28 -#define TCX_THC_REV_MINREV_MASK 15 - -/* The contents are unknown */ -struct tcx_tec { - volatile int tec_matrix; - volatile int tec_clip; - volatile int tec_vdc; -}; - -struct tcx_thc { - volatile uint thc_rev; - uint thc_pad0[511]; - volatile uint thc_hs; /* hsync timing */ - volatile uint thc_hsdvs; - volatile uint thc_hd; - volatile uint thc_vs; /* vsync timing */ - volatile uint thc_vd; - volatile uint thc_refresh; - volatile uint thc_misc; - uint thc_pad1[56]; - volatile uint thc_cursxy; /* cursor x,y position (16 bits each) */ - volatile uint thc_cursmask[32]; /* cursor mask bits */ - volatile uint thc_cursbits[32]; /* what to show where mask enabled */ -}; - -static void -tcx_restore_palette (fbinfo_t *fbinfo) -{ - volatile struct bt_regs *bt; - - bt = fbinfo->info.tcx.bt; - bt->addr = 0; - bt->color_map = 0xffffffff; - bt->color_map = 0xffffffff; - bt->color_map = 0xffffffff; -} - -static void -tcx_set_control_plane (fbinfo_t *fb) -{ - register uint *p, *pend; - - p = fb->info.tcx.tcx_cplane; - if (!p) return; - for (pend = p + (fb->info.tcx.tcx_sizes [TCX_CONTROLPLANE_OFFSET] >> 2); p < pend; p++) - *p &= 0xffffff; -} - -static void -tcx_switch_from_graph (void) -{ - fbinfo_t *fb = &(fbinfo [0]); - - /* Reset control plane to 8bit mode if necessary */ - if (fb->open && fb->mmaped) - tcx_set_control_plane (fb); -} - -/* Ugh: X wants to mmap a bunch of cute stuff at the same time :-( */ -/* So, we just mmap the things that are being asked for */ -static int -tcx_mmap (struct inode *inode, struct file *file, struct vm_area_struct *vma, - long base, fbinfo_t *fb) -{ - uint size, page, r, map_size; - unsigned long map_offset = 0; - uint i; - long offsets[13] = { -1, TCX_RAM24BIT, TCX_UNK3, TCX_UNK4, - -1, TCX_UNK6, TCX_UNK7, - -1, -1, -1, TCX_UNK2, TCX_DHC, TCX_ALT }; - - size = vma->vm_end - vma->vm_start; - if (vma->vm_offset & ~PAGE_MASK) - return -ENXIO; - - /* To stop the swapper from even considering these pages */ - vma->vm_flags |= FB_MMAP_VM_FLAGS; - - /* Each page, see which map applies */ - for (page = 0; page < size; ){ - switch (vma->vm_offset+page){ - case TCX_RAM8BIT: - map_size = fb->type.fb_size; - map_offset = get_phys ((unsigned long) fb->base); - break; - case TCX_TEC: - map_size = PAGE_SIZE; - map_offset = get_phys ((unsigned long)fb->info.tcx.tec); - break; - case TCX_BTREGS: - map_size = PAGE_SIZE; - map_offset = get_phys ((unsigned long)fb->info.tcx.bt); - break; - case TCX_THC: - map_size = PAGE_SIZE; - map_offset = get_phys ((unsigned long)fb->info.tcx.thc); - break; - case TCX_CONTROLPLANE: - if (fb->info.tcx.tcx_cplane) { - map_size = fb->info.tcx.tcx_sizes [TCX_CONTROLPLANE_OFFSET]; - map_offset = get_phys ((unsigned long)fb->info.tcx.tcx_cplane); - } else - map_size = 0; - break; - default: - map_size = 0; - for (i = 0; i < 13; i++) - if (offsets [i] == vma->vm_offset+page) { - if ((map_size = fb->info.tcx.tcx_sizes [i])) - map_offset = fb->info.tcx.tcx_offsets [i]; - break; - } - break; - } - if (!map_size){ - page += PAGE_SIZE; - continue; - } - if (page + map_size > size) - map_size = size - page; - r = io_remap_page_range (vma->vm_start+page, - map_offset, - map_size, vma->vm_page_prot, - fb->space); - if (r) - return -EAGAIN; - page += map_size; - } - - vma->vm_file = file; - file->f_count++; - return 0; -} - -static void -tcx_loadcmap (fbinfo_t *fb, int index, int count) -{ - struct bt_regs *bt = fb->info.tcx.bt; - int i; - - bt->addr = index << 24; - for (i = index; count--; i++){ - bt->color_map = fb->color_map CM(i,0) << 24; - bt->color_map = fb->color_map CM(i,1) << 24; - bt->color_map = fb->color_map CM(i,2) << 24; - } - bt->addr = 0; -} - -static void -tcx_setcursormap (fbinfo_t *fb, unsigned char *red, - unsigned char *green, - unsigned char *blue) -{ - struct bt_regs *bt = fb->info.tcx.bt; - - /* Note the 2 << 24 is different from cg6's 1 << 24 */ - bt->addr = 2 << 24; - bt->cursor = red[0] << 24; - bt->cursor = green[0] << 24; - bt->cursor = blue[0] << 24; - bt->addr = 3 << 24; - bt->cursor = red[1] << 24; - bt->cursor = green[1] << 24; - bt->cursor = blue[1] << 24; - bt->addr = 0; -} - -/* Load cursor information */ -static void -tcx_setcursor (fbinfo_t *fb) -{ - uint v; - struct cg_cursor *c = &fb->cursor; - - if (c->enable){ - v = ((c->cpos.fbx - c->chot.fbx) << 16) - |((c->cpos.fby - c->chot.fby) & 0xffff); - } else { - /* Magic constant to turn off the cursor */ - v = ((65536-32) << 16) | (65536-32); - } - fb->info.tcx.thc->thc_cursxy = v; -} - -/* Set cursor shape */ -static void -tcx_setcurshape (fbinfo_t *fb) -{ - struct tcx_thc *thc = fb->info.tcx.thc; - int i; - - for (i = 0; i < 32; i++){ - thc->thc_cursmask [i] = fb->cursor.bits[0][i]; - thc->thc_cursbits [i] = fb->cursor.bits[1][i]; - } -} - -static void -tcx_blank (fbinfo_t *fb) -{ - fb->info.tcx.thc->thc_misc &= ~TCX_THC_MISC_VIDEO; - /* This should put us in power-save */ - fb->info.tcx.thc->thc_misc |= TCX_THC_MISC_VSYNC_DIS; - fb->info.tcx.thc->thc_misc |= TCX_THC_MISC_HSYNC_DIS; -} - -static void -tcx_unblank (fbinfo_t *fb) -{ - fb->info.tcx.thc->thc_misc &= ~TCX_THC_MISC_VSYNC_DIS; - fb->info.tcx.thc->thc_misc &= ~TCX_THC_MISC_HSYNC_DIS; - fb->info.tcx.thc->thc_misc |= TCX_THC_MISC_VIDEO; -} - -void -tcx_reset (fbinfo_t *fb) -{ - struct tcx_info *tcx = &(fb->info.tcx); - - if (fb->setcursor && fb == &fbinfo[0]) - sbus_hw_hide_cursor (); - /* Reset control plane to 8bit mode if necessary */ - if (fb->open && fb->mmaped) - tcx_set_control_plane (fb); - - /* Turn off stuff in the Transform Engine. */ - tcx->tec->tec_matrix = 0; - tcx->tec->tec_clip = 0; - tcx->tec->tec_vdc = 0; - - /* Enable cursor in Brooktree DAC. */ - tcx->bt->addr = 0x06 << 24; - tcx->bt->control |= 0x03 << 24; -} - -__initfunc(void tcx_setup (fbinfo_t *fb, int slot, int node, u32 tcx, struct linux_sbus_device *sbdp)) -{ - struct tcx_info *tcxinfo; - int i; - - printk ("tcx%d at 0x%8.8x ", slot, tcx); - - /* Fill in parameters we left out */ - fb->type.fb_cmsize = 256; - fb->mmap = tcx_mmap; - fb->loadcmap = tcx_loadcmap; - fb->reset = tcx_reset; - fb->blank = tcx_blank; - fb->unblank = tcx_unblank; - fb->emulations [1] = FBTYPE_SUN3COLOR; - fb->emulations [2] = FBTYPE_MEMCOLOR; - fb->switch_from_graph = tcx_switch_from_graph; - fb->postsetup = cg_postsetup; - - tcxinfo = (struct tcx_info *) &fb->info.tcx; - - memset (tcxinfo, 0, sizeof(struct tcx_info)); - - for (i = 0; i < 13; i++) - tcxinfo->tcx_offsets [i] = (long)(sbdp->reg_addrs [i].phys_addr); - - /* Map the hardware registers */ - tcxinfo->bt = sparc_alloc_io((u32)tcxinfo->tcx_offsets [TCX_BROOKTREE_OFFSET], 0, - sizeof (struct bt_regs),"tcx_dac", fb->space, 0); - tcxinfo->thc = sparc_alloc_io((u32)tcxinfo->tcx_offsets [TCX_THC_OFFSET], 0, - sizeof (struct tcx_thc), "tcx_thc", fb->space, 0); - tcxinfo->tec = sparc_alloc_io((u32)tcxinfo->tcx_offsets [TCX_TEC_OFFSET], 0, - sizeof (struct tcx_tec), "tcx_tec", fb->space, 0); - if (!fb->base){ - fb->base = (uint) (unsigned long) - sparc_alloc_io((u32)tcxinfo->tcx_offsets [TCX_RAM8BIT_OFFSET], - 0, fb->type.fb_size, "tcx_ram", fb->space, 0); - } - - if (prom_getbool (node, "hw-cursor")) { - fb->setcursor = tcx_setcursor; - fb->setcursormap = tcx_setcursormap; - fb->setcurshape = tcx_setcurshape; - } - - if (!slot) { - fb_restore_palette = tcx_restore_palette; - } - - i = fb->type.fb_size; - tcxinfo->tcx_sizes[2] = i << 3; - tcxinfo->tcx_sizes[3] = i << 3; - tcxinfo->tcx_sizes[10] = 0x20000; - tcxinfo->tcx_sizes[11] = PAGE_SIZE; - tcxinfo->tcx_sizes[12] = PAGE_SIZE; - - if (prom_getbool (node, "tcx-8-bit")) - tcxinfo->lowdepth = 1; - - if (!tcxinfo->lowdepth) { - tcxinfo->tcx_sizes[1] = i << 2; - tcxinfo->tcx_sizes[4] = i << 2; - tcxinfo->tcx_sizes[5] = i << 3; - tcxinfo->tcx_sizes[6] = i << 3; - fb->type.fb_depth = 24; - tcxinfo->tcx_cplane = - sparc_alloc_io((u32)tcxinfo->tcx_offsets[TCX_CONTROLPLANE_OFFSET], 0, - tcxinfo->tcx_sizes [TCX_CONTROLPLANE_OFFSET], - "tcx_cplane", fb->space, 0); - } - - /* Initialize Brooktree DAC */ - tcxinfo->bt->addr = 0x04 << 24; /* color planes */ - tcxinfo->bt->control = 0xff << 24; - tcxinfo->bt->addr = 0x05 << 24; - tcxinfo->bt->control = 0x00 << 24; - tcxinfo->bt->addr = 0x06 << 24; /* overlay plane */ - tcxinfo->bt->control = 0x73 << 24; - tcxinfo->bt->addr = 0x07 << 24; - tcxinfo->bt->control = 0x00 << 24; - - printk("Rev %d.%d %s\n", - (tcxinfo->thc->thc_rev >> TCX_THC_REV_REV_SHIFT) & TCX_THC_REV_REV_MASK, - (tcxinfo->thc->thc_rev >> TCX_THC_REV_MINREV_SHIFT) & TCX_THC_REV_MINREV_MASK, - tcxinfo->lowdepth ? "8-bit only" : "24-bit depth"); - - /* Reset the tcx */ - tcx_reset(fb); - - if (!slot) - /* Enable Video */ - tcx_unblank (fb); - else - tcx_blank (fb); -} diff --git a/drivers/sbus/char/weitek.c b/drivers/sbus/char/weitek.c deleted file mode 100644 index 4662bbbb7..000000000 --- a/drivers/sbus/char/weitek.c +++ /dev/null @@ -1,117 +0,0 @@ -/* $Id: weitek.c,v 1.16 1998/03/10 20:18:54 jj Exp $ - * weitek.c: Tadpole P9100/P9000 console driver - * - * Copyright (C) 1996 David Redman (djhr@tadpole.co.uk) - */ - -#include <linux/kd.h> -#include <linux/tty.h> -#include <linux/malloc.h> -#include <linux/proc_fs.h> - -#include <asm/openprom.h> -#include <asm/sbus.h> -#include <asm/io.h> -#include <asm/fbio.h> -#include <asm/pgtable.h> - -/* These must be included after asm/fbio.h */ -#include <linux/vt_kern.h> -#include <linux/selection.h> -#include <linux/console_struct.h> -#include "fb.h" -#include "cg_common.h" - -/* - * mmap info - */ -#define WEITEK_VRAM_OFFSET 0 -#define WEITEK_VRAM_SIZE (2*1024*1024) /* maximum */ -#define WEITEK_GX_REG_OFFSET WEITEK_VRAM_SIZE -#define WEITEK_GX_REG_SIZE 8192 -#define WEITEK_VID_REG_OFFSET (WEITEK_GX_REG_OFFSET+WEITEK_GX_REG_SIZE) -#define WEITEK_VID_REG_SIZE 0x1000 - -#define CONTROL_OFFSET 0 -#define RAMDAC_OFFSET (CONTROL_OFFSET+0x200) - -#if 0 -static int -weitek_mmap(struct inode *inode, struct file *file, struct vm_area_struct *vma, - long base, fbinfo_t *fb) -{ - unsigned int size, page, r, map_size; - unsigned long map_offset = 0; - - size = vma->vm_end - vma->vm_start; - if (vma->vm_offset & ~PAGE_MASK) - return -ENXIO; - - /* To stop the swapper from even considering these pages */ - vma->vm_flags |= FB_MMAP_VM_FLAGS; - - /* Each page, see which map applies */ - for (page = 0; page < size; ){ - switch (vma->vm_offset+page){ - case WEITEK_VRAM_OFFSET: - map_size = size-page; - map_offset = get_phys ((unsigned long) fb->base); - if (map_size > fb->type.fb_size) - map_size = fb->type.fb_size; - break; - case WEITEK_GX_REG_OFFSET: - map_size = size-page; - map_offset = get_phys ((unsigned long) fb->base); - if (map_size > fb->type.fb_size) - map_size = fb->type.fb_size; - break; - default: - map_size = 0; - break; - } - if (!map_size){ - page += PAGE_SIZE; - continue; - } - if (page + map_size > size) - map_size = size - page; - r = io_remap_page_range (vma->vm_start+page, - map_offset, - map_size, vma->vm_page_prot, - fb->space); - if (r) - return -EAGAIN; - page += map_size; - } - - vma->vm_file = file; - file->f_count++; - return 0; -} -#endif - -#if 0 -static void -weitek_loadcmap (void *fbinfo, int index, int count) -{ - printk("weitek_cmap: unimplemented!\n"); -} -#endif - -__initfunc(void weitek_setup(fbinfo_t *fb, int slot, u32 addr, int io)) -{ - printk ("weitek%d at 0x%8.8x\n", slot, addr); - - /* Fill in parameters we left out */ - fb->type.fb_type = FBTYPE_NOTSUN1; - fb->type.fb_cmsize = 256; - fb->mmap = 0; /* weitek_mmap; */ - fb->loadcmap = 0; /* unimplemented */ - fb->ioctl = 0; /* no special ioctls */ - fb->reset = 0; /* no special reset */ - - /* Map the card registers */ - if (!fb->base){ - prom_printf ("Missing mapping routine and no address found\n"); - } -} diff --git a/drivers/sbus/char/zs.c b/drivers/sbus/char/zs.c index 3d8d24a02..9bc0b2717 100644 --- a/drivers/sbus/char/zs.c +++ b/drivers/sbus/char/zs.c @@ -1,4 +1,4 @@ -/* $Id: zs.c,v 1.20 1998/02/25 23:51:57 ecd Exp $ +/* $Id: zs.c,v 1.26 1998/08/03 23:58:14 davem Exp $ * zs.c: Zilog serial port driver for the Sparc. * * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) @@ -413,10 +413,6 @@ static _INLINE_ void zs_sched_event(struct sun_serial *info, extern void breakpoint(void); /* For the KGDB frame character */ #endif -#ifdef CONFIG_MAGIC_SYSRQ -static int serial_sysrq; -#endif - static _INLINE_ void receive_chars(struct sun_serial *info, struct pt_regs *regs) { struct tty_struct *tty = info->tty; @@ -455,27 +451,12 @@ static _INLINE_ void receive_chars(struct sun_serial *info, struct pt_regs *regs return; } if(info->is_cons) { -#ifdef CONFIG_MAGIC_SYSRQ - if (!ch) { - serial_sysrq = 1; - return; - } else if (serial_sysrq) { - if (ch == 'a' || ch == 'A') - /* whee, break-A received */ - batten_down_hatches(); - else - handle_sysrq(ch, regs, NULL, NULL); - serial_sysrq = 0; - return; - } -#else if(ch==0) { /* whee, break received */ batten_down_hatches(); /* Continue execution... */ return; } -#endif /* It is a 'keyboard interrupt' ;-) */ wake_up(&keypress_wait); } @@ -573,13 +554,8 @@ static _INLINE_ void status_handle(struct sun_serial *info) * 'break asserted' status change interrupt, call * the boot prom. */ - if((status & BRK_ABRT) && info->break_abort) { -#ifdef CONFIG_MAGIC_SYSRQ - serial_sysrq = 1; -#else + if((status & BRK_ABRT) && info->break_abort) batten_down_hatches(); -#endif - } /* XXX Whee, put in a buffer somewhere, the status information * XXX whee whee whee... Where does the information go... @@ -1832,7 +1808,7 @@ int zs_open(struct tty_struct *tty, struct file * filp) static void show_serial_version(void) { - char *revision = "$Revision: 1.20 $"; + char *revision = "$Revision: 1.26 $"; char *version, *p; version = strchr(revision, ' '); @@ -1850,8 +1826,6 @@ static void show_serial_version(void) * we have a special version for sun4u. */ #ifdef __sparc_v9__ -static struct devid_cookie zs_dcookie; -static unsigned long zs_irq_flags; __initfunc(static struct sun_zslayout * get_zs(int chip)) { @@ -1892,27 +1866,15 @@ get_zs(int chip)) (char *) &sun4u_ino, (sizeof(sun4u_ino))); if(!irq) { - irq = zilog_irq = sun4u_ino; - - /* Construct dcookie. */ - if(central_bus) { - zs_dcookie.imap = - ¢ral_bus->child->fhc_regs.uregs->fhc_uart_imap; - zs_dcookie.iclr = - ¢ral_bus->child->fhc_regs.uregs->fhc_uart_iclr; - zs_dcookie.pil = 12; - zs_dcookie.bus_cookie = NULL; - zs_irq_flags = - (SA_DCOOKIE|SA_INTERRUPT|SA_STATIC_ALLOC|SA_FHC); + if (central_bus) { + irq = zilog_irq = + build_irq(12, 0, + ¢ral_bus->child->fhc_regs.uregs->fhc_uart_iclr, + ¢ral_bus->child->fhc_regs.uregs->fhc_uart_imap); } else { - zs_dcookie.imap = zs_dcookie.iclr = NULL; - zs_dcookie.pil = -1; - zs_dcookie.bus_cookie = SBus_chain; - zs_irq_flags = - (SA_DCOOKIE|SA_INTERRUPT|SA_STATIC_ALLOC|SA_SBUS); + irq = zilog_irq = + sbus_build_irq(SBus_chain, sun4u_ino); } - } else if(irq != sun4u_ino) { - panic("zilog: bogon irqs"); } break; } @@ -2470,22 +2432,15 @@ __initfunc(int zs_init(void)) info->normal_termios = serial_driver.init_termios; info->open_wait = 0; info->close_wait = 0; - printk("tty%02d at 0x%04x (irq = %d)", info->line, - info->port, info->irq); + printk("tty%02d at 0x%04x (irq = %s)", info->line, + info->port, __irq_itoa(info->irq)); printk(" is a Zilog8530\n"); } -#ifndef __sparc_v9__ if (request_irq(zilog_irq, zs_interrupt, (SA_INTERRUPT | SA_STATIC_ALLOC), "Zilog8530", zs_chain)) panic("Unable to attach zs intr\n"); -#else - zs_dcookie.real_dev_id = zs_chain; - if (request_irq(zilog_irq, zs_interrupt, - zs_irq_flags, "Zilog8530", &zs_dcookie)) - panic("Unable to attach zs intr\n"); -#endif restore_flags(flags); keyboard_zsinit(kbd_put_char); |