1fa225cbcSrjs/* 2fa225cbcSrjs * Copyright © 2007 Intel Corporation 3fa225cbcSrjs * 4fa225cbcSrjs * Permission is hereby granted, free of charge, to any person obtaining a 5fa225cbcSrjs * copy of this software and associated documentation files (the "Software"), 6fa225cbcSrjs * to deal in the Software without restriction, including without limitation 7fa225cbcSrjs * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8fa225cbcSrjs * and/or sell copies of the Software, and to permit persons to whom the 9fa225cbcSrjs * Software is furnished to do so, subject to the following conditions: 10fa225cbcSrjs * 11fa225cbcSrjs * The above copyright notice and this permission notice (including the next 12fa225cbcSrjs * paragraph) shall be included in all copies or substantial portions of the 13fa225cbcSrjs * Software. 14fa225cbcSrjs * 15fa225cbcSrjs * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16fa225cbcSrjs * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17fa225cbcSrjs * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18fa225cbcSrjs * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19fa225cbcSrjs * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20fa225cbcSrjs * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 21fa225cbcSrjs * DEALINGS IN THE SOFTWARE. 22fa225cbcSrjs * 23fa225cbcSrjs * Authors: 24fa225cbcSrjs * Eric Anholt <eric@anholt.net> 25fa225cbcSrjs * 26fa225cbcSrjs */ 27fa225cbcSrjs 28fa225cbcSrjs#include <inttypes.h> 29fa225cbcSrjs#include <string.h> 30fa225cbcSrjs#include <stdlib.h> 31fa225cbcSrjs#include <stdio.h> 32fa225cbcSrjs#include <pciaccess.h> 33fa225cbcSrjs#include "common.h" 34fa225cbcSrjs 35fa225cbcSrjs/** @file 36fa225cbcSrjs * This file defines the typedefs and stub structures necessary for us to 37fa225cbcSrjs * use i830_debug.c mostly unmodified. 38fa225cbcSrjs */ 39fa225cbcSrjs 40fa225cbcSrjstypedef char Bool; 41fa225cbcSrjs 42fa225cbcSrjs#define FALSE 0 43fa225cbcSrjs#define TRUE 1 44fa225cbcSrjs 45fa225cbcSrjs#define X_INFO 0 46fa225cbcSrjs#define X_WARNING 1 47fa225cbcSrjs#define X_ERROR 2 48fa225cbcSrjs 49fa225cbcSrjstypedef struct _i830 { 50fa225cbcSrjs /* Fields in common with the real pI830 */ 51fa225cbcSrjs struct pci_device *PciInfo; 52fa225cbcSrjs Bool use_drm_mode; 53fa225cbcSrjs 54fa225cbcSrjs /* Fields used for setting up reg_dumper */ 55fa225cbcSrjs volatile unsigned char *mmio; 56fa225cbcSrjs} I830Rec, *I830Ptr; 57fa225cbcSrjs 58fa225cbcSrjstypedef struct _scrn { 59fa225cbcSrjs /* Fields in common with the real pScrn */ 60fa225cbcSrjs int scrnIndex; 61fa225cbcSrjs 62fa225cbcSrjs /* Fields used for setting up reg_dumper */ 63fa225cbcSrjs I830Ptr pI830; 64fa225cbcSrjs} ScrnInfoRec, *ScrnInfoPtr; 65fa225cbcSrjs 66fa225cbcSrjs#define I830PTR(pScrn) (pScrn->pI830) 67fa225cbcSrjs 68fa225cbcSrjs#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) 69fa225cbcSrjs 70fa225cbcSrjs#define INREG8(reg) (*(volatile uint8_t *)((pI830)->mmio + (reg))) 71fa225cbcSrjs#define INREG16(reg) (*(volatile uint16_t *)((pI830)->mmio + (reg))) 72fa225cbcSrjs#define INREG(reg) (*(volatile uint32_t *)((pI830)->mmio + (reg))) 73fa225cbcSrjs#define OUTREG8(reg, val) \ 74fa225cbcSrjs *(volatile uint8_t *)((pI830)->mmio + (reg)) = (val) 75fa225cbcSrjs#define OUTREG16(reg, val) \ 76fa225cbcSrjs *(volatile uint16_t *)((pI830)->mmio + (reg)) = (val) 77fa225cbcSrjs#define OUTREG(reg, val) \ 78fa225cbcSrjs *(volatile uint32_t *)((pI830)->mmio + (reg)) = (val) 79fa225cbcSrjs 80fa225cbcSrjs#define xalloc malloc 81fa225cbcSrjs#define xfree free 82fa225cbcSrjs#define ErrorF printf 83fa225cbcSrjs 84fa225cbcSrjschar *XNFprintf(const char *format, ...); 85fa225cbcSrjsvoid xf86DrvMsg(int scrnIndex, int severity, const char *format, ...); 86fa225cbcSrjsvoid i830DumpRegs(ScrnInfoPtr pScrn); 87fa225cbcSrjsvoid intel_i830rec_init(I830Ptr pI830); 88