Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
67bf3c24
Commit
67bf3c24
authored
Mar 02, 2003
by
David S. Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FRAMEBUFFER]: Convert cg14 driver to new APIs.
parent
57b55f79
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
606 additions
and
3 deletions
+606
-3
drivers/video/Kconfig
drivers/video/Kconfig
+2
-2
drivers/video/Makefile
drivers/video/Makefile
+2
-1
drivers/video/cg14.c
drivers/video/cg14.c
+597
-0
drivers/video/fbmem.c
drivers/video/fbmem.c
+5
-0
No files found.
drivers/video/Kconfig
View file @
67bf3c24
...
@@ -823,9 +823,9 @@ config FB_TCX
...
@@ -823,9 +823,9 @@ config FB_TCX
This is the frame buffer device driver for the TCX 24/8bit frame
This is the frame buffer device driver for the TCX 24/8bit frame
buffer.
buffer.
config FB_CG
FOURTEEN
config FB_CG
14
bool "CGfourteen (SX) support"
bool "CGfourteen (SX) support"
depends on FB_SBUS
&& SPARC32
depends on FB_SBUS
help
help
This is the frame buffer device driver for the CGfourteen frame
This is the frame buffer device driver for the CGfourteen frame
buffer on Desktop SPARCsystems with the SX graphics option.
buffer on Desktop SPARCsystems with the SX graphics option.
...
...
drivers/video/Makefile
View file @
67bf3c24
...
@@ -72,7 +72,6 @@ obj-$(CONFIG_FB_VOODOO1) += sstfb.o cfbfillrect.o cfbcopyarea.o cfbimgb
...
@@ -72,7 +72,6 @@ obj-$(CONFIG_FB_VOODOO1) += sstfb.o cfbfillrect.o cfbcopyarea.o cfbimgb
# One by one these are being converted over to the new APIs
# One by one these are being converted over to the new APIs
#obj-$(CONFIG_FB_TCX) += tcxfb.o sbusfb.o
#obj-$(CONFIG_FB_TCX) += tcxfb.o sbusfb.o
#obj-$(CONFIG_FB_CGFOURTEEN) += cgfourteenfb.o sbusfb.o
#obj-$(CONFIG_FB_P9100) += p9100fb.o sbusfb.o
#obj-$(CONFIG_FB_P9100) += p9100fb.o sbusfb.o
#obj-$(CONFIG_FB_LEO) += leofb.o sbusfb.o
#obj-$(CONFIG_FB_LEO) += leofb.o sbusfb.o
...
@@ -82,6 +81,8 @@ obj-$(CONFIG_FB_CG3) += cg3.o sbuslib.o cfbimgblt.o cfbcopyarea.o
...
@@ -82,6 +81,8 @@ obj-$(CONFIG_FB_CG3) += cg3.o sbuslib.o cfbimgblt.o cfbcopyarea.o
cfbfillrect.o
cfbfillrect.o
obj-$(CONFIG_FB_BW2)
+=
bw2.o sbuslib.o cfbimgblt.o cfbcopyarea.o
\
obj-$(CONFIG_FB_BW2)
+=
bw2.o sbuslib.o cfbimgblt.o cfbcopyarea.o
\
cfbfillrect.o
cfbfillrect.o
obj-$(CONFIG_FB_CG14)
+=
cg14.o sbuslib.o cfbimgblt.o cfbcopyarea.o
\
cfbfillrect.o
# Files generated that shall be removed upon make clean
# Files generated that shall be removed upon make clean
clean-files
:=
promcon_tbl.c
clean-files
:=
promcon_tbl.c
...
...
drivers/video/cg
fourteenfb
.c
→
drivers/video/cg
14
.c
View file @
67bf3c24
/* $Id: cgfourteenfb.c,v 1.11 2001/09/19 00:04:33 davem Exp $
/* cg14.c: CGFOURTEEN frame buffer driver
* cgfourteenfb.c: CGfourteen frame buffer driver
*
*
* Copyright (C) 2003 David S. Miller (davem@redhat.com)
* Copyright (C) 1996,1998 Jakub Jelinek (jj@ultra.linux.cz)
* Copyright (C) 1996,1998 Jakub Jelinek (jj@ultra.linux.cz)
* Copyright (C) 1995 Miguel de Icaza (miguel@nuclecu.unam.mx)
* Copyright (C) 1995 Miguel de Icaza (miguel@nuclecu.unam.mx)
*
* Driver layout based loosely on tgafb.c, see that file for credits.
*/
*/
#include <linux/module.h>
#include <linux/module.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/errno.h>
#include <linux/string.h>
#include <linux/string.h>
#include <linux/mm.h>
#include <linux/tty.h>
#include <linux/slab.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/delay.h>
#include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/fb.h>
#include <linux/init.h>
#include <linux/init.h>
#include <linux/selection.h>
#include <linux/fb.h>
#include <linux/mm.h>
#include <video/sbusfb.h>
#include <asm/io.h>
#include <asm/io.h>
#include <asm/pgtable.h>
#include <asm/sbus.h>
#include <asm/uaccess.h>
#include <asm/oplib.h>
#include <asm/fbio.h>
#include "sbuslib.h"
/*
* Local functions.
*/
static
int
cg14_check_var
(
struct
fb_var_screeninfo
*
,
struct
fb_info
*
);
static
int
cg14_set_par
(
struct
fb_info
*
);
static
int
cg14_setcolreg
(
unsigned
,
unsigned
,
unsigned
,
unsigned
,
unsigned
,
struct
fb_info
*
);
#include <video/fbcon-cfb8.h>
static
int
cg14_mmap
(
struct
fb_info
*
,
struct
file
*
,
struct
vm_area_struct
*
);
static
int
cg14_ioctl
(
struct
inode
*
,
struct
file
*
,
unsigned
int
,
unsigned
long
,
struct
fb_info
*
);
/*
* Frame buffer operations
*/
static
struct
fb_ops
cg14_ops
=
{
.
owner
=
THIS_MODULE
,
.
fb_check_var
=
cg14_check_var
,
.
fb_set_par
=
cg14_set_par
,
.
fb_setcolreg
=
cg14_setcolreg
,
.
fb_fillrect
=
cfb_fillrect
,
.
fb_copyarea
=
cfb_copyarea
,
.
fb_imageblit
=
cfb_imageblit
,
.
fb_mmap
=
cg14_mmap
,
.
fb_ioctl
=
cg14_ioctl
,
.
fb_cursor
=
soft_cursor
,
};
#define CG14_MCR_INTENABLE_SHIFT 7
#define CG14_MCR_INTENABLE_SHIFT 7
#define CG14_MCR_INTENABLE_MASK 0x80
#define CG14_MCR_INTENABLE_MASK 0x80
...
@@ -72,8 +99,6 @@
...
@@ -72,8 +99,6 @@
#define CG14_MCR_PIXMODE_16 2
#define CG14_MCR_PIXMODE_16 2
#define CG14_MCR_PIXMODE_32 3
#define CG14_MCR_PIXMODE_32 3
MODULE_LICENSE
(
"GPL"
);
struct
cg14_regs
{
struct
cg14_regs
{
volatile
u8
mcr
;
/* Master Control Reg */
volatile
u8
mcr
;
/* Master Control Reg */
volatile
u8
ppr
;
/* Packed Pixel Reg */
volatile
u8
ppr
;
/* Packed Pixel Reg */
...
@@ -161,285 +186,412 @@ struct cg14_clut {
...
@@ -161,285 +186,412 @@ struct cg14_clut {
u32
c_clutd_inc
[
256
];
u32
c_clutd_inc
[
256
];
};
};
static
struct
sbus_mmap_map
cg14_mmap_map
[]
__initdata
=
{
#define CG14_MMAP_ENTRIES 16
{
CG14_REGS
,
0x80000000
,
0x1000
},
{
CG14_XLUT
,
0x80003000
,
0x1000
},
{
CG14_CLUT1
,
0x80004000
,
0x1000
},
{
CG14_CLUT2
,
0x80005000
,
0x1000
},
{
CG14_CLUT3
,
0x80006000
,
0x1000
},
{
CG3_MMAP_OFFSET
-
0x7000
,
0x80000000
,
0x7000
},
{
CG3_MMAP_OFFSET
,
0x00000000
,
SBUS_MMAP_FBSIZE
(
1
)
},
{
MDI_CURSOR_MAP
,
0x80001000
,
0x1000
},
{
MDI_CHUNKY_BGR_MAP
,
0x01000000
,
0x400000
},
{
MDI_PLANAR_X16_MAP
,
0x02000000
,
0x200000
},
{
MDI_PLANAR_C16_MAP
,
0x02800000
,
0x200000
},
{
MDI_PLANAR_X32_MAP
,
0x03000000
,
0x100000
},
{
MDI_PLANAR_B32_MAP
,
0x03400000
,
0x100000
},
{
MDI_PLANAR_G32_MAP
,
0x03800000
,
0x100000
},
{
MDI_PLANAR_R32_MAP
,
0x03c00000
,
0x100000
},
{
0
,
0
,
0
}
};
st
atic
void
cg14_loadcmap
(
struct
fb_info_sbusfb
*
fb
,
struct
display
*
p
,
st
ruct
cg14_par
{
int
index
,
int
count
)
spinlock_t
lock
;
{
struct
cg14_regs
*
regs
;
struct
cg14_clut
*
clut
=
fb
->
s
.
cg14
.
clut
;
struct
cg14_clut
*
clut
;
unsigned
long
flags
;
struct
cg14_cursor
*
cursor
;
spin_lock_irqsave
(
&
fb
->
lock
,
flags
);
u32
flags
;
for
(;
count
--
;
index
++
)
{
#define CG14_FLAG_BLANKED 0x00000001
u32
val
;
val
=
((
fb
->
color_map
CM
(
index
,
2
)
<<
16
)
|
unsigned
long
physbase
;
(
fb
->
color_map
CM
(
index
,
1
)
<<
8
)
|
unsigned
long
iospace
;
(
fb
->
color_map
CM
(
index
,
0
)));
unsigned
long
fbsize
;
sbus_writel
(
val
,
&
clut
->
c_clut
[
index
]);
}
spin_unlock_irqrestore
(
&
fb
->
lock
,
flags
);
}
static
void
cg14_margins
(
struct
fb_info_sbusfb
*
fb
,
struct
display
*
p
,
struct
sbus_mmap_map
mmap_map
[
CG14_MMAP_ENTRIES
];
int
x_margin
,
int
y_margin
)
{
fb
->
info
.
screen_base
+=
(
y_margin
-
fb
->
y_margin
)
*
fb
->
info
.
fix
.
line_length
+
(
x_margin
-
fb
->
x_margin
);
}
static
void
cg14_setcursormap
(
struct
fb_info_sbusfb
*
fb
,
u8
*
red
,
u8
*
green
,
u8
*
blue
)
{
struct
cg14_cursor
*
cur
=
fb
->
s
.
cg14
.
cursor
;
unsigned
long
flags
;
spin_lock_irqsave
(
&
fb
->
lock
,
flags
)
;
int
mode
;
sbus_writel
(((
red
[
0
])
|
(
green
[
0
]
<<
8
)
|
(
blue
[
0
]
<<
16
)),
&
cur
->
color0
)
;
int
ramsize
;
s
bus_writel
(((
red
[
1
])
|
(
green
[
1
]
<<
8
)
|
(
blue
[
1
]
<<
16
)),
&
cur
->
color1
)
;
s
truct
sbus_dev
*
sdev
;
s
pin_unlock_irqrestore
(
&
fb
->
lock
,
flags
)
;
s
truct
list_head
list
;
}
}
;
/* Set cursor shape */
static
void
__cg14_reset
(
struct
cg14_par
*
par
)
static
void
cg14_setcurshape
(
struct
fb_info_sbusfb
*
fb
)
{
{
struct
cg14_cursor
*
cur
=
fb
->
s
.
cg14
.
cursor
;
struct
cg14_regs
*
regs
=
par
->
regs
;
unsigned
long
flags
;
u8
val
;
int
i
;
spin_lock_irqsave
(
&
fb
->
lock
,
flags
);
val
=
sbus_readb
(
&
regs
->
mcr
);
for
(
i
=
0
;
i
<
32
;
i
++
){
val
&=
~
(
CG14_MCR_PIXMODE_MASK
);
sbus_writel
(
fb
->
cursor
.
bits
[
0
][
i
],
&
cur
->
cpl0
[
i
]);
sbus_writeb
(
val
,
&
regs
->
mcr
);
sbus_writel
(
fb
->
cursor
.
bits
[
1
][
i
],
&
cur
->
cpl1
[
i
]);
}
spin_unlock_irqrestore
(
&
fb
->
lock
,
flags
);
}
}
/* Load cursor information */
/**
static
void
cg14_setcursor
(
struct
fb_info_sbusfb
*
fb
)
* cg14_check_var - Optional function. Validates a var passed in.
* @var: frame buffer variable screen structure
* @info: frame buffer structure that represents a single frame buffer
*/
static
int
cg14_check_var
(
struct
fb_var_screeninfo
*
var
,
struct
fb_info
*
info
)
{
{
struct
cg_cursor
*
c
=
&
fb
->
cursor
;
if
(
var
->
bits_per_pixel
!=
8
)
struct
cg14_cursor
*
cur
=
fb
->
s
.
cg14
.
cursor
;
return
-
EINVAL
;
unsigned
long
flags
;
spin_lock_irqsave
(
&
fb
->
lock
,
flags
);
if
(
var
->
xres_virtual
!=
var
->
xres
||
var
->
yres_virtual
!=
var
->
yres
)
if
(
c
->
enable
)
{
return
-
EINVAL
;
u8
tmp
=
sbus_readb
(
&
cur
->
ccr
);
if
(
var
->
nonstd
)
return
-
EINVAL
;
if
((
var
->
vmode
&
FB_VMODE_MASK
)
!=
FB_VMODE_NONINTERLACED
)
return
-
EINVAL
;
tmp
|=
CG14_CCR_ENABLE
;
if
(
var
->
xres
!=
info
->
var
.
xres
||
var
->
yres
!=
info
->
var
.
yres
)
sbus_writeb
(
tmp
,
&
cur
->
ccr
);
return
-
EINVAL
;
}
else
{
u8
tmp
=
sbus_readb
(
&
cur
->
ccr
);
tmp
&=
~
CG14_CCR_ENABLE
;
return
0
;
sbus_writeb
(
tmp
,
&
cur
->
ccr
);
}
sbus_writew
(((
c
->
cpos
.
fbx
-
c
->
chot
.
fbx
)
&
0xfff
),
&
cur
->
cursx
);
sbus_writew
(((
c
->
cpos
.
fby
-
c
->
chot
.
fby
)
&
0xfff
),
&
cur
->
cursy
);
spin_unlock_irqrestore
(
&
fb
->
lock
,
flags
);
}
}
static
void
cg14_switch_from_graph
(
struct
fb_info_sbusfb
*
fb
)
/**
* cg14_set_par - Optional function. Alters the hardware state.
* @info: frame buffer structure that represents a single frame buffer
*/
static
int
cg14_set_par
(
struct
fb_info
*
info
)
{
return
0
;
}
/**
* cg14_setcolreg - Optional function. Sets a color register.
* @regno: boolean, 0 copy local, 1 get_user() function
* @red: frame buffer colormap structure
* @green: The green value which can be up to 16 bits wide
* @blue: The blue value which can be up to 16 bits wide.
* @transp: If supported the alpha value which can be up to 16 bits wide.
* @info: frame buffer info structure
*/
static
int
cg14_setcolreg
(
unsigned
regno
,
unsigned
red
,
unsigned
green
,
unsigned
blue
,
unsigned
transp
,
struct
fb_info
*
info
)
{
{
struct
cg14_par
*
par
=
(
struct
cg14_par
*
)
info
->
par
;
struct
cg14_clut
*
clut
=
par
->
clut
;
unsigned
long
flags
;
unsigned
long
flags
;
u32
val
;
spin_lock_irqsave
(
&
fb
->
lock
,
flags
);
if
(
regno
>=
256
)
return
1
;
/* Set the 8-bpp mode */
val
=
(
red
|
(
green
<<
8
)
|
(
blue
<<
16
));
if
(
fb
->
open
&&
fb
->
mmaped
){
volatile
char
*
mcr
=
&
fb
->
s
.
cg14
.
regs
->
mcr
;
char
tmp
;
fb
->
s
.
cg14
.
mode
=
8
;
spin_lock_irqsave
(
&
par
->
lock
,
flags
);
tmp
=
sbus_readb
(
mcr
);
sbus_writel
(
val
,
&
clut
->
c_clut
[
regno
]);
tmp
&=
~
(
CG14_MCR_PIXMODE_MASK
);
spin_unlock_irqrestore
(
&
par
->
lock
,
flags
);
sbus_writeb
(
tmp
,
mcr
);
}
return
0
;
spin_unlock_irqrestore
(
&
fb
->
lock
,
flags
);
}
}
static
void
cg14_reset
(
struct
fb_info_sbusfb
*
fb
)
static
int
cg14_mmap
(
struct
fb_info
*
info
,
struct
file
*
file
,
struct
vm_area_struct
*
vma
)
{
{
volatile
char
*
mcr
=
&
fb
->
s
.
cg14
.
regs
->
mcr
;
struct
cg14_par
*
par
=
(
struct
cg14_par
*
)
info
->
par
;
unsigned
long
flags
;
char
tmp
;
spin_lock_irqsave
(
&
fb
->
lock
,
flags
);
return
sbusfb_mmap_helper
(
par
->
mmap_map
,
tmp
=
sbus_readb
(
mcr
);
par
->
physbase
,
par
->
fbsize
,
tmp
&=
~
(
CG14_MCR_PIXMODE_MASK
);
par
->
iospace
,
vma
);
sbus_writeb
(
tmp
,
mcr
);
spin_unlock_irqrestore
(
&
fb
->
lock
,
flags
);
}
}
static
int
cg14_ioctl
(
struct
fb_info_sbusfb
*
fb
,
unsigned
int
cmd
,
unsigned
long
arg
)
static
int
cg14_ioctl
(
struct
inode
*
inode
,
struct
file
*
file
,
unsigned
int
cmd
,
unsigned
long
arg
,
struct
fb_info
*
info
)
{
{
volatile
char
*
mcr
=
&
fb
->
s
.
cg14
.
regs
->
mcr
;
struct
cg14_par
*
par
=
(
struct
cg14_par
*
)
info
->
par
;
struct
mdi_cfginfo
*
mdii
;
struct
cg14_regs
*
regs
=
par
->
regs
;
struct
mdi_cfginfo
kmdi
,
*
mdii
;
unsigned
long
flags
;
unsigned
long
flags
;
int
mode
,
ret
=
0
;
int
cur_mode
,
mode
,
ret
=
0
;
char
tmp
;
switch
(
cmd
)
{
switch
(
cmd
)
{
case
MDI_RESET
:
case
MDI_RESET
:
spin_lock_irqsave
(
&
fb
->
lock
,
flags
);
spin_lock_irqsave
(
&
par
->
lock
,
flags
);
tmp
=
sbus_readb
(
mcr
);
__cg14_reset
(
par
);
tmp
&=
~
CG14_MCR_PIXMODE_MASK
;
spin_unlock_irqrestore
(
&
par
->
lock
,
flags
);
sbus_writeb
(
tmp
,
mcr
);
spin_unlock_irqrestore
(
&
fb
->
lock
,
flags
);
break
;
break
;
case
MDI_GET_CFGINFO
:
case
MDI_GET_CFGINFO
:
mdii
=
(
struct
mdi_cfginfo
*
)
arg
;
memset
(
&
kmdi
,
0
,
sizeof
(
kmdi
));
if
(
put_user
(
FBTYPE_MDICOLOR
,
&
mdii
->
mdi_type
)
||
__put_user
(
fb
->
type
.
fb_height
,
&
mdii
->
mdi_height
)
||
spin_lock_irqsave
(
&
par
->
lock
,
flags
);
__put_user
(
fb
->
type
.
fb_width
,
&
mdii
->
mdi_width
)
||
kmdi
.
mdi_type
=
FBTYPE_MDICOLOR
;
__put_user
(
fb
->
s
.
cg14
.
mode
,
&
mdii
->
mdi_mode
)
||
kmdi
.
mdi_height
=
info
->
var
.
yres
;
__put_user
(
72
,
&
mdii
->
mdi_pixfreq
)
||
/* FIXME */
kmdi
.
mdi_width
=
info
->
var
.
xres
;
__put_user
(
fb
->
s
.
cg14
.
ramsize
,
&
mdii
->
mdi_size
))
kmdi
.
mdi_mode
=
par
->
mode
;
return
-
EFAULT
;
kmdi
.
mdi_pixfreq
=
72
;
/* FIXME */
kmdi
.
mdi_size
=
par
->
ramsize
;
spin_unlock_irqrestore
(
&
par
->
lock
,
flags
);
mdii
=
(
struct
mdi_cfginfo
*
)
arg
;
if
(
copy_to_user
(
mdii
,
&
kmdi
,
sizeof
(
kmdi
)))
ret
=
-
EFAULT
;
break
;
break
;
case
MDI_SET_PIXELMODE
:
case
MDI_SET_PIXELMODE
:
if
(
get_user
(
mode
,
(
int
*
)
arg
))
if
(
get_user
(
mode
,
(
int
*
)
arg
))
{
return
-
EFAULT
;
ret
=
-
EFAULT
;
break
;
}
spin_lock_irqsave
(
&
fb
->
lock
,
flags
);
spin_lock_irqsave
(
&
par
->
lock
,
flags
);
tmp
=
sbus_readb
(
mcr
);
cur_mode
=
sbus_readb
(
&
regs
->
mcr
);
switch
(
mode
){
cur_mode
&=
~
CG14_MCR_PIXMODE_MASK
;
switch
(
mode
)
{
case
MDI_32_PIX
:
case
MDI_32_PIX
:
tmp
=
(
tmp
&
~
CG14_MCR_PIXMODE_MASK
)
|
cur_mode
|=
(
CG14_MCR_PIXMODE_32
<<
(
CG14_MCR_PIXMODE_32
<<
CG14_MCR_PIXMODE_SHIFT
);
CG14_MCR_PIXMODE_SHIFT
);
break
;
break
;
case
MDI_16_PIX
:
case
MDI_16_PIX
:
tmp
=
(
tmp
&
~
CG14_MCR_PIXMODE_MASK
)
|
0x20
;
cur_mode
|=
0x20
;
break
;
break
;
case
MDI_8_PIX
:
case
MDI_8_PIX
:
tmp
=
(
tmp
&
~
CG14_MCR_PIXMODE_MASK
);
break
;
break
;
default:
default:
ret
=
-
ENOSYS
;
ret
=
-
ENOSYS
;
break
;
break
;
};
};
if
(
ret
==
0
)
{
if
(
!
ret
)
{
sbus_writeb
(
tmp
,
mcr
);
sbus_writeb
(
cur_mode
,
&
regs
->
mcr
);
fb
->
s
.
cg14
.
mode
=
mode
;
par
->
mode
=
mode
;
}
}
spin_unlock_irqrestore
(
&
fb
->
lock
,
flags
);
spin_unlock_irqrestore
(
&
par
->
lock
,
flags
);
break
;
break
;
default:
default:
ret
=
-
EINVAL
;
ret
=
-
EINVAL
;
break
;
};
};
return
ret
;
return
ret
;
}
}
static
unsigned
long
__init
get_phys
(
unsigned
long
addr
)
/*
{
* Initialisation
return
__get_phys
(
addr
);
*/
}
static
int
__init
get_iospace
(
unsigned
long
addr
)
static
void
cg14_init_fix
(
struct
fb_info
*
info
,
int
linebytes
)
{
{
return
__get_iospace
(
addr
);
struct
cg14_par
*
par
=
(
struct
cg14_par
*
)
info
->
par
;
strncpy
(
info
->
fix
.
id
,
par
->
sdev
->
prom_name
,
sizeof
(
info
->
fix
.
id
)
-
1
);
info
->
fix
.
id
[
sizeof
(
info
->
fix
.
id
)
-
1
]
=
0
;
info
->
fix
.
type
=
FB_TYPE_PACKED_PIXELS
;
info
->
fix
.
visual
=
FB_VISUAL_TRUECOLOR
;
info
->
fix
.
line_length
=
linebytes
;
info
->
fix
.
accel
=
FB_ACCEL_SUN_CG14
;
}
}
static
char
idstring
[
60
]
__initdata
=
{
0
};
static
struct
sbus_mmap_map
__cg14_mmap_map
[
CG14_MMAP_ENTRIES
]
__initdata
=
{
{
CG14_REGS
,
0x80000000
,
0x1000
},
{
CG14_XLUT
,
0x80003000
,
0x1000
},
{
CG14_CLUT1
,
0x80004000
,
0x1000
},
{
CG14_CLUT2
,
0x80005000
,
0x1000
},
{
CG14_CLUT3
,
0x80006000
,
0x1000
},
{
CG3_MMAP_OFFSET
-
0x7000
,
0x80000000
,
0x7000
},
{
CG3_MMAP_OFFSET
,
0x00000000
,
SBUS_MMAP_FBSIZE
(
1
)
},
{
MDI_CURSOR_MAP
,
0x80001000
,
0x1000
},
{
MDI_CHUNKY_BGR_MAP
,
0x01000000
,
0x400000
},
{
MDI_PLANAR_X16_MAP
,
0x02000000
,
0x200000
},
{
MDI_PLANAR_C16_MAP
,
0x02800000
,
0x200000
},
{
MDI_PLANAR_X32_MAP
,
0x03000000
,
0x100000
},
{
MDI_PLANAR_B32_MAP
,
0x03400000
,
0x100000
},
{
MDI_PLANAR_G32_MAP
,
0x03800000
,
0x100000
},
{
MDI_PLANAR_R32_MAP
,
0x03c00000
,
0x100000
},
{
0
,
0
,
0
}
};
struct
all_info
{
struct
fb_info
info
;
struct
cg14_par
par
;
struct
list_head
list
;
};
static
LIST_HEAD
(
cg14_list
);
char
__init
*
cgfourteenfb_init
(
struct
fb_info_sbusfb
*
fb
)
static
void
cg14_init_one
(
struct
sbus_dev
*
sdev
,
int
node
,
int
parent_node
)
{
{
struct
fb_fix_screeninfo
*
fix
=
&
fb
->
info
.
fix
;
struct
all_info
*
all
;
struct
display
*
disp
=
&
fb
->
disp
;
unsigned
long
phys
,
rphys
;
struct
fbtype
*
type
=
&
fb
->
type
;
unsigned
long
rphys
,
phys
;
u32
bases
[
6
];
u32
bases
[
6
];
int
is_8mb
,
i
;
int
is_8mb
,
linebytes
,
i
;
#ifndef FBCON_HAS_CFB8
if
(
!
sdev
)
{
return
NULL
;
prom_getproperty
(
node
,
"address"
,
#endif
(
char
*
)
&
bases
[
0
],
sizeof
(
bases
));
prom_getproperty
(
fb
->
prom_node
,
"address"
,
(
char
*
)
&
bases
[
0
],
8
);
if
(
!
bases
[
0
])
{
if
(
!
bases
[
0
])
{
printk
(
"cg14 not mmaped
\n
"
);
printk
(
KERN_ERR
"cg14: Device is not mapped.
\n
"
);
return
NULL
;
return
;
}
}
if
(
get_iospace
(
bases
[
0
])
!=
get_iospace
(
bases
[
1
]))
{
if
(
__get_iospace
(
bases
[
0
])
!=
__
get_iospace
(
bases
[
1
]))
{
printk
(
"Ugh. cg14 iospaces don't match
\n
"
);
printk
(
KERN_ERR
"cg14: I/O spaces don't match.
\n
"
);
return
NULL
;
return
;
}
}
fb
->
physbase
=
phys
=
get_phys
(
bases
[
1
]);
}
rphys
=
get_phys
(
bases
[
0
]);
fb
->
iospace
=
get_iospace
(
bases
[
0
]);
all
=
kmalloc
(
sizeof
(
*
all
),
GFP_KERNEL
);
fb
->
s
.
cg14
.
regs
=
(
struct
cg14_regs
*
)(
unsigned
long
)
bases
[
0
];
if
(
!
all
)
{
fb
->
s
.
cg14
.
clut
=
(
void
*
)((
unsigned
long
)
bases
[
0
]
+
CG14_CLUT1
);
printk
(
KERN_ERR
"cg14: Cannot allocate memory.
\n
"
);
fb
->
s
.
cg14
.
cursor
=
(
void
*
)((
unsigned
long
)
bases
[
0
]
+
CG14_CURSORREGS
);
return
;
fb
->
info
.
screen_base
=
(
char
*
)
bases
[
1
];
}
memset
(
all
,
0
,
sizeof
(
*
all
));
/* CG14_VCA_8MB_MASK is not correctly set on the 501-2482
* VSIMM, so we read the memory size from the PROM
INIT_LIST_HEAD
(
&
all
->
list
);
*/
prom_getproperty
(
fb
->
prom_node
,
"reg"
,
(
char
*
)
&
bases
[
0
],
24
);
spin_lock_init
(
&
all
->
par
.
lock
);
is_8mb
=
bases
[
5
]
==
0x800000
;
sbusfb_fill_var
(
&
all
->
info
.
var
,
node
,
8
);
fb
->
mmap_map
=
kmalloc
(
sizeof
(
cg14_mmap_map
),
GFP_KERNEL
);
if
(
!
fb
->
mmap_map
)
linebytes
=
prom_getintdefault
(
sdev
->
prom_node
,
"linebytes"
,
return
NULL
;
all
->
info
.
var
.
xres
);
all
->
par
.
fbsize
=
PAGE_ALIGN
(
linebytes
*
all
->
info
.
var
.
yres
);
for
(
i
=
0
;
;
i
++
)
{
fb
->
mmap_map
[
i
].
voff
=
cg14_mmap_map
[
i
].
voff
;
all
->
par
.
sdev
=
sdev
;
fb
->
mmap_map
[
i
].
poff
=
(
cg14_mmap_map
[
i
].
poff
&
0x80000000
)
?
if
(
sdev
)
{
(
cg14_mmap_map
[
i
].
poff
&
0x7fffffff
)
+
rphys
-
phys
:
rphys
=
sdev
->
reg_addrs
[
0
].
phys_addr
;
cg14_mmap_map
[
i
].
poff
;
all
->
par
.
physbase
=
phys
=
sdev
->
reg_addrs
[
1
].
phys_addr
;
fb
->
mmap_map
[
i
].
size
=
cg14_mmap_map
[
i
].
size
;
all
->
par
.
iospace
=
sdev
->
reg_addrs
[
0
].
which_io
;
if
(
is_8mb
&&
fb
->
mmap_map
[
i
].
size
>=
0x100000
&&
fb
->
mmap_map
[
i
].
size
<=
0x400000
)
all
->
par
.
regs
=
(
struct
cg14_regs
*
)
fb
->
mmap_map
[
i
].
size
<<=
1
;
sbus_ioremap
(
&
sdev
->
resource
[
0
],
0
,
if
(
!
cg14_mmap_map
[
i
].
size
)
sizeof
(
struct
cg14_regs
),
"cg14 regs"
);
all
->
par
.
clut
=
(
struct
cg14_clut
*
)
sbus_ioremap
(
&
sdev
->
resource
[
0
],
CG14_CLUT1
,
sizeof
(
struct
cg14_clut
),
"cg14 clut"
);
all
->
par
.
cursor
=
(
struct
cg14_cursor
*
)
sbus_ioremap
(
&
sdev
->
resource
[
0
],
CG14_CURSORREGS
,
sizeof
(
struct
cg14_cursor
),
"cg14 cursor"
);
all
->
info
.
screen_base
=
(
char
*
)
sbus_ioremap
(
&
sdev
->
resource
[
1
],
0
,
all
->
par
.
fbsize
,
"cg14 ram"
);
}
else
{
rphys
=
__get_phys
(
bases
[
0
]);
all
->
par
.
physbase
=
phys
=
__get_phys
(
bases
[
1
]);
all
->
par
.
iospace
=
__get_iospace
(
bases
[
0
]);
all
->
par
.
regs
=
(
struct
cg14_regs
*
)(
unsigned
long
)
bases
[
0
];
all
->
par
.
clut
=
(
struct
cg14_clut
*
)((
unsigned
long
)
bases
[
0
]
+
CG14_CLUT1
);
all
->
par
.
cursor
=
(
struct
cg14_cursor
*
)((
unsigned
long
)
bases
[
0
]
+
CG14_CURSORREGS
);
all
->
info
.
screen_base
=
(
char
*
)(
unsigned
long
)
bases
[
1
];
}
prom_getproperty
(
node
,
"reg"
,
(
char
*
)
&
bases
[
0
],
sizeof
(
bases
));
is_8mb
=
(
bases
[
5
]
==
0x800000
);
if
(
sizeof
(
all
->
par
.
mmap_map
)
!=
sizeof
(
__cg14_mmap_map
))
{
extern
void
__cg14_mmap_sized_wrongly
(
void
);
__cg14_mmap_sized_wrongly
();
}
memcpy
(
&
all
->
par
.
mmap_map
,
&
__cg14_mmap_map
,
sizeof
(
all
->
par
.
mmap_map
));
for
(
i
=
0
;
i
<
CG14_MMAP_ENTRIES
;
i
++
)
{
struct
sbus_mmap_map
*
map
=
&
all
->
par
.
mmap_map
[
i
];
if
(
!
map
->
size
)
break
;
break
;
if
(
map
->
poff
&
0x80000000
)
map
->
poff
=
(
map
->
poff
&
0x7fffffff
)
+
rphys
-
phys
;
if
(
is_8mb
&&
map
->
size
>=
0x100000
&&
map
->
size
<=
0x400000
)
map
->
size
*=
2
;
}
}
strcpy
(
fb
->
info
.
modename
,
"CGfourteen"
);
all
->
par
.
mode
=
MDI_8_PIX
;
strcpy
(
fix
->
id
,
"CGfourteen"
);
all
->
par
.
ramsize
=
(
is_8mb
?
0x800000
:
0x400000
);
fix
->
line_length
=
fb
->
info
.
var
.
xres_virtual
;
fix
->
accel
=
FB_ACCEL_SUN_CG14
;
disp
->
scrollmode
=
SCROLL_YREDRAW
;
all
->
info
.
node
=
NODEV
;
fb
->
info
.
screen_base
+=
fix
->
line_length
*
fb
->
y_margin
+
fb
->
x_margin
;
all
->
info
.
flags
=
FBINFO_FLAG_DEFAULT
;
fb
->
dispsw
=
fbcon_cfb8
;
all
->
info
.
fbops
=
&
cg14_ops
;
all
->
info
.
currcon
=
-
1
;
all
->
info
.
par
=
&
all
->
par
;
type
->
fb_depth
=
24
;
__cg14_reset
(
&
all
->
par
);
fb
->
emulations
[
1
]
=
FBTYPE_SUN3COLOR
;
fb
->
margins
=
cg14_margins
;
if
(
fb_alloc_cmap
(
&
all
->
info
.
cmap
,
256
,
0
))
{
fb
->
loadcmap
=
cg14_loadcmap
;
printk
(
KERN_ERR
"cg14: Could not allocate color map.
\n
"
)
;
fb
->
setcursor
=
cg14_setcursor
;
kfree
(
all
)
;
fb
->
setcursormap
=
cg14_setcursormap
;
return
;
fb
->
setcurshape
=
cg14_setcurshape
;
}
fb
->
reset
=
cg14_reset
;
fb
->
switch_from_graph
=
cg14_switch_from_graph
;
cg14_set_par
(
&
all
->
info
)
;
fb
->
ioctl
=
cg14_ioctl
;
cg14_init_fix
(
&
all
->
info
,
linebytes
)
;
fb
->
s
.
cg14
.
mode
=
8
;
if
(
register_framebuffer
(
&
all
->
info
)
<
0
)
{
fb
->
s
.
cg14
.
ramsize
=
(
is_8mb
)
?
0x800000
:
0x400000
;
printk
(
KERN_ERR
"cg14: Could not register framebuffer.
\n
"
);
fb_dealloc_cmap
(
&
all
->
info
.
cmap
);
kfree
(
all
);
return
;
}
cg14_reset
(
fb
);
list_add
(
&
all
->
list
,
&
cg14_list
);
sprintf
(
idstring
,
"cgfourteen at %x.%08lx, %dMB, rev=%d, impl=%d"
,
fb
->
iospace
,
phys
,
printk
(
"cg14: cgfourteen at %lx:%lx
\n
"
,
is_8mb
?
8
:
4
,
fb
->
s
.
cg14
.
regs
->
rev
>>
4
,
fb
->
s
.
cg14
.
regs
->
rev
&
0xf
);
all
->
par
.
physbase
,
all
->
par
.
iospace
);
return
idstring
;
}
}
int
__init
cg14_init
(
void
)
{
struct
sbus_bus
*
sbus
;
struct
sbus_dev
*
sdev
;
#ifdef CONFIG_SPARC32
{
int
root
,
node
;
root
=
prom_getchild
(
prom_root_node
);
root
=
prom_searchsiblings
(
root
,
"obio"
);
if
(
root
)
{
node
=
prom_searchsiblings
(
prom_getchild
(
root
),
"cgfourteen"
);
if
(
node
)
cg14_init_one
(
NULL
,
node
,
root
);
}
}
#endif
for_all_sbusdev
(
sdev
,
sbus
)
{
if
(
!
strcmp
(
sdev
->
prom_name
,
"cgfourteen"
))
cg14_init_one
(
sdev
,
sdev
->
prom_node
,
sbus
->
prom_node
);
}
return
0
;
}
void
__exit
cg14_exit
(
void
)
{
struct
list_head
*
pos
,
*
tmp
;
list_for_each_safe
(
pos
,
tmp
,
&
cg14_list
)
{
struct
all_info
*
all
=
list_entry
(
pos
,
typeof
(
*
all
),
list
);
unregister_framebuffer
(
&
all
->
info
);
fb_dealloc_cmap
(
&
all
->
info
.
cmap
);
kfree
(
all
);
}
}
int
__init
cg14_setup
(
char
*
arg
)
{
/* No cmdline options yet... */
return
0
;
}
#ifdef MODULE
module_init
(
cg14_init
);
module_exit
(
cg14_exit
);
#endif
MODULE_DESCRIPTION
(
"framebuffer driver for CGfourteen chipsets"
);
MODULE_AUTHOR
(
"David S. Miller <davem@redhat.com>"
);
MODULE_LICENSE
(
"GPL"
);
drivers/video/fbmem.c
View file @
67bf3c24
...
@@ -152,6 +152,8 @@ extern int cg3_init(void);
...
@@ -152,6 +152,8 @@ extern int cg3_init(void);
extern
int
cg3_setup
(
char
*
);
extern
int
cg3_setup
(
char
*
);
extern
int
bw2_init
(
void
);
extern
int
bw2_init
(
void
);
extern
int
bw2_setup
(
char
*
);
extern
int
bw2_setup
(
char
*
);
extern
int
cg14_init
(
void
);
extern
int
cg14_setup
(
char
*
);
static
struct
{
static
struct
{
const
char
*
name
;
const
char
*
name
;
...
@@ -255,6 +257,9 @@ static struct {
...
@@ -255,6 +257,9 @@ static struct {
#ifdef CONFIG_FB_BW2
#ifdef CONFIG_FB_BW2
{
"bw2"
,
bw2_init
,
bw2_setup
},
{
"bw2"
,
bw2_init
,
bw2_setup
},
#endif
#endif
#ifdef CONFIG_FB_CG14
{
"cg14"
,
cg14_init
,
cg14_setup
},
#endif
/*
/*
* Generic drivers that are used as fallbacks
* Generic drivers that are used as fallbacks
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment