17e6fb56fSmrg/* 2963d66acSmrg * Copyright 2005-2015 The Openchrome Project 3983b4bf2Smrg * [https://www.freedesktop.org/wiki/Openchrome] 47e6fb56fSmrg * Copyright 2004-2005 The Unichrome Project [unichrome.sf.net] 57e6fb56fSmrg * 67e6fb56fSmrg * Permission is hereby granted, free of charge, to any person obtaining a 77e6fb56fSmrg * copy of this software and associated documentation files (the "Software"), 87e6fb56fSmrg * to deal in the Software without restriction, including without limitation 97e6fb56fSmrg * the rights to use, copy, modify, merge, publish, distribute, sub license, 107e6fb56fSmrg * and/or sell copies of the Software, and to permit persons to whom the 117e6fb56fSmrg * Software is furnished to do so, subject to the following conditions: 127e6fb56fSmrg * 137e6fb56fSmrg * The above copyright notice and this permission notice (including the 147e6fb56fSmrg * next paragraph) shall be included in all copies or substantial portions 157e6fb56fSmrg * of the Software. 167e6fb56fSmrg * 177e6fb56fSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 187e6fb56fSmrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 197e6fb56fSmrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 207e6fb56fSmrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 217e6fb56fSmrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 227e6fb56fSmrg * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 237e6fb56fSmrg * DEALINGS IN THE SOFTWARE. 247e6fb56fSmrg */ 257e6fb56fSmrg 267e6fb56fSmrg/* 277e6fb56fSmrg * A big structure with card-ID information, plus some checking functions. 287e6fb56fSmrg */ 297e6fb56fSmrg 307e6fb56fSmrg#ifdef HAVE_CONFIG_H 317e6fb56fSmrg#include "config.h" 327e6fb56fSmrg#endif 337e6fb56fSmrg 347e6fb56fSmrg#include "via_driver.h" 357e6fb56fSmrg 3690b17f1bSmrgstatic void 377e6fb56fSmrgViaDoubleCheckCLE266Revision(ScrnInfoPtr pScrn) 387e6fb56fSmrg{ 397e6fb56fSmrg vgaHWPtr hwp = VGAHWPTR(pScrn); 407e6fb56fSmrg VIAPtr pVia = VIAPTR(pScrn); 417e6fb56fSmrg /* Crtc 0x4F is only defined in CLE266Cx */ 427e6fb56fSmrg CARD8 tmp = hwp->readCrtc(hwp, 0x4F); 4390b17f1bSmrg 447e6fb56fSmrg hwp->writeCrtc(hwp, 0x4F, 0x55); 457e6fb56fSmrg if (hwp->readCrtc(hwp, 0x4F) == 0x55) { 4690b17f1bSmrg if (CLE266_REV_IS_AX(pVia->ChipRev)) 4790b17f1bSmrg xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "CLE266 Revision seems" 4890b17f1bSmrg " to be Cx, yet %d was detected previously.\n", 4990b17f1bSmrg pVia->ChipRev); 507e6fb56fSmrg } else { 5190b17f1bSmrg if (CLE266_REV_IS_CX(pVia->ChipRev)) 5290b17f1bSmrg xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "CLE266 Revision seems" 5390b17f1bSmrg " to be Ax, yet %d was detected previously.\n", 5490b17f1bSmrg pVia->ChipRev); 557e6fb56fSmrg } 567e6fb56fSmrg hwp->writeCrtc(hwp, 0x4F, tmp); 577e6fb56fSmrg} 58