b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Bus.h,v 1.23 2003/08/24 17:36:50 dawes Exp $ */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/*
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync *
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * Permission is hereby granted, free of charge, to any person obtaining a
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * copy of this software and associated documentation files (the "Software"),
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * to deal in the Software without restriction, including without limitation
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * the rights to use, copy, modify, merge, publish, distribute, sublicense,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * and/or sell copies of the Software, and to permit persons to whom the
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * Software is furnished to do so, subject to the following conditions:
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync *
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * The above copyright notice and this permission notice shall be included in
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * all copies or substantial portions of the Software.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync *
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * OTHER DEALINGS IN THE SOFTWARE.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync *
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * Except as contained in this notice, the name of the copyright holder(s)
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * and author(s) shall not be used in advertising or otherwise to promote
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * the sale, use or other dealings in this Software without prior written
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * authorization from the copyright holder(s) and author(s).
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/*
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * This file contains definitions of the bus-related data structures/types.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * Everything contained here is private to xf86Bus.c. In particular the
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * video drivers must not include this file.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#ifdef HAVE_XORG_CONFIG_H
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#include <xorg-config.h>
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#endif
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#ifndef _XF86_BUS_H
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define _XF86_BUS_H
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#include "xf86pciBus.h"
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#ifdef __sparc__
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#include "xf86sbusBus.h"
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#endif
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsynctypedef struct racInfo {
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync xf86AccessPtr mem_new;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync xf86AccessPtr io_new;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync xf86AccessPtr io_mem_new;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync xf86SetAccessFuncPtr old;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync} AccessFuncRec, *AccessFuncPtr;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsynctypedef struct {
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync DriverPtr driver;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync int chipset;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync int entityProp;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync EntityProc entityInit;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync EntityProc entityEnter;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync EntityProc entityLeave;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync pointer private;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync resPtr resources;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync Bool active;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync Bool inUse;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync BusRec bus;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync EntityAccessPtr access;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync AccessFuncPtr rac;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync pointer busAcc;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync int lastScrnFlag;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync DevUnion * entityPrivates;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync int numInstances;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync GDevPtr * devices;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync IOADDRESS domainIO;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync} EntityRec, *EntityPtr;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* asynchronous event handling */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#ifdef async
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsynctypedef struct _AsyncQRec {
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync void (*func)(pointer);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync pointer arg;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync struct _AsyncQRec *next;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync} AsyncQRec, *AsyncQPtr;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#endif
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define NO_SEPARATE_IO_FROM_MEM 0x0001
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define NO_SEPARATE_MEM_FROM_IO 0x0002
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define NEED_VGA_ROUTED 0x0004
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define NEED_VGA_ROUTED_SETUP 0x0008
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define NEED_MEM 0x0010
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define NEED_IO 0x0020
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define NEED_MEM_SHARED 0x0040
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define NEED_IO_SHARED 0x0080
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define ACCEL_IS_SHARABLE 0x0100
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define IS_SHARED_ACCEL 0x0200
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define SA_PRIM_INIT_DONE 0x0400
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define NEED_VGA_MEM 0x1000
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define NEED_VGA_IO 0x2000
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define NEED_SHARED (NEED_MEM_SHARED | NEED_IO_SHARED)
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define busType bus.type
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define pciBusId bus.id.pci
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define isaBusId bus.id.isa
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define sbusBusId bus.id.sbus
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncstruct x_BusAccRec;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsynctypedef void (*BusAccProcPtr)(struct x_BusAccRec *ptr);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsynctypedef struct x_BusAccRec {
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync BusAccProcPtr set_f;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync BusAccProcPtr enable_f;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync BusAccProcPtr disable_f;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync BusAccProcPtr save_f;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync BusAccProcPtr restore_f;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync struct x_BusAccRec *current; /* pointer to bridge open on this bus */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync struct x_BusAccRec *primary; /* pointer to the bus connecting to this */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync struct x_BusAccRec *next; /* this links the different buses together */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync BusType type;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync BusType busdep_type;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync /* Bus-specific fields */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync union {
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync struct {
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync int bus;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync int primary_bus;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync PCITAG acc;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync pciBridgesSave save;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync } pci;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync } busdep;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync} BusAccRec, *BusAccPtr;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* state change notification callback */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsynctypedef struct _stateChange {
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync xf86StateChangeNotificationCallbackFunc func;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync pointer arg;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync struct _stateChange *next;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync} StateChangeNotificationRec, *StateChangeNotificationPtr;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern EntityPtr *xf86Entities;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern int xf86NumEntities;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern xf86AccessRec AccessNULL;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern BusRec primaryBus;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern resPtr Acc;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern resPtr osRes;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern resPtr ResRange;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern BusAccPtr xf86BusAccInfo;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncint xf86AllocateEntity(void);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncBusType StringToBusType(const char* busID, const char **retID);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncmemType ChkConflict(resRange *rgp, resPtr res, xf86State state);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncBool xf86IsSubsetOf(resRange range, resPtr list);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncBool xf86IsListSubsetOf(resPtr list, resPtr BaseList);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncresPtr xf86ExtractTypeFromList(resPtr list, unsigned long type);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncresPtr findIntersect(resRange Range, resPtr list);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncresPtr xf86FindIntersect(resRange Range, resPtr list);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncvoid RemoveOverlaps(resPtr target, resPtr list, Bool pow2Alignment,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync Bool useEstimated);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncvoid xf86ConvertListToHost(int entityIndex, resPtr list);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#endif /* _XF86_BUS_H */