diff options
author | Ralf Baechle <ralf@linux-mips.org> | 1999-10-09 00:00:47 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 1999-10-09 00:00:47 +0000 |
commit | d6434e1042f3b0a6dfe1b1f615af369486f9b1fa (patch) | |
tree | e2be02f33984c48ec019c654051d27964e42c441 /drivers/video/pm2fb.c | |
parent | 609d1e803baf519487233b765eb487f9ec227a18 (diff) |
Merge with 2.3.19.
Diffstat (limited to 'drivers/video/pm2fb.c')
-rw-r--r-- | drivers/video/pm2fb.c | 101 |
1 files changed, 59 insertions, 42 deletions
diff --git a/drivers/video/pm2fb.c b/drivers/video/pm2fb.c index dfb0f8ae8..343ad3f52 100644 --- a/drivers/video/pm2fb.c +++ b/drivers/video/pm2fb.c @@ -50,7 +50,7 @@ #define PM2FB_MASTER_DEBUG #ifdef PM2FB_MASTER_DEBUG -#define DPRINTK(a,b...) printk("pm2fb: %s: " a, __FUNCTION__ , ## b) +#define DPRINTK(a,b...) printk(KERN_DEBUG "pm2fb: %s: " a, __FUNCTION__ , ## b) #else #define DPRINTK(a,b...) #endif @@ -192,12 +192,12 @@ static struct pm2fb_info { int board; /* Permedia2 board index (see board_table[] below) */ struct { - unsigned char* fb_base; /* framebuffer memory base */ + unsigned long fb_base; /* physical framebuffer memory base */ u32 fb_size; /* framebuffer memory size */ - unsigned char* rg_base; /* register memory base */ - unsigned char* p_fb; /* physical address of frame buffer */ + unsigned long rg_base; /* physical register memory base */ + unsigned long p_fb; /* physical address of frame buffer */ unsigned char* v_fb; /* virtual address of frame buffer */ - unsigned char* p_regs; /* physical address of registers + unsigned long p_regs; /* physical address of registers region, must be rg_base or rg_base+PM2_REGS_SIZE depending on the host endianness */ @@ -741,7 +741,7 @@ static void pm2fb_reset(struct pm2fb_info* p) { set_memclock(p, p->memclock); } -__initfunc(static int pm2fb_conf(struct pm2fb_info* p)) { +static int __init pm2fb_conf(struct pm2fb_info* p){ for (p->board=0; board_table[p->board].detect && !(board_table[p->board].detect(p)); p->board++); @@ -750,13 +750,26 @@ __initfunc(static int pm2fb_conf(struct pm2fb_info* p)) { return 0; } DPRINTK("found board: %s\n", board_table[p->board].name); + p->regions.p_fb=p->regions.fb_base; + if (!__request_region(&iomem_resource, p->regions.p_fb, + p->regions.fb_size, "pm2fb")) { + printk (KERN_ERR "pm2fb: cannot reserve fb memory, abort\n"); + return 0; + } p->regions.v_fb=MMAP(p->regions.p_fb, p->regions.fb_size); + #ifdef __LITTLE_ENDIAN p->regions.p_regs=p->regions.rg_base; #else p->regions.p_regs=p->regions.rg_base+PM2_REGS_SIZE; #endif + if (!__request_region(&iomem_resource, p->regions.p_regs, + PM2_REGS_SIZE, "pm2fb")) { + printk (KERN_ERR "pm2fb: cannot reserve mmio memory, abort\n"); + UNMAP(p->regions.v_fb, p->regions.fb_size); + return 0; + } p->regions.v_regs=MMAP(p->regions.p_regs, PM2_REGS_SIZE); return 1; } @@ -809,9 +822,9 @@ static int cvppc_detect(struct pm2fb_info* p) { if (!cvppc_PCI_init(&p->board_par.cvppc)) return 0; - p->regions.fb_base=(unsigned char* )CVPPC_FB_APERTURE_ONE; + p->regions.fb_base=CVPPC_FB_APERTURE_ONE; p->regions.fb_size=CVPPC_FB_SIZE; - p->regions.rg_base=(unsigned char* )CVPPC_REGS_REGION; + p->regions.rg_base=CVPPC_REGS_REGION; p->memclock=CVPPC_MEMCLOCK; return 1; } @@ -852,27 +865,21 @@ static int pm2pci_detect(struct pm2fb_info* p) { return 0; } DPRINTK("PCI board @%08lx %08lx %08lx rom %08lx\n", - pci->dev->base_address[0], - pci->dev->base_address[1], - pci->dev->base_address[2], - pci->dev->rom_address); + pci->dev->resource[0].start, + pci->dev->resource[1].start, + pci->dev->resource[2].start, + pci->dev->resource[PCI_ROM_RESOURCE].start); #ifdef __sparc__ - p->regions.rg_base=(unsigned char* ) - __pa(pci->dev->base_address[0] & PCI_BASE_ADDRESS_MEM_MASK); - p->regions.fb_base=(unsigned char* ) - __pa(pci->dev->base_address[1] & PCI_BASE_ADDRESS_MEM_MASK); + p->regions.rg_base= __pa(pci->dev->resource[0].start); + p->regions.fb_base= __pa(pci->dev->resource[1].start); #else if (pm2fb_options.flags & OPTF_VIRTUAL) { - p->regions.rg_base=(unsigned char* ) - __pa(pci->dev->base_address[0] & PCI_BASE_ADDRESS_MEM_MASK); - p->regions.fb_base=(unsigned char* ) - __pa(pci->dev->base_address[1] & PCI_BASE_ADDRESS_MEM_MASK); + p->regions.rg_base= __pa(pci->dev->resource[0].start); + p->regions.fb_base= __pa(pci->dev->resource[1].start); } else { - p->regions.rg_base=(unsigned char* ) - (pci->dev->base_address[0] & PCI_BASE_ADDRESS_MEM_MASK); - p->regions.fb_base=(unsigned char* ) - (pci->dev->base_address[1] & PCI_BASE_ADDRESS_MEM_MASK); + p->regions.rg_base= (pci->dev->resource[0].start); + p->regions.fb_base= (pci->dev->resource[0].start); } #endif #ifdef __BIG_ENDIAN @@ -1526,14 +1533,14 @@ static int pm2fb_setcolreg(unsigned regno, } static void pm2fb_set_disp(const void* par, struct display* disp, - struct fb_info_gen* info) { + struct fb_info_gen* info) { struct pm2fb_info* i=(struct pm2fb_info* )info; - u32 flags; - u32 depth; + unsigned long flags; + unsigned long depth; save_flags(flags); cli(); - disp->screen_base=i->regions.v_fb; + disp->screen_base = i->regions.v_fb; switch (depth=((struct pm2fb_par* )par)->depth) { #ifdef FBCON_HAS_CFB8 case 8: @@ -1581,21 +1588,29 @@ static int pm2fb_release(struct fb_info* info, int user) { * Begin of public functions ***************************************************************************/ -void pm2fb_cleanup(struct fb_info* info) { - struct pm2fb_info* i=(struct pm2fb_info* )info; +#ifdef MODULE +static void pm2fb_cleanup(void) { + struct pm2fb_info* i = &fb_info; - unregister_framebuffer(info); + unregister_framebuffer((struct fb_info *)i); pm2fb_reset(i); - /* FIXME UNMAP()??? */ + + UNMAP(i->regions.v_fb, i->regions.fb_size); + __release_region(&iomem_resource, i->regions.p_fb, i->regions.fb_size); + + UNMAP(i->regions.v_regs, PM2_REGS_SIZE); + __release_region(&iomem_resource, i->regions.p_regs, PM2_REGS_SIZE); + if (board_table[i->board].cleanup) board_table[i->board].cleanup(i); } +#endif /* MODULE */ -__initfunc(void pm2fb_init(void)) { +int __init pm2fb_init(void){ memset(&fb_info, 0, sizeof(fb_info)); if (!pm2fb_conf(&fb_info)) - return; + return -ENXIO; pm2fb_reset(&fb_info); fb_info.disp.scrollmode=SCROLL_YNOMOVE; fb_info.gen.parsize=sizeof(struct pm2fb_par); @@ -1613,18 +1628,19 @@ __initfunc(void pm2fb_init(void)) { fbgen_set_disp(-1, &fb_info.gen); fbgen_install_cmap(0, &fb_info.gen); if (register_framebuffer(&fb_info.gen.info)<0) { - printk("pm2fb: unable to register.\n"); - return; + printk(KERN_ERR "pm2fb: unable to register.\n"); + return -EINVAL; } - printk("fb%d: %s (%s), using %uK of video memory.\n", + printk(KERN_INFO "fb%d: %s (%s), using %uK of video memory.\n", GET_FB_IDX(fb_info.gen.info.node), board_table[fb_info.board].name, permedia2_name, (u32 )(fb_info.regions.fb_size>>10)); MOD_INC_USE_COUNT; + return 0; } -__initfunc(void pm2fb_mode_setup(char* options)) { +void __init pm2fb_mode_setup(char* options){ int i; for (i=0; user_mode[i].name[0] && @@ -1634,13 +1650,13 @@ __initfunc(void pm2fb_mode_setup(char* options)) { sizeof(pm2fb_options.user_mode)); } -__initfunc(void pm2fb_font_setup(char* options)) { +void __init pm2fb_font_setup(char* options){ strncpy(pm2fb_options.font, options, sizeof(pm2fb_options.font)); pm2fb_options.font[sizeof(pm2fb_options.font)-1]='\0'; } -__initfunc(void pm2fb_setup(char* options, int* ints)) { +int __init pm2fb_setup(char* options){ char* next; while (options) { @@ -1658,6 +1674,7 @@ __initfunc(void pm2fb_setup(char* options, int* ints)) { pm2fb_options.flags |= OPTF_VIRTUAL; options=next; } + return 0; } /*************************************************************************** @@ -1665,9 +1682,9 @@ __initfunc(void pm2fb_setup(char* options, int* ints)) { ***************************************************************************/ #ifdef MODULE -int init_module(void) { +int __init init_module(void) { - pm2fb_init(); + return pm2fb_init(); } void cleanup_module(void) { |