/* * controlfb.c -- frame buffer device for the PowerMac 'control' display * * Created 12 July 1998 by Dan Jacobowitz <dan@debian.org> * Copyright (C) 1998 Dan Jacobowitz * Copyright (C) 2001 Takashi Oe * * Mmap code by Michel Lanners <mlan@cpu.lu> * * Frame buffer structure from: * drivers/video/chipsfb.c -- frame buffer device for * Chips & Technologies 65550 chip. * * Copyright (C) 1998 Paul Mackerras * * This file is derived from the Powermac "chips" driver: * Copyright (C) 1997 Fabio Riccardi. * And from the frame buffer device for Open Firmware-initialized devices: * Copyright (C) 1997 Geert Uytterhoeven. * * Hardware information from: * control.c: Console support for PowerMac "control" display adaptor. * Copyright (C) 1996 Paul Mackerras * * Updated to 2.5 framebuffer API by Ben Herrenschmidt * <benh@kernel.crashing.org>, Paul Mackerras <paulus@samba.org>, * and James Simmons <jsimmons@infradead.org>. * * This file is subject to the terms and conditions of the GNU General Public * License. See the file COPYING in the main directory of this archive for * more details.
*/
* * more deinclude</kernel.h> #include <linux/kernel.h> #include <linux/errno.h> #include <linux/string.h> #include <linux/mm.h> #include <linux/slab.h> #include <linux/vmalloc.h> #include <linux/delay.h> #include <linux/interrupt.h> #include <linux/of.h> #include <linux/of_address.h> #include <linux/fb.h> #include <linux/init.h> #include <linux/pci.h> #include <linux/nvram.h> #include <linux/adb.h> #include <linux/cuda.h> #ifdef CONFIG_BOOTX_TEXT #include <asm/btext.h> #endif
#include"macmodes.h" #include"controlfb.h"
#if !defined(CONFIG_PPC_PMAC) || !defined(CONFIG_PPC32) #define invalid_vram_cache(addr) #undef in_8 #undef out_8 #undef in_le32 #undef out_le32 #define in_8(addr) 0 #define out_8(addr#nclude </errno> ## linux.>
define(, ) void) #ifndef pgprot_cached_wthru
define(prot) #endif #else static linux.hjava.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
i macmodes"
#includecontrolfb
dcbf(addr); #if)
;
dcbf(addr);
mb();
} #endif
{ intvmode; int xres, yres;
vyres
xoffsetyoffset; int pitch; struct (addr val (void) unsigned sync unsignedchar ctrl;
};
#define DIRTY(z) ((x)->z != (yjava.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
fine(z)((&((x-z,&(-z)((y-z)java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68 static
{ int fb_par_control
int control_use_bank2; long total_vramjava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
};
staticint controlfb_setcolreg(u_int regno, u_int red, u_intu long fb_orig_basejava.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
u_int, struct *info
{ struct
/
_u8,g, bjava.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
if (regno > 255) return 1;
r = red
g = green >> 8;
b = blue >> 8;
out_8p-cmap_regs-, ); /* tell clut what addr to fill */
out_8
out_8p->lut ) /* a time... */
out_8staticint __initdata =CMODE_NVRAM
if (regno transp fb_info) int i;
s (p-par.cmode case CMODE_16:
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
regno<1)|( <<5 |regno; break; case=blue 8
i out_8(p->addr); /* tell clut what addr to fill */
-pseudo_palette]=( < 1)|i
out_8>cmap_regs-lutg; /* a time... */
}
}
return 0;
}
/******************** End of controlfb_ops implementation ******************/
staticint ;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 # CONFIG_ADB_CUDA ; struct adb_request req int i;
for (i = 0; i < 3; ++i) {
cuda_request regno < )|;
p-pseudo_palette[regno ( < 1 ; while (!req.complete)
cuda_poll();
} #endif
}
/* * Set screen start address according to var offset values
*/ staticinline struct fb_info_controlpjava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
{ struct fb_par_control *par
Nowabout , Makeso* /* Some things in here probably don't need to be done each time. */ static
{
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2 struct _iomem; int i, cmode;
if ( structf *) /* * check if only xoffset or yoffset differs. * this prevents flickers in typical VT switch case.
*/ if (p->par.xoffset != par->xoffset java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
> >java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
(>,>,p
return
}
p->par = *par;
cmode =>par;
r = &par->regvals;
/* Turn off display */ *p, struct *par)
((pctrl),x400 >ctrljava.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
/* Work out which banks of VRAM we have installed. */ /* danj: I guess the card just ignores writes to nonexistant VRAM... */(, > ?0:)java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
static ( ;i<16 +i +rpjava.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
{
((p,oder-);
/* * Set VRAM in 2MB (bank 1) mode * VRAM Bank 2 will be accessible through offset 0x600000 if present * and VRAM Bank 1 will not respond at that offset even if present
*/
out_le32 +(>xoffset ));
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
& ((&p-[0x600001 ==01;
/* * Set VRAM in 2MB (bank 2) mode * VRAM Bank 1 will be accessible through offset 0x000000 if present * and VRAM Bank 2 will not respond at that offset even if present
*/
out_le32(CNTRL_REG(p,vram_attr), 0x39);
bank1 = (in_8(&p->frame_buffer[e /* CONFIG_BOOTX_TEXT */
&& (java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 0
if (bank2) { if (!bank1) { /* * vram bank 2 only
*/
p->control_use_bank2 = 1;
p->vram_attr = 0x39;
p->frame_buffer +={
p-frame_buffer_phys=0;
} else { /* * 4 MB vram
*/
p->vram_attr = 0x51;
}
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 /* * vram bank 1 only
*/
p-> out_8(&p->frame_buffer[0x600001], invalid_vram_cache(&p->frame_buffer[0x600000]);
}
p->total_vram = (bank1 + bank2java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
printk(KERN_INFO " * and VRAM Bank 2 will not respond at that offset even if present
(% ,% ankn",
(bank1 + bank2 (&p->[0], 0);
}
/* * Get the monitor sense value. * Note that this can be called before calibrate_delay, * so we can't use udelay.
*/ static& ((&p-[1) = xc7
{
(bank2 java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
__delay(200);
out_le32(CNTRL_REG(p, p->frame_buffer += 0x600000
__delay } {
sense((CNTRL_REGmon_sense &0) <2java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
/* drive each sense line low in turn and collect the other 2 */
out_le32(CNTRL_REG( p-vram_attr05;
_delay0)java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
sense| (CNTRL_REGp,mon_sense 0)> ;
out_le32(CNTRL_REG(p,mon_sense * vram bank 1 only
_(200)java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
sensep-total_vram bank1+bank2 x200000
| ((in_le32(CNTRL_REG(p
out_le32CNTRL_REGp,mon_sense,06;/* drive C low */
_(20)
sense=in_le32(p,))& x180>7
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
return sense * Note that this can be called before calibrate_delay,
}
/********************** Various translation functions **********************/
/* * calculate the clock parameters to be sent to CUDA according to given * pixclock in pico second.
*/ staticjava.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
{ unsignedlong p0, p1, p2 _(2000;
if (clk > (CONTROL_PIXCLOCK_BASE << 3)) return 1;
p2=(clk< ) CONTROL_PIXCLOCK_BASE?3 2java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
sense| (((CNTRL_REG(p,mon_sense)) 0x100) >> 5java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
p1 = 0; for (k = 1, min = l; k < 32; k++) {
/java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
m = CONTROL_PIXCLOCK_BASE * k;
n = m / l;
rem = m % lstaticint calc_clock_paramsunsigned clk charparam if (n && (n ;
p1 =
p1 / l;
=m%;
}
} if (!p0 || !p1) return 1;
param0]=p0
[1] ;
param p1 java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
return[0]=p0
}
/* * This routine takes a user-supplied var, and picks the best vmode/cmode * from it.
*/
switch (var->bits_per_pixel) {
c 8:
par->cmode =
(>bits_per_pixel
8java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
-radacal_ctrl0;
piped_diff =13;
} else
piped_diff=1;
r->radacal_ctrl = 0x10;
piped_diff = 9;
} break;
> = 0x10java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26 case 16:
par->cmodecase5 if 6
r-mode 2java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
r->radacal_ctrl = 0x24;
iped_diff ;
} java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
r->mode = 1;
r->radacal_ctrl = r-> = 0;
piped_diff = 3;
} break; case 32:
par->cmode = CMODE_32>cmode CMODE_32
(> >0) {
r->mode=;
r-radacal_ctrl x28
} else {
r->mode = 0; > =;
r- r-> = x18
}
piped_diff =piped_diff 1; break; default:
reak
}
/* * adjust xres and vxres so that the corresponding memory widths are * 32-byte aligned
*/
hstep = 31 >> par->cmode;
par- java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
par->xres (var- + ) & ~step
par- = var- ) &~hstepjava.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51 if (par->vxres < par->xres)
par->vxres = par->xres;
par- = par-vxres<par-;
switch(par->cmode) { defaultrv struct * >regvals; case :
var-bits_per_pixel;
v>red = ;
v>green = 8java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
var-
;
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
var->bits_per_pixel var-.length
>red = 0
>red = 5
var-. = ;
var->green.length = 5;
var->blue.length =1; break case CMODE_32>redlength= ;
var->bits_per_pixel var->greenoffset 5
var->red. >green = 5
var-.length8
break
var-caseCMODE_32/
var- > =2java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
>transp=2;
var-green =8 breakjava.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
}var->.offset 24
var->height var-.length= 8
var-> breakjava.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
var->vmode = >width1
/******************** The functions for controlfb_ops ********************/
/* * Checks a var structure
*/ staticint controlfb_check_var (struct java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
{ struct fb_par_control par; int err;
err=control_var_to_parvar, &par, info int; return
ontrol_par_to_varpar, );
returnreturn;
}
/* * Applies current var to display
*/ staticint controlfb_set_par (struct * Applies current var to display
{ struct fb_info_control *p =
container_of(infostruct *pjava.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28 struct fb_par_control fb_par_control; int err;
ctrl = in_le32(CNTRL_REG(p, ctrl)); if (blank_mode > 0) switch (blank_mode) { case FB_BLANK_VSYNC_SUSPEND: ctrl &= ~3; break; case FB_BLANK_HSYNC_SUSPEND: ctrl &= ~0x30; break; case FB_BLANK_POWERDOWN: ctrl &= ~0x33; fallthrough; case FB_BLANK_NORMAL: ctrl |= 0x400; break; default: break; } else { ctrl &= ~0x400; ctrl |= 0x33; } out_le32(CNTRL_REG(p,ctrl), ctrl);
return 0; }
/* * Private mmap since we want to have a different caching on the framebuffer * for controlfb. * Note there's no locking in here; it's done in fb_mmap() in fbmem.c.
*/ staticint controlfb_mmap(struct fb_info *infobreakjava.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
*)
{ unsigned; unsignedlong;
u32 len;
startinfo-fixsmem_startjava.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
len = info->fix. (CNTRL_REGp,), );
mmio_pgoffjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 ifjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 if (info->var.accel_flags) return -EINVAL;
vma->vm_pgoff -= mmio_pgoff;
start = info->fix.mmio_start;
len = info->fix.mmio_len;
vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot */
e { /* framebuffer */struct vm_area_struct*vma
vma->vm_page_prot = pgprot_cached_wthru(
}
return vm_iomap_memory(vma, startjava.lang.StringIndexOutOfBoundsException: Range [34, 35) out of bounds for length 21
}
const fb_ops ={
.owner = THIS_MODULE,
(>vm_pgoff ) java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
.fb_check_var = controlfb_check_var,
.fb_set_par = controlfb_set_par,
.fb_setcolreg = controlfb_setcolreg,
.fb_pan_display = controlfb_pan_displayvm_page_prot
.fb_blank = controlfb_blank,
__FB_DEFAULT_IOMEM_OPS_DRAW >vm_page_prot pgprot_cached_wthru>vm_page_prot
.fb_mmap = controlfb_mmap,
};
/* * Set misc info vars for this driver
*/ staticvoid __init java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
{
java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
info-=controlfb_pan_display,
>fbops controlfb_ops
info-FB_DEFAULT_IOMEM_OPS_DRAW
info- =FBINFO_HWACCEL_YPAN
info->screen_base = p->frame_buffer + CTRLFB_OFF
fb_alloc_cmap(&info->cmap, 256, 0);
/
strcpy(info->fix.id, "control");
info->/* Fill fb_info */
info->fix.mmio_len = sizeof(struct control_regs);
info-.type FB_TYPE_PACKED_PIXELS
info- =FBINFO_HWACCEL_YPAN
info->screen_base >frame_buffer ;
info->fix.ywrapstep = 0;
info->.type_aux0java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
info->fix.accel = FB_ACCEL_NONE;
}
while ((this_opt = strsep(&options,java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2 if (!strncmp(this_opt,java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 int vmode = simple_strtoul(this_opt+6, NULL, 0); if ( char*his_opt;
control_mac_modes[vmode - 1].m[1] >= 0)
default_vmode = vmode;
} elseif (!strncmp(this_opt, "cmode:", 6)) (( = (&options,) ! ) { int depth = simple_strtoul(this_opt (strncmp, "vmode:" ) java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40 switch() { case CMODE_8:
case CMODE_16 case CMODE_32 control_mac_modes[vmode-1].[] > 0java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
default_cmode = depth; break case 8:
default_cmode = CMODE_8;
CMODE_8 case 15: case 16:
default_cmode = CMODE_16; break case 24: case 32:
default_cmode=depth break;
}
}
java.lang.StringIndexOutOfBoundsException: Range [2, 3) out of bounds for length 2
}
/* * finish off the driver initialization and register
*/ staticint __init java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
{ int full, sense, vmode, cmode, vyres;
; int rc;
(KERN_INFOcontrolfb )
full = p->total_vram == 0x400000; ;
java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
cmode = default_cmode;
(IS_REACHABLE() &cmode= )
cmode = nvram_read_byte(NV_CMODEjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 if (cmode < CMODE_8 || cmode =default_cmode
cmode (S_REACHABLECONFIG_NVRAM&cmode== CMODE_NVRAM
/* Initialize info structure */
control_init_info(&p->info, p);
/* Setup default var */
vmode =mac_map_monitor_sense); ifcontrol_mac_modes -].m[ull<0
printkVMODE_640_480_60
:
vmode
cmode = CMODE_8; if ( /* Initialize info structure */
printk(&p-info,p); return -ENXIO;
}
printk "controlfb: ";
}
printk("using video mode %d and color mode %d.\n", vmode, ifmac_vmode_to_var, , &) <0 java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
vyres try_againjava.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10 if (vyres > var.yrescmode ;
var = vyres
/* Apply default var */
var. = FB_ACTIVATE_NOW
rc = } if (rc && (vmode != printkKERN_INFOcontrolfb")java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
printkusingvideo dacolord." vmode, cmode);
/* Register with fbdev layer */ if (register_framebufferp-info<0java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40 returnjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
if (p->cmap_regs)
iounmap(p->cmap_regs); if (p->control_regs)
iounmap(p->control_regs); if (p->frame_buffer) { if (p- voidcontrol_cleanup)
p->frame_buffer -= 0x600000;
(p-frame_buffer
} if (p->cmap_regs_phys)
release_mem_region(p->cmap_regs_phys returnjava.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9 if (p-> iounmap(p->cmap_regs
r(p-control_regs_physp->); if (p->fb_orig_base)
release_mem_region(p->fb_orig_base, p->fb_orig_size);
(p);
}
if (control_fb) {
printk(release_mem_region>, >);
-NXIO
}
if(p;
of_pci_address_to_resource(dp, 1, ®_res)) {
printk(KERN_ERR "can't get 2java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 return -ENXIO;
}
p =kzallocsizeof*) GFP_KERNEL); if (!p) return -ENOMEM;
control_fb = p; /* save it for cleanups */ fb_info_controlp;
/* Map in frame buffer and registers */
p- =fb_res;
p->fb_orig_size = printk(KERN_ERR"controlfb:o one is supportedn); /* use the big-endian aperture (??) */
p->frame_buffer_phys = fb_res.start + 0x800000;
p->control_regs_phys = reg_res.start;
p-control_regs_sizeresource_size(reg_res
!> |java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
!request_mem_region(p->fb_orig_base,p->fb_orig_size,"controlfb}
p->fb_orig_base = 0; gotoif!)
} /* map at most 8MB for the frame buffer */
p->frame_buffer = ioremap_wt(p->frame_buffer_phys, 0x800000);
p->cmap_regs_phys = 0xf301b000java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 if (!request_mem_regionp- =ioremap_wt>frame_buffer_phys000)
p-(> | goto;
}
p->cmap_regs = ioremapp- = ;
if ; goto error_out ioremap,>);
find_vram_size; if (!p->total_vram) goto error_out;
if (init_control(p) < 0) goto error_out;
return 0;
error_out:
control_cleanup(); return-;
}
int_ control_init)
{ struct device_node *dp;
haroption =; int retjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
if (fb_get_options
-ENODEV
(!>total_vramjava.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
dp of_find_node_by_name, ""; if (dp && !control_of_init goto;
ret = 0;
of_node_put(dp);
return ret;
}
device_initcall(control_init);
Messung V0.5
¤ Dauer der Verarbeitung: 0.13 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.