1 | /* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Bus.h,v 1.21 2002/11/25 14:04:56 eich Exp $ */
|
---|
2 | /*
|
---|
3 | * Copyright (c) 1997 by The XFree86 Project, Inc.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * This file contains definitions of the bus-related data structures/types.
|
---|
8 | * Everything contained here is private to xf86Bus.c. In particular the
|
---|
9 | * video drivers must not include this file.
|
---|
10 | */
|
---|
11 |
|
---|
12 | #ifndef _XF86_BUS_H
|
---|
13 | #define _XF86_BUS_H
|
---|
14 |
|
---|
15 | #include "xf86pciBus.h"
|
---|
16 | #ifdef __sparc__
|
---|
17 | #include "xf86sbusBus.h"
|
---|
18 | #endif
|
---|
19 |
|
---|
20 | typedef struct racInfo {
|
---|
21 | xf86AccessPtr mem_new;
|
---|
22 | xf86AccessPtr io_new;
|
---|
23 | xf86AccessPtr io_mem_new;
|
---|
24 | xf86SetAccessFuncPtr old;
|
---|
25 | } AccessFuncRec, *AccessFuncPtr;
|
---|
26 |
|
---|
27 |
|
---|
28 | typedef struct {
|
---|
29 | DriverPtr driver;
|
---|
30 | int chipset;
|
---|
31 | int entityProp;
|
---|
32 | EntityProc entityInit;
|
---|
33 | EntityProc entityEnter;
|
---|
34 | EntityProc entityLeave;
|
---|
35 | pointer private;
|
---|
36 | resPtr resources;
|
---|
37 | Bool active;
|
---|
38 | Bool inUse;
|
---|
39 | BusRec bus;
|
---|
40 | EntityAccessPtr access;
|
---|
41 | AccessFuncPtr rac;
|
---|
42 | pointer busAcc;
|
---|
43 | int lastScrnFlag;
|
---|
44 | DevUnion * entityPrivates;
|
---|
45 | int numInstances;
|
---|
46 | GDevPtr * devices;
|
---|
47 | IOADDRESS domainIO;
|
---|
48 | } EntityRec, *EntityPtr;
|
---|
49 |
|
---|
50 | /* asynchronous event handling */
|
---|
51 | #ifdef async
|
---|
52 | typedef struct _AsyncQRec {
|
---|
53 | void (*func)(pointer);
|
---|
54 | pointer arg;
|
---|
55 | struct _AsyncQRec *next;
|
---|
56 | } AsyncQRec, *AsyncQPtr;
|
---|
57 | #endif
|
---|
58 |
|
---|
59 | #define NO_SEPARATE_IO_FROM_MEM 0x0001
|
---|
60 | #define NO_SEPARATE_MEM_FROM_IO 0x0002
|
---|
61 | #define NEED_VGA_ROUTED 0x0004
|
---|
62 | #define NEED_VGA_ROUTED_SETUP 0x0008
|
---|
63 | #define NEED_MEM 0x0010
|
---|
64 | #define NEED_IO 0x0020
|
---|
65 | #define NEED_MEM_SHARED 0x0040
|
---|
66 | #define NEED_IO_SHARED 0x0080
|
---|
67 | #define ACCEL_IS_SHARABLE 0x0100
|
---|
68 | #define IS_SHARED_ACCEL 0x0200
|
---|
69 | #define SA_PRIM_INIT_DONE 0x0400
|
---|
70 | #define NEED_VGA_MEM 0x1000
|
---|
71 | #define NEED_VGA_IO 0x2000
|
---|
72 |
|
---|
73 | #define NEED_SHARED (NEED_MEM_SHARED | NEED_IO_SHARED)
|
---|
74 |
|
---|
75 | #define busType bus.type
|
---|
76 | #define pciBusId bus.id.pci
|
---|
77 | #define isaBusId bus.id.isa
|
---|
78 | #define sbusBusId bus.id.sbus
|
---|
79 |
|
---|
80 | struct x_BusAccRec;
|
---|
81 | typedef void (*BusAccProcPtr)(struct x_BusAccRec *ptr);
|
---|
82 |
|
---|
83 | typedef struct x_BusAccRec {
|
---|
84 | BusAccProcPtr set_f;
|
---|
85 | BusAccProcPtr enable_f;
|
---|
86 | BusAccProcPtr disable_f;
|
---|
87 | BusAccProcPtr save_f;
|
---|
88 | BusAccProcPtr restore_f;
|
---|
89 | struct x_BusAccRec *current; /* pointer to bridge open on this bus */
|
---|
90 | struct x_BusAccRec *primary; /* pointer to the bus connecting to this */
|
---|
91 | struct x_BusAccRec *next; /* this links the different buses together */
|
---|
92 | BusType type;
|
---|
93 | BusType busdep_type;
|
---|
94 | /* Bus-specific fields */
|
---|
95 | union {
|
---|
96 | struct {
|
---|
97 | int bus;
|
---|
98 | int primary_bus;
|
---|
99 | PCITAG acc;
|
---|
100 | pciBridgesSave save;
|
---|
101 | void (*func)(PCITAG,int,CARD32,CARD32);
|
---|
102 | } pci;
|
---|
103 | } busdep;
|
---|
104 | } BusAccRec, *BusAccPtr;
|
---|
105 |
|
---|
106 | /* state change notification callback */
|
---|
107 | typedef struct _stateChange {
|
---|
108 | xf86StateChangeNotificationCallbackFunc func;
|
---|
109 | pointer arg;
|
---|
110 | struct _stateChange *next;
|
---|
111 | } StateChangeNotificationRec, *StateChangeNotificationPtr;
|
---|
112 |
|
---|
113 |
|
---|
114 | extern EntityPtr *xf86Entities;
|
---|
115 | extern int xf86NumEntities;
|
---|
116 | extern xf86AccessRec AccessNULL;
|
---|
117 | extern BusRec primaryBus;
|
---|
118 | extern resPtr Acc;
|
---|
119 | extern resPtr osRes;
|
---|
120 | extern resPtr ResRange;
|
---|
121 | extern BusAccPtr xf86BusAccInfo;
|
---|
122 |
|
---|
123 | int xf86AllocateEntity(void);
|
---|
124 | BusType StringToBusType(const char* busID, const char **retID);
|
---|
125 | memType ChkConflict(resRange *rgp, resPtr res, xf86State state);
|
---|
126 | Bool xf86IsSubsetOf(resRange range, resPtr list);
|
---|
127 | Bool xf86IsListSubsetOf(resPtr list, resPtr BaseList);
|
---|
128 | resPtr xf86ExtractTypeFromList(resPtr list, unsigned long type);
|
---|
129 | resPtr findIntersect(resRange Range, resPtr list);
|
---|
130 | resPtr xf86FindIntersect(resRange Range, resPtr list);
|
---|
131 | void RemoveOverlaps(resPtr target, resPtr list, Bool pow2Alignment,
|
---|
132 | Bool useEstimated);
|
---|
133 | void xf86ConvertListToHost(int entityIndex, resPtr list);
|
---|
134 |
|
---|
135 | #endif /* _XF86_BUS_H */
|
---|