1fa225cbcSrjs 2fa225cbcSrjs/************************************************************************** 3fa225cbcSrjs 4fa225cbcSrjsCopyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. 5fa225cbcSrjsCopyright © 2002 David Dawes 6fa225cbcSrjs 7fa225cbcSrjsAll Rights Reserved. 8fa225cbcSrjs 9fa225cbcSrjsPermission is hereby granted, free of charge, to any person obtaining a 10fa225cbcSrjscopy of this software and associated documentation files (the 11fa225cbcSrjs"Software"), to deal in the Software without restriction, including 12fa225cbcSrjswithout limitation the rights to use, copy, modify, merge, publish, 13fa225cbcSrjsdistribute, sub license, and/or sell copies of the Software, and to 14fa225cbcSrjspermit persons to whom the Software is furnished to do so, subject to 15fa225cbcSrjsthe following conditions: 16fa225cbcSrjs 17fa225cbcSrjsThe above copyright notice and this permission notice (including the 18fa225cbcSrjsnext paragraph) shall be included in all copies or substantial portions 19fa225cbcSrjsof the Software. 20fa225cbcSrjs 21fa225cbcSrjsTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 22fa225cbcSrjsOR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23fa225cbcSrjsMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 24fa225cbcSrjsIN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR 25fa225cbcSrjsANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 26fa225cbcSrjsTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 27fa225cbcSrjsSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28fa225cbcSrjs 29fa225cbcSrjs**************************************************************************/ 30fa225cbcSrjs 31fa225cbcSrjs/* 32fa225cbcSrjs * Authors: 33fa225cbcSrjs * Keith Whitwell <keith@tungstengraphics.com> 34fa225cbcSrjs * David Dawes <dawes@xfree86.org> 35fa225cbcSrjs * 36fa225cbcSrjs */ 37fa225cbcSrjs 38fa225cbcSrjs#ifndef _INTEL_COMMON_H_ 39fa225cbcSrjs#define _INTEL_COMMON_H_ 40fa225cbcSrjs 41fa225cbcSrjs/* Provide substitutes for gcc's __FUNCTION__ on other compilers */ 42fa225cbcSrjs#if !defined(__GNUC__) && !defined(__FUNCTION__) 43fa225cbcSrjs# if defined(__STDC__) && (__STDC_VERSION__>=199901L) /* C99 */ 44fa225cbcSrjs# define __FUNCTION__ __func__ 45fa225cbcSrjs# else 46fa225cbcSrjs# define __FUNCTION__ "" 47fa225cbcSrjs# endif 48fa225cbcSrjs#endif 49fa225cbcSrjs 50fa225cbcSrjs 51fa225cbcSrjs#define PFX __FILE__,__LINE__,__FUNCTION__ 52fa225cbcSrjs#define FUNCTION_NAME __FUNCTION__ 53fa225cbcSrjs 54fa225cbcSrjs#ifdef I830DEBUG 55fa225cbcSrjs#define MARKER() ErrorF("\n### %s:%d: >>> %s <<< ###\n\n", \ 56fa225cbcSrjs __FILE__, __LINE__,__FUNCTION__) 57fa225cbcSrjs#define DPRINTF I830DPRINTF 58fa225cbcSrjs#else /* #ifdef I830DEBUG */ 59fa225cbcSrjs#define MARKER() 60fa225cbcSrjs#define DPRINTF I830DPRINTF_stub 61fa225cbcSrjsstatic inline void 62fa225cbcSrjsI830DPRINTF_stub(const char *filename, int line, const char *function, 63fa225cbcSrjs const char *fmt, ...) 64fa225cbcSrjs{ 65fa225cbcSrjs} 66fa225cbcSrjs#endif /* #ifdef I830DEBUG */ 67fa225cbcSrjs 68fa225cbcSrjs#define KB(x) ((x) * 1024) 69fa225cbcSrjs#define MB(x) ((x) * KB(1024)) 70fa225cbcSrjs 71fa225cbcSrjs/* Using usleep() makes things noticably slow. */ 72fa225cbcSrjs#if 0 73fa225cbcSrjs#define DELAY(x) usleep(x) 74fa225cbcSrjs#else 75fa225cbcSrjs#define DELAY(x) do {;} while (0) 76fa225cbcSrjs#endif 77fa225cbcSrjs 78fa225cbcSrjs#ifndef REG_DUMPER 79fa225cbcSrjs/* I830 hooks for the I810 driver setup/probe. */ 80fa225cbcSrjsextern const OptionInfoRec *I830AvailableOptions(int chipid, int busid); 81fa225cbcSrjsextern void I830InitpScrn(ScrnInfoPtr pScrn); 82fa225cbcSrjs 83fa225cbcSrjs/* Symbol lists shared by the i810 and i830 parts. */ 84fa225cbcSrjsextern int I830EntityIndex; 85fa225cbcSrjs 86fa225cbcSrjsextern void I830DPRINTF_stub(const char *filename, int line, 87fa225cbcSrjs const char *function, const char *fmt, ...); 88fa225cbcSrjs 89fa225cbcSrjs#ifdef _I830_H_ 90fa225cbcSrjs#define PrintErrorState i830_dump_error_state 91fa225cbcSrjs#define WaitRingFunc I830WaitLpRing 92fa225cbcSrjs#define RecPtr pI830 93fa225cbcSrjs#else 94fa225cbcSrjs#define PrintErrorState I810PrintErrorState 95fa225cbcSrjs#define WaitRingFunc I810WaitLpRing 96fa225cbcSrjs#define RecPtr pI810 97fa225cbcSrjs#endif 98fa225cbcSrjs 99fa225cbcSrjsstatic inline void memset_volatile(volatile void *b, int c, size_t len) 100fa225cbcSrjs{ 101fa225cbcSrjs int i; 102fa225cbcSrjs 103fa225cbcSrjs for (i = 0; i < len; i++) 104fa225cbcSrjs ((volatile char *)b)[i] = c; 105fa225cbcSrjs} 106fa225cbcSrjs 107fa225cbcSrjsstatic inline void memcpy_volatile(volatile void *dst, const void *src, 108fa225cbcSrjs size_t len) 109fa225cbcSrjs{ 110fa225cbcSrjs int i; 111fa225cbcSrjs 112fa225cbcSrjs for (i = 0; i < len; i++) 113fa225cbcSrjs ((volatile char *)dst)[i] = ((volatile char *)src)[i]; 114fa225cbcSrjs} 115fa225cbcSrjs 116fa225cbcSrjs/* Memory mapped register access macros */ 117fa225cbcSrjs#define INREG8(addr) *(volatile uint8_t *)(RecPtr->MMIOBase + (addr)) 118fa225cbcSrjs#define INREG16(addr) *(volatile uint16_t *)(RecPtr->MMIOBase + (addr)) 119fa225cbcSrjs#define INREG(addr) *(volatile uint32_t *)(RecPtr->MMIOBase + (addr)) 120fa225cbcSrjs#define INGTT(addr) *(volatile uint32_t *)(RecPtr->GTTBase + (addr)) 121fa225cbcSrjs#define POSTING_READ(addr) (void)INREG(addr) 122fa225cbcSrjs 123fa225cbcSrjs#define OUTREG8(addr, val) do { \ 124fa225cbcSrjs *(volatile uint8_t *)(RecPtr->MMIOBase + (addr)) = (val); \ 125fa225cbcSrjs if (I810_DEBUG&DEBUG_VERBOSE_OUTREG) { \ 126fa225cbcSrjs ErrorF("OUTREG8(0x%lx, 0x%lx) in %s\n", (unsigned long)(addr), \ 127fa225cbcSrjs (unsigned long)(val), FUNCTION_NAME); \ 128fa225cbcSrjs } \ 129fa225cbcSrjs} while (0) 130fa225cbcSrjs 131fa225cbcSrjs#define OUTREG16(addr, val) do { \ 132fa225cbcSrjs *(volatile uint16_t *)(RecPtr->MMIOBase + (addr)) = (val); \ 133fa225cbcSrjs if (I810_DEBUG&DEBUG_VERBOSE_OUTREG) { \ 134fa225cbcSrjs ErrorF("OUTREG16(0x%lx, 0x%lx) in %s\n", (unsigned long)(addr), \ 135fa225cbcSrjs (unsigned long)(val), FUNCTION_NAME); \ 136fa225cbcSrjs } \ 137fa225cbcSrjs} while (0) 138fa225cbcSrjs 139fa225cbcSrjs#define OUTREG(addr, val) do { \ 140fa225cbcSrjs *(volatile uint32_t *)(RecPtr->MMIOBase + (addr)) = (val); \ 141fa225cbcSrjs if (I810_DEBUG&DEBUG_VERBOSE_OUTREG) { \ 142fa225cbcSrjs ErrorF("OUTREG(0x%lx, 0x%lx) in %s\n", (unsigned long)(addr), \ 143fa225cbcSrjs (unsigned long)(val), FUNCTION_NAME); \ 144fa225cbcSrjs } \ 145fa225cbcSrjs} while (0) 146fa225cbcSrjs 147fa225cbcSrjs/* To remove all debugging, make sure I810_DEBUG is defined as a 148fa225cbcSrjs * preprocessor symbol, and equal to zero. 149fa225cbcSrjs */ 150fa225cbcSrjs#if 1 151fa225cbcSrjs#define I810_DEBUG 0 152fa225cbcSrjs#endif 153fa225cbcSrjs#ifndef I810_DEBUG 154fa225cbcSrjs#warning "Debugging enabled - expect reduced performance" 155fa225cbcSrjsextern int I810_DEBUG; 156fa225cbcSrjs#endif 157fa225cbcSrjs 158fa225cbcSrjs#define DEBUG_VERBOSE_ACCEL 0x1 159fa225cbcSrjs#define DEBUG_VERBOSE_SYNC 0x2 160fa225cbcSrjs#define DEBUG_VERBOSE_VGA 0x4 161fa225cbcSrjs#define DEBUG_VERBOSE_RING 0x8 162fa225cbcSrjs#define DEBUG_VERBOSE_OUTREG 0x10 163fa225cbcSrjs#define DEBUG_VERBOSE_MEMORY 0x20 164fa225cbcSrjs#define DEBUG_VERBOSE_CURSOR 0x40 165fa225cbcSrjs#define DEBUG_ALWAYS_SYNC 0x80 166fa225cbcSrjs#define DEBUG_VERBOSE_DRI 0x100 167fa225cbcSrjs#define DEBUG_VERBOSE_BIOS 0x200 168fa225cbcSrjs#endif /* !REG_DUMPER */ 169fa225cbcSrjs 170fa225cbcSrjs/* Size of the mmio region. 171fa225cbcSrjs */ 172fa225cbcSrjs#define I810_REG_SIZE 0x80000 173fa225cbcSrjs 174fa225cbcSrjs#ifndef PCI_CHIP_I810 175fa225cbcSrjs#define PCI_CHIP_I810 0x7121 176fa225cbcSrjs#define PCI_CHIP_I810_DC100 0x7123 177fa225cbcSrjs#define PCI_CHIP_I810_E 0x7125 178fa225cbcSrjs#define PCI_CHIP_I815 0x1132 179fa225cbcSrjs#define PCI_CHIP_I810_BRIDGE 0x7120 180fa225cbcSrjs#define PCI_CHIP_I810_DC100_BRIDGE 0x7122 181fa225cbcSrjs#define PCI_CHIP_I810_E_BRIDGE 0x7124 182fa225cbcSrjs#define PCI_CHIP_I815_BRIDGE 0x1130 183fa225cbcSrjs#endif 184fa225cbcSrjs 185fa225cbcSrjs#ifndef PCI_CHIP_I830_M 186fa225cbcSrjs#define PCI_CHIP_I830_M 0x3577 187fa225cbcSrjs#define PCI_CHIP_I830_M_BRIDGE 0x3575 188fa225cbcSrjs#endif 189fa225cbcSrjs 190fa225cbcSrjs#ifndef PCI_CHIP_845_G 191fa225cbcSrjs#define PCI_CHIP_845_G 0x2562 192fa225cbcSrjs#define PCI_CHIP_845_G_BRIDGE 0x2560 193fa225cbcSrjs#endif 194fa225cbcSrjs 195fa225cbcSrjs#ifndef PCI_CHIP_I855_GM 196fa225cbcSrjs#define PCI_CHIP_I855_GM 0x3582 197fa225cbcSrjs#define PCI_CHIP_I855_GM_BRIDGE 0x3580 198fa225cbcSrjs#endif 199fa225cbcSrjs 200fa225cbcSrjs#ifndef PCI_CHIP_I865_G 201fa225cbcSrjs#define PCI_CHIP_I865_G 0x2572 202fa225cbcSrjs#define PCI_CHIP_I865_G_BRIDGE 0x2570 203fa225cbcSrjs#endif 204fa225cbcSrjs 205fa225cbcSrjs#ifndef PCI_CHIP_I915_G 206fa225cbcSrjs#define PCI_CHIP_I915_G 0x2582 207fa225cbcSrjs#define PCI_CHIP_I915_G_BRIDGE 0x2580 208fa225cbcSrjs#endif 209fa225cbcSrjs 210fa225cbcSrjs#ifndef PCI_CHIP_I915_GM 211fa225cbcSrjs#define PCI_CHIP_I915_GM 0x2592 212fa225cbcSrjs#define PCI_CHIP_I915_GM_BRIDGE 0x2590 213fa225cbcSrjs#endif 214fa225cbcSrjs 215fa225cbcSrjs#ifndef PCI_CHIP_E7221_G 216fa225cbcSrjs#define PCI_CHIP_E7221_G 0x258A 217fa225cbcSrjs/* Same as I915_G_BRIDGE */ 218fa225cbcSrjs#define PCI_CHIP_E7221_G_BRIDGE 0x2580 219fa225cbcSrjs#endif 220fa225cbcSrjs 221fa225cbcSrjs#ifndef PCI_CHIP_I945_G 222fa225cbcSrjs#define PCI_CHIP_I945_G 0x2772 223fa225cbcSrjs#define PCI_CHIP_I945_G_BRIDGE 0x2770 224fa225cbcSrjs#endif 225fa225cbcSrjs 226fa225cbcSrjs#ifndef PCI_CHIP_I945_GM 227fa225cbcSrjs#define PCI_CHIP_I945_GM 0x27A2 228fa225cbcSrjs#define PCI_CHIP_I945_GM_BRIDGE 0x27A0 229fa225cbcSrjs#endif 230fa225cbcSrjs 231fa225cbcSrjs#ifndef PCI_CHIP_I945_GME 232fa225cbcSrjs#define PCI_CHIP_I945_GME 0x27AE 233fa225cbcSrjs#define PCI_CHIP_I945_GME_BRIDGE 0x27AC 234fa225cbcSrjs#endif 235fa225cbcSrjs 236fa225cbcSrjs#ifndef PCI_CHIP_IGD_GM 237fa225cbcSrjs#define PCI_CHIP_IGD_GM 0xA011 238fa225cbcSrjs#define PCI_CHIP_IGD_GM_BRIDGE 0xA010 239fa225cbcSrjs#define PCI_CHIP_IGD_G 0xA001 240fa225cbcSrjs#define PCI_CHIP_IGD_G_BRIDGE 0xA000 241fa225cbcSrjs#endif 242fa225cbcSrjs 243fa225cbcSrjs#ifndef PCI_CHIP_G35_G 244fa225cbcSrjs#define PCI_CHIP_G35_G 0x2982 245fa225cbcSrjs#define PCI_CHIP_G35_G_BRIDGE 0x2980 246fa225cbcSrjs#endif 247fa225cbcSrjs 248fa225cbcSrjs#ifndef PCI_CHIP_I965_Q 249fa225cbcSrjs#define PCI_CHIP_I965_Q 0x2992 250fa225cbcSrjs#define PCI_CHIP_I965_Q_BRIDGE 0x2990 251fa225cbcSrjs#endif 252fa225cbcSrjs 253fa225cbcSrjs#ifndef PCI_CHIP_I965_G 254fa225cbcSrjs#define PCI_CHIP_I965_G 0x29A2 255fa225cbcSrjs#define PCI_CHIP_I965_G_BRIDGE 0x29A0 256fa225cbcSrjs#endif 257fa225cbcSrjs 258fa225cbcSrjs#ifndef PCI_CHIP_I946_GZ 259fa225cbcSrjs#define PCI_CHIP_I946_GZ 0x2972 260fa225cbcSrjs#define PCI_CHIP_I946_GZ_BRIDGE 0x2970 261fa225cbcSrjs#endif 262fa225cbcSrjs 263fa225cbcSrjs#ifndef PCI_CHIP_I965_GM 264fa225cbcSrjs#define PCI_CHIP_I965_GM 0x2A02 265fa225cbcSrjs#define PCI_CHIP_I965_GM_BRIDGE 0x2A00 266fa225cbcSrjs#endif 267fa225cbcSrjs 268fa225cbcSrjs#ifndef PCI_CHIP_I965_GME 269fa225cbcSrjs#define PCI_CHIP_I965_GME 0x2A12 270fa225cbcSrjs#define PCI_CHIP_I965_GME_BRIDGE 0x2A10 271fa225cbcSrjs#endif 272fa225cbcSrjs 273fa225cbcSrjs#ifndef PCI_CHIP_G33_G 274fa225cbcSrjs#define PCI_CHIP_G33_G 0x29C2 275fa225cbcSrjs#define PCI_CHIP_G33_G_BRIDGE 0x29C0 276fa225cbcSrjs#endif 277fa225cbcSrjs 278fa225cbcSrjs#ifndef PCI_CHIP_Q35_G 279fa225cbcSrjs#define PCI_CHIP_Q35_G 0x29B2 280fa225cbcSrjs#define PCI_CHIP_Q35_G_BRIDGE 0x29B0 281fa225cbcSrjs#endif 282fa225cbcSrjs 283fa225cbcSrjs#ifndef PCI_CHIP_Q33_G 284fa225cbcSrjs#define PCI_CHIP_Q33_G 0x29D2 285fa225cbcSrjs#define PCI_CHIP_Q33_G_BRIDGE 0x29D0 286fa225cbcSrjs#endif 287fa225cbcSrjs 288fa225cbcSrjs#ifndef PCI_CHIP_GM45_GM 289fa225cbcSrjs#define PCI_CHIP_GM45_GM 0x2A42 290fa225cbcSrjs#define PCI_CHIP_GM45_BRIDGE 0x2A40 291fa225cbcSrjs#endif 292fa225cbcSrjs 293fa225cbcSrjs#ifndef PCI_CHIP_IGD_E_G 294fa225cbcSrjs#define PCI_CHIP_IGD_E_G 0x2E02 295fa225cbcSrjs#define PCI_CHIP_IGD_E_G_BRIDGE 0x2E00 296fa225cbcSrjs#endif 297fa225cbcSrjs 298fa225cbcSrjs#ifndef PCI_CHIP_G45_G 299fa225cbcSrjs#define PCI_CHIP_G45_G 0x2E22 300fa225cbcSrjs#define PCI_CHIP_G45_G_BRIDGE 0x2E20 301fa225cbcSrjs#endif 302fa225cbcSrjs 303fa225cbcSrjs#ifndef PCI_CHIP_Q45_G 304fa225cbcSrjs#define PCI_CHIP_Q45_G 0x2E12 305fa225cbcSrjs#define PCI_CHIP_Q45_G_BRIDGE 0x2E10 306fa225cbcSrjs#endif 307fa225cbcSrjs 308fa225cbcSrjs#ifndef PCI_CHIP_G41_G 309fa225cbcSrjs#define PCI_CHIP_G41_G 0x2E32 310fa225cbcSrjs#define PCI_CHIP_G41_G_BRIDGE 0x2E30 311fa225cbcSrjs#endif 312fa225cbcSrjs 313fa225cbcSrjs#ifndef PCI_CHIP_B43_G 314fa225cbcSrjs#define PCI_CHIP_B43_G 0x2E42 315fa225cbcSrjs#define PCI_CHIP_B43_G_BRIDGE 0x2E40 316fa225cbcSrjs#endif 317fa225cbcSrjs 318fa225cbcSrjs#ifndef PCI_CHIP_IGDNG_D_G 319fa225cbcSrjs#define PCI_CHIP_IGDNG_D_G 0x0042 320fa225cbcSrjs#define PCI_CHIP_IGDNG_D_G_BRIDGE 0x0040 321fa225cbcSrjs#endif 322fa225cbcSrjs 323fa225cbcSrjs#ifndef PCI_CHIP_IGDNG_M_G 324fa225cbcSrjs#define PCI_CHIP_IGDNG_M_G 0x0046 325fa225cbcSrjs#define PCI_CHIP_IGDNG_M_G_BRIDGE 0x0044 326fa225cbcSrjs#endif 327fa225cbcSrjs 328fa225cbcSrjs#define I810_MEMBASE(p,n) (p)->regions[(n)].base_addr 329fa225cbcSrjs#define VENDOR_ID(p) (p)->vendor_id 330fa225cbcSrjs#define DEVICE_ID(p) (p)->device_id 331fa225cbcSrjs#define SUBVENDOR_ID(p) (p)->subvendor_id 332fa225cbcSrjs#define SUBSYS_ID(p) (p)->subdevice_id 333fa225cbcSrjs#define CHIP_REVISION(p) (p)->revision 334fa225cbcSrjs 335fa225cbcSrjs#define IS_I810(pI810) (DEVICE_ID(pI810->PciInfo) == PCI_CHIP_I810 || \ 336fa225cbcSrjs DEVICE_ID(pI810->PciInfo) == PCI_CHIP_I810_DC100 || \ 337fa225cbcSrjs DEVICE_ID(pI810->PciInfo) == PCI_CHIP_I810_E) 338fa225cbcSrjs#define IS_I815(pI810) (DEVICE_ID(pI810->PciInfo) == PCI_CHIP_I815) 339fa225cbcSrjs#define IS_I830(pI810) (DEVICE_ID(pI810->PciInfo) == PCI_CHIP_I830_M) 340fa225cbcSrjs#define IS_845G(pI810) (DEVICE_ID(pI810->PciInfo) == PCI_CHIP_845_G) 341fa225cbcSrjs#define IS_I85X(pI810) (DEVICE_ID(pI810->PciInfo) == PCI_CHIP_I855_GM) 342fa225cbcSrjs#define IS_I852(pI810) (DEVICE_ID(pI810->PciInfo) == PCI_CHIP_I855_GM && (pI810->variant == I852_GM || pI810->variant == I852_GME)) 343fa225cbcSrjs#define IS_I855(pI810) (DEVICE_ID(pI810->PciInfo) == PCI_CHIP_I855_GM && (pI810->variant == I855_GM || pI810->variant == I855_GME)) 344fa225cbcSrjs#define IS_I865G(pI810) (DEVICE_ID(pI810->PciInfo) == PCI_CHIP_I865_G) 345fa225cbcSrjs 346fa225cbcSrjs#define IS_I915G(pI810) (DEVICE_ID(pI810->PciInfo) == PCI_CHIP_I915_G || DEVICE_ID(pI810->PciInfo) == PCI_CHIP_E7221_G) 347fa225cbcSrjs#define IS_I915GM(pI810) (DEVICE_ID(pI810->PciInfo) == PCI_CHIP_I915_GM) 348fa225cbcSrjs#define IS_I945G(pI810) (DEVICE_ID(pI810->PciInfo) == PCI_CHIP_I945_G) 349fa225cbcSrjs#define IS_I945GM(pI810) (DEVICE_ID(pI810->PciInfo) == PCI_CHIP_I945_GM || DEVICE_ID(pI810->PciInfo) == PCI_CHIP_I945_GME) 350fa225cbcSrjs#define IS_IGDGM(pI810) (DEVICE_ID(pI810->PciInfo) == PCI_CHIP_IGD_GM) 351fa225cbcSrjs#define IS_IGDG(pI810) (DEVICE_ID(pI810->PciInfo) == PCI_CHIP_IGD_G) 352fa225cbcSrjs#define IS_IGD(pI810) (IS_IGDG(pI810) || IS_IGDGM(pI810)) 353fa225cbcSrjs#define IS_GM45(pI810) (DEVICE_ID(pI810->PciInfo) == PCI_CHIP_GM45_GM) 354fa225cbcSrjs#define IS_G4X(pI810) (DEVICE_ID(pI810->PciInfo) == PCI_CHIP_IGD_E_G || DEVICE_ID(pI810->PciInfo) == PCI_CHIP_G45_G || DEVICE_ID(pI810->PciInfo) == PCI_CHIP_Q45_G || DEVICE_ID(pI810->PciInfo) == PCI_CHIP_G41_G || DEVICE_ID(pI810->PciInfo) == PCI_CHIP_B43_G || IS_GM45(pI810)) 355fa225cbcSrjs#define IS_I965GM(pI810) (DEVICE_ID(pI810->PciInfo) == PCI_CHIP_I965_GM || DEVICE_ID(pI810->PciInfo) == PCI_CHIP_I965_GME) 356fa225cbcSrjs#define IS_965_Q(pI810) (DEVICE_ID(pI810->PciInfo) == PCI_CHIP_I965_Q) 357fa225cbcSrjs#define IS_IGDNG_D(pI810) (DEVICE_ID(pI810->PciInfo) == PCI_CHIP_IGDNG_D_G) 358fa225cbcSrjs#define IS_IGDNG_M(pI810) (DEVICE_ID(pI810->PciInfo) == PCI_CHIP_IGDNG_M_G) 359fa225cbcSrjs#define IS_IGDNG(pI810) (IS_IGDNG_D(pI810) || IS_IGDNG_M(pI810)) 360fa225cbcSrjs#define IS_I965G(pI810) (DEVICE_ID(pI810->PciInfo) == PCI_CHIP_I965_G || DEVICE_ID(pI810->PciInfo) == PCI_CHIP_G35_G || DEVICE_ID(pI810->PciInfo) == PCI_CHIP_I965_Q || DEVICE_ID(pI810->PciInfo) == PCI_CHIP_I946_GZ || DEVICE_ID(pI810->PciInfo) == PCI_CHIP_I965_GM || DEVICE_ID(pI810->PciInfo) == PCI_CHIP_I965_GME || IS_G4X(pI810) || IS_IGDNG(pI810)) 361fa225cbcSrjs#define IS_G33CLASS(pI810) (DEVICE_ID(pI810->PciInfo) == PCI_CHIP_G33_G ||\ 362fa225cbcSrjs DEVICE_ID(pI810->PciInfo) == PCI_CHIP_Q35_G ||\ 363fa225cbcSrjs DEVICE_ID(pI810->PciInfo) == PCI_CHIP_Q33_G || \ 364fa225cbcSrjs IS_IGD(pI810)) 365fa225cbcSrjs#define IS_I9XX(pI810) (IS_I915G(pI810) || IS_I915GM(pI810) || IS_I945G(pI810) || IS_I945GM(pI810) || IS_I965G(pI810) || IS_G33CLASS(pI810)) 366fa225cbcSrjs#define IS_I915(pI810) (IS_I915G(pI810) || IS_I915GM(pI810) || IS_I945G(pI810) || IS_I945GM(pI810) || IS_G33CLASS(pI810)) 367fa225cbcSrjs 368fa225cbcSrjs#define IS_MOBILE(pI810) (IS_I830(pI810) || IS_I85X(pI810) || IS_I915GM(pI810) || IS_I945GM(pI810) || IS_I965GM(pI810) || IS_GM45(pI810) || IS_IGD(pI810) || IS_IGDNG_M(pI810)) 369fa225cbcSrjs/* mark chipsets for using gfx VM offset for overlay */ 370fa225cbcSrjs#define OVERLAY_NOPHYSICAL(pI810) (IS_G33CLASS(pI810) || IS_I965G(pI810)) 371fa225cbcSrjs/* mark chipsets without overlay hw */ 372fa225cbcSrjs#define OVERLAY_NOEXIST(pI810) (IS_G4X(pI810) || IS_IGDNG(pI810)) 373fa225cbcSrjs/* chipsets require graphics mem for hardware status page */ 374fa225cbcSrjs#define HWS_NEED_GFX(pI810) (!pI810->use_drm_mode && \ 375fa225cbcSrjs (IS_G33CLASS(pI810) ||\ 376fa225cbcSrjs IS_G4X(pI810) || IS_IGDNG(pI810))) 377fa225cbcSrjs/* chipsets require status page in non stolen memory */ 378fa225cbcSrjs#define HWS_NEED_NONSTOLEN(pI810) (IS_G4X(pI810) || IS_IGDNG(pI810)) 379fa225cbcSrjs#define SUPPORTS_INTEGRATED_HDMI(pI810) (IS_G4X(pI810) || IS_IGDNG(pI810)) 380fa225cbcSrjs/* dsparb controlled by hw only */ 381fa225cbcSrjs#define DSPARB_HWCONTROL(pI810) (IS_G4X(pI810) || IS_IGDNG(pI810)) 382fa225cbcSrjs/* supports Y tiled surfaces (pre-965 Mesa isn't ready yet) */ 383fa225cbcSrjs#define SUPPORTS_YTILING(pI810) (IS_I965G(pI830)) 384fa225cbcSrjs 385fa225cbcSrjs#define GTT_PAGE_SIZE KB(4) 386fa225cbcSrjs#define ROUND_TO(x, y) (((x) + (y) - 1) / (y) * (y)) 387fa225cbcSrjs#define ROUND_DOWN_TO(x, y) ((x) / (y) * (y)) 388fa225cbcSrjs#define ROUND_TO_PAGE(x) ROUND_TO((x), GTT_PAGE_SIZE) 389fa225cbcSrjs#define ROUND_TO_MB(x) ROUND_TO((x), MB(1)) 390fa225cbcSrjs#define PRIMARY_RINGBUFFER_SIZE KB(128) 391fa225cbcSrjs#define MIN_SCRATCH_BUFFER_SIZE KB(16) 392fa225cbcSrjs#define MAX_SCRATCH_BUFFER_SIZE KB(64) 393fa225cbcSrjs#define HWCURSOR_SIZE GTT_PAGE_SIZE 394fa225cbcSrjs#define HWCURSOR_SIZE_ARGB GTT_PAGE_SIZE * 4 395fa225cbcSrjs#define OVERLAY_SIZE GTT_PAGE_SIZE 396fa225cbcSrjs 397fa225cbcSrjs/* Use a 64x64 HW cursor */ 398fa225cbcSrjs#define I810_CURSOR_X 64 399fa225cbcSrjs#define I810_CURSOR_Y I810_CURSOR_X 400fa225cbcSrjs 401fa225cbcSrjs#define PIPE_NAME(n) ('A' + (n)) 402fa225cbcSrjs 403fa225cbcSrjsstruct pci_device * 404fa225cbcSrjsintel_host_bridge (void); 405fa225cbcSrjs 406fa225cbcSrjs#endif /* _INTEL_COMMON_H_ */ 407