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 isaBusId bus.id.isa
|
---|
95 | #define sbusBusId bus.id.sbus
|
---|
96 |
|
---|
97 | struct x_BusAccRec;
|
---|
98 | typedef void (*BusAccProcPtr)(struct x_BusAccRec *ptr);
|
---|
99 |
|
---|
100 | typedef struct x_BusAccRec {
|
---|
101 | BusAccProcPtr set_f;
|
---|
102 | BusAccProcPtr enable_f;
|
---|
103 | BusAccProcPtr disable_f;
|
---|
104 | BusAccProcPtr save_f;
|
---|
105 | BusAccProcPtr restore_f;
|
---|
106 | struct x_BusAccRec *current; /* pointer to bridge open on this bus */
|
---|
107 | struct x_BusAccRec *primary; /* pointer to the bus connecting to this */
|
---|
108 | struct x_BusAccRec *next; /* this links the different buses together */
|
---|
109 | BusType type;
|
---|
110 | BusType busdep_type;
|
---|
111 | /* Bus-specific fields */
|
---|
112 | union {
|
---|
113 | struct {
|
---|
114 | int bus;
|
---|
115 | int primary_bus;
|
---|
116 | struct pci_device * dev;
|
---|
117 | pciBridgesSave save;
|
---|
118 | } pci;
|
---|
119 | } busdep;
|
---|
120 | } BusAccRec, *BusAccPtr;
|
---|
121 |
|
---|
122 | /* state change notification callback */
|
---|
123 | typedef struct _stateChange {
|
---|
124 | xf86StateChangeNotificationCallbackFunc func;
|
---|
125 | pointer arg;
|
---|
126 | struct _stateChange *next;
|
---|
127 | } StateChangeNotificationRec, *StateChangeNotificationPtr;
|
---|
128 |
|
---|
129 |
|
---|
130 | extern EntityPtr *xf86Entities;
|
---|
131 | extern int xf86NumEntities;
|
---|
132 | extern xf86AccessRec AccessNULL;
|
---|
133 | extern BusRec primaryBus;
|
---|
134 | extern resPtr Acc;
|
---|
135 | extern resPtr ResRange;
|
---|
136 | extern BusAccPtr xf86BusAccInfo;
|
---|
137 |
|
---|
138 | int xf86AllocateEntity(void);
|
---|
139 | BusType StringToBusType(const char* busID, const char **retID);
|
---|
140 | Bool xf86IsSubsetOf(resRange range, resPtr list);
|
---|
141 | resPtr xf86ExtractTypeFromList(resPtr list, unsigned long type);
|
---|
142 | resPtr xf86FindIntersect(resRange Range, resPtr list);
|
---|
143 |
|
---|
144 | #endif /* _XF86_BUS_H */
|
---|