i740_io.c revision 301ea0f4
1/************************************************************************** 2 3Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. 4All Rights Reserved. 5 6Permission is hereby granted, free of charge, to any person obtaining a 7copy of this software and associated documentation files (the 8"Software"), to deal in the Software without restriction, including 9without limitation the rights to use, copy, modify, merge, publish, 10distribute, sub license, and/or sell copies of the Software, and to 11permit persons to whom the Software is furnished to do so, subject to 12the following conditions: 13 14The above copyright notice and this permission notice (including the 15next paragraph) shall be included in all copies or substantial portions 16of the Software. 17 18THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 19OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 21IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR 22ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 26**************************************************************************/ 27/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i740/i740_io.c,v 1.4 2002/01/25 21:56:03 tsi Exp $ */ 28 29/* 30 * Authors: 31 * Daryll Strauss <daryll@precisioninsight.com> 32 * 33 */ 34 35#ifdef HAVE_CONFIG_H 36#include "config.h" 37#endif 38 39#include "xf86.h" 40#include "xf86_OSproc.h" 41#include "compiler.h" 42#include "vgaHW.h" 43 44#include "xf86xv.h" 45#include "i740.h" 46 47static void I740WriteControlPIO(I740Ptr pI740, int addr, unsigned char index, char val) { 48 outb(addr, index); 49 outb(addr+1, val); 50} 51 52static char I740ReadControlPIO(I740Ptr pI740, int addr, unsigned char index) { 53 outb(addr, index); 54 return inb(addr+1); 55} 56 57static void I740WriteStandardPIO(I740Ptr pI740, int addr, unsigned char val) { 58 outb(addr, val); 59} 60 61static char I740ReadStandardPIO(I740Ptr pI740, int addr) { 62 return inb(addr); 63} 64 65void I740SetPIOAccess(I740Ptr pI740) { 66 pI740->writeControl=I740WriteControlPIO; 67 pI740->readControl=I740ReadControlPIO; 68 pI740->writeStandard=I740WriteStandardPIO; 69 pI740->readStandard=I740ReadStandardPIO; 70} 71 72static void I740WriteControlMMIO(I740Ptr pI740, int addr, unsigned char index, char val) { 73 moutb(addr, index); 74 moutb(addr+1, val); 75} 76 77static char I740ReadControlMMIO(I740Ptr pI740, int addr, unsigned char index) { 78 moutb(addr, index); 79 return minb(addr+1); 80} 81 82static void I740WriteStandardMMIO(I740Ptr pI740, int addr, unsigned char val) { 83 moutb(addr, val); 84} 85 86static char I740ReadStandardMMIO(I740Ptr pI740, int addr) { 87 return minb(addr); 88} 89 90void I740SetMMIOAccess(I740Ptr pI740) { 91 pI740->writeControl=I740WriteControlMMIO; 92 pI740->readControl=I740ReadControlMMIO; 93 pI740->writeStandard=I740WriteStandardMMIO; 94 pI740->readStandard=I740ReadStandardMMIO; 95} 96 97