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
28/*
29 * Authors:
30 *   Daryll Strauss <daryll@precisioninsight.com>
31 *
32 */
33
34#ifdef HAVE_CONFIG_H
35#include "config.h"
36#endif
37
38#include "xf86.h"
39#include "xf86_OSproc.h"
40#include "compiler.h"
41#include "vgaHW.h"
42
43#include "xf86xv.h"
44#include "i740.h"
45
46static void I740WriteControlPIO(I740Ptr pI740, int addr, unsigned char index, char val) {
47  outb(addr, index);
48  outb(addr+1, val);
49}
50
51static char I740ReadControlPIO(I740Ptr pI740, int addr, unsigned char index) {
52  outb(addr, index);
53  return inb(addr+1);
54}
55
56static void I740WriteStandardPIO(I740Ptr pI740, int addr, unsigned char val) {
57  outb(addr, val);
58}
59
60static char I740ReadStandardPIO(I740Ptr pI740, int addr) {
61  return inb(addr);
62}
63
64void I740SetPIOAccess(I740Ptr pI740) {
65  pI740->writeControl=I740WriteControlPIO;
66  pI740->readControl=I740ReadControlPIO;
67  pI740->writeStandard=I740WriteStandardPIO;
68  pI740->readStandard=I740ReadStandardPIO;
69}
70
71static void I740WriteControlMMIO(I740Ptr pI740, int addr, unsigned char index, char val) {
72  moutb(addr, index);
73  moutb(addr+1, val);
74}
75
76static char I740ReadControlMMIO(I740Ptr pI740, int addr, unsigned char index) {
77  moutb(addr, index);
78  return minb(addr+1);
79}
80
81static void I740WriteStandardMMIO(I740Ptr pI740, int addr, unsigned char val) {
82  moutb(addr, val);
83}
84
85static char I740ReadStandardMMIO(I740Ptr pI740, int addr) {
86  return minb(addr);
87}
88
89void I740SetMMIOAccess(I740Ptr pI740) {
90  pI740->writeControl=I740WriteControlMMIO;
91  pI740->readControl=I740ReadControlMMIO;
92  pI740->writeStandard=I740WriteStandardMMIO;
93  pI740->readStandard=I740ReadStandardMMIO;
94}
95
96