1 | /* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Bus.h,v 1.23 2003/08/24 17:36:50 dawes Exp $ */
|
---|
2 |
|
---|
3 | /*
|
---|
4 | * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
|
---|
5 | *
|
---|
6 | * Permission is hereby granted, free of charge, to any person obtaining a
|
---|
7 | * copy of this software and associated documentation files (the "Software"),
|
---|
8 | * to deal in the Software without restriction, including without limitation
|
---|
9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
---|
10 | * and/or sell copies of the Software, and to permit persons to whom the
|
---|
11 | * Software is furnished to do so, subject to the following conditions:
|
---|
12 | *
|
---|
13 | * The above copyright notice and this permission notice shall be included in
|
---|
14 | * all copies or substantial portions of the Software.
|
---|
15 | *
|
---|
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
---|
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
---|
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
---|
19 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
---|
20 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
---|
21 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
---|
22 | * OTHER DEALINGS IN THE SOFTWARE.
|
---|
23 | *
|
---|
24 | * Except as contained in this notice, the name of the copyright holder(s)
|
---|
25 | * and author(s) shall not be used in advertising or otherwise to promote
|
---|
26 | * the sale, use or other dealings in this Software without prior written
|
---|
27 | * authorization from the copyright holder(s) and author(s).
|
---|
28 | */
|
---|
29 |
|
---|
30 | /*
|
---|
31 | * This file contains definitions of the bus-related data structures/types.
|
---|
32 | * Everything contained here is private to xf86Bus.c. In particular the
|
---|
33 | * video drivers must not include this file.
|
---|
34 | */
|
---|
35 |
|
---|
36 | #ifdef HAVE_XORG_CONFIG_H
|
---|
37 | #include <xorg-config.h>
|
---|
38 | #endif
|
---|
39 |
|
---|
40 | #ifndef _XF86_BUS_H
|
---|
41 | #define _XF86_BUS_H
|
---|
42 |
|
---|
43 | #include "xf86pciBus.h"
|
---|
44 | #ifdef __sparc__
|
---|
45 | #include "xf86sbusBus.h"
|
---|
46 | #endif
|
---|
47 |
|
---|
48 | typedef struct racInfo {
|
---|
49 | xf86AccessPtr mem_new;
|
---|
50 | xf86AccessPtr io_new;
|
---|
51 | xf86AccessPtr io_mem_new;
|
---|
52 | xf86SetAccessFuncPtr old;
|
---|
53 | } AccessFuncRec, *AccessFuncPtr;
|
---|
54 |
|
---|
55 |
|
---|
56 | typedef struct {
|
---|
57 | DriverPtr driver;
|
---|
58 | int chipset;
|
---|
59 | int entityProp;
|
---|
60 | EntityProc entityInit;
|
---|
61 | EntityProc entityEnter;
|
---|
62 | EntityProc entityLeave;
|
---|
63 | pointer private;
|
---|
64 | resPtr resources;
|
---|
65 | Bool active;
|
---|
66 | Bool inUse;
|
---|
67 | BusRec bus;
|
---|
68 | EntityAccessPtr access;
|
---|
69 | AccessFuncPtr rac;
|
---|
70 | pointer busAcc;
|
---|
71 | int lastScrnFlag;
|
---|
72 | DevUnion * entityPrivates;
|
---|
73 | int numInstances;
|
---|
74 | GDevPtr * devices;
|
---|
75 | IOADDRESS domainIO;
|
---|
76 | } EntityRec, *EntityPtr;
|
---|
77 |
|
---|
78 | /* asynchronous event handling */
|
---|
79 | #ifdef async
|
---|
80 | typedef struct _AsyncQRec {
|
---|
81 | void (*func)(pointer);
|
---|
82 | pointer arg;
|
---|
83 | struct _AsyncQRec *next;
|
---|
84 | } AsyncQRec, *AsyncQPtr;
|
---|
85 | #endif
|
---|
86 |
|
---|
87 | #define NO_SEPARATE_IO_FROM_MEM 0x0001
|
---|
88 | #define NO_SEPARATE_MEM_FROM_IO 0x0002
|
---|
89 | #define NEED_VGA_ROUTED 0x0004
|
---|
90 | #define NEED_VGA_ROUTED_SETUP 0x0008
|
---|
91 | #define NEED_MEM 0x0010
|
---|
92 | #define NEED_IO 0x0020
|
---|
93 | #define NEED_MEM_SHARED 0x0040
|
---|
94 | #define NEED_IO_SHARED 0x0080
|
---|
95 | #define ACCEL_IS_SHARABLE 0x0100
|
---|
96 | #define IS_SHARED_ACCEL 0x0200
|
---|
97 | #define SA_PRIM_INIT_DONE 0x0400
|
---|
98 | #define NEED_VGA_MEM 0x1000
|
---|
99 | #define NEED_VGA_IO 0x2000
|
---|
100 |
|
---|
101 | #define NEED_SHARED (NEED_MEM_SHARED | NEED_IO_SHARED)
|
---|
102 |
|
---|
103 | #define busType bus.type
|
---|
104 | #define pciBusId bus.id.pci
|
---|
105 | #define isaBusId bus.id.isa
|
---|
106 | #define sbusBusId bus.id.sbus
|
---|
107 |
|
---|
108 | struct x_BusAccRec;
|
---|
109 | typedef void (*BusAccProcPtr)(struct x_BusAccRec *ptr);
|
---|
110 |
|
---|
111 | typedef struct x_BusAccRec {
|
---|
112 | BusAccProcPtr set_f;
|
---|
113 | BusAccProcPtr enable_f;
|
---|
114 | BusAccProcPtr disable_f;
|
---|
115 | BusAccProcPtr save_f;
|
---|
116 | BusAccProcPtr restore_f;
|
---|
117 | struct x_BusAccRec *current; /* pointer to bridge open on this bus */
|
---|
118 | struct x_BusAccRec *primary; /* pointer to the bus connecting to this */
|
---|
119 | struct x_BusAccRec *next; /* this links the different buses together */
|
---|
120 | BusType type;
|
---|
121 | BusType busdep_type;
|
---|
122 | /* Bus-specific fields */
|
---|
123 | union {
|
---|
124 | struct {
|
---|
125 | int bus;
|
---|
126 | int primary_bus;
|
---|
127 | PCITAG acc;
|
---|
128 | pciBridgesSave save;
|
---|
129 | } pci;
|
---|
130 | } busdep;
|
---|
131 | } BusAccRec, *BusAccPtr;
|
---|
132 |
|
---|
133 | /* state change notification callback */
|
---|
134 | typedef struct _stateChange {
|
---|
135 | xf86StateChangeNotificationCallbackFunc func;
|
---|
136 | pointer arg;
|
---|
137 | struct _stateChange *next;
|
---|
138 | } StateChangeNotificationRec, *StateChangeNotificationPtr;
|
---|
139 |
|
---|
140 |
|
---|
141 | extern EntityPtr *xf86Entities;
|
---|
142 | extern int xf86NumEntities;
|
---|
143 | extern xf86AccessRec AccessNULL;
|
---|
144 | extern BusRec primaryBus;
|
---|
145 | extern resPtr Acc;
|
---|
146 | extern resPtr osRes;
|
---|
147 | extern resPtr ResRange;
|
---|
148 | extern BusAccPtr xf86BusAccInfo;
|
---|
149 |
|
---|
150 | int xf86AllocateEntity(void);
|
---|
151 | BusType StringToBusType(const char* busID, const char **retID);
|
---|
152 | memType ChkConflict(resRange *rgp, resPtr res, xf86State state);
|
---|
153 | Bool xf86IsSubsetOf(resRange range, resPtr list);
|
---|
154 | Bool xf86IsListSubsetOf(resPtr list, resPtr BaseList);
|
---|
155 | resPtr xf86ExtractTypeFromList(resPtr list, unsigned long type);
|
---|
156 | resPtr findIntersect(resRange Range, resPtr list);
|
---|
157 | resPtr xf86FindIntersect(resRange Range, resPtr list);
|
---|
158 | void RemoveOverlaps(resPtr target, resPtr list, Bool pow2Alignment,
|
---|
159 | Bool useEstimated);
|
---|
160 | void xf86ConvertListToHost(int entityIndex, resPtr list);
|
---|
161 |
|
---|
162 | #endif /* _XF86_BUS_H */
|
---|