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