b9a21c3c91c47e090316e28d759194e46628ed49vboxsync/*
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * Copyright 1998 by Concurrent Computer Corporation
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync *
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * Permission to use, copy, modify, distribute, and sell this software
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * and its documentation for any purpose is hereby granted without fee,
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * provided that the above copyright notice appear in all copies and that
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * both that copyright notice and this permission notice appear in
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * supporting documentation, and that the name of Concurrent Computer
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * Corporation not be used in advertising or publicity pertaining to
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * distribution of the software without specific, written prior
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * permission. Concurrent Computer Corporation makes no representations
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * about the suitability of this software for any purpose. It is
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * provided "as is" without express or implied warranty.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync *
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * CONCURRENT COMPUTER CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * AND FITNESS, IN NO EVENT SHALL CONCURRENT COMPUTER CORPORATION BE
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * SOFTWARE.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync *
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * Copyright 1998 by Metro Link Incorporated
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync *
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * Permission to use, copy, modify, distribute, and sell this software
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * and its documentation for any purpose is hereby granted without fee,
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * provided that the above copyright notice appear in all copies and that
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * both that copyright notice and this permission notice appear in
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * supporting documentation, and that the name of Metro Link
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * Incorporated not be used in advertising or publicity pertaining to
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * distribution of the software without specific, written prior
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * permission. Metro Link Incorporated makes no representations
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * about the suitability of this software for any purpose. It is
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * provided "as is" without express or implied warranty.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync *
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * METRO LINK INCORPORATED DISCLAIMS ALL WARRANTIES WITH REGARD
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * AND FITNESS, IN NO EVENT SHALL METRO LINK INCORPORATED BE
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * SOFTWARE.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync *
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * This file is derived in part from the original xf86_PCI.h that included
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * following copyright message:
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync *
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * Copyright 1995 by Robin Cutshaw <robin@XFree86.Org>
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync *
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * Permission to use, copy, modify, distribute, and sell this software and its
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * documentation for any purpose is hereby granted without fee, provided that
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * the above copyright notice appear in all copies and that both that
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * copyright notice and this permission notice appear in supporting
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * documentation, and that the names of the above listed copyright holder(s)
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * not be used in advertising or publicity pertaining to distribution of
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * the software without specific, written prior permission. The above listed
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * copyright holder(s) make(s) no representations about the suitability of this
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * software for any purpose. It is provided "as is" without express or
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * implied warranty.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync *
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM(S) ALL WARRANTIES WITH REGARD
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync *
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync */
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync/*
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * Copyright (c) 1999-2003 by The XFree86 Project, Inc.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync *
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * Permission is hereby granted, free of charge, to any person obtaining a
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * copy of this software and associated documentation files (the "Software"),
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * to deal in the Software without restriction, including without limitation
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * the rights to use, copy, modify, merge, publish, distribute, sublicense,
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * and/or sell copies of the Software, and to permit persons to whom the
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * Software is furnished to do so, subject to the following conditions:
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync *
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * The above copyright notice and this permission notice shall be included in
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * all copies or substantial portions of the Software.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync *
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * OTHER DEALINGS IN THE SOFTWARE.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync *
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * Except as contained in this notice, the name of the copyright holder(s)
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * and author(s) shall not be used in advertising or otherwise to promote
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * the sale, use or other dealings in this Software without prior written
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * authorization from the copyright holder(s) and author(s).
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync */
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync/*
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * This file has the private Pci definitions. The public ones are imported
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * from xf86Pci.h. Drivers should not use this file.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync */
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync#ifdef HAVE_XORG_CONFIG_H
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync#include <xorg-config.h>
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync#endif
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync#ifndef _PCI_H
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync#define _PCI_H 1
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync#include <X11/Xarch.h>
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync#include <X11/Xfuncproto.h>
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync#include "xf86Pci.h"
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync#include "xf86PciInfo.h"
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync/*
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * Global Definitions
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync */
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync#if (defined(__alpha__) || defined(__ia64__)) && defined (linux)
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync#define PCI_DOM_MASK 0x01fful
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync#else
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync#define PCI_DOM_MASK 0x0ffu
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync#endif
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync#define DEVID(vendor, device) \
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync ((CARD32)((PCI_##device << 16) | PCI_##vendor))
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync#ifndef PCI_DOM_MASK
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync# define PCI_DOM_MASK 0x0ffu
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync#endif
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync#define PCI_DOMBUS_MASK (((PCI_DOM_MASK) << 8) | 0x0ffu)
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync/*
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * "b" contains an optional domain number.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync */
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync#define PCI_MAKE_TAG(b,d,f) ((((b) & (PCI_DOMBUS_MASK)) << 16) | \
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync (((d) & 0x00001fu) << 11) | \
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync (((f) & 0x000007u) << 8))
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync#define PCI_MAKE_BUS(d,b) ((((d) & (PCI_DOM_MASK)) << 8) | ((b) & 0xffu))
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync#define PCI_DOM_FROM_TAG(tag) (((tag) >> 24) & (PCI_DOM_MASK))
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync#define PCI_BUS_FROM_TAG(tag) (((tag) >> 16) & (PCI_DOMBUS_MASK))
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync#define PCI_DEV_FROM_TAG(tag) (((tag) & 0x0000f800u) >> 11)
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync#define PCI_FUNC_FROM_TAG(tag) (((tag) & 0x00000700u) >> 8)
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync#define PCI_DFN_FROM_TAG(tag) (((tag) & 0x0000ff00u) >> 8)
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync#define PCI_BDEV_FROM_TAG(tag) ((tag) & 0x00fff800u)
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync#define PCI_DOM_FROM_BUS(bus) (((bus) >> 8) & (PCI_DOM_MASK))
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync#define PCI_BUS_NO_DOMAIN(bus) ((bus) & 0xffu)
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync#define PCI_TAG_NO_DOMAIN(tag) ((tag) & 0x00ffff00u)
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync defined(__OpenBSD__) || defined(__NetBSD__) || \
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync defined(__DragonFly__) || defined(__sun) || defined(__GNU__)
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync#define ARCH_PCI_INIT bsdPciInit
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync#endif
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync#if defined(linux)
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync#define ARCH_PCI_INIT linuxPciInit
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync#endif /* defined(linux) */
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync#ifndef ARCH_PCI_INIT
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync#error No PCI support available for this architecture/OS combination
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync#endif
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsyncextern void ARCH_PCI_INIT(void);
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync#endif /* _PCI_H */