diff options
author | Krzysztof Helt <krzysztof.h1@wp.pl> | 2007-10-16 04:29:12 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-16 12:43:18 -0400 |
commit | 9199ec5c5fe0cb6b03390fea2338435999e0df5c (patch) | |
tree | 65e5dc179d419dde604c2edff81b31db38356c6d /drivers/video/cirrusfb.c | |
parent | 7345de32df7ef0ab49eaa88cad1297d8572a6757 (diff) |
cirrusfb: remove fields from cirrusfb_info
This patch removes unused or redundant fields from cirrusfb_info structure.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Antonino Daplas <adaplas@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video/cirrusfb.c')
-rw-r--r-- | drivers/video/cirrusfb.c | 149 |
1 files changed, 68 insertions, 81 deletions
diff --git a/drivers/video/cirrusfb.c b/drivers/video/cirrusfb.c index 8c0603cc02a3..ebb8ddb0095a 100644 --- a/drivers/video/cirrusfb.c +++ b/drivers/video/cirrusfb.c | |||
@@ -369,23 +369,14 @@ enum cirrusfb_dbg_reg_class { | |||
369 | 369 | ||
370 | /* info about board */ | 370 | /* info about board */ |
371 | struct cirrusfb_info { | 371 | struct cirrusfb_info { |
372 | struct fb_info *info; | ||
373 | |||
374 | u8 __iomem *fbmem; | ||
375 | u8 __iomem *regbase; | 372 | u8 __iomem *regbase; |
376 | u8 __iomem *mem; | ||
377 | unsigned long size; | ||
378 | enum cirrus_board btype; | 373 | enum cirrus_board btype; |
379 | unsigned char SFR; /* Shadow of special function register */ | 374 | unsigned char SFR; /* Shadow of special function register */ |
380 | 375 | ||
381 | unsigned long fbmem_phys; | ||
382 | unsigned long fbregs_phys; | ||
383 | |||
384 | struct cirrusfb_regs currentmode; | 376 | struct cirrusfb_regs currentmode; |
385 | int blank_mode; | 377 | int blank_mode; |
386 | 378 | ||
387 | u32 pseudo_palette[16]; | 379 | u32 pseudo_palette[16]; |
388 | struct { u8 red, green, blue, pad; } palette[256]; | ||
389 | 380 | ||
390 | #ifdef CONFIG_ZORRO | 381 | #ifdef CONFIG_ZORRO |
391 | struct zorro_dev *zdev; | 382 | struct zorro_dev *zdev; |
@@ -393,7 +384,7 @@ struct cirrusfb_info { | |||
393 | #ifdef CONFIG_PCI | 384 | #ifdef CONFIG_PCI |
394 | struct pci_dev *pdev; | 385 | struct pci_dev *pdev; |
395 | #endif | 386 | #endif |
396 | void (*unmap)(struct cirrusfb_info *cinfo); | 387 | void (*unmap)(struct fb_info *info); |
397 | }; | 388 | }; |
398 | 389 | ||
399 | static unsigned cirrusfb_def_mode = 1; | 390 | static unsigned cirrusfb_def_mode = 1; |
@@ -536,7 +527,7 @@ static int cirrusfb_decode_var(const struct fb_var_screeninfo *var, | |||
536 | struct cirrusfb_regs *regs, | 527 | struct cirrusfb_regs *regs, |
537 | const struct fb_info *info); | 528 | const struct fb_info *info); |
538 | /*--- Internal routines ----------------------------------------------------*/ | 529 | /*--- Internal routines ----------------------------------------------------*/ |
539 | static void init_vgachip(struct cirrusfb_info *cinfo); | 530 | static void init_vgachip(struct fb_info *info); |
540 | static void switch_monitor(struct cirrusfb_info *cinfo, int on); | 531 | static void switch_monitor(struct cirrusfb_info *cinfo, int on); |
541 | static void WGen(const struct cirrusfb_info *cinfo, | 532 | static void WGen(const struct cirrusfb_info *cinfo, |
542 | int regnum, unsigned char val); | 533 | int regnum, unsigned char val); |
@@ -645,7 +636,6 @@ static long cirrusfb_get_mclk(long freq, int bpp, long *div) | |||
645 | static int cirrusfb_check_var(struct fb_var_screeninfo *var, | 636 | static int cirrusfb_check_var(struct fb_var_screeninfo *var, |
646 | struct fb_info *info) | 637 | struct fb_info *info) |
647 | { | 638 | { |
648 | struct cirrusfb_info *cinfo = info->par; | ||
649 | int nom, den; /* translyting from pixels->bytes */ | 639 | int nom, den; /* translyting from pixels->bytes */ |
650 | int yres, i; | 640 | int yres, i; |
651 | static struct { int xres, yres; } modes[] = | 641 | static struct { int xres, yres; } modes[] = |
@@ -690,7 +680,7 @@ static int cirrusfb_check_var(struct fb_var_screeninfo *var, | |||
690 | return -EINVAL; | 680 | return -EINVAL; |
691 | } | 681 | } |
692 | 682 | ||
693 | if (var->xres * nom / den * var->yres > cinfo->size) { | 683 | if (var->xres * nom / den * var->yres > info->screen_size) { |
694 | printk(KERN_ERR "cirrusfb: mode %dx%dx%d rejected..." | 684 | printk(KERN_ERR "cirrusfb: mode %dx%dx%d rejected..." |
695 | "resolution too high to fit into video memory!\n", | 685 | "resolution too high to fit into video memory!\n", |
696 | var->xres, var->yres, var->bits_per_pixel); | 686 | var->xres, var->yres, var->bits_per_pixel); |
@@ -704,7 +694,8 @@ static int cirrusfb_check_var(struct fb_var_screeninfo *var, | |||
704 | printk(KERN_INFO | 694 | printk(KERN_INFO |
705 | "cirrusfb: using maximum available virtual resolution\n"); | 695 | "cirrusfb: using maximum available virtual resolution\n"); |
706 | for (i = 0; modes[i].xres != -1; i++) { | 696 | for (i = 0; modes[i].xres != -1; i++) { |
707 | if (modes[i].xres * nom / den * modes[i].yres < cinfo->size / 2) | 697 | int size = modes[i].xres * nom / den * modes[i].yres; |
698 | if (size < info->screen_size / 2) | ||
708 | break; | 699 | break; |
709 | } | 700 | } |
710 | if (modes[i].xres == -1) { | 701 | if (modes[i].xres == -1) { |
@@ -1018,7 +1009,7 @@ static int cirrusfb_set_par_foo(struct fb_info *info) | |||
1018 | var->xres, var->yres, var->bits_per_pixel); | 1009 | var->xres, var->yres, var->bits_per_pixel); |
1019 | DPRINTK("pixclock: %d\n", var->pixclock); | 1010 | DPRINTK("pixclock: %d\n", var->pixclock); |
1020 | 1011 | ||
1021 | init_vgachip(cinfo); | 1012 | init_vgachip(info); |
1022 | 1013 | ||
1023 | err = cirrusfb_decode_var(var, ®s, info); | 1014 | err = cirrusfb_decode_var(var, ®s, info); |
1024 | if (err) { | 1015 | if (err) { |
@@ -1686,10 +1677,6 @@ static int cirrusfb_setcolreg(unsigned regno, unsigned red, unsigned green, | |||
1686 | return 0; | 1677 | return 0; |
1687 | } | 1678 | } |
1688 | 1679 | ||
1689 | cinfo->palette[regno].red = red; | ||
1690 | cinfo->palette[regno].green = green; | ||
1691 | cinfo->palette[regno].blue = blue; | ||
1692 | |||
1693 | if (info->var.bits_per_pixel == 8) | 1680 | if (info->var.bits_per_pixel == 8) |
1694 | WClut(cinfo, regno, red >> 10, green >> 10, blue >> 10); | 1681 | WClut(cinfo, regno, red >> 10, green >> 10, blue >> 10); |
1695 | 1682 | ||
@@ -1848,8 +1835,9 @@ static int cirrusfb_blank(int blank_mode, struct fb_info *info) | |||
1848 | /****************************************************************************/ | 1835 | /****************************************************************************/ |
1849 | /**** BEGIN Internal Routines ***********************************************/ | 1836 | /**** BEGIN Internal Routines ***********************************************/ |
1850 | 1837 | ||
1851 | static void init_vgachip(struct cirrusfb_info *cinfo) | 1838 | static void init_vgachip(struct fb_info *info) |
1852 | { | 1839 | { |
1840 | struct cirrusfb_info *cinfo = info->par; | ||
1853 | const struct cirrusfb_board_info_rec *bi; | 1841 | const struct cirrusfb_board_info_rec *bi; |
1854 | 1842 | ||
1855 | DPRINTK("ENTER\n"); | 1843 | DPRINTK("ENTER\n"); |
@@ -1903,7 +1891,8 @@ static void init_vgachip(struct cirrusfb_info *cinfo) | |||
1903 | break; | 1891 | break; |
1904 | } | 1892 | } |
1905 | 1893 | ||
1906 | assert(cinfo->size > 0); /* make sure RAM size set by this point */ | 1894 | /* make sure RAM size set by this point */ |
1895 | assert(info->screen_size > 0); | ||
1907 | 1896 | ||
1908 | /* the P4 is not fully initialized here; I rely on it having been */ | 1897 | /* the P4 is not fully initialized here; I rely on it having been */ |
1909 | /* inited under AmigaOS already, which seems to work just fine */ | 1898 | /* inited under AmigaOS already, which seems to work just fine */ |
@@ -2089,7 +2078,7 @@ static void init_vgachip(struct cirrusfb_info *cinfo) | |||
2089 | WHDR(cinfo, 0); /* Hidden DAC register: - */ | 2078 | WHDR(cinfo, 0); /* Hidden DAC register: - */ |
2090 | 2079 | ||
2091 | printk(KERN_DEBUG "cirrusfb: This board has %ld bytes of DRAM memory\n", | 2080 | printk(KERN_DEBUG "cirrusfb: This board has %ld bytes of DRAM memory\n", |
2092 | cinfo->size); | 2081 | info->screen_size); |
2093 | DPRINTK("EXIT\n"); | 2082 | DPRINTK("EXIT\n"); |
2094 | return; | 2083 | return; |
2095 | } | 2084 | } |
@@ -2150,24 +2139,25 @@ static void switch_monitor(struct cirrusfb_info *cinfo, int on) | |||
2150 | /* Linux 2.6-style accelerated functions */ | 2139 | /* Linux 2.6-style accelerated functions */ |
2151 | /******************************************/ | 2140 | /******************************************/ |
2152 | 2141 | ||
2153 | static void cirrusfb_prim_fillrect(struct cirrusfb_info *cinfo, | 2142 | static void cirrusfb_prim_fillrect(struct fb_info *info, |
2154 | const struct fb_fillrect *region) | 2143 | const struct fb_fillrect *region) |
2155 | { | 2144 | { |
2145 | struct cirrusfb_info *cinfo = info->par; | ||
2156 | int m; /* bytes per pixel */ | 2146 | int m; /* bytes per pixel */ |
2157 | u32 color = (cinfo->info->fix.visual == FB_VISUAL_TRUECOLOR) ? | 2147 | u32 color = (info->fix.visual == FB_VISUAL_TRUECOLOR) ? |
2158 | cinfo->pseudo_palette[region->color] : region->color; | 2148 | cinfo->pseudo_palette[region->color] : region->color; |
2159 | 2149 | ||
2160 | if (cinfo->info->var.bits_per_pixel == 1) { | 2150 | if (info->var.bits_per_pixel == 1) { |
2161 | cirrusfb_RectFill(cinfo->regbase, | 2151 | cirrusfb_RectFill(cinfo->regbase, |
2162 | cinfo->info->var.bits_per_pixel, | 2152 | info->var.bits_per_pixel, |
2163 | region->dx / 8, region->dy, | 2153 | region->dx / 8, region->dy, |
2164 | region->width / 8, region->height, | 2154 | region->width / 8, region->height, |
2165 | color, | 2155 | color, |
2166 | cinfo->currentmode.line_length); | 2156 | cinfo->currentmode.line_length); |
2167 | } else { | 2157 | } else { |
2168 | m = (cinfo->info->var.bits_per_pixel + 7) / 8; | 2158 | m = (info->var.bits_per_pixel + 7) / 8; |
2169 | cirrusfb_RectFill(cinfo->regbase, | 2159 | cirrusfb_RectFill(cinfo->regbase, |
2170 | cinfo->info->var.bits_per_pixel, | 2160 | info->var.bits_per_pixel, |
2171 | region->dx * m, region->dy, | 2161 | region->dx * m, region->dy, |
2172 | region->width * m, region->height, | 2162 | region->width * m, region->height, |
2173 | color, | 2163 | color, |
@@ -2179,7 +2169,6 @@ static void cirrusfb_prim_fillrect(struct cirrusfb_info *cinfo, | |||
2179 | static void cirrusfb_fillrect(struct fb_info *info, | 2169 | static void cirrusfb_fillrect(struct fb_info *info, |
2180 | const struct fb_fillrect *region) | 2170 | const struct fb_fillrect *region) |
2181 | { | 2171 | { |
2182 | struct cirrusfb_info *cinfo = info->par; | ||
2183 | struct fb_fillrect modded; | 2172 | struct fb_fillrect modded; |
2184 | int vxres, vyres; | 2173 | int vxres, vyres; |
2185 | 2174 | ||
@@ -2204,22 +2193,24 @@ static void cirrusfb_fillrect(struct fb_info *info, | |||
2204 | if (modded.dy + modded.height > vyres) | 2193 | if (modded.dy + modded.height > vyres) |
2205 | modded.height = vyres - modded.dy; | 2194 | modded.height = vyres - modded.dy; |
2206 | 2195 | ||
2207 | cirrusfb_prim_fillrect(cinfo, &modded); | 2196 | cirrusfb_prim_fillrect(info, &modded); |
2208 | } | 2197 | } |
2209 | 2198 | ||
2210 | static void cirrusfb_prim_copyarea(struct cirrusfb_info *cinfo, | 2199 | static void cirrusfb_prim_copyarea(struct fb_info *info, |
2211 | const struct fb_copyarea *area) | 2200 | const struct fb_copyarea *area) |
2212 | { | 2201 | { |
2202 | struct cirrusfb_info *cinfo = info->par; | ||
2213 | int m; /* bytes per pixel */ | 2203 | int m; /* bytes per pixel */ |
2214 | if (cinfo->info->var.bits_per_pixel == 1) { | 2204 | |
2215 | cirrusfb_BitBLT(cinfo->regbase, cinfo->info->var.bits_per_pixel, | 2205 | if (info->var.bits_per_pixel == 1) { |
2206 | cirrusfb_BitBLT(cinfo->regbase, info->var.bits_per_pixel, | ||
2216 | area->sx / 8, area->sy, | 2207 | area->sx / 8, area->sy, |
2217 | area->dx / 8, area->dy, | 2208 | area->dx / 8, area->dy, |
2218 | area->width / 8, area->height, | 2209 | area->width / 8, area->height, |
2219 | cinfo->currentmode.line_length); | 2210 | cinfo->currentmode.line_length); |
2220 | } else { | 2211 | } else { |
2221 | m = (cinfo->info->var.bits_per_pixel + 7) / 8; | 2212 | m = (info->var.bits_per_pixel + 7) / 8; |
2222 | cirrusfb_BitBLT(cinfo->regbase, cinfo->info->var.bits_per_pixel, | 2213 | cirrusfb_BitBLT(cinfo->regbase, info->var.bits_per_pixel, |
2223 | area->sx * m, area->sy, | 2214 | area->sx * m, area->sy, |
2224 | area->dx * m, area->dy, | 2215 | area->dx * m, area->dy, |
2225 | area->width * m, area->height, | 2216 | area->width * m, area->height, |
@@ -2231,9 +2222,9 @@ static void cirrusfb_prim_copyarea(struct cirrusfb_info *cinfo, | |||
2231 | static void cirrusfb_copyarea(struct fb_info *info, | 2222 | static void cirrusfb_copyarea(struct fb_info *info, |
2232 | const struct fb_copyarea *area) | 2223 | const struct fb_copyarea *area) |
2233 | { | 2224 | { |
2234 | struct cirrusfb_info *cinfo = info->par; | ||
2235 | struct fb_copyarea modded; | 2225 | struct fb_copyarea modded; |
2236 | u32 vxres, vyres; | 2226 | u32 vxres, vyres; |
2227 | |||
2237 | modded.sx = area->sx; | 2228 | modded.sx = area->sx; |
2238 | modded.sy = area->sy; | 2229 | modded.sy = area->sy; |
2239 | modded.dx = area->dx; | 2230 | modded.dx = area->dx; |
@@ -2265,7 +2256,7 @@ static void cirrusfb_copyarea(struct fb_info *info, | |||
2265 | if (modded.dy + modded.height > vyres) | 2256 | if (modded.dy + modded.height > vyres) |
2266 | modded.height = vyres - modded.dy; | 2257 | modded.height = vyres - modded.dy; |
2267 | 2258 | ||
2268 | cirrusfb_prim_copyarea(cinfo, &modded); | 2259 | cirrusfb_prim_copyarea(info, &modded); |
2269 | } | 2260 | } |
2270 | 2261 | ||
2271 | static void cirrusfb_imageblit(struct fb_info *info, | 2262 | static void cirrusfb_imageblit(struct fb_info *info, |
@@ -2363,18 +2354,19 @@ static void get_pci_addrs(const struct pci_dev *pdev, | |||
2363 | DPRINTK("EXIT\n"); | 2354 | DPRINTK("EXIT\n"); |
2364 | } | 2355 | } |
2365 | 2356 | ||
2366 | static void cirrusfb_pci_unmap(struct cirrusfb_info *cinfo) | 2357 | static void cirrusfb_pci_unmap(struct fb_info *info) |
2367 | { | 2358 | { |
2359 | struct cirrusfb_info *cinfo = info->par; | ||
2368 | struct pci_dev *pdev = cinfo->pdev; | 2360 | struct pci_dev *pdev = cinfo->pdev; |
2369 | 2361 | ||
2370 | iounmap(cinfo->fbmem); | 2362 | iounmap(info->screen_base); |
2371 | #if 0 /* if system didn't claim this region, we would... */ | 2363 | #if 0 /* if system didn't claim this region, we would... */ |
2372 | release_mem_region(0xA0000, 65535); | 2364 | release_mem_region(0xA0000, 65535); |
2373 | #endif | 2365 | #endif |
2374 | if (release_io_ports) | 2366 | if (release_io_ports) |
2375 | release_region(0x3C0, 32); | 2367 | release_region(0x3C0, 32); |
2376 | pci_release_regions(pdev); | 2368 | pci_release_regions(pdev); |
2377 | framebuffer_release(cinfo->info); | 2369 | framebuffer_release(info); |
2378 | } | 2370 | } |
2379 | #endif /* CONFIG_PCI */ | 2371 | #endif /* CONFIG_PCI */ |
2380 | 2372 | ||
@@ -2386,21 +2378,20 @@ static void __devexit cirrusfb_zorro_unmap(struct cirrusfb_info *cinfo) | |||
2386 | if (cinfo->btype == BT_PICASSO4) { | 2378 | if (cinfo->btype == BT_PICASSO4) { |
2387 | cinfo->regbase -= 0x600000; | 2379 | cinfo->regbase -= 0x600000; |
2388 | iounmap((void *)cinfo->regbase); | 2380 | iounmap((void *)cinfo->regbase); |
2389 | iounmap((void *)cinfo->fbmem); | 2381 | iounmap(info->screen_base); |
2390 | } else { | 2382 | } else { |
2391 | if (zorro_resource_start(cinfo->zdev) > 0x01000000) | 2383 | if (zorro_resource_start(cinfo->zdev) > 0x01000000) |
2392 | iounmap((void *)cinfo->fbmem); | 2384 | iounmap(info->screen_base); |
2393 | } | 2385 | } |
2394 | framebuffer_release(cinfo->info); | 2386 | framebuffer_release(cinfo->info); |
2395 | } | 2387 | } |
2396 | #endif /* CONFIG_ZORRO */ | 2388 | #endif /* CONFIG_ZORRO */ |
2397 | 2389 | ||
2398 | static int cirrusfb_set_fbinfo(struct cirrusfb_info *cinfo) | 2390 | static int cirrusfb_set_fbinfo(struct fb_info *info) |
2399 | { | 2391 | { |
2400 | struct fb_info *info = cinfo->info; | 2392 | struct cirrusfb_info *cinfo = info->par; |
2401 | struct fb_var_screeninfo *var = &info->var; | 2393 | struct fb_var_screeninfo *var = &info->var; |
2402 | 2394 | ||
2403 | info->par = cinfo; | ||
2404 | info->pseudo_palette = cinfo->pseudo_palette; | 2395 | info->pseudo_palette = cinfo->pseudo_palette; |
2405 | info->flags = FBINFO_DEFAULT | 2396 | info->flags = FBINFO_DEFAULT |
2406 | | FBINFO_HWACCEL_XPAN | 2397 | | FBINFO_HWACCEL_XPAN |
@@ -2410,7 +2401,6 @@ static int cirrusfb_set_fbinfo(struct cirrusfb_info *cinfo) | |||
2410 | if (noaccel) | 2401 | if (noaccel) |
2411 | info->flags |= FBINFO_HWACCEL_DISABLED; | 2402 | info->flags |= FBINFO_HWACCEL_DISABLED; |
2412 | info->fbops = &cirrusfb_ops; | 2403 | info->fbops = &cirrusfb_ops; |
2413 | info->screen_base = cinfo->fbmem; | ||
2414 | if (cinfo->btype == BT_GD5480) { | 2404 | if (cinfo->btype == BT_GD5480) { |
2415 | if (var->bits_per_pixel == 16) | 2405 | if (var->bits_per_pixel == 16) |
2416 | info->screen_base += 1 * MB_; | 2406 | info->screen_base += 1 * MB_; |
@@ -2424,9 +2414,9 @@ static int cirrusfb_set_fbinfo(struct cirrusfb_info *cinfo) | |||
2424 | 2414 | ||
2425 | /* monochrome: only 1 memory plane */ | 2415 | /* monochrome: only 1 memory plane */ |
2426 | /* 8 bit and above: Use whole memory area */ | 2416 | /* 8 bit and above: Use whole memory area */ |
2427 | info->fix.smem_start = cinfo->fbmem_phys; | 2417 | info->fix.smem_len = info->screen_size; |
2428 | info->fix.smem_len = | 2418 | if (var->bits_per_pixel == 1) |
2429 | (var->bits_per_pixel == 1) ? cinfo->size / 4 : cinfo->size; | 2419 | info->fix.smem_len /= 4; |
2430 | info->fix.type = cinfo->currentmode.type; | 2420 | info->fix.type = cinfo->currentmode.type; |
2431 | info->fix.type_aux = 0; | 2421 | info->fix.type_aux = 0; |
2432 | info->fix.visual = cinfo->currentmode.visual; | 2422 | info->fix.visual = cinfo->currentmode.visual; |
@@ -2436,7 +2426,6 @@ static int cirrusfb_set_fbinfo(struct cirrusfb_info *cinfo) | |||
2436 | info->fix.line_length = cinfo->currentmode.line_length; | 2426 | info->fix.line_length = cinfo->currentmode.line_length; |
2437 | 2427 | ||
2438 | /* FIXME: map region at 0xB8000 if available, fill in here */ | 2428 | /* FIXME: map region at 0xB8000 if available, fill in here */ |
2439 | info->fix.mmio_start = cinfo->fbregs_phys; | ||
2440 | info->fix.mmio_len = 0; | 2429 | info->fix.mmio_len = 0; |
2441 | info->fix.accel = FB_ACCEL_NONE; | 2430 | info->fix.accel = FB_ACCEL_NONE; |
2442 | 2431 | ||
@@ -2445,9 +2434,9 @@ static int cirrusfb_set_fbinfo(struct cirrusfb_info *cinfo) | |||
2445 | return 0; | 2434 | return 0; |
2446 | } | 2435 | } |
2447 | 2436 | ||
2448 | static int cirrusfb_register(struct cirrusfb_info *cinfo) | 2437 | static int cirrusfb_register(struct fb_info *info) |
2449 | { | 2438 | { |
2450 | struct fb_info *info; | 2439 | struct cirrusfb_info *cinfo = info->par; |
2451 | int err; | 2440 | int err; |
2452 | enum cirrus_board btype; | 2441 | enum cirrus_board btype; |
2453 | 2442 | ||
@@ -2456,13 +2445,12 @@ static int cirrusfb_register(struct cirrusfb_info *cinfo) | |||
2456 | printk(KERN_INFO "cirrusfb: Driver for Cirrus Logic based " | 2445 | printk(KERN_INFO "cirrusfb: Driver for Cirrus Logic based " |
2457 | "graphic boards, v" CIRRUSFB_VERSION "\n"); | 2446 | "graphic boards, v" CIRRUSFB_VERSION "\n"); |
2458 | 2447 | ||
2459 | info = cinfo->info; | ||
2460 | btype = cinfo->btype; | 2448 | btype = cinfo->btype; |
2461 | 2449 | ||
2462 | /* sanity checks */ | 2450 | /* sanity checks */ |
2463 | assert(btype != BT_NONE); | 2451 | assert(btype != BT_NONE); |
2464 | 2452 | ||
2465 | DPRINTK("cirrusfb: (RAM start set to: 0x%p)\n", cinfo->fbmem); | 2453 | DPRINTK("cirrusfb: (RAM start set to: 0x%p)\n", info->screen_base); |
2466 | 2454 | ||
2467 | /* Make pretend we've set the var so our structures are in a "good" */ | 2455 | /* Make pretend we've set the var so our structures are in a "good" */ |
2468 | /* state, even though we haven't written the mode to the hw yet... */ | 2456 | /* state, even though we haven't written the mode to the hw yet... */ |
@@ -2477,7 +2465,7 @@ static int cirrusfb_register(struct cirrusfb_info *cinfo) | |||
2477 | } | 2465 | } |
2478 | 2466 | ||
2479 | /* set all the vital stuff */ | 2467 | /* set all the vital stuff */ |
2480 | cirrusfb_set_fbinfo(cinfo); | 2468 | cirrusfb_set_fbinfo(info); |
2481 | 2469 | ||
2482 | err = register_framebuffer(info); | 2470 | err = register_framebuffer(info); |
2483 | if (err < 0) { | 2471 | if (err < 0) { |
@@ -2492,7 +2480,7 @@ static int cirrusfb_register(struct cirrusfb_info *cinfo) | |||
2492 | err_dealloc_cmap: | 2480 | err_dealloc_cmap: |
2493 | fb_dealloc_cmap(&info->cmap); | 2481 | fb_dealloc_cmap(&info->cmap); |
2494 | err_unmap_cirrusfb: | 2482 | err_unmap_cirrusfb: |
2495 | cinfo->unmap(cinfo); | 2483 | cinfo->unmap(info); |
2496 | return err; | 2484 | return err; |
2497 | } | 2485 | } |
2498 | 2486 | ||
@@ -2506,7 +2494,7 @@ static void __devexit cirrusfb_cleanup(struct fb_info *info) | |||
2506 | unregister_framebuffer(info); | 2494 | unregister_framebuffer(info); |
2507 | fb_dealloc_cmap(&info->cmap); | 2495 | fb_dealloc_cmap(&info->cmap); |
2508 | printk("Framebuffer unregistered\n"); | 2496 | printk("Framebuffer unregistered\n"); |
2509 | cinfo->unmap(cinfo); | 2497 | cinfo->unmap(info); |
2510 | 2498 | ||
2511 | DPRINTK("EXIT\n"); | 2499 | DPRINTK("EXIT\n"); |
2512 | } | 2500 | } |
@@ -2535,7 +2523,6 @@ static int cirrusfb_pci_register(struct pci_dev *pdev, | |||
2535 | } | 2523 | } |
2536 | 2524 | ||
2537 | cinfo = info->par; | 2525 | cinfo = info->par; |
2538 | cinfo->info = info; | ||
2539 | cinfo->pdev = pdev; | 2526 | cinfo->pdev = pdev; |
2540 | cinfo->btype = btype = (enum cirrus_board) ent->driver_data; | 2527 | cinfo->btype = btype = (enum cirrus_board) ent->driver_data; |
2541 | 2528 | ||
@@ -2546,19 +2533,19 @@ static int cirrusfb_pci_register(struct pci_dev *pdev, | |||
2546 | if (isPReP) { | 2533 | if (isPReP) { |
2547 | pci_write_config_dword(pdev, PCI_BASE_ADDRESS_0, 0x00000000); | 2534 | pci_write_config_dword(pdev, PCI_BASE_ADDRESS_0, 0x00000000); |
2548 | #ifdef CONFIG_PPC_PREP | 2535 | #ifdef CONFIG_PPC_PREP |
2549 | get_prep_addrs(&board_addr, &cinfo->fbregs_phys); | 2536 | get_prep_addrs(&board_addr, &info->fix.mmio_start); |
2550 | #endif | 2537 | #endif |
2551 | /* PReP dies if we ioremap the IO registers, but it works w/out... */ | 2538 | /* PReP dies if we ioremap the IO registers, but it works w/out... */ |
2552 | cinfo->regbase = (char __iomem *) cinfo->fbregs_phys; | 2539 | cinfo->regbase = (char __iomem *) info->fix.mmio_start; |
2553 | } else { | 2540 | } else { |
2554 | DPRINTK("Attempt to get PCI info for Cirrus Graphics Card\n"); | 2541 | DPRINTK("Attempt to get PCI info for Cirrus Graphics Card\n"); |
2555 | get_pci_addrs(pdev, &board_addr, &cinfo->fbregs_phys); | 2542 | get_pci_addrs(pdev, &board_addr, &info->fix.mmio_start); |
2556 | /* FIXME: this forces VGA. alternatives? */ | 2543 | /* FIXME: this forces VGA. alternatives? */ |
2557 | cinfo->regbase = NULL; | 2544 | cinfo->regbase = NULL; |
2558 | } | 2545 | } |
2559 | 2546 | ||
2560 | DPRINTK("Board address: 0x%lx, register address: 0x%lx\n", | 2547 | DPRINTK("Board address: 0x%lx, register address: 0x%lx\n", |
2561 | board_addr, cinfo->fbregs_phys); | 2548 | board_addr, info->fix.mmio_start); |
2562 | 2549 | ||
2563 | board_size = (btype == BT_GD5480) ? | 2550 | board_size = (btype == BT_GD5480) ? |
2564 | 32 * MB_ : cirrusfb_get_memsize(cinfo->regbase); | 2551 | 32 * MB_ : cirrusfb_get_memsize(cinfo->regbase); |
@@ -2582,24 +2569,24 @@ static int cirrusfb_pci_register(struct pci_dev *pdev, | |||
2582 | if (request_region(0x3C0, 32, "cirrusfb")) | 2569 | if (request_region(0x3C0, 32, "cirrusfb")) |
2583 | release_io_ports = 1; | 2570 | release_io_ports = 1; |
2584 | 2571 | ||
2585 | cinfo->fbmem = ioremap(board_addr, board_size); | 2572 | info->screen_base = ioremap(board_addr, board_size); |
2586 | if (!cinfo->fbmem) { | 2573 | if (!info->screen_base) { |
2587 | ret = -EIO; | 2574 | ret = -EIO; |
2588 | goto err_release_legacy; | 2575 | goto err_release_legacy; |
2589 | } | 2576 | } |
2590 | 2577 | ||
2591 | cinfo->fbmem_phys = board_addr; | 2578 | info->fix.smem_start = board_addr; |
2592 | cinfo->size = board_size; | 2579 | info->screen_size = board_size; |
2593 | cinfo->unmap = cirrusfb_pci_unmap; | 2580 | cinfo->unmap = cirrusfb_pci_unmap; |
2594 | 2581 | ||
2595 | printk(KERN_INFO " RAM (%lu kB) at 0xx%lx, ", | 2582 | printk(KERN_INFO " RAM (%lu kB) at 0xx%lx, ", |
2596 | cinfo->size / KB_, board_addr); | 2583 | info->screen_size / KB_, board_addr); |
2597 | printk(KERN_INFO "Cirrus Logic chipset on PCI bus\n"); | 2584 | printk(KERN_INFO "Cirrus Logic chipset on PCI bus\n"); |
2598 | pci_set_drvdata(pdev, info); | 2585 | pci_set_drvdata(pdev, info); |
2599 | 2586 | ||
2600 | ret = cirrusfb_register(cinfo); | 2587 | ret = cirrusfb_register(info); |
2601 | if (ret) | 2588 | if (ret) |
2602 | iounmap(cinfo->fbmem); | 2589 | iounmap(info->screen_base); |
2603 | return ret; | 2590 | return ret; |
2604 | 2591 | ||
2605 | err_release_legacy: | 2592 | err_release_legacy: |
@@ -2677,7 +2664,7 @@ static int cirrusfb_zorro_register(struct zorro_dev *z, | |||
2677 | cinfo->zdev = z; | 2664 | cinfo->zdev = z; |
2678 | board_addr = zorro_resource_start(z); | 2665 | board_addr = zorro_resource_start(z); |
2679 | board_size = zorro_resource_len(z); | 2666 | board_size = zorro_resource_len(z); |
2680 | cinfo->size = size; | 2667 | info->screen_size = size; |
2681 | 2668 | ||
2682 | if (!zorro_request_device(z, "cirrusfb")) { | 2669 | if (!zorro_request_device(z, "cirrusfb")) { |
2683 | printk(KERN_ERR "cirrusfb: cannot reserve region 0x%lx, " | 2670 | printk(KERN_ERR "cirrusfb: cannot reserve region 0x%lx, " |
@@ -2705,27 +2692,27 @@ static int cirrusfb_zorro_register(struct zorro_dev *z, | |||
2705 | DPRINTK("cirrusfb: Virtual address for board set to: $%p\n", | 2692 | DPRINTK("cirrusfb: Virtual address for board set to: $%p\n", |
2706 | cinfo->regbase); | 2693 | cinfo->regbase); |
2707 | cinfo->regbase += 0x600000; | 2694 | cinfo->regbase += 0x600000; |
2708 | cinfo->fbregs_phys = board_addr + 0x600000; | 2695 | info->fix.mmio_start = board_addr + 0x600000; |
2709 | 2696 | ||
2710 | cinfo->fbmem_phys = board_addr + 16777216; | 2697 | info->fix.smem_start = board_addr + 16777216; |
2711 | cinfo->fbmem = ioremap(cinfo->fbmem_phys, 16777216); | 2698 | info->screen_base = ioremap(info->fix.smem_start, 16777216); |
2712 | if (!cinfo->fbmem) | 2699 | if (!info->screen_base) |
2713 | goto err_unmap_regbase; | 2700 | goto err_unmap_regbase; |
2714 | } else { | 2701 | } else { |
2715 | printk(KERN_INFO " REG at $%lx\n", | 2702 | printk(KERN_INFO " REG at $%lx\n", |
2716 | (unsigned long) z2->resource.start); | 2703 | (unsigned long) z2->resource.start); |
2717 | 2704 | ||
2718 | cinfo->fbmem_phys = board_addr; | 2705 | info->fix.smem_start = board_addr; |
2719 | if (board_addr > 0x01000000) | 2706 | if (board_addr > 0x01000000) |
2720 | cinfo->fbmem = ioremap(board_addr, board_size); | 2707 | info->screen_base = ioremap(board_addr, board_size); |
2721 | else | 2708 | else |
2722 | cinfo->fbmem = (caddr_t) ZTWO_VADDR(board_addr); | 2709 | info->screen_base = (caddr_t) ZTWO_VADDR(board_addr); |
2723 | if (!cinfo->fbmem) | 2710 | if (!info->screen_base) |
2724 | goto err_release_region; | 2711 | goto err_release_region; |
2725 | 2712 | ||
2726 | /* set address for REG area of board */ | 2713 | /* set address for REG area of board */ |
2727 | cinfo->regbase = (caddr_t) ZTWO_VADDR(z2->resource.start); | 2714 | cinfo->regbase = (caddr_t) ZTWO_VADDR(z2->resource.start); |
2728 | cinfo->fbregs_phys = z2->resource.start; | 2715 | info->fix.mmio_start = z2->resource.start; |
2729 | 2716 | ||
2730 | DPRINTK("cirrusfb: Virtual address for board set to: $%p\n", | 2717 | DPRINTK("cirrusfb: Virtual address for board set to: $%p\n", |
2731 | cinfo->regbase); | 2718 | cinfo->regbase); |
@@ -2738,10 +2725,10 @@ static int cirrusfb_zorro_register(struct zorro_dev *z, | |||
2738 | ret = cirrusfb_register(cinfo); | 2725 | ret = cirrusfb_register(cinfo); |
2739 | if (ret) { | 2726 | if (ret) { |
2740 | if (btype == BT_PICASSO4) { | 2727 | if (btype == BT_PICASSO4) { |
2741 | iounmap(cinfo->fbmem); | 2728 | iounmap(info->screen_base); |
2742 | iounmap(cinfo->regbase - 0x600000); | 2729 | iounmap(cinfo->regbase - 0x600000); |
2743 | } else if (board_addr > 0x01000000) | 2730 | } else if (board_addr > 0x01000000) |
2744 | iounmap(cinfo->fbmem); | 2731 | iounmap(info->screen_base); |
2745 | } | 2732 | } |
2746 | return ret; | 2733 | return ret; |
2747 | 2734 | ||