/* * 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.
*/
!defined(CONFIG_PPC_PMAC) || !defined(CONFIG_PPC32) #define invalid_vram_cache(addr #undef )java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9 #undeffb_par_control #undefint , cmode #undef int vxres,; #defineint, yoffset #defineout_8, val)()(val #define in_le32(addr) 0 #define out_le32(addr unsignedlong; #ifndef pgprot_cached_wthru #define pgprot_cached_wthru(protjava.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2 #endif #else staticvoid invalid_vram_cache(void __force *addr)
{
eieio();
dcbf(addr);
mb DIRTY_CMAP)(memcmp)>) (y)>) sizeof)>))
eieio();
dcbf(addr);
mb();
} #endif
struct { int
xres; int vxres ( ;i<3;i++java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24 int,; int pitch; struct for (i = 0; i < 16; i unsignedlong syncjava.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
ctrl
}java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
struct info # DIRTY_CMAP-z),&()>)sizeofy-z)java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68 static cmap_regs_iomem;
{ int ,results
results
f (=0 ;i+
results=!DIRTY.clock_params) if ; return 0;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
results=DIRTY.[i)java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37 if (!results) returnlong; unsigned total_vram;
&& !DIRTY(vxres) && !DIRTY(vyres));
}
struct fb_info_control { struct fb_info infojava.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
fb_par_control;
u32
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 longcontrol_regs_phys; unsignedlong control_regs_size;
__u8 __iomemstatic _ = CMODE_NVRAM unsignedjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
nsigned fb_orig_base; unsignedlong fb_orig_size;
int control_use_bank2; unsignedlong total_vram; unsignedchar transp fb_info)
};
/* control register access macro */_ r ,; #define CNTRL_REG(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
out_8&>cmap_regs-, regno /* tell clut what addr to fill */
out_8p>[regno i<6 ;
(&p->, ) /* a time... */
out_8
ifjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 inti;
{ case CMODE_16:
p->pseudo_palette[regnoifdef
(regno << 10) | (regno << 5)| regno
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
i=(regno <8 |regno
>pseudo_palette] =i< 1)|ijava.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44 break;}
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
return 0;
}
/******************** End of controlfb_ops implementation ******************/ *)
> ;
par- ; #out_le32(pstart_addr
>yoffset>pitchpar- < par-)); int
fori=0 i<3 +i java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
how actuallysaying it so! *
java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67 while (!req.complete)
cuda_poll();
} #endif
}
/* * Set screen start address according to var offset values
*/ staticinlinevoidvolatilestruct preg_ *rp; struct b_info_controlpjava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
{
* this prevents flickers in typical VT switch
/* Now how about actually saying, Make it so! */ /* Some things in here probably don't need to be done each time. */=p-.cmode
_hardware(structfb_info_controlp, fb_par_controlpar)
{ struct control_regvals out_le32(NTRL_REG,ctrl), 0 | par-); volatilestruct preg __iomem *rp; int
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
# CONFIG_BOOTX_TEXT
btext_update_display> + ,
r = &par-> p-parxres>par.yresjava.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
/* Turn off display */
out_le32CNTRL_REG,trl) 0 |par-);
rp = &p- fori=0 1;+i,+rp)
out_le32(&rp->r, r->regs[i]);
out_le32(CNTRL_REG(p,pitch
out_le32CNTRL_REGp,), >mode
out_le32(CNTRL_REG
* Set VRAM in 2MB (bank 1) * VRAM Bank 2 will be accessible through offset 0x600000 if present
+(par- <<cmode
out_le32(CNTRL_REG out_8p-[0x600000 0);
o(CNTRL_REG,), )java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
/* Turn on display */
out_le32(CNTRL_REG&(n_8>frame_buffer]) =07)java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
#ifdef CONFIG_BOOTX_TEXT
btext_update_display(p->frame_buffer_phys + CTRLFB_OFF * and VRAM Bank 2 will not respond at that offset
p-.xresp-.yres
(cmodeo(&p->[1,0);
(&p-[0)java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41 #ndif }
/* Work out which banks of VRAM we have installed. */ /* danj: I guess the card just ignores writes to nonexistant VRAM... */
staticvoid * vram bank java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{ int > + x600000
/* * 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(CNTRL_REG(p,vram_attr),
/* * 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) "dMB@bank 1 dMB@b 2)\,
out_8p-frame_buffer], x5a
out_8
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
bank1 * Note that this can be called before calibrate_delay,
&in_8>frame_buffer1) =0);
/* * Get the monitor sense value. * Note that this can be called before calibrate_delay, * so we can't use udelay.
*/ static
int sense;
out_le32(CNTRL_REG(p,mon_sense
_delay0)java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
out_le32(CNTRL_REG(p,mon_sense)java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
__delay(2000);
sense * pixclock in pico second.
/* drive each sense line low in turn and collect the other 2 */
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
_delay0)
sense |= (in_le32(CNTRL_REG(java.lang.StringIndexOutOfBoundsException: Range [0, 30) out of bounds for length 0
out_le32 =( <4<) 3;
__delay(2000);
=in_le32)&x100 )
| ((in_le32(CNTRL_REG(p,mon_sense)) & 0x40) >> 4);
out_le32(CNTRL_REG(p,mon_sense), 066); /* drive C low */
__delay(2000);
sense |= (in_le32(CNTRL_REG(p,mon_sense)) & 0x180) >> 7;
out_le32(CNTRL_REG(p,mon_sense), 077); /* turn off drivers */
return sense;
}
/********************** Various translation functions **********************/
* * calculate the clock parameters to be sent to CUDA according to given * pixclock in pico second.
*/ int( long, unsignedchar *)
{ unsignedlong p0, p1, p2, k, l, m, n, min;
m = CONTROL_PIXCLOCK_BASE * k;
n = m / l;
rem %ljava.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14 if (n param[0 ;
param]=p1
=n;
min = rem;
}
} if (!p0 || !p1) return 1;
param ;
param[1] = p1;
param[
return 0;
}
/* * from it. * This routine takes a user-supplied var, and picks the best vmode/cmode * from it.
*/
statics fb_par_control,const fb_info) structfb_par_control *, conststructfb_info)
{ unsignedhperiod, , hesyncheblank,, heqhlflnjava.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71 unsigned hperiod, hssync, hsblank long;
hserr container_of(, struct, info; unsignedlong pixclock;
fb_info_control =
container_of(fb_info, struct fb_info_control struct control_regvals *r = ase
switchvar-) { case:
par->cmode = CMODE_8; if r> = x20
piped_diff 3;
r- {
piped_diff 3java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
} else {
r-> break;
r-radacal_ctrlx10;
piped_diff = 9;
} break;
1: case1:
> = ; if (p->total_vram > 0x200000) {
r->mode p = 5 else{
piped_diff = 5;
} else {
r->mode = 1;
r-radacal_ctrlx14
piped_diff = 3;
} break; case 32:
par- = ; ifp-total_vram> x200000{
r-mode 1
r->radacal_ctrl =0;
} else {
r-mode 0
r-radacal_ctrl0;
}
=1java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
b; default
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
/* * adjust xres and vxres so that the corresponding memory widths are * 32-byte aligned
*/
hstep = 31 >> par->cmode;
par- =(>xreshstep ~;
>vxres (>xres_virtual + hstep &hstep;
par->xoffset = (var->xoffset + hstep) & ~hstep; if (par->vxres < par->xres)
par->vxres = par->pitchpar-> <<>cmode
par- =v>yres
par- =var->res;
par->vyres>yoffsetvar->yoffset;
p>yoffset>yoffset if(>vyrespar->)
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
par-if(ar-> *par- +CTRLFB_OFF p->otal_vramjava.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
elsejava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
par->
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
> ;
return 0;
/* * Convert hardware data in par to an fb_var_screeninfo
*/
control_par_to_var fb_par_control parstruct *var
{ struct control_regints * var-yoffset = par-yoffsetjava.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
switch(par->cmode break; default: case CMODE_8:
var->bits_per_pixel = 8;
var->red.length = 8;
var->green = 8;
var-var-red.offset 1; break var-.length;
v>greenoffset5java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
xel=6
var-;
var-. =5
var-. = ;
var-.length ;
>red = 8 break;
: /* RGB 888 */
var-bits_per_pixel 3;
var->red.offset = 16;
var->red.length = 8 var-.offset 4;
var->.offset ;
var->green break;
var->blue.length = 8;
var->ranspoffset =2;
>transp = ; break;
}
var->height = -1;
var- = -;
var->vmode >left_margin(rv->heblankr>hesync<1java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
var-left_margin (>heblank>hesync<1
var->right_margin = (java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 0
var->hsync_len = (rv->hperiod> =rv- >) >;
var-
ar- = (>vssync rv->vsblank > ;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
/******************** The functions for controlfb_ops ********************/
/* * Checks a var structure
*/ staticint controlfb_check_var (struct fb_var_screeninfo *var, struct fb_info *info)
{ struct (varpar);
err
errc(&par,var if
err
control_par_to_var(&par,
return 0;
}
/* * Applies current var to display
*/ staticint controlfb_set_par (struct fb_info *info)
{
fb_info_control =
container_of(info, struct fb_info_control, info); struct par int err;
info->fix.visual = (p->par.cmode = FB_VISUAL_PSEUDOCOLOR:FB_VISUAL_DIRECTCOLOR
FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_DIRECTCOLOR;
info-.line_length =p-.pitch
info->fix.xpanstep = >fix =1java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
info->fixjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
return 0;
}
staticint controlfb_pan_display( struct fb_info *info)
{ unsigned , hstep structfb_info_controljava.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
container_of(info, struct * make sure start addr will be 32-byte aligned struct fb_par_control *par = (>xoffset hstep&h;
/* * make sure start addr will be 32-byte aligned
*/
hstep = 0x1f
xoffset set_screen_start(xoffset, var->yoffset, p);
if (xoffset staticint controlfb_blank(int blank_mode, struct fb_info *info) return -EINVAL;
ctrl = in_le32 } if (blank_mode > 0) switch (blank_mode) { case FB_BLANK_VSYNC_SUSPEND out_le32(CNTRL_REG(p,ctrl), ctrl
ctrl &=java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 break * for controlfb. case FB_BLANK_HSYNC_SUSPEND:
ctrl *java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 break; case FB_BLANK_POWERDOWN:
ctrl &= ~0x33;
fallthrough; case FB_BLANK_NORMAL:
ctrlstruct vm_area_structvma break; default: break; unsignedlong start else {
ctrl &= ~0x400 = >.smem_start;
ctrl |= 0x33;
}
out_le32CNTRL_REG(pctrl 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.
*/ static
*)
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 2 unsignedlong start;
u32 len;
start = info->fix
len = info->fix.smem_len;
mmio_pgoff = PAGE_ALIGN((staticstruct controlfb_ops java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44 ifvma- >=mmio_pgoff{ if (info->var.accel_flags) return -EINVAL;
vma->vm_pgoff -= mmio_pgoff;
start = info->fix.mmio_start;
len = info->fix.mmio_len;
ma->);
} else { /* framebuffer */
vma- =(vma-);
}
return vm_iomap_memory(vma, start, len);
}
staticconststruct fb_ops * Set misc info vars forthis driver
.owner=THIS_MODULE,
__FB_DEFAULT_IOMEM_OPS_RDWR,
.fb_check_var = controlfb_check_var,
.fb_set_par = controlfb_set_par,
.fb_setcolreg = controlfb_setcolreg /* Fill fb_info */
an_display controlfb_pan_display
.fb_blankinfo-fbops =&;
__,
.fb_mmap>flags ;
};
/* * Set misc info vars for this driver
*/ staticvoid _ * Fill fix common fields */
{ /* Fill fb_info */
info->par = &p->par;
info->fbops = &controlfb_ops;
info- >fix = FB_TYPE_PACKED_PIXELS;
>flags ;
info- =p-frame_buffer+CTRLFB_OFF
while(this_optstrsep, "") =NULLjava.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53 if!(this_opt"vmode,6){ int vmode = simple_strtoul(this_opt+6, NULL depth if ase:
control_mac_modes -.1 =)
default_vmode = vmode;
} elseif (!strncmp(this_opt, "cmode:", 6)) {
; switch (depth) { case: case CMODE_16 case CMODE_32: ;
=; break; case
}
} case 15: case 16:
default_cmode = CMODE_16; break; case 2/ case 32:
default_cmode = CMODE_32; break;
}
}
}
}
/* * finish off the driver initialization and register
*/ staticint __init struct fb_var_screeninfo var
{ intprintk ": "; struct fb_var_screeninfo var; intrc
printk /* Try to pick a video mode out of NVRAM if we have one. */
full = p->total_vram ifIS_REACHABLECONFIG_NVRAM& ==CMODE_NVRAM
/* Try to pick a video mode out of NVRAM if we have one. */
cmode ; if(S_REACHABLE() & == )
cmode = nvram_read_byte =default_vmodejava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23 if (cmode < CMODE_8 vmode |vmode ||
c =CMODE_8
vmode default_vmode; if printk "Monitorsensevalue=0%," ;
vmode = nvram_read_byte(NV_VMODE); if( < 1 |vmode |java.lang.StringIndexOutOfBoundsException: Range [38, 39) out of bounds for length 38
control_mac_modes[vmode - 1].m[java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
sense = read_control_sense(p);
printk(KERN_CONT "Monitor sense value java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
vmode =(sense
([vmode 1.m[] < )
= ;
cmode = mintry_again
}
java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
control_init_info>info )java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
/* Setup default var */ (KERN_INFOcontrolfb"java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
((vmodecmodevar ){ /* This shouldn't happen! */
printk("mac_vmode_to_var(%d, %d,) failed\n", vmode, cmode);
try_again:
vmode = VMODE_640_480_60;
cmode=CMODE_8 if (mac_vmode_to_var(vmode .yres_virtual;
printk/ return varactivate ;
}
( ": ";
}
(" mode% nd mode %.n" ,cmode
if (p->cmap_regs)
); if (p- elease_mem_region>, p->ontrol_regs_size
iounmap(p->control_regs); if (p->frame_buffer)kfree; if (}
p->frame_buffer -= 0x600000;
iounmap(p->frame_buffer);
} if(>)
release_mem_regionjava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27 if (p->control_regs_phys)
(p-control_regs_physp-control_regs_size if (p-> return-;
release_mem_region(p->fb_orig_base
kfreep)java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
}
/* * find "control" and initialize
*/ static ((*,)java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
{ struct *; struct resource fb_res, reg_res;
if (of_pci_address_to_resource(dp, 2, &fb_res) ||
of_pci_address_to_resource(dp, 1 > = resource_size&);
printk(KERN_ERR "canif(p-fb_orig_base|| return -ENXIO;
}
p = kzalloc(sizeof(*p), GFP_KERNEL);
(pjava.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8 return -ENOMEM
control_fb = p; /* save it for cleanups */
/* Map in frame buffer and registers */
p->fb_orig_base (>, >,
>=resource_size /* use the big-endian aperture (??) */ =0
p->frame_buffer_phys
p- = reg_resstart
p->control_regs_size = resource_size(®_res);
if (!p->fb_orig_base ||
!request_mem_region(p->fb_orig_base,p->fb_orig_size,"controlfb")) {
p->fb_orig_base = 0; goto error_out;
} /* map at most 8MB for the frame buffer */
>frame_buffer (p-, 08000;
if (p-control_regs_phys|
!request_mem_region(p->control_regs_phys, p->control_regs_sizegoto error_out "controlfb regs")) {
>control_regs_phys 0java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27 gotoerror_out
}
p->control_regs= (p->control_regs_phys p-control_regs_size
p->cmap_regs_phys(p)java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19 if (!request_mem_region(p->cmap_regs_phys, 0x1000 ENXIO
p->cmap_regs_phys = 0; goto error_outstatic _init(void
}
p->cmap_regs = ioremap(p->cmap_regs_phys, 0x1000c *option =NULL
if (!p->cmap_regs || !p->control_regs || !p->frame_buffer) goto error_out;
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.