incorporatet fbmem
This commit is contained in:
@@ -103,17 +103,19 @@ CSRCS= \
|
||||
bootp.c \
|
||||
tftp.c \
|
||||
\
|
||||
fbmem.c \
|
||||
\
|
||||
videl.c \
|
||||
video.c \
|
||||
\
|
||||
radeon_base.c \
|
||||
radeon_accel.c \
|
||||
radeon_cursor.c \
|
||||
radeon_monitor.c \
|
||||
\
|
||||
basflash.c \
|
||||
basflash_start.c
|
||||
|
||||
#radeon_base.c \
|
||||
#radeon_vid.c \
|
||||
#radeon_accel.c \
|
||||
#radeon_cursor.c \
|
||||
|
||||
ASRCS= \
|
||||
startcf.S \
|
||||
|
||||
@@ -81,10 +81,12 @@ SECTIONS
|
||||
|
||||
OBJDIR/video.o
|
||||
OBJDIR/videl.o
|
||||
OBJDIR/fbmem.o
|
||||
|
||||
//OBJDIR/radeon_base.o
|
||||
//OBJDIR/radeon_accel.o
|
||||
//OBJDIR/radeon_cursor.o
|
||||
OBJDIR/radeon_base.o
|
||||
OBJDIR/radeon_accel.o
|
||||
OBJDIR/radeon_cursor.o
|
||||
OBJDIR/radeon_monitor.o
|
||||
|
||||
OBJDIR/xhdi_sd.o(.text)
|
||||
OBJDIR/xhdi_interface.o(.text)
|
||||
|
||||
@@ -280,7 +280,8 @@ struct radeon_i2c_chan
|
||||
};
|
||||
#endif
|
||||
|
||||
enum radeon_pm_mode {
|
||||
enum radeon_pm_mode
|
||||
{
|
||||
radeon_pm_none = 0, /* Nothing supported */
|
||||
radeon_pm_d2 = 0x00000001, /* Can do D2 state */
|
||||
radeon_pm_off = 0x00000002, /* Can resume from D3 cold */
|
||||
@@ -358,7 +359,10 @@ struct radeonfb_info
|
||||
|
||||
struct
|
||||
{
|
||||
uint8_t red, green, blue, pad;
|
||||
uint8_t red;
|
||||
uint8_t green;
|
||||
uint8_t blue;
|
||||
uint8_t pad;
|
||||
} palette[256];
|
||||
|
||||
int32_t chipset;
|
||||
@@ -457,7 +461,8 @@ struct radeonfb_info
|
||||
* IO macros
|
||||
*/
|
||||
|
||||
/* Note about this function: we have some rare cases where we must not schedule,
|
||||
/*
|
||||
* Note about this function: we have some rare cases where we must not schedule,
|
||||
* this typically happen with our special "wake up early" hook which allows us to
|
||||
* wake up the graphic chip (and thus get the console back) before everything else
|
||||
* on some machines that support that mecanism. At this point, intterrupts are off
|
||||
@@ -480,9 +485,9 @@ extern void __OUTPLLP(struct radeonfb_info *rinfo, uint32_t index, uint32_t val,
|
||||
#define INREG8(addr) *((uint8_t *)(rinfo->mmio_base + addr))
|
||||
#define INREG16(addr) swpw(*(uint16_t *)(rinfo->mmio_base + addr))
|
||||
#define INREG(addr) swpl(*(uint32_t *)(rinfo->mmio_base + addr))
|
||||
#define OUTREG8(addr,val) (*((uint8_t *)(rinfo->mmio_base + addr)) = val)
|
||||
#define OUTREG16(addr,val) (*((uint16_t *)(rinfo->mmio_base + addr)) = swpw(val))
|
||||
#define OUTREG(addr,val) (*((uint32_t *)(rinfo->mmio_base + addr)) = swpl(val))
|
||||
#define OUTREG8(addr, val) (*((uint8_t *)(rinfo->mmio_base + addr)) = val)
|
||||
#define OUTREG16(addr, val) (*((uint16_t *)(rinfo->mmio_base + addr)) = swpw(val))
|
||||
#define OUTREG(addr, val) (*((uint32_t *)(rinfo->mmio_base + addr)) = swpl(val))
|
||||
|
||||
extern int32_t *tab_funcs_pci;
|
||||
#define BIOS_IN8(v) (* ((uint8_t *) rinfo->bios_seg_phys + v))
|
||||
@@ -490,10 +495,10 @@ extern int32_t *tab_funcs_pci;
|
||||
#define BIOS_IN32(v) (swpl(*(uint32_t *) ((uint8_t *) rinfo->bios_seg_phys + v)))
|
||||
|
||||
#define ADDRREG(addr) ((volatile uint32_t *)(rinfo->mmio_base + (addr)))
|
||||
#define OUTREGP(addr,val,mask) _OUTREGP(rinfo, addr, val, mask)
|
||||
#define OUTREGP(addr, val, mask) _OUTREGP(rinfo, addr, val, mask)
|
||||
#define INPLL(addr) __INPLL(rinfo, addr)
|
||||
#define OUTPLL(index,val) __OUTPLL(rinfo, index, val)
|
||||
#define OUTPLLP(index,val,mask) __OUTPLLP(rinfo, index, val, mask)
|
||||
#define OUTPLL(index, val) __OUTPLL(rinfo, index, val)
|
||||
#define OUTPLLP(index, val, mask) __OUTPLLP(rinfo, index, val, mask)
|
||||
|
||||
/*
|
||||
* Inline utilities
|
||||
@@ -524,9 +529,9 @@ extern void radeonfb_pm_exit(struct radeonfb_info *rinfo);
|
||||
|
||||
/* Monitor probe functions */
|
||||
extern void radeon_probe_screens(struct radeonfb_info *rinfo,
|
||||
const uint8_t *monitor_layout, int32_t ignore_edid);
|
||||
const char *monitor_layout, int ignore_edid);
|
||||
extern void radeon_check_modes(struct radeonfb_info *rinfo, struct mode_option *resolution);
|
||||
extern int32_t radeon_match_mode(struct radeonfb_info *rinfo,
|
||||
extern int radeon_match_mode(struct radeonfb_info *rinfo,
|
||||
struct fb_var_screeninfo *dest,
|
||||
const struct fb_var_screeninfo *src);
|
||||
|
||||
|
||||
@@ -214,7 +214,8 @@ typedef struct
|
||||
/* these common regs are cleared before mode setting so they do not
|
||||
* interfere with anything
|
||||
*/
|
||||
static reg_val common_regs[] = {
|
||||
static reg_val common_regs[] =
|
||||
{
|
||||
{ OVR_CLR, 0 },
|
||||
{ OVR_WID_LEFT_RIGHT, 0 },
|
||||
{ OVR_WID_TOP_BOTTOM, 0 },
|
||||
@@ -227,7 +228,8 @@ static reg_val common_regs[] = {
|
||||
{ CAP1_TRIG_CNTL, 0 },
|
||||
};
|
||||
|
||||
|
||||
extern struct fb_info *info_fb;
|
||||
#define rinfo ((struct radeonfb_info *) info_fb->par)
|
||||
static uint32_t inreg(uint32_t addr)
|
||||
{
|
||||
return(INREG(addr));
|
||||
@@ -235,7 +237,7 @@ static uint32_t inreg(uint32_t addr)
|
||||
|
||||
static void outreg(uint32_t addr, uint32_t val)
|
||||
{
|
||||
OUTREG(addr,val);
|
||||
OUTREG(addr, val);
|
||||
}
|
||||
|
||||
#undef rinfo
|
||||
@@ -1231,7 +1233,7 @@ static void radeon_wait_vbl(struct fb_info *info)
|
||||
|
||||
static void radeon_timer_func(void)
|
||||
{
|
||||
struct fb_info *info = info_fvdi;
|
||||
struct fb_info *info = info_fb;
|
||||
struct radeonfb_info *rinfo = info->par;
|
||||
struct fb_var_screeninfo var;
|
||||
uint32_t x, y;
|
||||
@@ -2179,7 +2181,7 @@ int32_t radeonfb_pci_register(int32_t handle, const struct pci_device_id *ent)
|
||||
|
||||
void radeonfb_pci_unregister(void)
|
||||
{
|
||||
struct fb_info *info = info_fvdi;
|
||||
struct fb_info *info = info_fb;
|
||||
struct radeonfb_info *rinfo = info->par;
|
||||
// radeonfb_pm_exit(rinfo);
|
||||
uninstall_vbl_timer(radeon_timer_func);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
233
BaS_gcc/video/fbmem.c
Normal file
233
BaS_gcc/video/fbmem.c
Normal file
@@ -0,0 +1,233 @@
|
||||
/*
|
||||
* fbmem.c
|
||||
*
|
||||
* Copyright (C) 1994 Martin Schaller
|
||||
*
|
||||
* 2001 - Documented with DocBook
|
||||
* - Brad Douglas <brad@neruo.com>
|
||||
*
|
||||
* 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 <bas_string.h>
|
||||
#include "fb.h"
|
||||
#include "radeonfb.h"
|
||||
|
||||
long mem_cmp(char *p1, char *p2, long size)
|
||||
{
|
||||
while(size--)
|
||||
{
|
||||
if(*p1++ != *p2++)
|
||||
return(1);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Frame buffer device initialization and setup routines
|
||||
*/
|
||||
|
||||
#define FBPIXMAPSIZE (1024 * 8)
|
||||
|
||||
int fb_pan_display(struct fb_info *info, struct fb_var_screeninfo *var)
|
||||
{
|
||||
int xoffset = var->xoffset;
|
||||
int yoffset = var->yoffset;
|
||||
int err;
|
||||
// DPRINT("fb_pan_display\r\n");
|
||||
if((xoffset < 0) || (yoffset < 0)
|
||||
|| ((xoffset + info->var.xres) > info->var.xres_virtual))
|
||||
return -1; //-EINVAL;
|
||||
if((err = info->fbops->fb_pan_display(var, info)))
|
||||
return err;
|
||||
info->var.xoffset = var->xoffset;
|
||||
info->var.yoffset = var->yoffset;
|
||||
if(var->vmode & FB_VMODE_YWRAP)
|
||||
info->var.vmode |= FB_VMODE_YWRAP;
|
||||
else
|
||||
info->var.vmode &= ~FB_VMODE_YWRAP;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var)
|
||||
{
|
||||
int err;
|
||||
// DPRINT("fb_set_var\r\n");
|
||||
if(var->activate & FB_ACTIVATE_INV_MODE)
|
||||
/* return 1 if equal */
|
||||
return(!mem_cmp((char *)&info->var, (char *)var, sizeof(struct fb_var_screeninfo)));
|
||||
if((var->activate & FB_ACTIVATE_FORCE)
|
||||
|| mem_cmp((char *)&info->var, (char *)var, sizeof(struct fb_var_screeninfo)))
|
||||
{
|
||||
if((err = info->fbops->fb_check_var(var, info)))
|
||||
return err;
|
||||
if((var->activate & FB_ACTIVATE_MASK) == FB_ACTIVATE_NOW)
|
||||
{
|
||||
memcpy(&info->var, var, sizeof(struct fb_var_screeninfo));
|
||||
info->fbops->fb_set_par(info);
|
||||
fb_pan_display(info, &info->var);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int fb_blank(struct fb_info *info, int blank)
|
||||
{
|
||||
// DPRINT("fb_blank\r\n");
|
||||
if(blank > FB_BLANK_POWERDOWN)
|
||||
blank = FB_BLANK_POWERDOWN;
|
||||
return(info->fbops->fb_blank(blank, info));
|
||||
}
|
||||
|
||||
int fb_ioctl(unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
struct fb_info *info = info_fvdi;
|
||||
struct fb_var_screeninfo var;
|
||||
struct fb_fix_screeninfo fix;
|
||||
void *argp = (void *)arg;
|
||||
int i;
|
||||
switch(cmd)
|
||||
{
|
||||
case FBIOGET_VSCREENINFO:
|
||||
memcpy(argp, &info->var, sizeof(var));
|
||||
return 0;
|
||||
case FBIOPUT_VSCREENINFO:
|
||||
memcpy(&var, argp, sizeof(var));
|
||||
i = fb_set_var(info, &var);
|
||||
if(i)
|
||||
return i;
|
||||
memcpy(argp, &var, sizeof(var));
|
||||
return 0;
|
||||
case FBIOGET_FSCREENINFO:
|
||||
memcpy(argp, &info->fix, sizeof(fix));
|
||||
return 0;
|
||||
case FBIOPAN_DISPLAY:
|
||||
memcpy(&var, argp, sizeof(var));
|
||||
i = fb_pan_display(info, &var);
|
||||
if(i)
|
||||
return i;
|
||||
memcpy(argp, &var, sizeof(var));
|
||||
return 0;
|
||||
case FBIOBLANK:
|
||||
i = fb_blank(info, arg);
|
||||
return i;
|
||||
case FBIO_ALLOC:
|
||||
return(offscreen_alloc(info,(long)arg));
|
||||
case FBIO_FREE:
|
||||
return(offscreen_free(info,(long)arg));
|
||||
default:
|
||||
return(info->fbops->fb_ioctl(cmd, arg, info));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if 1
|
||||
|
||||
static struct radeonfb_info struct_radeon_info;
|
||||
|
||||
/**
|
||||
* framebuffer_alloc - creates a new frame buffer info structure
|
||||
*
|
||||
* @size: size of driver private data, can be zero
|
||||
* @dev: pointer to the device for this fb, this can be NULL
|
||||
*
|
||||
* Creates a new frame buffer info structure. Also reserves @size bytes
|
||||
* for driver private data (info->par). info->par (if any) will be
|
||||
* aligned to sizeof(long).
|
||||
*
|
||||
* Returns the new structure, or NULL if an error occured.
|
||||
*
|
||||
*/
|
||||
struct fb_info *framebuffer_alloc(unsigned long size)
|
||||
{
|
||||
static struct fb_info struct_info;
|
||||
struct fb_info *info = &struct_info;
|
||||
memset(info, 0, sizeof(struct fb_info));
|
||||
if(size)
|
||||
{
|
||||
if(size <= sizeof(struct radeonfb_info))
|
||||
{
|
||||
memset(&struct_radeon_info, 0, sizeof(struct radeonfb_info));
|
||||
info->par = (void *)&struct_radeon_info;
|
||||
}
|
||||
else
|
||||
{
|
||||
char *p = Funcs_malloc(size, 3);
|
||||
if(!p)
|
||||
return NULL;
|
||||
memset(p, 0, size);
|
||||
info->par = p;
|
||||
}
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
/**
|
||||
* framebuffer_release - marks the structure available for freeing
|
||||
*
|
||||
* @info: frame buffer info structure
|
||||
*
|
||||
* Drop the reference count of the class_device embedded in the
|
||||
* framebuffer info structure.
|
||||
*
|
||||
*/
|
||||
void framebuffer_release(struct fb_info *info)
|
||||
{
|
||||
if(info->par != (void *)&struct_radeon_info)
|
||||
Funcs_free(info->par);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
/**
|
||||
* framebuffer_alloc - creates a new frame buffer info structure
|
||||
*
|
||||
* @size: size of driver private data, can be zero
|
||||
* @dev: pointer to the device for this fb, this can be NULL
|
||||
*
|
||||
* Creates a new frame buffer info structure. Also reserves @size bytes
|
||||
* for driver private data (info->par). info->par (if any) will be
|
||||
* aligned to sizeof(long).
|
||||
*
|
||||
* Returns the new structure, or NULL if an error occured.
|
||||
*
|
||||
*/
|
||||
struct fb_info *framebuffer_alloc(unsigned long size)
|
||||
{
|
||||
#define BYTES_PER_LONG (32/8)
|
||||
#define PADDING (BYTES_PER_LONG - (sizeof(struct fb_info) % BYTES_PER_LONG))
|
||||
int fb_info_size = sizeof(struct fb_info);
|
||||
struct fb_info *info;
|
||||
char *p;
|
||||
if(size)
|
||||
fb_info_size += PADDING;
|
||||
p = Funcs_malloc(fb_info_size + size, 3);
|
||||
if(!p)
|
||||
return NULL;
|
||||
memset(p, 0, fb_info_size + size);
|
||||
info = (struct fb_info *) p;
|
||||
if(size)
|
||||
info->par = p + fb_info_size;
|
||||
return info;
|
||||
#undef PADDING
|
||||
#undef BYTES_PER_LONG
|
||||
}
|
||||
|
||||
/**
|
||||
* framebuffer_release - marks the structure available for freeing
|
||||
*
|
||||
* @info: frame buffer info structure
|
||||
*
|
||||
* Drop the reference count of the class_device embedded in the
|
||||
* framebuffer info structure.
|
||||
*
|
||||
*/
|
||||
void framebuffer_release(struct fb_info *info)
|
||||
{
|
||||
Funcs_free(info);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user