|
|
|
|
Quelle amifb.c
Sprache: C
|
|
/*
* linux/drivers/video/amifb.c -- Amiga builtin chipset frame buffer device
*
* Copyright (C) 1995-2003 Geert Uytterhoeven
*
* with work by Roman Zippel
*
*
* This file is based on the Atari frame buffer device (atafb.c):
*
* Copyright (C) 1994 Martin Schaller
* Roman Hodek
*
* with work by Andreas Schwab
* Guenther Kelleter
*
* and on the original Amiga console driver (amicon.c):
*
* Copyright (C) 1993 Hamish Macdonald
* Greg Harp
* Copyright (C) 1994 David Carter [carter@compsci.bristol.ac.uk]
*
* with work by William Rucklidge (wjr@cs.cornell.edu)
* Geert Uytterhoeven
* Jes Sorensen (jds@kom.auc.dk)
*
*
* History:
*
* - 24 Jul 96: Copper generates now vblank interrupt and
* VESA Power Saving Protocol is fully implemented
* - 14 Jul 96: Rework and hopefully last ECS bugs fixed
* - 7 Mar 96: Hardware sprite support by Roman Zippel
* - 18 Feb 96: OCS and ECS support by Roman Zippel
* Hardware functions completely rewritten
* - 2 Dec 95: AGA version by Geert Uytterhoeven
*
* 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.
*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/string.h>
#include <linux/mm.h>
#include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/fb.h>
#include <linux/init.h>
#include <linux/ioport.h>
#include <linux/platform_device.h>
#include <linux/uaccess.h>
#include <asm/irq.h>
#include <asm/amigahw.h>
#include <asm/amigaints.h>
#include <asm/setup.h>
#include "c2p.h"
#define DEBUG
#if !defined(CONFIG_FB_AMIGA_OCS) && !defined(CONFIG_FB_AMIGA_ECS) && !defined(CONFIG_FB_AMIGA_AGA)
#define CONFIG_FB_AMIGA_OCS /* define at least one fb driver, this will change later */
#endif
#if !defined(CONFIG_FB_AMIGA_OCS)
# define IS_OCS (0)
#elif defined(CONFIG_FB_AMIGA_ECS) || defined(CONFIG_FB_AMIGA_AGA)
# define IS_OCS (chipset == TAG_OCS)
#else
# define CONFIG_FB_AMIGA_OCS_ONLY
# define IS_OCS (1)
#endif
#if !defined(CONFIG_FB_AMIGA_ECS)
# define IS_ECS (0)
#elif defined(CONFIG_FB_AMIGA_OCS) || defined(CONFIG_FB_AMIGA_AGA)
# define IS_ECS (chipset == TAG_ECS)
#else
# define CONFIG_FB_AMIGA_ECS_ONLY
# define IS_ECS (1)
#endif
#if !defined(CONFIG_FB_AMIGA_AGA)
# define IS_AGA (0)
#elif defined(CONFIG_FB_AMIGA_OCS) || defined(CONFIG_FB_AMIGA_ECS)
# define IS_AGA (chipset == TAG_AGA)
#else
# define CONFIG_FB_AMIGA_AGA_ONLY
# define IS_AGA (1)
#endif
#ifdef DEBUG
# define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __func__ , ## args)
#else
# define DPRINTK(fmt, args...)
#endif
/*******************************************************************************
Generic video timings
---------------------
Timings used by the frame buffer interface:
+----------+---------------------------------------------+----------+-------+
| | ^ | | |
| | |upper_margin | | |
| | v | | |
+----------###############################################----------+-------+
| # ^ # | |
| # | # | |
| # | # | |
| # | # | |
| left # | # right | hsync |
| margin # | xres # margin | len |
|<-------->#<---------------+--------------------------->#<-------->|<----->|
| # | # | |
| # | # | |
| # | # | |
| # |yres # | |
| # | # | |
| # | # | |
| # | # | |
| # | # | |
| # | # | |
| # | # | |
| # | # | |
| # | # | |
| # v # | |
+----------###############################################----------+-------+
| | ^ | | |
| | |lower_margin | | |
| | v | | |
+----------+---------------------------------------------+----------+-------+
| | ^ | | |
| | |vsync_len | | |
| | v | | |
+----------+---------------------------------------------+----------+-------+
Amiga video timings
-------------------
The Amiga native chipsets uses another timing scheme:
- hsstrt: Start of horizontal synchronization pulse
- hsstop: End of horizontal synchronization pulse
- htotal: Last value on the line (i.e. line length = htotal + 1)
- vsstrt: Start of vertical synchronization pulse
- vsstop: End of vertical synchronization pulse
- vtotal: Last line value (i.e. number of lines = vtotal + 1)
- hcenter: Start of vertical retrace for interlace
You can specify the blanking timings independently. Currently I just set
them equal to the respective synchronization values:
- hbstrt: Start of horizontal blank
- hbstop: End of horizontal blank
- vbstrt: Start of vertical blank
- vbstop: End of vertical blank
Horizontal values are in color clock cycles (280 ns), vertical values are in
scanlines.
(0, 0) is somewhere in the upper-left corner :-)
Amiga visible window definitions
--------------------------------
Currently I only have values for AGA, SHRES (28 MHz dotclock). Feel free to
make corrections and/or additions.
Within the above synchronization specifications, the visible window is
defined by the following parameters (actual register resolutions may be
different; all horizontal values are normalized with respect to the pixel
clock):
- diwstrt_h: Horizontal start of the visible window
- diwstop_h: Horizontal stop + 1(*) of the visible window
- diwstrt_v: Vertical start of the visible window
- diwstop_v: Vertical stop of the visible window
- ddfstrt: Horizontal start of display DMA
- ddfstop: Horizontal stop of display DMA
- hscroll: Horizontal display output delay
Sprite positioning:
- sprstrt_h: Horizontal start - 4 of sprite
- sprstrt_v: Vertical start of sprite
(*) Even Commodore did it wrong in the AGA monitor drivers by not adding 1.
Horizontal values are in dotclock cycles (35 ns), vertical values are in
scanlines.
(0, 0) is somewhere in the upper-left corner :-)
Dependencies (AGA, SHRES (35 ns dotclock))
-------------------------------------------
Since there are much more parameters for the Amiga display than for the
frame buffer interface, there must be some dependencies among the Amiga
display parameters. Here's what I found out:
- ddfstrt and ddfstop are best aligned to 64 pixels.
- the chipset needs 64 + 4 horizontal pixels after the DMA start before
the first pixel is output, so diwstrt_h = ddfstrt + 64 + 4 if you want
to display the first pixel on the line too. Increase diwstrt_h for
virtual screen panning.
- the display DMA always fetches 64 pixels at a time (fmode = 3).
- ddfstop is ddfstrt+#pixels - 64.
- diwstop_h = diwstrt_h + xres + 1. Because of the additional 1 this can
be 1 more than htotal.
- hscroll simply adds a delay to the display output. Smooth horizontal
panning needs an extra 64 pixels on the left to prefetch the pixels that
`fall off' on the left.
- if ddfstrt < 192, the sprite DMA cycles are all stolen by the bitplane
DMA, so it's best to make the DMA start as late as possible.
- you really don't want to make ddfstrt < 128, since this will steal DMA
cycles from the other DMA channels (audio, floppy and Chip RAM refresh).
- I make diwstop_h and diwstop_v as large as possible.
General dependencies
--------------------
- all values are SHRES pixel (35ns)
table 1:fetchstart table 2:prefetch table 3:fetchsize
------------------ ---------------- -----------------
Pixclock # SHRES|HIRES|LORES # SHRES|HIRES|LORES # SHRES|HIRES|LORES
-------------#------+-----+------#------+-----+------#------+-----+------
Bus width 1x # 16 | 32 | 64 # 16 | 32 | 64 # 64 | 64 | 64
Bus width 2x # 32 | 64 | 128 # 32 | 64 | 64 # 64 | 64 | 128
Bus width 4x # 64 | 128 | 256 # 64 | 64 | 64 # 64 | 128 | 256
- chipset needs 4 pixels before the first pixel is output
- ddfstrt must be aligned to fetchstart (table 1)
- chipset needs also prefetch (table 2) to get first pixel data, so
ddfstrt = ((diwstrt_h - 4) & -fetchstart) - prefetch
- for horizontal panning decrease diwstrt_h
- the length of a fetchline must be aligned to fetchsize (table 3)
- if fetchstart is smaller than fetchsize, then ddfstrt can a little bit
moved to optimize use of dma (useful for OCS/ECS overscan displays)
- ddfstop is ddfstrt + ddfsize - fetchsize
- If C= didn't change anything for AGA, then at following positions the
dma bus is already used:
ddfstrt < 48 -> memory refresh
< 96 -> disk dma
< 160 -> audio dma
< 192 -> sprite 0 dma
< 416 -> sprite dma (32 per sprite)
- in accordance with the hardware reference manual a hardware stop is at
192, but AGA (ECS?) can go below this.
DMA priorities
--------------
Since there are limits on the earliest start value for display DMA and the
display of sprites, I use the following policy on horizontal panning and
the hardware cursor:
- if you want to start display DMA too early, you lose the ability to
do smooth horizontal panning (xpanstep 1 -> 64).
- if you want to go even further, you lose the hardware cursor too.
IMHO a hardware cursor is more important for X than horizontal scrolling,
so that's my motivation.
Implementation
--------------
ami_decode_var() converts the frame buffer values to the Amiga values. It's
just a `straightforward' implementation of the above rules.
Standard VGA timings
--------------------
xres yres left right upper lower hsync vsync
---- ---- ---- ----- ----- ----- ----- -----
80x25 720 400 27 45 35 12 108 2
80x30 720 480 27 45 30 9 108 2
These were taken from a XFree86 configuration file, recalculated for a 28 MHz
dotclock (Amigas don't have a 25 MHz dotclock) and converted to frame buffer
generic timings.
As a comparison, graphics/monitor.h suggests the following:
xres yres left right upper lower hsync vsync
---- ---- ---- ----- ----- ----- ----- -----
VGA 640 480 52 112 24 19 112 - 2 +
VGA70 640 400 52 112 27 21 112 - 2 -
Sync polarities
---------------
VSYNC HSYNC Vertical size Vertical total
----- ----- ------------- --------------
+ + Reserved Reserved
+ - 400 414
- + 350 362
- - 480 496
Source: CL-GD542X Technical Reference Manual, Cirrus Logic, Oct 1992
Broadcast video timings
-----------------------
According to the CCIR and RETMA specifications, we have the following values:
CCIR -> PAL
-----------
- a scanline is 64 µs long, of which 52.48 µs are visible. This is about
736 visible 70 ns pixels per line.
- we have 625 scanlines, of which 575 are visible (interlaced); after
rounding this becomes 576.
RETMA -> NTSC
-------------
- a scanline is 63.5 µs long, of which 53.5 µs are visible. This is about
736 visible 70 ns pixels per line.
- we have 525 scanlines, of which 485 are visible (interlaced); after
rounding this becomes 484.
Thus if you want a PAL compatible display, you have to do the following:
- set the FB_SYNC_BROADCAST flag to indicate that standard broadcast
timings are to be used.
- make sure upper_margin + yres + lower_margin + vsync_len = 625 for an
interlaced, 312 for a non-interlaced and 156 for a doublescanned
display.
- make sure left_margin + xres + right_margin + hsync_len = 1816 for a
SHRES, 908 for a HIRES and 454 for a LORES display.
- the left visible part begins at 360 (SHRES; HIRES:180, LORES:90),
left_margin + 2 * hsync_len must be greater or equal.
- the upper visible part begins at 48 (interlaced; non-interlaced:24,
doublescanned:12), upper_margin + 2 * vsync_len must be greater or
equal.
- ami_encode_var() calculates margins with a hsync of 5320 ns and a vsync
of 4 scanlines
The settings for a NTSC compatible display are straightforward.
Note that in a strict sense the PAL and NTSC standards only define the
encoding of the color part (chrominance) of the video signal and don't say
anything about horizontal/vertical synchronization nor refresh rates.
-- Geert --
*******************************************************************************/
/*
* Custom Chipset Definitions
*/
#define CUSTOM_OFS(fld) ((long)&((struct CUSTOM*)0)->fld)
/*
* BPLCON0 -- Bitplane Control Register 0
*/
#define BPC0_HIRES (0x8000)
#define BPC0_BPU2 (0x4000) /* Bit plane used count */
#define BPC0_BPU1 (0x2000)
#define BPC0_BPU0 (0x1000)
#define BPC0_HAM (0x0800) /* HAM mode */
#define BPC0_DPF (0x0400) /* Double playfield */
#define BPC0_COLOR (0x0200) /* Enable colorburst */
#define BPC0_GAUD (0x0100) /* Genlock audio enable */
#define BPC0_UHRES (0x0080) /* Ultrahi res enable */
#define BPC0_SHRES (0x0040) /* Super hi res mode */
#define BPC0_BYPASS (0x0020) /* Bypass LUT - AGA */
#define BPC0_BPU3 (0x0010) /* AGA */
#define BPC0_LPEN (0x0008) /* Light pen enable */
#define BPC0_LACE (0x0004) /* Interlace */
#define BPC0_ERSY (0x0002) /* External resync */
#define BPC0_ECSENA (0x0001) /* ECS enable */
/*
* BPLCON2 -- Bitplane Control Register 2
*/
#define BPC2_ZDBPSEL2 (0x4000) /* Bitplane to be used for ZD - AGA */
#define BPC2_ZDBPSEL1 (0x2000)
#define BPC2_ZDBPSEL0 (0x1000)
#define BPC2_ZDBPEN (0x0800) /* Enable ZD with ZDBPSELx - AGA */
#define BPC2_ZDCTEN (0x0400) /* Enable ZD with palette bit #31 - AGA */
#define BPC2_KILLEHB (0x0200) /* Kill EHB mode - AGA */
#define BPC2_RDRAM (0x0100) /* Color table accesses read, not write - AGA */
#define BPC2_SOGEN (0x0080) /* SOG output pin high - AGA */
#define BPC2_PF2PRI (0x0040) /* PF2 priority over PF1 */
#define BPC2_PF2P2 (0x0020) /* PF2 priority wrt sprites */
#define BPC2_PF2P1 (0x0010)
#define BPC2_PF2P0 (0x0008)
#define BPC2_PF1P2 (0x0004) /* ditto PF1 */
#define BPC2_PF1P1 (0x0002)
#define BPC2_PF1P0 (0x0001)
/*
* BPLCON3 -- Bitplane Control Register 3 (AGA)
*/
#define BPC3_BANK2 (0x8000) /* Bits to select color register bank */
#define BPC3_BANK1 (0x4000)
#define BPC3_BANK0 (0x2000)
#define BPC3_PF2OF2 (0x1000) /* Bits for color table offset when PF2 */
#define BPC3_PF2OF1 (0x0800)
#define BPC3_PF2OF0 (0x0400)
#define BPC3_LOCT (0x0200) /* Color register writes go to low bits */
#define BPC3_SPRES1 (0x0080) /* Sprite resolution bits */
#define BPC3_SPRES0 (0x0040)
#define BPC3_BRDRBLNK (0x0020) /* Border blanked? */
#define BPC3_BRDRTRAN (0x0010) /* Border transparent? */
#define BPC3_ZDCLKEN (0x0004) /* ZD pin is 14 MHz (HIRES) clock output */
#define BPC3_BRDRSPRT (0x0002) /* Sprites in border? */
#define BPC3_EXTBLKEN (0x0001) /* BLANK programmable */
/*
* BPLCON4 -- Bitplane Control Register 4 (AGA)
*/
#define BPC4_BPLAM7 (0x8000) /* bitplane color XOR field */
#define BPC4_BPLAM6 (0x4000)
#define BPC4_BPLAM5 (0x2000)
#define BPC4_BPLAM4 (0x1000)
#define BPC4_BPLAM3 (0x0800)
#define BPC4_BPLAM2 (0x0400)
#define BPC4_BPLAM1 (0x0200)
#define BPC4_BPLAM0 (0x0100)
#define BPC4_ESPRM7 (0x0080) /* 4 high bits for even sprite colors */
#define BPC4_ESPRM6 (0x0040)
#define BPC4_ESPRM5 (0x0020)
#define BPC4_ESPRM4 (0x0010)
#define BPC4_OSPRM7 (0x0008) /* 4 high bits for odd sprite colors */
#define BPC4_OSPRM6 (0x0004)
#define BPC4_OSPRM5 (0x0002)
#define BPC4_OSPRM4 (0x0001)
/*
* BEAMCON0 -- Beam Control Register
*/
#define BMC0_HARDDIS (0x4000) /* Disable hardware limits */
#define BMC0_LPENDIS (0x2000) /* Disable light pen latch */
#define BMC0_VARVBEN (0x1000) /* Enable variable vertical blank */
#define BMC0_LOLDIS (0x0800) /* Disable long/short line toggle */
#define BMC0_CSCBEN (0x0400) /* Composite sync/blank */
#define BMC0_VARVSYEN (0x0200) /* Enable variable vertical sync */
#define BMC0_VARHSYEN (0x0100) /* Enable variable horizontal sync */
#define BMC0_VARBEAMEN (0x0080) /* Enable variable beam counters */
#define BMC0_DUAL (0x0040) /* Enable alternate horizontal beam counter */
#define BMC0_PAL (0x0020) /* Set decodes for PAL */
#define BMC0_VARCSYEN (0x0010) /* Enable variable composite sync */
#define BMC0_BLANKEN (0x0008) /* Blank enable (no longer used on AGA) */
#define BMC0_CSYTRUE (0x0004) /* CSY polarity */
#define BMC0_VSYTRUE (0x0002) /* VSY polarity */
#define BMC0_HSYTRUE (0x0001) /* HSY polarity */
/*
* FMODE -- Fetch Mode Control Register (AGA)
*/
#define FMODE_SSCAN2 (0x8000) /* Sprite scan-doubling */
#define FMODE_BSCAN2 (0x4000) /* Use PF2 modulus every other line */
#define FMODE_SPAGEM (0x0008) /* Sprite page mode */
#define FMODE_SPR32 (0x0004) /* Sprite 32 bit fetch */
#define FMODE_BPAGEM (0x0002) /* Bitplane page mode */
#define FMODE_BPL32 (0x0001) /* Bitplane 32 bit fetch */
/*
* Tags used to indicate a specific Pixel Clock
*
* clk_shift is the shift value to get the timings in 35 ns units
*/
enum { TAG_SHRES, TAG_HIRES, TAG_LORES };
/*
* Tags used to indicate the specific chipset
*/
enum { TAG_OCS, TAG_ECS, TAG_AGA };
/*
* Tags used to indicate the memory bandwidth
*/
enum { TAG_FMODE_1, TAG_FMODE_2, TAG_FMODE_4 };
/*
* Clock Definitions, Maximum Display Depth
*
* These depend on the E-Clock or the Chipset, so they are filled in
* dynamically
*/
static u_long pixclock[3]; /* SHRES/HIRES/LORES: index = clk_shift */
static u_short maxdepth[3]; /* SHRES/HIRES/LORES: index = clk_shift */
static u_short maxfmode, chipset;
/*
* Broadcast Video Timings
*
* Horizontal values are in 35 ns (SHRES) units
* Vertical values are in interlaced scanlines
*/
#define PAL_DIWSTRT_H (360) /* PAL Window Limits */
#define PAL_DIWSTRT_V (48)
#define PAL_HTOTAL (1816)
#define PAL_VTOTAL (625)
#define NTSC_DIWSTRT_H (360) /* NTSC Window Limits */
#define NTSC_DIWSTRT_V (40)
#define NTSC_HTOTAL (1816)
#define NTSC_VTOTAL (525)
/*
* Various macros
*/
#define up2(v) (((v) + 1) & -2)
#define down2(v) ((v) & -2)
#define div2(v) ((v)>>1)
#define mod2(v) ((v) & 1)
#define up4(v) (((v) + 3) & -4)
#define down4(v) ((v) & -4)
#define mul4(v) ((v) << 2)
#define div4(v) ((v)>>2)
#define mod4(v) ((v) & 3)
#define up8(v) (((v) + 7) & -8)
#define down8(v) ((v) & -8)
#define div8(v) ((v)>>3)
#define mod8(v) ((v) & 7)
#define up16(v) (((v) + 15) & -16)
#define down16(v) ((v) & -16)
#define div16(v) ((v)>>4)
#define mod16(v) ((v) & 15)
#define up32(v) (((v) + 31) & -32)
#define down32(v) ((v) & -32)
#define div32(v) ((v)>>5)
#define mod32(v) ((v) & 31)
#define up64(v) (((v) + 63) & -64)
#define down64(v) ((v) & -64)
#define div64(v) ((v)>>6)
#define mod64(v) ((v) & 63)
#define upx(x, v) (((v) + (x) - 1) & -(x))
#define downx(x, v) ((v) & -(x))
#define modx(x, v) ((v) & ((x) - 1))
/*
* FIXME: Use C variants of the code marked with #ifdef __mc68000__
* in the driver. It shouldn't negatively affect the performance and
* is required for APUS support (once it is re-added to the kernel).
* Needs to be tested on the hardware though..
*/
/* if x1 is not a constant, this macro won't make real sense :-) */
#ifdef __mc68000__
#define DIVUL(x1, x2) ({int res; asm("divul %1,%2,%3": "=d" (res): \
"d" (x2), "d" ((long)((x1) / 0x100000000ULL)), "0" ((long)(x1))); res;})
#else
/* We know a bit about the numbers, so we can do it this way */
#define DIVUL(x1, x2) ((((long)((unsigned long long)x1 >> 8) / x2) << 8) + \
((((long)((unsigned long long)x1 >> 8) % x2) << 8) / x2))
#endif
#define highw(x) ((u_long)(x)>>16 & 0xffff)
#define loww(x) ((u_long)(x) & 0xffff)
#define custom amiga_custom
#define VBlankOn() custom.intena = IF_SETCLR|IF_COPER
#define VBlankOff() custom.intena = IF_COPER
/*
* Chip RAM we reserve for the Frame Buffer
*
* This defines the Maximum Virtual Screen Size
* (Setable per kernel options?)
*/
#define VIDEOMEMSIZE_AGA_2M (1310720) /* AGA (2MB) : max 1280*1024*256 */
#define VIDEOMEMSIZE_AGA_1M (786432) /* AGA (1MB) : max 1024*768*256 */
#define VIDEOMEMSIZE_ECS_2M (655360) /* ECS (2MB) : max 1280*1024*16 */
#define VIDEOMEMSIZE_ECS_1M (393216) /* ECS (1MB) : max 1024*768*16 */
#define VIDEOMEMSIZE_OCS (262144) /* OCS : max ca. 800*600*16 */
#define SPRITEMEMSIZE (64 * 64 / 4) /* max 64*64*4 */
#define DUMMYSPRITEMEMSIZE (8)
static u_long spritememory;
#define CHIPRAM_SAFETY_LIMIT (16384)
static u_long videomemory;
/*
* This is the earliest allowed start of fetching display data.
* Only if you really want no hardware cursor and audio,
* set this to 128, but let it better at 192
*/
static u_long min_fstrt = 192;
#define assignchunk(name, type, ptr, size) \
{ \
(name) = (type)(ptr); \
ptr += size; \
}
/*
* Copper Instructions
*/
#define CMOVE(val, reg) (CUSTOM_OFS(reg) << 16 | (val))
#define CMOVE2(val, reg) ((CUSTOM_OFS(reg) + 2) << 16 | (val))
#define CWAIT(x, y) (((y) & 0x1fe) << 23 | ((x) & 0x7f0) << 13 | 0x0001fffe)
#define CEND (0xfffffffe)
typedef union {
u_long l;
u_short w[2];
} copins;
static struct copdisplay {
copins *init;
copins *wait;
copins *list[2][2];
copins *rebuild[2];
} copdisplay;
static u_short currentcop = 0;
/*
* Hardware Cursor API Definitions
* These used to be in linux/fb.h, but were preliminary and used by
* amifb only anyway
*/
#define FBIOGET_FCURSORINFO 0x4607
#define FBIOGET_VCURSORINFO 0x4608
#define FBIOPUT_VCURSORINFO 0x4609
#define FBIOGET_CURSORSTATE 0x460A
#define FBIOPUT_CURSORSTATE 0x460B
struct fb_fix_cursorinfo {
__u16 crsr_width; /* width and height of the cursor in */
__u16 crsr_height; /* pixels (zero if no cursor) */
__u16 crsr_xsize; /* cursor size in display pixels */
__u16 crsr_ysize;
__u16 crsr_color1; /* colormap entry for cursor color1 */
__u16 crsr_color2; /* colormap entry for cursor color2 */
};
struct fb_var_cursorinfo {
__u16 width;
__u16 height;
__u16 xspot;
__u16 yspot;
DECLARE_FLEX_ARRAY(__u8, data); /* field with [height][width] */
};
struct fb_cursorstate {
__s16 xoffset;
__s16 yoffset;
__u16 mode;
};
#define FB_CURSOR_OFF 0
#define FB_CURSOR_ON 1
#define FB_CURSOR_FLASH 2
/*
* Hardware Cursor
*/
static int cursorrate = 20; /* Number of frames/flash toggle */
static u_short cursorstate = -1;
static u_short cursormode = FB_CURSOR_OFF;
static u_short *lofsprite, *shfsprite, *dummysprite;
/*
* Current Video Mode
*/
struct amifb_par {
/* General Values */
int xres; /* vmode */
int yres; /* vmode */
int vxres; /* vmode */
int vyres; /* vmode */
int xoffset; /* vmode */
int yoffset; /* vmode */
u_short bpp; /* vmode */
u_short clk_shift; /* vmode */
u_short line_shift; /* vmode */
int vmode; /* vmode */
u_short diwstrt_h; /* vmode */
u_short diwstop_h; /* vmode */
u_short diwstrt_v; /* vmode */
u_short diwstop_v; /* vmode */
u_long next_line;/* modulo for next line */
u_long next_plane; /* modulo for next plane */
/* Cursor Values */
struct
=-1
short crsr_y; /* movecursor */
short spot_x;
short
u_short height;#CMD_BUFF_SIZE(1024*50)
u_short width;
u_short fmode;
} crsr;
/* OCS Hardware Registers */
u_long
void(enable)(truct *
;
ujava.lang.StringIndexOutOfBoundsException: Range [10, 9) out of bounds for length 22
u_short long video_mem_phys; /* physical address of frame buffer */
u_shortu_int java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
u_short /* vmode */
u_shortvolatileu_char task_state;
htotal; /* vmode */
struct command_done;
/* Additional ECS Hardware Registers */
_hort smart_thread
u_short beamcon0; /* vmode */
u_short java.lang.StringIndexOutOfBoundsException: Range [0, 15) out of bounds for length 6
u_short /
u_short /
u_short hbstop; /* vmode */
u_shortvsstrt; /* vmode */
u_short vsstop; /* vmode */
java.lang.StringIndexOutOfBoundsException: Range [9, 8) out of bounds for length 29
u_short hcenter; /* vmode */
/* Additional AGA Hardware Registers */
u_short fmode; /* vmode */
};
/*
* Saved color entry 0 so we can restore it when unblanking
*/
static u_char red0, green0, blue0;
#if defined(CONFIG_FB_AMIGA_ECS)
static u_short ecs_palette[32];
#endif
/*
* Latches for Display Changes during VBlank
*/
static u_short do_vmode_full = 0; /* Change the Video Mode */
static u_short do_vmode_pan = 0; /* Update the Video Mode */
static short do_blank = 0; /* (Un)Blank the Screen (±1) */
static u_short do_cursor = 0; /* Move the Cursor */
/*
* Various Flags
*/
static u_short is_blanked = 0; /* Screen is Blanked */
static u_short is_lace = 0; /* Screen is laced */
/*
* Predefined Video Modes
*
*/
static struct fb_videomode ami_modedb[] __initdata = {
/*
* AmigaOS Video Modes
*
* If you change these, make sure to update DEFMODE_* as well!
*/
{
/* 640x200, 15 kHz, 60 Hz (NTSC) */
"ntsc", 60, 640, 200, TAG_HIRES, 106, 86, 44, 16, 76, 2,
FB_SYNC_BROADCAST, FB_VMODE_NONINTERLACED | FB_VMODE_YWRAP
}, {
/* 640x400, 15 kHz, 60 Hz interlaced (NTSC) */
"ntsc-lace", 60, 640, 400, TAG_HIRES, 106, 86, 88, 33, 76, 4,
FB_SYNC_BROADCAST, FB_VMODE_INTERLACED | FB_VMODE_YWRAP
}, {
/* 640x256, 15 kHz, 50 Hz (PAL) */
"pal", 50, 640, 256, TAG_HIRES, 106, 86, 40, 14, 76, 2,
FB_SYNC_BROADCAST, FB_VMODE_NONINTERLACED | FB_VMODE_YWRAP
}, {
/* 640x512, 15 kHz, 50 Hz interlaced (PAL) */
"pal-lace", 50, 640, 512, TAG_HIRES, 106, 86, 80, 29, 76, 4,
FB_SYNC_BROADCAST, FB_VMODE_INTERLACED | FB_VMODE_YWRAP
}, {
/* 640x480, 29 kHz, 57 Hz */
"multiscan", 57, 640, 480, TAG_SHRES, 96, 112, 29, 8, 72, 8,
0, FB_VMODE_NONINTERLACED | FB_VMODE_YWRAP
}, {
/* 640x960, 29 kHz, 57 Hz interlaced */
"multiscan-lace", 57, 640, 960, TAG_SHRES, 96, 112, 58, 16, 72,
16,
0, FB_VMODE_INTERLACED | FB_VMODE_YWRAP
}, {
/* 640x200, 15 kHz, 72 Hz */
"euro36", 72, 640, 200, TAG_HIRES, 92, 124, 6, 6, 52, 5,
0, FB_VMODE_NONINTERLACED | FB_VMODE_YWRAP
}, {
/* 640x400, 15 kHz, 72 Hz interlaced */
"euro36-lace", 72, 640, 400, TAG_HIRES, 92, 124, 12, 12, 52,
10,
0, FB_VMODE_INTERLACED | FB_VMODE_YWRAP
}, {
/* 640x400, 29 kHz, 68 Hz */
"euro72", 68, 640, 400, TAG_SHRES, 164, 92, 9, 9, 80, 8,
0, FB_VMODE_NONINTERLACED | FB_VMODE_YWRAP
}, {
/* 640x800, 29 kHz, 68 Hz interlaced */
"euro72-lace", 68, 640, 800, TAG_SHRES, 164, 92, 18, 18, 80,
16,
0, FB_VMODE_INTERLACED | FB_VMODE_YWRAP
}, {
/* 800x300, 23 kHz, 70 Hz */
"super72", 70, 800, 300, TAG_SHRES, 212, 140, 10, 11, 80, 7,
0, FB_VMODE_NONINTERLACED | FB_VMODE_YWRAP
}, {
/* 800x600, 23 kHz, 70 Hz interlaced */
"super72-lace", 70, 800, 600, TAG_SHRES, 212, 140, 20, 22, 80,
14,
0, FB_VMODE_INTERLACED | FB_VMODE_YWRAP
}, {
/* 640x200, 27 kHz, 57 Hz doublescan */
"dblntsc", 57, 640, 200, TAG_SHRES, 196, 124, 18, 17, 80, 4,
0, FB_VMODE_DOUBLE | FB_VMODE_YWRAP
}, {
/* 640x400, 27 kHz, 57 Hz */
"dblntsc-ff", 57, 640, 400, TAG_SHRES, 196, 124, 36, 35, 80, 7,
0, FB_VMODE_NONINTERLACED | FB_VMODE_YWRAP
}, {
/* 640x800, 27 kHz, 57 Hz interlaced */
"dblntsc-lace", 57, 640, 800, TAG_SHRES, 196, 124, 72, 70, 80,
14,
0, FB_VMODE_INTERLACED | FB_VMODE_YWRAP
}, {
/* 640x256, 27 kHz, 47 Hz doublescan */
"dblpal", 47, 640, 256, TAG_SHRES, 196, 124, 14, 13, 80, 4,
0, FB_VMODE_DOUBLE | FB_VMODE_YWRAP
}, {
/* 640x512, 27 kHz, 47 Hz */
"dblpal-ff", 47, 640, 512, TAG_SHRES, 196, 124, 28, 27, 80, 7,
0, FB_VMODE_NONINTERLACED | FB_VMODE_YWRAP
}, {
/* 640x1024, 27 kHz, 47 Hz interlaced */
"dblpal-lace", 47, 640, 1024, TAG_SHRES, 196, 124, 56, 54, 80,
14,
0, FB_VMODE_INTERLACED | FB_VMODE_YWRAP
},
/*
* VGA Video Modes
*/
{
/* 640x480, 31 kHz, 60 Hz (VGA) */
"vga", 60, 640, 480, TAG_SHRES, 64, 96, 30, 9, 112, 2,
0, FB_VMODE_NONINTERLACED | FB_VMODE_YWRAP
}, {
/* 640x400, 31 kHz, 70 Hz (VGA) */
"vga70", 70, 640, 400, TAG_SHRES, 64, 96, 35, 12, 112, 2,
FB_SYNC_VERT_HIGH_ACT | FB_SYNC_COMP_HIGH_ACT,
FB_VMODE_NONINTERLACED | FB_VMODE_YWRAP
},
#if 0
/*
* A2024 video modes
* These modes don't work yet because there's no A2024 driver.
*/
{
/* 1024x800, 10 Hz */
"a2024-10", 10, 1024, 800, TAG_HIRES, 0, 0, 0, 0, 0, 0,
0, FB_VMODE_NONINTERLACED | FB_VMODE_YWRAP
}, {
/* 1024x800, 15 Hz */
"a2024-15", 15, 1024, 800, TAG_HIRES, 0, 0, 0, 0, 0, 0,
0, FB_VMODE_NONINTERLACED | FB_VMODE_YWRAP
}
#endif
};
#define NUM_TOTAL_MODES ARRAY_SIZE(ami_modedb)
static char *mode_option __initdata = NULL;
static int round_down_bpp = 1; /* for mode probing */
/*
* Some default modes
*/
#define DEFMODE_PAL 2 /* "pal" for PAL OCS/ECS */
#define DEFMODE_NTSC 0 /* "ntsc" for NTSC OCS/ECS */
#define DEFMODE_AMBER_PAL 3 /* "pal-lace" for flicker fixed PAL (A3000) */
#define DEFMODE_AMBER_NTSC 1 /* "ntsc-lace" for flicker fixed NTSC (A3000) */
#define DEFMODE_AGA 19 /* "vga70" for AGA */
static int amifb_ilbm = 0; /* interleaved or normal bitplanes */
static u32 amifb_hfmin __initdata; /* monitor hfreq lower limit (Hz) */
static u32 amifb_hfmax __initdata;
static- : java.lang.StringIndexOutOfBoundsException: Range [39, 38) out of bounds for length 58
static u16 amifb_vfmax __initdata; /* monitor vfreq upper limit (Hz) */
/*
* Macros for the conversion from real world values to hardware register
* #include include <linux/string.h>
*
*This helps us to ourattention on the real stuff...
*
* java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
*
* #if !defined) & defined(ONFIG_FB_AMIGA_ECS &!()
* - java.lang.StringIndexOutOfBoundsException: Range [10, 9) out of bounds for length 37
* diwstrt_helifdefined() |defined()
20471
*
* # define DPRINTKfmt,args.. printk(KERN_DEBUG %s:" fmt,__unc__ , # args
*
ddfstrt 2032 16
* ddfstop 0 2032 || v | |
*
* htotal 8 2048 8
left # right|hsync |
* java.lang.StringIndexOutOfBoundsException: Range [17, 10) out of bounds for length 31
* vtotal 1 4096 1
* vsstrt 0 4095 1
* vsstop 0 4095 1
* hcenter 0 2040 8
*
* hbstrt 0 2047 1
* hbstop 0 2047 1
* vbstrt 0 4095 1
* vbstop 0 4095 1
*
* Horizontal values are in 35 ns (SHRES) pixels
* Vertical values are in half scanlines
*/
/* bplcon1 (smooth scrolling) */
#define hscroll2hw(hscroll) \
(((hscroll) << 12 & 0x3000) | ((hscroll) << 8 & 0xc300) | \
((hscroll) << 4 & 0x0c00) | ((hscroll) << 2 & 0x00f0) | \
((hscroll)>>2 & 0x000f))
/* diwstrt/diwstop/diwhigh (visible display window) */
#define diwstrt2hw(diwstrt_h, diwstrt_v) \
(((diwstrt_v) << 7 & 0xff00) | ((diwstrt_h)>>2 & 0x00ff))
#define diwstop2hw(diwstop_h, diwstop_v) \
(((diwstop_v) << 7 & 0xff00) | ((diwstop_h)>>2 & 0x00ff))
#define diwhigh2hw(diwstrt_h, diwstrt_v, diwstop_h, diwstop_v) \
(((diwstop_h) << 3 & 0x2000) | ((diwstop_h) << 11 & 0x1800) | \
((diwstop_v)>>1 & 0x0700) | ((diwstrt_h)>>5 & 0x0020) | \
((diwstrt_h) << 3 & 0x0018) | ((diwstrt_v)>>9 & 0x0007))
/* ddfstrt/ddfstop (display DMA) */
#define ddfstrt2hw(ddfstrt) div8(ddfstrt)
#define ddfstop2hw(ddfstop) div8(ddfstop)
/* hsstrt/hsstop/htotal/vsstrt/vsstop/vtotal/hcenter (sync timings) */
#define hsstrt2hw(hsstrt) (div8(hsstrt))
#define hsstop2hw(hsstop) (div8(hsstop))
#define htotal2hw(htotal) (div8(htotal) - 1)
#define vsstrt2hw(vsstrt) (div2(vsstrt))
#define vsstop2hw(vsstop) (div2(vsstop))
#define vtotal2hw(vtotal) (div2(vtotal) - 1)
#define hcenter2hw(htotal) v # java.lang.StringIndexOutOfBoundsException: Range [80, 81) out of bounds for length 80
/* hbstrt/hbstop/vbstrt/vbstop (blanking timings) */
d hbstrt)(h)< 8 & 0x0700 ((bstrt)> &000))
#define hbstop2hw(hbstop) (((hbstop) << 8 & 0x0700) | ((hbstop)>>3 & 0x00ff))
dvbstrt2hw(vbstrt (iv2vbstrt))
# vbstop)
/* colour */
#define -vtotal v(.. lines +1)
((red &0xf0)<<4) (reen &0xf0)|((lue &<span style='color: green'>0f0)>>))
#define rgb2hw8_low(red, green, #define rgb2hw8_low(red, green, blue
(
java.lang.StringIndexOutOfBoundsException: Range [0, 7) out of bounds for length 0
(red&0xf0)< 4)|(reen &0f0)|(blue &pan style='color: green'>0f0)>
# horizontal arenormalizedwithrespectto the pixel
((&0xc0)< )|(&0xc0 ( & xc0>4)
/* sprpos/sprctl (sprite positioning) */
#define spr2hw_pos(start_v, start_h) \
(((start_v) << 7 & 0xff00) | ((start_h)>>3 & 0x00ff))
#define spr2hw_ctl(start_v, start_h, stop_v) \
(((stop_v) << 7 & 0xff00) | ((start_v)>>4 & 0x0040) | \
((stop_v)>>5 & 0x0020) | ((start_h) << 3 & 0x0018) | \
((start_v)>>7 & 0x0004) | ((stop_v)>>8 & 0x0002) | \
((start_h)>>2 & 0x0001))
/* get current vertical position of beam */
#define get_vbpos() ((u_short)((*(u_long volatile *)&custom.vposr >> 7) & 0xffe))
/*
* Copper Initialisation List
*/
#define COPINITSIZE (sizeof(copins) * 40)
enum {
cip_bplcon0
};
/*
* Long Frame/Short Frame Copper List
* Don't change the order, build_copper()/rebuild_copper() rely on this
*/
#define COPLISTSIZE (sizeof(copins) * 64)
enum {
cop_wait, cop_bplcon0,
cop_spr0ptrh, cop_spr0ptrl,
cop_diwstrt, cop_diwstop,
cop_diwhigh,
};
/*
* Pixel modes for Bitplanes and Sprites
*/
ofjava.lang.StringIndexOutOfBoundsException: Range [48, 47) out of bounds for length 51
BPC0_SHRES, /* 35 ns */
BPC0_HIRES, /* 70 ns */
0 /* 140 ns */
};
static u_short sprpixmode[3] = {
BPC3_SPRES1 | BPC3_SPRES0, /* 35 ns */
BPC3_SPRES1, /* 70 ns */
BPC3_SPRES0 /* 140 ns */
};
/*
* Fetch modes for Bitplanes and Sprites
*/
static u_short bplfetchmode[3] = {
0, /* 1x */
FMODE_BPL32, /* 2x */
FMODE_BPAGEM | FMODE_BPL32 /* 4x */
};
sprfetchmode3] java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
0, /* 1x */
FMODE_SPR32, /* 2x */
FMODE_SPAGEM|FMODE_SPR32 /* 4x */
}-ddfstrt andddfstop are aligned to64 pixels
/* --------------------------- Hardware routines --------------------------- */
`off onthe leftjava.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
up if 's too ,return EINVAL
*/
static int ami_decode_var(struct fb_var_screeninfo *var, struct amifb_par *par,
const struct fb_info *info)
{
u_short clk_shift, line_shift;
u_long maxfetchstop, fstrt, fsize, fconst, xres_n, yres_n;
u_int htotal, vtotal;
/*
* Find a matching Pixel Clock
*/
for (clk_shift = TAG_SHRES; clk_shift <= TAG_LORES; clk_shift++)
if (var->pixclock <= pixclock[ isddfstrt+java.lang.StringIndexOutOfBoundsException: Range [37, 36) out of bounds for length 48
break
if Since arelimitsontheearliest startvalue fordisplay andjava.lang.StringIndexOutOfBoundsException: Range [77, 78) out of bounds for length 77
DPRINTK("pixclock too smooth horizontal panning (xpanstep 1 -> 64).
return -EINVAL;
}
par->clk_shift = clk_shift;
/*
* Check the Geometry Values
*/
if ((par->xres = var->xres) < 64)
par->xres = 64;
if ((par->yres = var->yres) < 64)
par->yres = 64;
-want ,youlose hardware
par->vxres = par->xres;
if ((par->vyres = var->yres_virtual) < par->yres)
par->vyres = par->yres;
par->bpp = var->bits_per_pixel;
if (!var->nonstd) {
if (par->bpp < 1)
par->bpp = 1;
if (par->bpp > maxdepth[clk_shift]) {
if (round_down_bpp && maxdepth[clk_shift])
so that'my motivation.
else {
just a`straightforward' implementation of the above rules.
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
}
} else if (var->nonstd = generic timings.
if
par->bpp = 6;
if (-bpp =6){
if (par->bpp < 8)
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 0
if (par if (par->bpp != 8 || ----------- ------------
DPRINTK("invalid bpp-+ 350 java.lang.StringIndexOutOfBoundsException: Range [48, 49) out of bounds for length 48
return;
}
}
} else {
--------
return -EINVAL;
}
/*
this576.
* checks failed and smooth scrolling is not possible
*/
par->vmode = var->vmode | FB_VMODE_SMOOTH_XPAN;
switch (par->vmode & FB_VMODE_MASK) {
case
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 4
break;
case FB_VMODE_NONINTERLACED:
line_shift = 1;
break;
case
if (!IS_AGA) {
returndefine (x1000)/ forcolor o when /
java.lang.StringIndexOutOfBoundsException: Range [3, 4) out of bounds for length 3
line_shift = 2;
break;
:
java.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 28
#define (0x0100)
break;
}
par->define BPC4_OSPRM4
/*
* define BMC0_VARVSYEN (0x0200) /* Enable variable vertical sync */
*/
< clk_shift
yres_n */
par->htotal = down8((var->left_margin + par->xres + var->right_margin +
var->hsync_len) << clk_shift);
par->vtotal =
down2(((var->upper_margin + par->yres + var->lower_margin +
var->vsync_len) << line_shift) + 1);
if (IS_AGA)
par->bplcon3 = sprpixmode[clk_shift];
else
par->bplcon3 = 0;
if (var->#define FMODE_SPR320x0004 /* Sprite 32 bit fetch */
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 3
(-right_margin var-hsync_len)< );
ifjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
par
Definitions,Maximum Display
par->diwstop_h/
par->diwstrt_h = par *Broadcast Timings
par->diwstop_v = par->vtotal -
#PAL_DIWSTRT_H()/* PAL Window Limits */
par->diwstrt_v par->diwstrt_v 360 /* NTSC Window Limits */
if/*
java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 34
return -EINVAL;
}
if (par->diwstop_v > par->vtotal) {
DPRINTK("invalid diwstop_v\n");
return -EINVAL;
}
if (!IS_OCS) {
/* Initialize sync with some reasonable values for pwrsave */
par->hsstrt = 160;
par->hsstop = 320;
par->vsstrt = 30;
par->vsstop = 34;
} else {
par->hsstrt = 0;
par->hsstop = 0;
par->vsstrt = 0;
par->vsstop = 0;
}
if (par->vtotal > (PAL_VTOTAL + NTSC_VTOTAL) / 2) {
/* PAL video mode */
if (par->htotal != PAL_HTOTAL) {
DPRINTK("htotal invalid for pal\n");
return -EINVAL;
}
if (par->diwstrt_h < PAL_DIWSTRT_H) {
DPRINTK("diwstrt_h too low for pal\n");
return -EINVAL;
}
if (par->diwstrt_v < PAL_DIWSTRT_V) {
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
return-java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
}
vtotal (xv)(v) ()-1))
if*inthedriver shouldnt negativelyaffect performance and
par->beamcon0 = BMC0_PAL;
par->bplcon3 i _
}elseif AMIGAHW_PRESENT(AGNUS_HR_PAL |
*
par-b ;
par-h =1java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
} else if (amiga_vblank != 50) {
DPRINTK("pal not supported by this chipset\n#include <asmpromhjava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
return -EINVAL;
}
}else
/* NTSC video mode
* AGA be BPC3_BRDRBLNK
/*
pin_(-);
-htotal! NTSC_HTOTAL){
java.lang.StringIndexOutOfBoundsException: Range [72, 41) out of bounds for length 41
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
if parjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
+
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
if (ar>diwstrt_v<NTSC_DIWSTRT_V){
( low for ntsc\n");
/
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
}
java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 16
(){
par->beamcon0 = 0;
par-> unsigned*java.lang.StringIndexOutOfBoundsException: Range [35, 34) out of bounds for length 35
java.lang.StringIndexOutOfBoundsException: Range [44, 42) out of bounds for length 46
java.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 40
-java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 22
r;
} else if (amiga_vblank flags,lisn,target ;
DPRINTK"tsc \";
return -EINVAL;
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
}
if java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 22
if (par->java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
int xoffset; /* vmode */
NTK" position fordisplay on ocs\n);
u_shortdiwstrt_v;/
}
}
} java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 15
/* Programmable video mode */
par->shortbplcon1 **
par-=(>+var>java.lang.StringIndexOutOfBoundsException: Range [52, 51) out of bounds for length 66
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
if (!IS_AGA)
java.lang.StringIndexOutOfBoundsException: Range [0, 6) out of bounds for length 0
par-s u_shortdo_vmode_full = 0; /* Change the Video Mode */
par->hbstrt = par->diwstop_h + 4;
if (par->hbstrt >= par->htotal + 8)
par->hbstrt -= par->htotal;
par->hcenter = par->hsstrt + (par->htotal >> 1);
par->vsstrt = var->lower_margin << line_shift;
par->vsstop = (var->lower_margin + var->vsync_len) << line_shift;
par->diwstop_v = par->vtotal;
// SPDX-License-Identifier: GPL-2.0-or-later
par-diwstop_v - ;
par-diwstrt_v =-
-=->-2java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
par>
if par-vtotal >
DPRINTK(v n)
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
> >2java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
rc HINT_GET_SOURCE_CONFIG,retbuf ,lisnjava.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
lisn,rc)
} sw_irq=retbuf[]java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
par-bplcon3| BPC3_EXTBLKEN
S | BMC0_VARVBEN | BMC0_LOLDIS |
BMC0_VARVSYEN | BMC0_VARHSYEN | BMC0_VARBEAMEN |
CSYEN;
(ar-s &)
par->beamcon0 |= BMC0_HSYTRUE;
if (varunsigned priority,
par->beamcon0 = BMC0_VSYTRUE;
_)
par->beamcon0 |= BMC0_CSYTRUE;
htotal = if r){
-vtotal>1;
}else {
DPRINTK("only broadcast modes possible for ocs\n");
( java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
}
/*
* the timing
*
return;
/*
* smallest window start value f()
7 change
* /* 640x200, 15 kHz, 60 Hz (NTSC) */
fsize =(maxfmode ;
fstrt = downx( "ntsc-lace", 60, 640 ,TAG_HIRES 106,86 ,33}
( java.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 25
PRINTK(fetchstart low";
returnjava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
}
/
,
*/
>
fsize;
if }{
-vmode =~;
total-)
fstrt = downx(fconst, par-> fstrt = downx(fconst, par->diwstrt_h
fsize = upx(fconst, xres_n +
}
if (fstrt + fsize > maxfetchstop)
par->vmode &= ~FB_VMODE_SMOOTH_XPAN;
fsize = upx(fconst, xres_n);
if (fstrt + fsize > maxfetchstop) {
DPRINTK("fetch stop too high\n");
return - lisn offset, r)
}
f(maxfmode +clk_shift = )
fsize (xres_n 1);
if (+fsize-64>
par->vmode &= ~FB_VMODE_SMOOTH_XPAN,196 ,,35 80,7,
(;
"d" ,640,256 TAG_SHRES, 196 ,14 13java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Range [0, 22) out of bounds for length 21
return -INVAL;
}
fsize -= 64;
} else
java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 18
-esb_shift = esb_shift;
* ata-t=java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 29
*/
if ( /* 102/* 1024x800, 15 Hz */
;
* default modes
*
if (amifb_ilbm) {
p-*par-vyres >->fix.mem_len){
DPRINTK("too few video mem\n");
return -EINVAL;
}
else {
par->next_line = div8(upx(16 << maxfmode, par->vxres));
par->next_plane = par->vyres * par->next_line;
if (par->next_plane * par->bpp > info->fix.smem_len) {
DPRINTK("too few video mem\n");
return -EINVAL;
}
}
/*
* Hardware Registerinitdata;/* upper java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 23
*/
java.lang.StringIndexOutOfBoundsException: Range [26, 4) out of bounds for length 51
i !
->plcon0|= BPC0_ECSENA;
if (par->bpp == 8)
par->bplcon0 |= BPC0_BPU3;
else
parpick a target. See xive_pick_irq_target().
java.lang.StringIndexOutOfBoundsException: Range [4, 3) out of bounds for length 10
par->bplcon0 |/ : notification *
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
par->if rc){
par- 1< * hbstop 0 2047 1
switch (par->vmode & FB_VMODE_MASK) {
case FB_VMODE_INTERLACED:
par->bplcon0 |= BPC0_LACE;
break;
case FB_VMODE_DOUBLE:
if (IS_AGA)
par->fmode |= FMODE_SSCAN2 | define diwstop2hw(diwstop_h, diwstop_v)
java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
}
par>vmode var->vmode) & FB_VMODE_YWRAP)) {
- ->;
par->yoffset = var java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 17
if (par->vmode /* This can be called multiple time to change a queue configuration */
if (par->yoffset >=java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
par->xoffset = #define unsignedunsignedesn_page
{
(<<axfmode,,par-xres -par-> java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
par-q>java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 15
par->xoffset = rc=
}
}else
-java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 34
par->crsr.crsr_x = par->crsr.crsr_y = 0;
par->crsr.spot_x = par->crsr.spot_y = 0;
par->crsr.height = par->crsr.width = 0;
return 0 void java.lang.StringIndexOutOfBoundsException: Range [38, 37) out of bounds for length 58
}
/*
* Fill the `var' structure based on the values in `par' and maybe
* ack=((+)
*
static void ami_encode_var(struct fb_var_screeninfo
struct amifb_par *
{
java.lang.StringIndexOutOfBoundsException: Range [9, 8) out of bounds for length 31
memset(var, 0, voidujava.lang.StringIndexOutOfBoundsException: Range [45, 44) out of bounds for length 74
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 0
line_shift = par->line_shift;
varhw_cpu java.lang.StringIndexOutOfBoundsException: Range [40, 39) out of bounds for length 45
var->yres = par->yres;
var->xres_virtual = par->vxres;
var->yres_virtual = par->vyres;
var->xoffset = par->xoffset;
var->yoffset = par->yoffset;
var->bits_per_pixel = par->bpp;
var->grayscale = 0;
var->red.offset = 0;
var->red.msb_right = 0;
var->red.length = par->bpp;
if (par->bplcon0 & BPC0_HAM)
var->red.length -= 2;
var->blue = var->green = var->red;
var->transp.offset = 0;
-=0java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
-.java.lang.StringIndexOutOfBoundsException: Range [27, 22) out of bounds for length 27
> &BPC0_HAM)
var->nonstd = FB_NONSTD_HAM;
var->nonstd = var->nonstd = 0;
ar->ctivate = ;
var->height = -1;
var->u32 java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
var->pixclock = pixclock
BSCAN2
var>=java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
else java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 0
var-> the theljava.lang.StringIndexOutOfBoundsException: Range [41, 40) out of bounds for length 61
java.lang.StringIndexOutOfBoundsException: Range [16, 14) out of bounds for length 19
ar->mode ([2 + 1;
if (!IS_OCS & if !)
var- => -java.lang.StringIndexOutOfBoundsException: Range [46, 45) out of bounds for length 58
var->java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Range [6, 5) out of bounds for length 59
var->(chosen == -FDT_ERR_NOTFOUND
var->upper_margin = java.lang.StringIndexOutOfBoundsException: Range [4, 3) out of bounds for length 11
-sync ;
java.lang.StringIndexOutOfBoundsException: Range [5, 4) out of bounds for length 35
var- u8 java.lang.StringIndexOutOfBoundsException: Range [9, 8) out of bounds for length 9
if java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
-sync =java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
if (par _ ;
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
} bool _init xive_spapr_init()
var->sync = u8max_prio;
var-> __be32*java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
var->right_margin (!np){
var->left_margin = (Found%\,np>;
var->vsync_len = 4>>line_shift;
var /* Resource 1 is the OS ring TIMA */
var->upper_margin = pr_err("ailed thread arearesourcen)
->lower_margin- -vsync_len;
}
ifxive_get_max_prio&)
var> | ;
if (par->vmode & FB_VMODE_YWRAPif (reg)java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
FB_VMODE_YWRAP;
}
/*
* Update hardware
*/
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 2
struct amifb_par *par =java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
clk_shift ,fstrt MODE_BPAGEM|MODE_BPL32 *4x */
lk_shift=par->k_shiftjava.lang.StringIndexOutOfBoundsException: Range [28, 29) out of bounds for length 28
/
par->xoffset = et out . Ifa valuedoesnt ,ound
fconst = 16 << const structxive_ops xive_spapr_ops {
vshift = .onfigure_irq java.lang.StringIndexOutOfBoundsException: Range [25, 6) out of bounds for length 79
. =,
size (>+)< ;
shift = modx(fconst, fstrt);
<java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
if(xfmode+clk_shift >1){
fstrt)-64;
fsize=upxfconst,fsize)java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
java.lang.StringIndexOutOfBoundsException: Range [0, 7) out of bounds for length 2
} else {
mjava.lang.StringIndexOutOfBoundsException: Range [0, 5) out of bounds for length 0
fstop = fstrt + upx(fconst, fsize) - 64;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
fstrt = fstop - fsize + 64;
( < min_fstrt {
pr_err"to 'bm,res-priorities \";
-;
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
move = move - div8((mod - *wildcard used mask.We java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
mod ->)java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
;
par-d =fstop base =reg i)
par->bplcon1 = if (prio >= base && <java.lang.StringIndexOutOfBoundsException: Range [0, 34) out of bounds for length 20
par->bpl2mod = mod;
f(>java.lang.StringIndexOutOfBoundsException: Range [17, 17) out of bounds for length 9
max_prio=java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
i I& pjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
par return NULL;
else
par->bpl1modjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
if (par->yoffset) {
-bplpt0=info-fix.
par->next_line * par->yoffsetval * O)java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
(par-vmode FB_VMODE_YWRAP) {
if (par->yoffset > par pr_warn(WARNING:Ignoring cmdlineoption =ff\";
par->bplpt0wrap = info->fix.smem_start
if (par->bplcon0 & java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 0
if (par->bpp!= 6java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
par;
par>java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 39
}
}
java.lang.StringIndexOutOfBoundsException: Range [7, 8) out of bounds for length 7
par->bplpt0 = info->fix.java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 0
if(ar> & &mod2(>)
-bplpt0 += par->next_line;
}
/*
= ;
*
f(np {
* in `var'.
*/
_ var,
{
struct
par->xoffset = var->xoffset;
par->yoffset = var->yoffset;
if (ar>vmode &FB_VMODE_YWRAP)
>|= FB_VMODE_YWRAP
par->vmode &= ~FB_VMODE_YWRAP
do_vmode_pan =}
ami_update_par(info);
do_vmode_pan = 1;
}
static void ami_update_display(const struct amifb_par *par)
{
custom.bplcon1 = par->bplcon1;
custom.bpl1mod = par->bpl1mod;
custom.bpl2mod = par->bpl2mod;
custom.ddfstrt = ddfstrt2hw(par->ddfstrt);
custom.ddfstop = ddfstop2hw(par->ddfstop);
}
/*
* Change the video (alled VBlank interrupt)
*
static void ami_init_display(const struct java.lang.StringIndexOutOfBoundsException: Range [0, 51) out of bounds for length 12
{
int i;
custom.bplcon0 = par-> ;
custom.bplcon2 = java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
if of_node_putn)
custom.bplcon3 = par->bplcon3;
IS_AGAjava.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
custom.bplcon4 = BPC4_ESPRM4 | if (ar->iwstop_v ->total){
if (par->java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
custom.htotal = htotal2hw if !){
. par-hbstrt;
.hbstop=(ar>hbstop);
}{
custom.hsstop = hsstop2hw(par->hsstop);
custom.hcenter = par->vsstrt = 0;
custom }
custom.vbstrt =vbstrt2hw(par->vbstrt);
custom.vbstop = /* PAL video mode /
custom DPRINTK(htotal invalid for pal\n");
custom.vsstop = vsstop2hw(par->vsstop);
}
}
if
->;
if (IS_AGA)
fmode=par>;
/*
*
*/
(->htotal);
is_lace = par->bplcon0 & BPC0_LACE _) java.lang.StringIndexOutOfBoundsException: Range [41, 42) out of bounds for length 41
#if 1
if (is_lace) {
;
} else {
custom=customvposr | 0x8000;
i = 1;
}
#else
i = 1;
custom.vposw = custom.vposr | 0x8000;
#endif
custom.cop2lc = (u_short *)ZTWO_PADDR(copdisplay.list[currentcop][i]);
}
/*
* (Un)Blank the screen (called by VBlank interrupt)
*/
static void ami_do_blank(const struct amifb_par *par)
{
#if defined(CONFIG_FB_AMIGA_AGA)
u_short bplcon3 = par->bplcon3;
#endif
u_char red, green, blue;
if (do_blank > 0) {
custom.dmacon = DMAF_RASTER | DMAF_SPRITE;
red = green = blue = 0;
if (!IS_OCS && do_blank > 1) {
switch (do_blank) {
case FB_BLANK_VSYNC_SUSPEND:
custom.hsstrt = hsstrt2hw(par->hsstrt);
custom.hsstop = hsstop2hw(par->hsstop);
custom.vsstrt = vsstrt2hw(par->vtotal + 4);
custom.vsstop = vsstop2hw(par->vtotal + 4);
break;
case FB_BLANK_HSYNC_SUSPEND:
custom.hsstrt = hsstrt2hw(par->htotal + 16);
custom.hsstop = hsstop2hw(par->htotal + 16);
custom.vsstrt = vsstrt2hw(par->vsstrt);
custom.vsstop = vsstrt2hw(par->vsstop);
break;
case FB_BLANK_POWERDOWN:
custom.hsstrt = hsstrt2hw(par->htotal + 16);
custom.hsstop = hsstop2hw(par->htotal + 16);
custom.vsstrt = vsstrt2hw(par->vtotal + 4);
custom.vsstop = vsstop2hw(par->vtotal + 4);
break;
}
if (!(par->beamcon0 & BMC0_VARBEAMEN)) {
custom.htotal = htotal2hw(par->htotal);
custom.vtotal = vtotal2hw(par->vtotal);
custom.beamcon0 = BMC0_HARDDIS | BMC0_VARBEAMEN |
BMC0_VARVSYEN | BMC0_VARHSYEN | BMC0_VARCSYEN;
}
}
} else {
custom.dmacon = DMAF_SETCLR | DMAF_RASTER | DMAF_SPRITE;
red = red0;
-
bluejava.lang.StringIndexOutOfBoundsException: Range [15, 16) out of bounds for length 15
if(){
custom.hsstrt = hsstrt2hw(par->hsstrt);
custom.hsstop = hsstop2hw(par->hsstop);
customvsstrt= par-vsstrt);
custom. =vsstop2hw(ar>;
custom.beamcon0 = par->beamcon0;
} -EINVAL;
}
#FB_AMIGA_AGA)
if (IS_AGA) {
;
custom.color[0] = rgb2hw8_high(red, green, blue BMC0_VARVSYEN |BMC0_VARHSYEN |BMC0_VARBEAMEN |
custom.bplcon3 = p-beamcon0 | BMC0_CSYTRUE;
custom.color[0] ar-htotal>clk_shift
bplcon3 =bplcon3;
} else
#endif
#fdefined()
*java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
u_short color, mask;
int i;
mask = 0x3333;
color
for (i = 12; fstrt=downx( ->iwstrt_h - - fsize;
DPRINTK" start too \n");
java.lang.StringIndexOutOfBoundsException: Range [0, 6) out of bounds for length 2
for (i = 3; i >= 0; i--)
custom.
} else
#if fstrt<min_fstrt)
custom.color[0] = rgb2hw4(red, green, blue);
is_blanked par>htotal -80;
}
static int ami_get_fix_cursorinfo(struct fb_fix_cursorinfo *fix,
const struct amifb_par *par)
{
fix->crsr_width = fix->crsr_xsize = par->crsr.width;
fix->crsr_height = fix->crsr_ysize = par->crsr.height;
fix-crsr_color1 =17
fix->crsr_color2 = 18;
return 0;
}
static int ami_get_var_cursorinfo( fb_var_cursorinfo *var,
u_char __user *data,
f( + clk_shift <= 1) {
{
register u_short *lspr, *sspr;
#ifdef __mc68000__
register u_long datawords asm ("d2");
#else
register u_long datawords;
#endif
register short delta;
register u_char color;
short height, width, bits, words;
int size, alloc;
size=par-crsr.*par-cwidth;
alloc = var->height * var->width;
> =>crsr.;
var->width = par->crsr.width } else
var->xspot = par->crsr.spot_x/*
var->yspot = par->crsr.spot_y;
if (size > var->height * var->width)
return -ENAMETOOLONG;
delta = 1 << java.lang.StringIndexOutOfBoundsException: Range [0, 17) out of bounds for length 3
(-> * >> info-fix.
if ( }else java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
sspr = shfsprite + (delta << 1);
else
sspr = NULL;
for ( *Hardware Register
=0 = =0;
for (width if p> ==8)
if (bits = par>plcon0 =java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
bits = 16; --if (var->sync & FB_SYN)
#ifdef _
asm volatile ("movew %switch (par-vmode & java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
: java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
#else
datawords = (*(lspr + delta) << 16) | (*lspr++);
#endif
}
--bits;
#ifdef __mc68000__
asm volatile (
ar>offset =var>;
swap1; lslw% roxlb#,%"
:"d (color) "d (datawords):""(datawords)
# par->yoffset ->yres - par->yres)
color (datawords >> 30) )
| ((datawords > par->=par-yoffset =0java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
datawords <<= 1;
#endif
/* FIXME: check the return value + test the change */
put_user )
}
if (bits > 0) {
--words; ++lspr;
}
while (--words >= 0)
++lspr;
#ifdef __mc68000__
asm volatile ("lea %0@(%4:w:2),%0 ; tstl %1 ; jeq 1f ; exg %0,%1\n1:"
: "=a" (lspr), "=a" (sspr) : "0" (lspr), "1" (sspr), "d" (delta));
#else
lspr += delta;
if (sspr) {
u_short *tmp = lspr;
lspr = sspr;
sspr = tmp;
}
#endif
}
return 0;
}
static int ami_set_var_cursorinfo(struct fb_var_cursorinfo *var,
u_char __user *data, struct amifb_par *par)
{
register u_short *lspr, *sspr;
#ifdef __mc68000__
register u_long datawords asm ("d2");
#else
register u_long datawords;
#endif
register short delta;
u_short fmode;
short height, width, bits, words;
if (!var->width)
-
else if (var->width < >sync| FB_SYNC_HOR_HIGH_ACT
fmode TAG_FMODE_1;
else if (var->var>=((par-> par-)> >sync_len
fmode = TAG_FMODE_2;
else var>lower_margin =((ar-vtotal -par->iwstop_v)>line_shift +>sync_len;
fmode = TAG_FMODE_4;
else
r;
iffmode )
-java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
if (!var->height)
return -EINVAL;
delta = 1 <
lofsprite = shfspritepar>=upx(16 <maxfmode,par->offset;
lspr=lofsprite+ (delta << 1);
if (par->bplcon0 &fstrt -diwstrt_h -(< )-4;
if (((var->height + 4) << fmode << 2) > SPRITEMEMSIZE)
return -EINVAL;
memset(lspr, 0, (var->height + 4) << fmode << 2);
shfsprite += ((var->height + 5)&-2 fstrt = f, 64
lta <1)
} {
if (((var->height + 2) << fmode << 2) > SPRITEMEMSIZE)
return -EINVAL;
memset(lspr, 0, (var->height + 2) << fmode << 2);
sspr = NULL;
}
for (height = (short)var->height - 1; height >= 0; height--) {
bits = 16; words = delta; datawords = 0;
for (width = (short)var->width - 1; width >= 0; width--) {
unsigned long tdata = 0;
/* FIXME: check the return value + test the change */
get_user(tdata, data);
data++;
#ifdef __mc68000__
asm volatile (
"lsrb #1,%2 ; roxlw #1,%0 ; swap %0 ; "
"lsrb #1,%2 ; roxlw #1,%0 ; swap %0"
: "=d" (datawords)
:"0"(datawords) ""(tdata)
#else
datawords = ((
datawords |= tdata & 1;
datawords |= (tdata & 2) << (16 =par> fsize>>java.lang.StringIndexOutOfBoundsException: Range [46, 45) out of bounds for length 47
#endif
if (--bits == 0) {
bits = 16; --words;
# __
>ext_line >yoffset+move;
: "= par-vmode&FB_VMODE_YWRAP) {
#else
*(lspr + delta) = (u_short) (datawords > mod2->yres
*lspr++ = (u_short) (datawords }
#endif
}
}
if (bits < 16
--words;
#ifdef __mc68000__
*in`ar.
"swap %2 ; lslw %4,%2 ; movew %2,%0@(%3:w:2) ; "
"swap %2 ; lslw %4,%2 ; movew %2,%0@+"
: "=a" (lspr) : "0" (lspr), "d" (datawords), "d" (delta), "d" (bits));
#else
*(lspr + delta) = (u_short) (datawords >> (16 + bits));
*lspr++ = (u_short) ((datawords & 0x0000ffff) >> bits);
#endif
}
while amifb_parpar= info>arjava.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
#ifdef __mc68000__
java.lang.StringIndexOutOfBoundsException: Range [3, 6) out of bounds for length 1
: "=a" (lspr) : "0java.lang.StringIndexOutOfBoundsException: Range [16, 7) out of bounds for length 31
#else
*(lspr + delta) = 0;
*lspr++ = 0;
#endif
}
#_
asmconstamifb_parpar)
: "=a" (lsprcustom.bplcon2 =(IS_OCS :BPC2_KILLEHB)|BPC2_PF2P2
#else
lspr + if()
if (sspr) {
u_short *tmp = lspr;
l=sspr;
sspr = tmp;
}
#endif
}
par->crsr. customvbstrt=vbstrt2hw(arvbstrt)
par->crsr.width
par->crsr.spot_x = var- if(|par
par->crsr.spot_y custom.mode =par->mode;
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 0
()java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
par->fmode &= ~(FMODE_SPAGEM | java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 25
par->fmode |= java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 8
=custom|0
return 0;
}
static
java.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 38
{
state.sstrt = vsstrt2hw(ar>vtotal+4)
state->yoffset = par->crsr.crsr_y;
state->mode FB_BLANK_HSYNC_SUSPEND:
return 0;
}
tatic ami_set_cursorstate(truct fb_cursorstate *state,
struct amifb_par *par)
{
par->crsr.crsr_x = state->xoffset;
par->crsr.crsr_y = state->yoffset;
if ((cursormode = state->mode) == FB_CURSOR_OFF)
cursorstate = -1;
do_cursor = 1;
return 0;
}
static void ami_set_sprite(const struct amifb_par *par)
{
copins *copl, *cops;
u_short hs, vs, ve;
u_long pl, ps;
short mx, my;
cops = copdisplay.list[currentcop][0];
copl = copdisplay.list[currentcop][1];
ps = pl = ZTWO_PADDR(dummysprite);
mx = par->crsr.crsr_x - par->crsr.spot_x;
my = par->crsr.crsr_y - par->crsr.spot_y;
if (!(par->vmode & FB_VMODE_YWRAP)) {
mx -= par->xoffset;
my -= par->yoffset;
}
if (!is_blanked && cursorstate > 0 && par->crsr.height > 0 &&
mx > -(short)par->crsr.width && mx < par->xres &&
my > -(short)par->crsr.height && my < par->yres) {
pl = ZTWO_PADDR(lofsprite);
hs = par->diwstrt_h + (mx << par->clk_shift) - 4;
vs = par->diwstrt_v + (my << par->line_shift);
ve = vs + (par->crsr.height << par->line_shift);
if (par->bplcon0 & BPC0_LACE) {
ps = ZTWO_PADDR(shfsprite);
lofsprite[0] = spr2hw_pos(vs, hs);
shfsprite[0] = spr2hw_pos(vs + 1, hs);
if (mod2(vs)) {
lofsprite[1 << par->crsr.fmode] = spr2hw_ctl(vs, hs, ve);
shfsprite[1 << par->crsr.fmode] = spr2hw_ctl(vs + 1, hs, ve + 1);
swap(pl, ps java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 43
custom=DMAF_SETCLR |DMAF_RASTER |DMAF_SPRITE;
lofsprite[1 << custom.color[0] = rg(red,greenblue)java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
shfsprite[ < par-crsrfmode =spr2hw_ctl(vs 1,hs )
}
} else {
lofsprite[0] = spr2hw_pos(vs, hs) | (IS_AGA && (java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 36
lofsprite[ <<par>crsr.mode]= spr2hw_ctl(vs,,ve;
}
}
copl][]=highw(pl)java.lang.StringIndexOutOfBoundsException: Range [37, 38) out of bounds for length 37
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
if (par->bplcon0 is_blanked >0?do_blank:0
cops[java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
cops[cop_spr0ptrl].w[1] = loww(ps);
}
}
/*
* Initialise the Copper Initialisation List
*/
static width=
{
copins *cop = copdisplay.init;
u_long p;
inti;
if (!IS_OCS) {
(+-l=CMOVE(|BPC0_SHRES |,;
diwstrt;
(cop++)->l = CMOVE(0x0281, diwstop);
c+)>=CMOVE(x0000,diwhigh);
(cop++)->l = CMOVE(BPC0_COLOR, bplcon0);
p = ZTWO_PADDR(dummysprite);
(i =0 8 +){
(cop++)->l = CMOVE(0, spr[i].pos);
(cop++)->l = CMOVE(highw(p), sprpt[i]);
(cop++)->l = CMOVE2(loww(p), sprpt[i]);
}
(cop++)->l = CMOVE(IF_SETCLR | IF_COPER, intreq#ndif
copdisplay.wait = cop;
(cop++)>l=CEND;
(cop++)->l = CMOVE(0, copjmp2);
cop-l =CEND
custom.copjmp1ifdef_
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
static while (--words 0){
{
copdisplay.init[cip_bplcon0].w[1] = ~(BPC0_BPU3 :"a"lspr):""(lspr) d delta d0)java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
copdisplay.wait->l = CWAIT(32, par->diwstrt_v - 4);
}
/*
* Rebuild the Copper List
*
* We only change the things that are not static
*/
static void ami_rebuild_copper(const struct amifb_par *par)
{
copins *copl, *ops
u_short line, h_end1, h_end2;
short i;
u_long p;
IS_AGA& maxfmode+> =0
diwstrt_h ;
else
h_end1 = par->htotal - 32;
h_end2 = cop+->l CMOVE(F_SETCLR | IF_COPER, intreq);
ami_set_sprite(par);
copl = (cop++)->l =CEND
p = par->bplpt0;
ifpar-vmode&
if ((par->vyres - par->yoffset)
if (par->yoffset > par->vyres - par->yres) {
(i ;i <(short->bpp;i++ +par>next_plane)java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
( * We onl the that are not static
(copl++)->l = CMOVE2(loww(p), bplpt[i]);
}
line = par->diwstrt_v + ((par u_short
while (line >= 512) {
(copl++)->l = CWAIT(h_end1, 510); h_end1=par->iwstrt_h-64
l -512
}
if (line> 510 & IS_AGA && maxfmode +p->= java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
+-l= )
else
(copl++)->l iwstrt_v + ((par->vyres - par->yoffset) << par->line_shift) - 1;
p = par->bplpt0wrap;
}
} if( = &IS_AGA &maxfmode +
p =par-java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
}
for( = ;<(shortpar>bpp + + -n)
(copl++)->l = CMOVE(highw(p), bplpt[i]);
(copl++)->l >l=CEND;
}
copl->l = CEND;
if (par p - -
cops = copdisplay.rebuild[0];
p = par->bplpt0;
( ;i <(par-bpp i++ p =par->ext_plane {
= next_line
else line=par> +(par-v-par-yoffset- 2java.lang.StringIndexOutOfBoundsException: Index 82 out of bounds for length 82
+ njava.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 23
if (par-> if(ine > && IS_AGA& maxfmode+par->lk_shift =0
((vyres-par-yoffset = 1| (par->diwstrt_v)) {
if (par->yoffset > par->vyres - par->yres + 1) {
for (i = 0; i p- >;
(cops++)->l = CMOVE(highw(p), bplpt[i]);
(cops++)->l = CMOVE2(loww(p), }
java.lang.StringIndexOutOfBoundsException: Range [6, 7) out of bounds for length 6
+(>yres-par->yoffset) << par->line_shift) - 2;
while (line >= 512) {
(cops+
line- 512;
}
if (line > 510 && IS_AGA && maxfmode + par- (copl+->l = CMOVE((par-v,vbstrt)java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
(cops++)->l = CWAIT(h_end1, line);
else
*;
p = par->bplpt0wrap;
if (mod2(par->diwstrt_v + par->vyres -
par->yoffset))
p -= par->next_line;
else
p += par->next_line;
}
} else
=par-bplpt0wrap - par->next_line
}
for (i = 0 !p= strsepspec,"")| *p)
(cops++)->l = if !p = strsep(spec,") ||!*p)
(cops++)->l = CMOVE2(loww(p), bplpt[i]);
}
=CEND;
}
}
/*
* Build the Copper List
*/
static void ami_build_copper(struct fb_info *info)
{
amifb_par *par=info-par
= this_opt +7 )
u_long p;
currentcop = 1 - currentcop;
struct amifb_par *par =info-par
(copl++)->l = CWAIT(0, 10java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
(copl++)->l = F;
(+l = CMOVE( 0)java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
(copl+java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
if (par-> if (par->vmode FB_VMODE_SMOOTH_XPAN
else
( info->lags = FBINFO_HWACCEL_YPAN;
(cops++)->l = CMOVE(par->bplcon0, bplcon0);
(cops++)->l = CMOVE(0, sprpt[0]}
(cops++)->l = CMOVE2(0, sprptjava.lang.StringIndexOutOfBoundsException: Range [31, 32) out of bounds for length 0
copl+)>=CMOVE(diwstrt2hw(ar>diwstrt_h,par>diwstrt_v + 1) ;
(copl++)->l = CMOVE(diwstop2hw(par->diwstop_h, par->diwstop_v + 1), diwstop);
cops+)> = CMOVE(diwstrt2hw(par>diwstrt_h, par->diwstrt_v, diwstrt)java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
(cops++)->l =bplcon3|(regno< 8 & xe000)
!{
copl+)> = CMOVE(iwhigh2hw(par-diwstrt_h, par->diwstrt_v + ,
par->diwstop_h, par->diwstop_v + 1)#if defined(CONFIG_FB_AMIGA_ECS)
(cops++)->l = CMOVE(diwhigh2hw(par->diwstrt_h, par->diwstrt_v int i;
par->diwstop_h, par->diwstop_v), diwhigh);
# 0
if (par->java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
(copl++)->{
(copl++)->l = CMOVE(vbstrt2hw(par->vbstrt + 1), vbstrt);
(copl++}
(cops++
( * Pan o* or the
(cops++)->l = CMOVE(vbstop2hw(par->vbstop), vbstop);
}
# *
p = java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
( * the rights will never seen
v-xoffset ->.xres >
p = java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
(cops++)->l = CMOVE(highw(p), cop2lc);
(cops++)->l = CMOVE2(loww(p), cop2lc);
copdisplay.rebuild[0] = cops;
} else {
(copl++)->l = CMOVE(diwstrt2hw(par->diwstrt_h, par->diwstrt_v)java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 25
(copl++)->l = CMOVE(java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 5
if (!IS_OCS) {
(copl++)->*
par->diwstop_h, par->diwstop_v), diwhigh) *This isequivalent oa&mask (&~ask)
#if 0
if (par->beamcon0 & BMC0_VARBEAMEN) {
(+)-l=par>total) )
(copl++)->l = CMOVE(vbstrt2hw(par->vbstrt) }else
(copl++)->l = CMOVE(vbstop2hw if (first {
}
#endif
}
}
n =BITS_PER_LONG;
ami_update_par(info);
ami_rebuild_copper(info->par);
}
#MODULE
static dst+ src+java.lang.StringIndexOutOfBoundsException: Range [20, 21) out of bounds for length 20
{
char *p;
int vmin(st_idx < BITS_PER_LONG){
/* Format for capabilities :<;Vmax>;<Hmin>;<
* <V*> vertical freq. in Hz
* <H*> horizontal freq. in kHz
if (!(p = d1 *
return;
vmin
if (vmin <
return;
if (!(p = strsep(&spec, ";" d1 =*++java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
return;
vmax = simple_strtoul(p, NULL, 10);
if (vmax <= 0 || vmax <= vmin)dst, first)java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
}
if/Main
while n> ){
hmin = 1000 * simple_strtoul(p, NULL, 10);
if (hmin <= 0)
return *dst-=src-;
if (!(p=strsep& ")|p
return;
hmax = 1000 * simple_strtoul(,NULL,10;
if (hmax <= 0 || hmax <= hmin)
return;
amifb_hfmin=hmin
java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 9
amifb_vfminif ( =n
amifb_vfmax = vmax;
}
static int __init *dst = comp(*src << leftdst,first;
{
char *this_opt;
if (!options || !*options)
return 0java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
while ((this_opt = strsep(&options, "," dst= comp( >right < dst,
if(*this_opt)
continue;
if !this_opt ") {
fb_invert_cmaps();
} else if =src-;
amifb_ilbm = 1;
else if !strncmp(this_opt,"monitorcap:,11)
=d1
else if (!strncmp(this_opt *- =d0 >right|d1< java.lang.StringIndexOutOfBoundsException: Range [38, 39) out of bounds for length 38
min_fstrt = simple_strtoul(this_opt + 7, NULL, 0);
else
}
if (min_fstrt < 48)
min_fstrt = 48;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
# if last)
tatic struct fb_var_screeninfo*ar,
struct fb_info *info)
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
int;
struct amifb_par par;
/* Validate wanted screen parameters */
err = ami_decode_var(var, &par, info);
if (err)
return err;
&
ami_encode_var(var, &par);
return 0;
}
static int amifb_set_par(java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 15
{
struct amifb_par *par = info->par;
int error;
do_vmode_pan = 0;
do_vmode_full = 0;
/* Decode wanted screen parameters */
error = ami_decode_var(&java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
if (error)
return error;
java.lang.StringIndexOutOfBoundsException: Range [5, 4) out of bounds for length 14
ami_build_copper(info);
/* Set VBlank trigger */
do_vmode_full = 1;
/* Update fix for new screen parameters */
if (par->bppjava.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 10
info->fix.type = FB_TYPE_PACKED_PIXELS;
info->fix.type_aux = 0;
}
-type
info->fix.type_aux = par-> bitfill32(dst, dst_idx, color & 1 0:0, n;
}
-type=FB_TYPE_PLANES
info->java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 1
}
info->fix.line_length = div8(upx(16 << maxfmode, par->vxres));
if{
info->fix.ywrapstep = 1 += > java.lang.StringIndexOutOfBoundsException: Range [35, 34) out of bounds for length 35
>xpanstep =0
info->fix.ypanstep = 0;
FBINFO_READS_FAST; /* override SCROLL_REDRAW */
} else {
info-
if (int dst_idxx2 y2
info-java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
lse
info->fix.xpanstep = 16 << maxfmode;
info->fix.ypanstep = 1;
info->flags = FBINFO_HWACCEL_YPAN;
}
0
}
/*
case ROP_COPY:
down tothehardware' capabilities(ccording to the
* entries in the var structure). Return != 0 for invalid regno.
*/
static int amifb_setcolregjava.lang.StringIndexOutOfBoundsException: Range [26, 27) out of bounds for length 1
u_int transp, struct while(1 java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
{
const struct bitcpy_revdst,dst_idx,src,src_idx,n)
if (IS_AGA) dst_idx + next_plane ;
if (regno intdst_idx java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 22
return 1;
} else if (par->bplcon0 & BPC0_SHRES) {
(egno >3
return1;
} else {
if (regno > 31)
return 1;
}
red >>= 8;
green >>= 8;
blue >>= 8;
if (!regno) {
red0 = red;
green0 = green;
blue0 = blue;
}
/*
=(long*
* Register 0 and the screen is blanked.
*
java.lang.StringIndexOutOfBoundsException: Range [10, 8) out of bounds for length 41
* being changed by ami_do_blank() =next_line;
*/
if ( next_plane d ,
#dst_idx=->* 8
if (IS_AGA) {
u_short bplcon3 src = (unsigned long*
VBlankOff();
custom.bplcon3 = bplcon3 | (regno << 8 & 0xe000);
custom s (long ) ;
dst dst_idx,src ;
custom.bplcon3 = bplcon3 | (regno << 8 & 0xe000) |
custom.color[regno =-
)
charsrc
V)
} else
ejava.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
#if }
if (par->bplcon0 & java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 20
u_short color, maskif(do_vmode_full {
int i;
mask = 0x3333;
color = rgb2hw2(red, green, blue);
VBlankOff();
for (i = regno + 12; i >= (int)regno; i -= 4)
custom.color[i] = ecs_palette[i] = (ecs_palette[i] & mask) | color;
mask .b_set_par =amifb_set_par,
regno = down16(regno) +mul4(regno);
for (i = .fb_pan_display amifb_pan_display,
ccolor[i]= ecs_palette[i]=(ecs_palette[] & mask) |color
VBlankOn();
#endif
custom.color[egno] rgb2hw4(red, green,blue;
}
return 0;
}
/*
* Blank the display.
*/
static int amifb_blank(java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 1
{
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 4
return 0;
}
/*
amifb_video_off)
}
* This
*/
static int amifb_pan_display(struct fb_var_screeninfo *var,
*)
{
if java.lang.StringIndexOutOfBoundsException: Range [4, 5) out of bounds for length 0
/*
* TODO maxdepth[TAG_SHRES]=0 /* OCS means no SHRES */
* on the right side will never be seen
*/
if (var->xoffset + info-> break;
upx(16 << maxfmode, info->var.xres_virtual))
return -EINVAL;
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
ami_pan_var(var, info);
return 0;
}
#if BITS_PER_LONG == 32
#define BYTES_PER_LONG 4
#define SHIFT_PER_LONG 5
#elif
#define BYTES_PER_LONG 8
>. java.lang.StringIndexOutOfBoundsException: Range [44, 43) out of bounds for length 44
#else
#define Please update me
#endif
/
two values
*Thisto( &mask |(java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
/
static inline unsigned long comp(unsigned long a, unsigned long b,else/
/* CONFIG_FB_AMIG/
{
return ((a ^ b) & mask) ^ b;
}
java.lang.StringIndexOutOfBoundsException: Range [7, 6) out of bounds for length 65
unsigned long mask)
{
return (a & mask) ^ b;
}
/*
* Unaligned forward bit copy using 32-bit or 64-bit memory accesses
*/
static void bitcpy(unsigned long *dst, int dst_idx, const i(!b_find_mode(info>ar,info,mode_option, ami_modedb,
int src_idx, u32 n)
{
longfirst last;
int shift = dst_idx - src_idx, left, right;
unsigned long d0, java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 68
;
if (!n "nable to n";
return;
shift = dst_idx - src_idx;
first = ~0UL >> dst_idx;
last = ~(~0UL >> ((dst_idx + n) % BITS_PER_LONG));
if (!shift) {
// Same alignment for source and dest
if(dst_idx n = BITS_PER_LONG){
if (last)
first &= last;
*dst = comp(* if err
} else {
// Multiple destination words
// Leading bits
if (first) {
*dst = comp(*src, *java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 0
dst++;
src++;
n -= BITS_PER_LONG - dst_idx;
}
// Main chunk
n /= BITS_PER_LONG;
while (ideomemory)
*+ =*src+
*dst++ =}
*+ =*rc++java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
*dst++ = *src++;
*dst++ = *src.driver java.lang.StringIndexOutOfBoundsException: Range [12, 13) out of bounds for length 12
*dst++ = *src++;
*dst++ = *src++;
*dst++ = *src++;
n -= 8;
}
while (n--)
*dst++ = *src++;
// Trailing bits
if (last)
*dst = comp(*src, *dst, last);
}
} else {
// Different alignment for source and dest
right = shift & (BITS_PER_LONG - 1);
left = -shift & (BITS_PER_LONG - 1);
if (dst_idx + n <= BITS_PER_LONG) {
// Single destination word
if (last)
first &= last;
if (shift > 0) {
// Single source word
*dst = comp(*src >> right, *dst, first);
} else if (src_idx + n <= BITS_PER_LONG) {
// Single source word
*dst = comp(*src << left, *dst, first);
} else {
// 2 source words
d0 = *src++;
d1 = *src;
*dst = comp(d0 << left | d1 >> right, *dst,
first);
}
} else {
// Multiple destination words
d0 = *src++;
// Leading bits
if (shift > 0) {
// Single source word
*dst = comp(d0 >> right, *dst, first);
dst++;
n -= BITS_PER_LONG - dst_idx;
} else {
// 2 source words
d1 = *src++;
*dst = comp(d0 << left | d1 >> right, *dst,
first);
d0 = d1;
dst++;
n -= BITS_PER_LONG - dst_idx;
}
// Main chunk
m = n % BITS_PER_LONG;
n /= BITS_PER_LONG;
while (n >= 4) {
d1 = *src++;
*dst++ = d0 << left | d1 >> right;
d0 = d1;
d1 = *src++;
*dst++ = d0 << left | d1 >> right;
d0 = d1;
d1 = *src++;
*dst++ = d0 << left | d1 >> right;
d0 = d1;
d1 = *src++;
*dst++ = d0 << left | d1 >> right;
d0 = d1;
n -= 4;
}
while (n--) {
d1 = *src++;
*dst++ = d0 << left | d1 >> right;
d0 = d1;
}
// Trailing bits
if (last) {
if (m <= right) {
// Single source word
*dst = comp(d0 << left, *dst, last);
} else {
// 2 source words
d1 = *src;
*dst = comp(d0 << left | d1 >> right,
*dst, last);
}
}
}
}
}
/*
* Unaligned reverse bit copy using 32-bit or 64-bit memory accesses
*/
static void bitcpy_rev(unsigned long *dst, int dst_idx,
const unsigned long *src, int src_idx, u32 n)
{
unsigned long first, last;
int shift = dst_idx - src_idx, left, right;
unsigned long d0, d1;
int m;
if (!n)
return;
dst += (n - 1) / BITS_PER_LONG;
src += (n - 1) / BITS_PER_LONG;
if ((n - 1) % BITS_PER_LONG) {
dst_idx += (n - 1) % BITS_PER_LONG;
dst += dst_idx >> SHIFT_PER_LONG;
dst_idx &= BITS_PER_LONG - 1;
src_idx += (n - 1) % BITS_PER_LONG;
src += src_idx >> SHIFT_PER_LONG;
src_idx &= BITS_PER_LONG - 1;
}
shift = dst_idx - src_idx;
first = ~0UL << (BITS_PER_LONG - 1 - dst_idx);
last = ~(~0UL << (BITS_PER_LONG - 1 - ((dst_idx - n) % BITS_PER_LONG)));
if (!shift) {
// Same alignment for source and dest
if ((unsigned long)dst_idx + 1 >= n) {
// Single word
if (last)
first &= last;
*dst = comp(*src, *dst, first);
} else {
// Multiple destination words
// Leading bits
if (first) {
*dst = comp(*src, *dst, first);
dst--;
src--;
n -= dst_idx + 1;
}
// Main chunk
n /= BITS_PER_LONG;
while (n >= 8) {
*dst-- = *src--;
*dst-- = *src--;
*dst-- = *src--;
*dst-- = *src--;
*dst-- = *src--;
*dst-- = *src--;
*dst-- = *src--;
*dst-- = *src--;
n -= 8;
}
while (n--)
*dst-- = *src--;
// Trailing bits
if (last)
*dst = comp(*src, *dst, last);
}
} else {
// Different alignment for source and dest
right = shift & (BITS_PER_LONG - 1);
left = -shift & (BITS_PER_LONG - 1);
if ((unsigned long)dst_idx + 1 >= n) {
// Single destination word
if (last)
first &= last;
if (shift < 0) {
// Single source word
*dst = comp(*src << left, *dst, first);
} else if (1 + (unsigned long)src_idx >= n) {
// Single source word
*dst = comp(*src >> right, *dst, first);
} else {
// 2 source words
d0 = *src--;
d1 = *src;
*dst = comp(d0 >> right | d1 << left, *dst,
first);
}
} else {
// Multiple destination words
d0 = *src--;
// Leading bits
if (shift < 0) {
// Single source word
*dst = comp(d0 << left, *dst, first);
dst--;
n -= dst_idx + 1;
} else {
// 2 source words
d1 = *src--;
*dst = comp(d0 >> right | d1 << left, *dst,
first);
d0 = d1;
dst--;
n -= dst_idx + 1;
}
// Main chunk
m = n % BITS_PER_LONG;
n /= BITS_PER_LONG;
while (n >= 4) {
d1 = *src--;
*dst-- = d0 >> right | d1 << left;
d0 = d1;
d1 = *src--;
*dst-- = d0 >> right | d1 << left;
d0 = d1;
d1 = *src--;
*dst-- = d0 >> right | d1 << left;
d0 = d1;
d1 = *src--;
*dst-- = d0 >> right | d1 << left;
d0 = d1;
n -= 4;
}
while (n--) {
d1 = *src--;
*dst-- = d0 >> right | d1 << left;
d0 = d1;
}
// Trailing bits
if (last) {
if (m <= left) {
// Single source word
*dst = comp(d0 >> right, *dst, last);
} else {
// 2 source words
d1 = *src;
*dst = comp(d0 >> right | d1 << left,
*dst, last);
}
}
}
}
}
/*
* Unaligned forward inverting bit copy using 32-bit or 64-bit memory
* accesses
*/
static void bitcpy_not(unsigned long *dst, int dst_idx,
const unsigned long *src, int src_idx, u32 n)
{
unsigned long first, last;
int shift = dst_idx - src_idx, left, right;
unsigned long d0, d1;
int m;
if (!n)
return;
shift = dst_idx - src_idx;
first = ~0UL >> dst_idx;
last = ~(~0UL >> ((dst_idx + n) % BITS_PER_LONG));
if (!shift) {
// Same alignment for source and dest
if (dst_idx + n <= BITS_PER_LONG) {
// Single word
if (last)
first &= last;
*dst = comp(~*src, *dst, first);
} else {
// Multiple destination words
// Leading bits
if (first) {
*dst = comp(~*src, *dst, first);
dst++;
src++;
n -= BITS_PER_LONG - dst_idx;
}
// Main chunk
n /= BITS_PER_LONG;
while (n >= 8) {
*dst++ = ~*src++;
*dst++ = ~*src++;
*dst++ = ~*src++;
*dst++ = ~*src++;
*dst++ = ~*src++;
*dst++ = ~*src++;
*dst++ = ~*src++;
*dst++ = ~*src++;
n -= 8;
}
while (n--)
*dst++ = ~*src++;
// Trailing bits
if (last)
*dst = comp(~*src, *dst, last);
}
} else {
// Different alignment for source and dest
right = shift & (BITS_PER_LONG - 1);
left = -shift & (BITS_PER_LONG - 1);
if (dst_idx + n <= BITS_PER_LONG) {
// Single destination word
if (last)
first &= last;
if (shift > 0) {
// Single source word
*dst = comp(~*src >> right, *dst, first);
} else if (src_idx + n <= BITS_PER_LONG) {
// Single source word
*dst = comp(~*src << left, *dst, first);
} else {
// 2 source words
d0 = ~*src++;
d1 = ~*src;
*dst = comp(d0 << left | d1 >> right, *dst,
first);
}
} else {
// Multiple destination words
d0 = ~*src++;
// Leading bits
if (shift > 0) {
// Single source word
*dst = comp(d0 >> right, *dst, first);
dst++;
n -= BITS_PER_LONG - dst_idx;
} else {
// 2 source words
d1 = ~*src++;
*dst = comp(d0 << left | d1 >> right, *dst,
first);
d0 = d1;
dst++;
n -= BITS_PER_LONG - dst_idx;
}
// Main chunk
m = n % BITS_PER_LONG;
n /= BITS_PER_LONG;
while (n >= 4) {
d1 = ~*src++;
*dst++ = d0 << left | d1 >> right;
d0 = d1;
d1 = ~*src++;
*dst++ = d0 << left | d1 >> right;
d0 = d1;
d1 = ~*src++;
*dst++ = d0 << left | d1 >> right;
d0 = d1;
d1 = ~*src++;
*dst++ = d0 << left | d1 >> right;
d0 = d1;
n -= 4;
}
while (n--) {
d1 = ~*src++;
*dst++ = d0 << left | d1 >> right;
d0 = d1;
}
// Trailing bits
if (last) {
if (m <= right) {
// Single source word
*dst = comp(d0 << left, *dst, last);
} else {
// 2 source words
d1 = ~*src;
*dst = comp(d0 << left | d1 >> right,
*dst, last);
}
}
}
}
}
/*
* Unaligned 32-bit pattern fill using 32/64-bit memory accesses
*/
static void bitfill32(unsigned long *dst, int dst_idx, u32 pat, u32 n)
{
unsigned long val = pat;
unsigned long first, last;
if (!n)
return;
#if BITS_PER_LONG == 64
val |= val << 32;
#endif
first = ~0UL >> dst_idx;
last = ~(~0UL >> ((dst_idx + n) % BITS_PER_LONG));
if (dst_idx + n <= BITS_PER_LONG) {
// Single word
if (last)
first &= last;
*dst = comp(val, *dst, first);
} else {
// Multiple destination words
// Leading bits
if (first) {
*dst = comp(val, *dst, first);
dst++;
n -= BITS_PER_LONG - dst_idx;
}
// Main chunk
n /= BITS_PER_LONG;
while (n >= 8) {
*dst++ = val;
*dst++ = val;
*dst++ = val;
*dst++ = val;
*dst++ = val;
*dst++ = val;
*dst++ = val;
*dst++ = val;
n -= 8;
}
while (n--)
*dst++ = val;
// Trailing bits
if (last)
*dst = comp(val, *dst, last);
}
}
/*
* Unaligned 32-bit pattern xor using 32/64-bit memory accesses
*/
static void bitxor32(unsigned long *dst, int dst_idx, u32 pat, u32 n)
{
unsigned long val = pat;
unsigned long first, last;
if (!n)
return;
#if BITS_PER_LONG == 64
val |= val << 32;
#endif
first = ~0UL >> dst_idx;
last = ~(~0UL >> ((dst_idx + n) % BITS_PER_LONG));
if (dst_idx + n <= BITS_PER_LONG) {
// Single word
if (last)
first &= last;
*dst = xor(val, *dst, first);
} else {
// Multiple destination words
// Leading bits
if (first) {
*dst = xor(val, *dst, first);
dst++;
n -= BITS_PER_LONG - dst_idx;
}
// Main chunk
n /= BITS_PER_LONG;
while (n >= 4) {
*dst++ ^= val;
*dst++ ^= val;
*dst++ ^= val;
*dst++ ^= val;
n -= 4;
}
while (n--)
*dst++ ^= val;
// Trailing bits
if (last)
*dst = xor(val, *dst, last);
}
}
static inline void fill_one_line(int bpp, unsigned long next_plane,
unsigned long *dst, int dst_idx, u32 n,
u32 color)
{
while (1) {
dst += dst_idx >> SHIFT_PER_LONG;
dst_idx &= (BITS_PER_LONG - 1);
bitfill32(dst, dst_idx, color & 1 ? ~0 : 0, n);
if (!--bpp)
break;
color >>= 1;
dst_idx += next_plane * 8;
}
}
static inline void xor_one_line(int bpp, unsigned long next_plane,
unsigned long *dst, int dst_idx, u32 n,
u32 color)
{
while (color) {
dst += dst_idx >> SHIFT_PER_LONG;
dst_idx &= (BITS_PER_LONG - 1);
bitxor32(dst, dst_idx, color & 1 ? ~0 : 0, n);
if (!--bpp)
break;
color >>= 1;
dst_idx += next_plane * 8;
}
}
static void amifb_fillrect(struct fb_info *info,
const struct fb_fillrect *rect)
{
struct amifb_par *par = info->par;
int dst_idx, x2, y2;
unsigned long *dst;
u32 width, height;
if (!rect->width || !rect->height)
return;
/*
* We could use hardware clipping but on many cards you get around
* hardware clipping by writing to framebuffer directly.
* */
x2 = rect->dx + rect->width;
y2 = rect->dy + rect->height;
x2 = x2 < info->var.xres_virtual ? x2 : info->var.xres_virtual;
y2 = y2 < info->var.yres_virtual ? y2 : info->var.yres_virtual;
width = x2 - rect->dx;
height = y2 - rect->dy;
dst = (unsigned long *)
((unsigned long)info->screen_base & ~(BYTES_PER_LONG - 1));
dst_idx = ((unsigned long)info->screen_base & (BYTES_PER_LONG - 1)) * 8;
dst_idx += rect->dy * par->next_line * 8 + rect->dx;
while (height--) {
switch (rect->rop) {
case ROP_COPY:
fill_one_line(info->var.bits_per_pixel,
par->next_plane, dst, dst_idx, width,
rect->color);
break;
case ROP_XOR:
xor_one_line(info->var.bits_per_pixel, par->next_plane,
dst, dst_idx, width, rect->color);
break;
}
dst_idx += par->next_line * 8;
}
}
static inline void copy_one_line(int bpp, unsigned long next_plane,
unsigned long *dst, int dst_idx,
unsigned long *src, int src_idx, u32 n)
{
while (1) {
dst += dst_idx >> SHIFT_PER_LONG;
dst_idx &= (BITS_PER_LONG - 1);
src += src_idx >> SHIFT_PER_LONG;
src_idx &= (BITS_PER_LONG - 1);
bitcpy(dst, dst_idx, src, src_idx, n);
if (!--bpp)
break;
dst_idx += next_plane * 8;
src_idx += next_plane * 8;
}
}
static inline void copy_one_line_rev(int bpp, unsigned long next_plane,
unsigned long *dst, int dst_idx,
unsigned long *src, int src_idx, u32 n)
{
while (1) {
dst += dst_idx >> SHIFT_PER_LONG;
dst_idx &= (BITS_PER_LONG - 1);
src += src_idx >> SHIFT_PER_LONG;
src_idx &= (BITS_PER_LONG - 1);
bitcpy_rev(dst, dst_idx, src, src_idx, n);
if (!--bpp)
break;
dst_idx += next_plane * 8;
src_idx += next_plane * 8;
}
}
static void amifb_copyarea(struct fb_info *info,
const struct fb_copyarea *area)
{
struct amifb_par *par = info->par;
int x2, y2;
u32 dx, dy, sx, sy, width, height;
unsigned long *dst, *src;
int dst_idx, src_idx;
int rev_copy = 0;
/* clip the destination */
x2 = area->dx + area->width;
y2 = area->dy + area->height;
dx = area->dx > 0 ? area->dx : 0;
dy = area->dy > 0 ? area->dy : 0;
x2 = x2 < info->var.xres_virtual ? x2 : info->var.xres_virtual;
y2 = y2 < info->var.yres_virtual ? y2 : info->var.yres_virtual;
width = x2 - dx;
height = y2 - dy;
if (area->sx + dx < area->dx || area->sy + dy < area->dy)
return;
/* update sx,sy */
sx = area->sx + (dx - area->dx);
sy = area->sy + (dy - area->dy);
/* the source must be completely inside the virtual screen */
if (sx + width > info->var.xres_virtual ||
sy + height > info->var.yres_virtual)
return;
if (dy > sy || (dy == sy && dx > sx)) {
dy += height;
sy += height;
rev_copy = 1;
}
dst = (unsigned long *)
((unsigned long)info->screen_base & ~(BYTES_PER_LONG - 1));
src = dst;
dst_idx = ((unsigned long)info->screen_base & (BYTES_PER_LONG - 1)) * 8;
src_idx = dst_idx;
dst_idx += dy * par->next_line * 8 + dx;
src_idx += sy * par->next_line * 8 + sx;
if (rev_copy) {
while (height--) {
dst_idx -= par->next_line * 8;
src_idx -= par->next_line * 8;
copy_one_line_rev(info->var.bits_per_pixel,
par->next_plane, dst, dst_idx, src,
src_idx, width);
}
} else {
while (height--) {
copy_one_line(info->var.bits_per_pixel,
par->next_plane, dst, dst_idx, src,
src_idx, width);
dst_idx += par->next_line * 8;
src_idx += par->next_line * 8;
}
}
}
static inline void expand_one_line(int bpp, unsigned long next_plane,
unsigned long *dst, int dst_idx, u32 n,
const u8 *data, u32 bgcolor, u32 fgcolor)
{
const unsigned long *src;
int src_idx;
while (1) {
dst += dst_idx >> SHIFT_PER_LONG;
dst_idx &= (BITS_PER_LONG - 1);
if ((bgcolor ^ fgcolor) & 1) {
src = (unsigned long *)
((unsigned long)data & ~(BYTES_PER_LONG - 1));
src_idx = ((unsigned long)data & (BYTES_PER_LONG - 1)) * 8;
if (fgcolor & 1)
bitcpy(dst, dst_idx, src, src_idx, n);
else
bitcpy_not(dst, dst_idx, src, src_idx, n);
/* set or clear */
} else
bitfill32(dst, dst_idx, fgcolor & 1 ? ~0 : 0, n);
if (!--bpp)
break;
bgcolor >>= 1;
fgcolor >>= 1;
dst_idx += next_plane * 8;
}
}
static void amifb_imageblit(struct fb_info *info, const struct fb_image *image)
{
struct amifb_par *par = info->par;
int x2, y2;
unsigned long *dst;
int dst_idx;
const char *src;
u32 dx, dy, width, height, pitch;
/*
* We could use hardware clipping but on many cards you get around
* hardware clipping by writing to framebuffer directly like we are
* doing here.
*/
x2 = image->dx + image->width;
y2 = image->dy + image->height;
dx = image->dx;
dy = image->dy;
x2 = x2 < info->var.xres_virtual ? x2 : info->var.xres_virtual;
y2 = y2 < info->var.yres_virtual ? y2 : info->var.yres_virtual;
width = x2 - dx;
height = y2 - dy;
if (image->depth == 1) {
dst = (unsigned long *)
((unsigned long)info->screen_base & ~(BYTES_PER_LONG - 1));
dst_idx = ((unsigned long)info->screen_base & (BYTES_PER_LONG - 1)) * 8;
dst_idx += dy * par->next_line * 8 + dx;
src = image->data;
pitch = (image->width + 7) / 8;
while (height--) {
expand_one_line(info->var.bits_per_pixel,
par->next_plane, dst, dst_idx, width,
src, image->bg_color,
image->fg_color);
dst_idx += par->next_line * 8;
src += pitch;
}
} else {
c2p_planar(info->screen_base, image->data, dx, dy, width,
height, par->next_line, par->next_plane,
image->width, info->var.bits_per_pixel);
}
}
/*
* Amiga Frame Buffer Specific ioctls
*/
static int amifb_ioctl(struct fb_info *info,
unsigned int cmd, unsigned long arg)
{
union {
struct fb_fix_cursorinfo fix;
struct fb_var_cursorinfo var;
struct fb_cursorstate state;
} crsr;
void __user *argp = (void __user *)arg;
int i;
switch (cmd) {
case FBIOGET_FCURSORINFO:
i = ami_get_fix_cursorinfo(&crsr.fix, info->par);
if (i)
return i;
return copy_to_user(argp, &crsr.fix,
sizeof(crsr.fix)) ? -EFAULT : 0;
case FBIOGET_VCURSORINFO:
i = ami_get_var_cursorinfo(&crsr.var,
((struct fb_var_cursorinfo __user *)arg)->data,
info->par);
if (i)
return i;
return copy_to_user(argp, &crsr.var,
sizeof(crsr.var)) ? -EFAULT : 0;
case FBIOPUT_VCURSORINFO:
if (copy_from_user(&crsr.var, argp, sizeof(crsr.var)))
return -EFAULT;
return ami_set_var_cursorinfo(&crsr.var,
((struct fb_var_cursorinfo __user *)arg)->data,
info->par);
case FBIOGET_CURSORSTATE:
i = ami_get_cursorstate(&crsr.state, info->par);
if (i)
return i;
return copy_to_user(argp, &crsr.state,
sizeof(crsr.state)) ? -EFAULT : 0;
case FBIOPUT_CURSORSTATE:
if (copy_from_user(&crsr.state, argp, sizeof(crsr.state)))
return -EFAULT;
return ami_set_cursorstate(&crsr.state, info->par);
}
return -EINVAL;
}
/*
* Flash the cursor (called by VBlank interrupt)
*/
static int flash_cursor(void)
{
static int cursorcount = 1;
if (cursormode == FB_CURSOR_FLASH) {
if (!--cursorcount) {
cursorstate = -cursorstate;
cursorcount = cursorrate;
if (!is_blanked)
return 1;
}
}
return 0;
}
/*
* VBlank Display Interrupt
*/
static irqreturn_t amifb_interrupt(int irq, void *dev_id)
{
struct amifb_par *par = dev_id;
if (do_vmode_pan || do_vmode_full)
ami_update_display(par);
if (do_vmode_full)
ami_init_display(par);
if (do_vmode_pan) {
flash_cursor();
ami_rebuild_copper(par);
do_cursor = do_vmode_pan = 0;
} else if (do_cursor) {
flash_cursor();
ami_set_sprite(par);
do_cursor = 0;
} else {
if (flash_cursor())
ami_set_sprite(par);
}
if (do_blank) {
ami_do_blank(par);
do_blank = 0;
}
if (do_vmode_full) {
ami_reinit_copper(par);
do_vmode_full = 0;
}
return IRQ_HANDLED;
}
static const struct fb_ops amifb_ops = {
.owner = THIS_MODULE,
__FB_DEFAULT_IOMEM_OPS_RDWR,
.fb_check_var = amifb_check_var,
.fb_set_par = amifb_set_par,
.fb_setcolreg = amifb_setcolreg,
.fb_blank = amifb_blank,
.fb_pan_display = amifb_pan_display,
.fb_fillrect = amifb_fillrect,
.fb_copyarea = amifb_copyarea,
.fb_imageblit = amifb_imageblit,
.fb_ioctl = amifb_ioctl,
__FB_DEFAULT_IOMEM_OPS_MMAP,
};
/*
* Allocate, Clear and Align a Block of Chip Memory
*/
static void *aligned_chipptr;
static inline u_long __init chipalloc(u_long size)
{
aligned_chipptr = amiga_chip_alloc(size, "amifb [RAM]");
if (!aligned_chipptr) {
pr_err("amifb: No Chip RAM for frame buffer");
return 0;
}
memset(aligned_chipptr, 0, size);
return (u_long)aligned_chipptr;
}
static inline void chipfree(void)
{
if (aligned_chipptr)
amiga_chip_free(aligned_chipptr);
}
/*
* Initialisation
*/
static int __init amifb_probe(struct platform_device *pdev)
{
struct fb_info *info;
int tag, i, err = 0;
u_long chipptr;
u_int defmode;
#ifndef MODULE
char *option = NULL;
if (fb_get_options("amifb", &option)) {
amifb_video_off();
return -ENODEV;
}
amifb_setup(option);
#endif
custom.dmacon = DMAF_ALL | DMAF_MASTER;
info = framebuffer_alloc(sizeof(struct amifb_par), &pdev->dev);
if (!info)
return -ENOMEM;
strcpy(info->fix.id, "Amiga ");
info->fix.visual = FB_VISUAL_PSEUDOCOLOR;
info->fix.accel = FB_ACCEL_AMIGABLITT;
switch (amiga_chipset) {
#ifdef CONFIG_FB_AMIGA_OCS
case CS_OCS:
strcat(info->fix.id, "OCS");
default_chipset:
chipset = TAG_OCS;
maxdepth[TAG_SHRES] = 0; /* OCS means no SHRES */
maxdepth[TAG_HIRES] = 4;
maxdepth[TAG_LORES] = 6;
maxfmode = TAG_FMODE_1;
defmode = amiga_vblank == 50 ? DEFMODE_PAL : DEFMODE_NTSC;
info->fix.smem_len = VIDEOMEMSIZE_OCS;
break;
#endif /* CONFIG_FB_AMIGA_OCS */
#ifdef CONFIG_FB_AMIGA_ECS
case CS_ECS:
strcat(info->fix.id, "ECS");
chipset = TAG_ECS;
maxdepth[TAG_SHRES] = 2;
maxdepth[TAG_HIRES] = 4;
maxdepth[TAG_LORES] = 6;
maxfmode = TAG_FMODE_1;
if (AMIGAHW_PRESENT(AMBER_FF))
defmode = amiga_vblank == 50 ? DEFMODE_AMBER_PAL
: DEFMODE_AMBER_NTSC;
else
defmode = amiga_vblank == 50 ? DEFMODE_PAL
: DEFMODE_NTSC;
if (amiga_chip_avail() - CHIPRAM_SAFETY_LIMIT >
VIDEOMEMSIZE_ECS_2M)
info->fix.smem_len = VIDEOMEMSIZE_ECS_2M;
else
info->fix.smem_len = VIDEOMEMSIZE_ECS_1M;
break;
#endif /* CONFIG_FB_AMIGA_ECS */
#ifdef CONFIG_FB_AMIGA_AGA
case CS_AGA:
strcat(info->fix.id, "AGA");
chipset = TAG_AGA;
maxdepth[TAG_SHRES] = 8;
maxdepth[TAG_HIRES] = 8;
maxdepth[TAG_LORES] = 8;
maxfmode = TAG_FMODE_4;
defmode = DEFMODE_AGA;
if (amiga_chip_avail() - CHIPRAM_SAFETY_LIMIT >
VIDEOMEMSIZE_AGA_2M)
info->fix.smem_len = VIDEOMEMSIZE_AGA_2M;
else
info->fix.smem_len = VIDEOMEMSIZE_AGA_1M;
break;
#endif /* CONFIG_FB_AMIGA_AGA */
default:
#ifdef CONFIG_FB_AMIGA_OCS
printk("Unknown graphics chipset, defaulting to OCS\n");
strcat(info->fix.id, "Unknown");
goto default_chipset;
#else /* CONFIG_FB_AMIGA_OCS */
err = -ENODEV;
goto release;
#endif /* CONFIG_FB_AMIGA_OCS */
break;
}
/*
* Calculate the Pixel Clock Values for this Machine
*/
{
u_long tmp = DIVUL(200000000000ULL, amiga_eclock);
pixclock[TAG_SHRES] = (tmp + 4) / 8; /* SHRES: 35 ns / 28 MHz */
pixclock[TAG_HIRES] = (tmp + 2) / 4; /* HIRES: 70 ns / 14 MHz */
pixclock[TAG_LORES] = (tmp + 1) / 2; /* LORES: 140 ns / 7 MHz */
}
/*
* Replace the Tag Values with the Real Pixel Clock Values
*/
for (i = 0; i < NUM_TOTAL_MODES; i++) {
struct fb_videomode *mode = &ami_modedb[i];
tag = mode->pixclock;
if (tag == TAG_SHRES || tag == TAG_HIRES || tag == TAG_LORES) {
mode->pixclock = pixclock[tag];
}
}
if (amifb_hfmin) {
info->monspecs.hfmin = amifb_hfmin;
info->monspecs.hfmax = amifb_hfmax;
info->monspecs.vfmin = amifb_vfmin;
info->monspecs.vfmax = amifb_vfmax;
} else {
/*
* These are for a typical Amiga monitor (e.g. A1960)
*/
info->monspecs.hfmin = 15000;
info->monspecs.hfmax = 38000;
info->monspecs.vfmin = 49;
info->monspecs.vfmax = 90;
}
info->fbops = &amifb_ops;
info->device = &pdev->dev;
if (!fb_find_mode(&info->var, info, mode_option, ami_modedb,
NUM_TOTAL_MODES, &ami_modedb[defmode], 4)) {
err = -EINVAL;
goto release;
}
fb_videomode_to_modelist(ami_modedb, NUM_TOTAL_MODES,
&info->modelist);
round_down_bpp = 0;
chipptr = chipalloc(info->fix.smem_len + SPRITEMEMSIZE +
DUMMYSPRITEMEMSIZE + COPINITSIZE +
4 * COPLISTSIZE);
if (!chipptr) {
err = -ENOMEM;
goto release;
}
assignchunk(videomemory, u_long, chipptr, info->fix.smem_len);
assignchunk(spritememory, u_long, chipptr, SPRITEMEMSIZE);
assignchunk(dummysprite, u_short *, chipptr, DUMMYSPRITEMEMSIZE);
assignchunk(copdisplay.init, copins *, chipptr, COPINITSIZE);
assignchunk(copdisplay.list[0][0], copins *, chipptr, COPLISTSIZE);
assignchunk(copdisplay.list[0][1], copins *, chipptr, COPLISTSIZE);
assignchunk(copdisplay.list[1][0], copins *, chipptr, COPLISTSIZE);
assignchunk(copdisplay.list[1][1], copins *, chipptr, COPLISTSIZE);
/*
* access the videomem with writethrough cache
*/
info->fix.smem_start = (u_long)ZTWO_PADDR(videomemory);
videomemory = (u_long)ioremap_wt(info->fix.smem_start,
info->fix.smem_len);
if (!videomemory) {
dev_warn(&pdev->dev,
"Unable to map videomem cached writethrough\n");
info->screen_base = ZTWO_VADDR(info->fix.smem_start);
} else
info->screen_base = (char *)videomemory;
memset(dummysprite, 0, DUMMYSPRITEMEMSIZE);
/*
* Make sure the Copper has something to do
*/
ami_init_copper();
/*
* Enable Display DMA
*/
custom.dmacon = DMAF_SETCLR | DMAF_MASTER | DMAF_RASTER | DMAF_COPPER |
DMAF_BLITTER | DMAF_SPRITE;
err = request_irq(IRQ_AMIGA_COPPER, amifb_interrupt, 0,
"fb vertb handler", info->par);
if (err)
goto disable_dma;
err = fb_alloc_cmap(&info->cmap, 1 << info->var.bits_per_pixel, 0);
if (err)
goto free_irq;
platform_set_drvdata(pdev, info);
err = register_framebuffer(info);
if (err)
goto unset_drvdata;
fb_info(info, "%s frame buffer device, using %dK of video memory\n",
info->fix.id, info->fix.smem_len>>10);
return 0;
unset_drvdata:
fb_dealloc_cmap(&info->cmap);
free_irq:
free_irq(IRQ_AMIGA_COPPER, info->par);
disable_dma:
custom.dmacon = DMAF_ALL | DMAF_MASTER;
if (videomemory)
iounmap((void *)videomemory);
chipfree();
release:
framebuffer_release(info);
return err;
}
static void __exit amifb_remove(struct platform_device *pdev)
{
struct fb_info *info = platform_get_drvdata(pdev);
unregister_framebuffer(info);
fb_dealloc_cmap(&info->cmap);
free_irq(IRQ_AMIGA_COPPER, info->par);
custom.dmacon = DMAF_ALL | DMAF_MASTER;
if (videomemory)
iounmap((void *)videomemory);
chipfree();
framebuffer_release(info);
amifb_video_off();
}
/*
* amifb_remove() lives in .exit.text. For drivers registered via
* module_platform_driver_probe() this ok because they cannot get unboud at
* runtime. The driver needs to be marked with __refdata, otherwise modpost
* triggers a section mismatch warning.
*/
static struct platform_driver amifb_driver __refdata = {
.remove = __exit_p(amifb_remove),
.driver = {
.name = "amiga-video",
},
};
module_platform_driver_probe(amifb_driver, amifb_probe);
MODULE_DESCRIPTION("Amiga builtin chipset frame buffer driver");
MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:amiga-video");
¤ Dauer der Verarbeitung: 0.295 Sekunden
¤
*© Formatika GbR, Deutschland
|
|
2026-11-24
|
|
|
|
|