alistair23-linux/drivers/video/fbdev/nvidia/nv_type.h

176 lines
3.4 KiB
C
Raw Normal View History

#ifndef __NV_TYPE_H__
#define __NV_TYPE_H__
#include <linux/fb.h>
#include <linux/types.h>
#include <linux/i2c.h>
#include <linux/i2c-algo-bit.h>
#include <video/vga.h>
#define NV_ARCH_04 0x04
#define NV_ARCH_10 0x10
#define NV_ARCH_20 0x20
#define NV_ARCH_30 0x30
#define NV_ARCH_40 0x40
#define BITMASK(t,b) (((unsigned)(1U << (((t)-(b)+1)))-1) << (b))
#define MASKEXPAND(mask) BITMASK(1?mask,0?mask)
#define SetBF(mask,value) ((value) << (0?mask))
#define GetBF(var,mask) (((unsigned)((var) & MASKEXPAND(mask))) >> (0?mask) )
#define SetBitField(value,from,to) SetBF(to, GetBF(value,from))
#define SetBit(n) (1<<(n))
#define Set8Bits(value) ((value)&0xff)
#define V_DBLSCAN 1
typedef struct {
int bitsPerPixel;
int depth;
int displayWidth;
int weight;
} NVFBLayout;
#define NUM_SEQ_REGS 0x05
#define NUM_CRT_REGS 0x41
#define NUM_GRC_REGS 0x09
#define NUM_ATC_REGS 0x15
struct nvidia_par;
struct nvidia_i2c_chan {
struct nvidia_par *par;
unsigned long ddc_base;
struct i2c_adapter adapter;
struct i2c_algo_bit_data algo;
};
typedef struct _riva_hw_state {
u8 attr[NUM_ATC_REGS];
u8 crtc[NUM_CRT_REGS];
u8 gra[NUM_GRC_REGS];
u8 seq[NUM_SEQ_REGS];
u8 misc_output;
u32 bpp;
u32 width;
u32 height;
u32 interlace;
u32 repaint0;
u32 repaint1;
u32 screen;
u32 scale;
u32 dither;
u32 extra;
u32 fifo;
u32 pixel;
u32 horiz;
u32 arbitration0;
u32 arbitration1;
u32 pll;
u32 pllB;
u32 vpll;
u32 vpll2;
u32 vpllB;
u32 vpll2B;
u32 pllsel;
u32 general;
u32 crtcOwner;
u32 head;
u32 head2;
u32 config;
u32 cursorConfig;
u32 cursor0;
u32 cursor1;
u32 cursor2;
u32 timingH;
u32 timingV;
u32 displayV;
u32 crtcSync;
u32 control;
} RIVA_HW_STATE;
struct riva_regs {
RIVA_HW_STATE ext;
};
struct nvidia_par {
RIVA_HW_STATE SavedReg;
RIVA_HW_STATE ModeReg;
RIVA_HW_STATE initial_state;
RIVA_HW_STATE *CurrentState;
struct vgastate vgastate;
u32 pseudo_palette[16];
struct pci_dev *pci_dev;
u32 Architecture;
u32 CursorStart;
int Chipset;
unsigned long FbAddress;
u8 __iomem *FbStart;
u32 FbMapSize;
u32 FbUsableSize;
u32 ScratchBufferSize;
u32 ScratchBufferStart;
int FpScale;
u32 MinVClockFreqKHz;
u32 MaxVClockFreqKHz;
u32 CrystalFreqKHz;
u32 RamAmountKBytes;
u32 IOBase;
NVFBLayout CurrentLayout;
int cursor_reset;
int lockup;
int videoKey;
int FlatPanel;
int FPDither;
int Television;
int CRTCnumber;
int alphaCursor;
int twoHeads;
int twoStagePLL;
int fpScaler;
int fpWidth;
int fpHeight;
int PanelTweak;
int paneltweak;
int LVDS;
int pm_state;
int reverse_i2c;
u32 crtcSync_read;
u32 fpSyncs;
u32 dmaPut;
u32 dmaCurrent;
u32 dmaFree;
u32 dmaMax;
u32 __iomem *dmaBase;
u32 currentRop;
int WaitVSyncPossible;
int BlendingPossible;
u32 paletteEnabled;
u32 forceCRTC;
u32 open_count;
u8 DDCBase;
video: fbdev: nvidia: use arch_phys_wc_add() and ioremap_wc() This driver uses the same area for MTRR and ioremap(). Convert the driver from using the x86 specific MTRR code to the architecture agnostic arch_phys_wc_add(). arch_phys_wc_add() will avoid MTRR if write-combining is available, in order to take advantage of that also ensure the ioremap'd area is requested as write-combining. There are a few motivations for this: a) Take advantage of PAT when available b) Help bury MTRR code away, MTRR is architecture specific and on x86 its replaced by PAT c) Help with the goal of eventually using _PAGE_CACHE_UC over _PAGE_CACHE_UC_MINUS on x86 on ioremap_nocache() (see commit de33c442e titled "x86 PAT: fix performance drop for glx, use UC minus for ioremap(), ioremap_nocache() and pci_mmap_page_range()") The conversion done is expressed by the following Coccinelle SmPL patch, it additionally required manual intervention to address all the #ifdery and removal of redundant things which arch_phys_wc_add() already addresses such as verbose message about when MTRR fails and doing nothing when we didn't get an MTRR. @ mtrr_found @ expression index, base, size; @@ -index = mtrr_add(base, size, MTRR_TYPE_WRCOMB, 1); +index = arch_phys_wc_add(base, size); @ mtrr_rm depends on mtrr_found @ expression mtrr_found.index, mtrr_found.base, mtrr_found.size; @@ -mtrr_del(index, base, size); +arch_phys_wc_del(index); @ mtrr_rm_zero_arg depends on mtrr_found @ expression mtrr_found.index; @@ -mtrr_del(index, 0, 0); +arch_phys_wc_del(index); @ mtrr_rm_fb_info depends on mtrr_found @ struct fb_info *info; expression mtrr_found.index; @@ -mtrr_del(index, info->fix.smem_start, info->fix.smem_len); +arch_phys_wc_del(index); @ ioremap_replace_nocache depends on mtrr_found @ struct fb_info *info; expression base, size; @@ -info->screen_base = ioremap_nocache(base, size); +info->screen_base = ioremap_wc(base, size); @ ioremap_replace_default depends on mtrr_found @ struct fb_info *info; expression base, size; @@ -info->screen_base = ioremap(base, size); +info->screen_base = ioremap_wc(base, size); Generated-by: Coccinelle SmPL Cc: Antonino Daplas <adaplas@gmail.com> Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com> Cc: Suresh Siddha <sbsiddha@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Juergen Gross <jgross@suse.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Dave Airlie <airlied@redhat.com> Cc: linux-fbdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com> Reviewed-by: Dave Airlie <airlied@redhat.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-04-21 14:16:28 -06:00
int wc_cookie;
struct nvidia_i2c_chan chan[3];
volatile u32 __iomem *REGS;
volatile u32 __iomem *PCRTC0;
volatile u32 __iomem *PCRTC;
volatile u32 __iomem *PRAMDAC0;
volatile u32 __iomem *PFB;
volatile u32 __iomem *PFIFO;
volatile u32 __iomem *PGRAPH;
volatile u32 __iomem *PEXTDEV;
volatile u32 __iomem *PTIMER;
volatile u32 __iomem *PMC;
volatile u32 __iomem *PRAMIN;
volatile u32 __iomem *FIFO;
volatile u32 __iomem *CURSOR;
volatile u8 __iomem *PCIO0;
volatile u8 __iomem *PCIO;
volatile u8 __iomem *PVIO;
volatile u8 __iomem *PDIO0;
volatile u8 __iomem *PDIO;
volatile u32 __iomem *PRAMDAC;
};
#endif /* __NV_TYPE_H__ */