1/*
2 * SBUS bus-specific declarations
3 *
4 * Copyright (C) 2000 Jakub Jelinek (jakub@redhat.com)
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * 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 * JAKUB JELINEK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
20 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 */
23
24#ifndef _XF86_SBUSBUS_H
25#define _XF86_SBUSBUS_H
26
27#include "xf86str.h"
28
29#define SBUS_DEVICE_BW2		0x0001
30#define SBUS_DEVICE_CG2		0x0002
31#define SBUS_DEVICE_CG3		0x0003
32#define SBUS_DEVICE_CG4		0x0004
33#define SBUS_DEVICE_CG6		0x0005
34#define SBUS_DEVICE_CG8		0x0006
35#define SBUS_DEVICE_CG12	0x0007
36#define SBUS_DEVICE_CG14	0x0008
37#define SBUS_DEVICE_LEO		0x0009
38#define SBUS_DEVICE_TCX		0x000a
39#define SBUS_DEVICE_FFB		0x000b
40#define SBUS_DEVICE_GT		0x000c
41#define SBUS_DEVICE_MGX		0x000d
42#define SBUS_DEVICE_P9100	0x000e
43#define SBUS_DEVICE_AG10E	0x000f
44
45typedef struct sbus_prom_node {
46    int node;
47    /* Because of misdesigned openpromio */
48    int cookie[2];
49} sbusPromNode, *sbusPromNodePtr;
50
51typedef struct sbus_device {
52    int devId;
53    int fbNum;
54    int fd;
55    int width, height;
56    sbusPromNode node;
57    const char *descr;
58    const char *device;
59} sbusDevice, *sbusDevicePtr;
60
61struct sbus_devtable {
62    int devId;
63    int fbType;
64    const char *promName;
65    const char *driverName;
66    const char *descr;
67};
68
69extern _X_EXPORT void xf86SbusProbe(void);
70extern _X_EXPORT sbusDevicePtr *xf86SbusInfo;
71extern _X_EXPORT struct sbus_devtable sbusDeviceTable[];
72
73extern _X_EXPORT int xf86MatchSbusInstances(const char *driverName,
74                                            int sbusDevId, GDevPtr * devList,
75                                            int numDevs, DriverPtr drvp,
76                                            int **foundEntities);
77extern _X_EXPORT sbusDevicePtr xf86GetSbusInfoForEntity(int entityIndex);
78extern _X_EXPORT int xf86GetEntityForSbusInfo(sbusDevicePtr psdp);
79extern _X_EXPORT void xf86SbusUseBuiltinMode(ScrnInfoPtr pScrn,
80                                             sbusDevicePtr psdp);
81extern _X_EXPORT void *xf86MapSbusMem(sbusDevicePtr psdp,
82                                        unsigned long offset,
83                                        unsigned long size);
84extern _X_EXPORT void xf86UnmapSbusMem(sbusDevicePtr psdp, void *addr,
85                                       unsigned long size);
86extern _X_EXPORT void xf86SbusHideOsHwCursor(sbusDevicePtr psdp);
87extern _X_EXPORT void xf86SbusSetOsHwCursorCmap(sbusDevicePtr psdp, int bg,
88                                                int fg);
89extern _X_EXPORT Bool xf86SbusHandleColormaps(ScreenPtr pScreen,
90                                              sbusDevicePtr psdp);
91
92extern _X_EXPORT int promRootNode;
93
94extern _X_EXPORT int promGetSibling(int node);
95extern _X_EXPORT int promGetChild(int node);
96extern _X_EXPORT char *promGetProperty(const char *prop, int *lenp);
97extern _X_EXPORT int promGetBool(const char *prop);
98
99extern _X_EXPORT int sparcPromInit(void);
100extern _X_EXPORT void sparcPromClose(void);
101extern _X_EXPORT char *sparcPromGetProperty(sbusPromNodePtr pnode,
102                                            const char *prop, int *lenp);
103extern _X_EXPORT int sparcPromGetBool(sbusPromNodePtr pnode, const char *prop);
104extern _X_EXPORT void sparcPromAssignNodes(void);
105extern _X_EXPORT char *sparcPromNode2Pathname(sbusPromNodePtr pnode);
106extern _X_EXPORT int sparcPromPathname2Node(const char *pathName);
107extern _X_EXPORT const char *sparcDriverName(void);
108
109extern Bool xf86SbusConfigure(void *busData, sbusDevicePtr sBus);
110extern void xf86SbusConfigureNewDev(void *busData, sbusDevicePtr sBus,
111                                    GDevRec * GDev);
112
113#endif                          /* _XF86_SBUSBUS_H */
114