b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86pciBus.h,v 3.10 2003/08/24 17:36:56 dawes Exp $ */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/*
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * Copyright (c) 1999-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#ifdef HAVE_XORG_CONFIG_H
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#include <xorg-config.h>
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#endif
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#ifndef _XF86_PCI_BUS_H
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define _XF86_PCI_BUS_H
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define PCITAG_SPECIAL pciTag(0xFF,0xFF,0xFF)
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsynctypedef struct {
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync CARD32 command;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync CARD32 base[6];
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync CARD32 biosBase;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync} pciSave, *pciSavePtr;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsynctypedef struct {
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync PCITAG tag;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync CARD32 ctrl;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync} pciArg;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsynctypedef struct {
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync int busnum;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync int devnum;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync int funcnum;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync pciArg arg;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync xf86AccessRec ioAccess;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync xf86AccessRec io_memAccess;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync xf86AccessRec memAccess;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync pciSave save;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync pciSave restore;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync Bool ctrl;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync} pciAccRec, *pciAccPtr;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsynctypedef union {
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync CARD16 control;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync} pciBridgesSave, *pciBridgesSavePtr;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsynctypedef struct pciBusRec {
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync int brbus, brdev, brfunc; /* ID of the bridge to this bus */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync int primary, secondary, subordinate;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync int subclass; /* bridge type */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync int interface;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync resPtr preferred_io; /* I/O range */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync resPtr preferred_mem; /* non-prefetchable memory range */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync resPtr preferred_pmem; /* prefetchable memory range */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync resPtr io; /* for subtractive PCI-PCI bridges */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync resPtr mem;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync resPtr pmem;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync int brcontrol; /* bridge_control byte */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync struct pciBusRec *next;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync} PciBusRec, *PciBusPtr;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncvoid xf86PciProbe(void);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncvoid ValidatePci(void);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncresList GetImplicitPciResources(int entityIndex);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncvoid initPciState(void);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncvoid initPciBusState(void);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncvoid DisablePciAccess(void);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncvoid DisablePciBusAccess(void);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncvoid PciStateEnter(void);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncvoid PciBusStateEnter(void);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncvoid PciStateLeave(void);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncvoid PciBusStateLeave(void);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncresPtr ResourceBrokerInitPci(resPtr *osRes);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncvoid pciConvertRange2Host(int entityIndex, resRange *pRange);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncvoid isaConvertRange2Host(resRange *pRange);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern pciAccPtr * xf86PciAccInfo;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#endif /* _XF86_PCI_BUS_H */