pcib_private.h revision 102441
178828Sobrien/*-
2104834Sobrien * Copyright (c) 1994,1995 Stefan Esser, Wolfgang StanglMeier
360484Sobrien * Copyright (c) 2000 Michael Smith <msmith@freebsd.org>
460484Sobrien * Copyright (c) 2000 BSDi
589857Sobrien * All rights reserved.
660484Sobrien *
789857Sobrien * Redistribution and use in source and binary forms, with or without
860484Sobrien * modification, are permitted provided that the following conditions
960484Sobrien * are met:
1060484Sobrien * 1. Redistributions of source code must retain the above copyright
1160484Sobrien *    notice, this list of conditions and the following disclaimer.
1289857Sobrien * 2. Redistributions in binary form must reproduce the above copyright
1360484Sobrien *    notice, this list of conditions and the following disclaimer in the
1460484Sobrien *    documentation and/or other materials provided with the distribution.
1560484Sobrien * 3. The name of the author may not be used to endorse or promote products
1660484Sobrien *    derived from this software without specific prior written permission.
1760484Sobrien *
1889857Sobrien * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19218822Sdim * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20218822Sdim * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2160484Sobrien * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
2260484Sobrien * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2360484Sobrien * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2460484Sobrien * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2560484Sobrien * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2660484Sobrien * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2760484Sobrien * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2860484Sobrien * SUCH DAMAGE.
2960484Sobrien *
3060484Sobrien * $FreeBSD: head/sys/dev/pci/pcib_private.h 102441 2002-08-26 15:57:08Z jhb $
3160484Sobrien */
3260484Sobrien
3360484Sobrien#ifndef __PCIB_PRIVATE_H__
3460484Sobrien#define	__PCIB_PRIVATE_H__
3560484Sobrien
3660484Sobrien/*
3760484Sobrien * Export portions of generic PCI:PCI bridge support so that it can be
3860484Sobrien * used by subclasses.
3960484Sobrien */
4060484Sobrien
4160484Sobrien/*
4260484Sobrien * Bridge-specific data.
43104834Sobrien */
4460484Sobrienstruct pcib_softc
4560484Sobrien{
4660484Sobrien    device_t	dev;
4760484Sobrien    u_int16_t	command;	/* command register */
4860484Sobrien    u_int8_t	secbus;		/* secondary bus number */
4960484Sobrien    u_int8_t	subbus;		/* subordinate bus number */
5060484Sobrien    pci_addr_t	pmembase;	/* base address of prefetchable memory */
5160484Sobrien    pci_addr_t	pmemlimit;	/* topmost address of prefetchable memory */
5260484Sobrien    pci_addr_t	membase;	/* base address of memory window */
5360484Sobrien    pci_addr_t	memlimit;	/* topmost address of memory window */
5460484Sobrien    u_int32_t	iobase;		/* base address of port window */
5560484Sobrien    u_int32_t	iolimit;	/* topmost address of port window */
5660484Sobrien    u_int16_t	secstat;	/* secondary bus status register */
5760484Sobrien    u_int16_t	bridgectl;	/* bridge control register */
5860484Sobrien    u_int8_t	seclat;		/* secondary bus latency timer */
5960484Sobrien};
6060484Sobrien
6160484Sobrienvoid		pcib_attach_common(device_t dev);
6260484Sobrienint		pcib_read_ivar(device_t dev, device_t child, int which, uintptr_t *result);
6360484Sobrienint		pcib_write_ivar(device_t dev, device_t child, int which, uintptr_t value);
6460484Sobrienstruct resource *pcib_alloc_resource(device_t dev, device_t child, int type, int *rid,
6560484Sobrien					    u_long start, u_long end, u_long count, u_int flags);
6660484Sobrienint		pcib_maxslots(device_t dev);
67218822Sdimu_int32_t	pcib_read_config(device_t dev, int b, int s, int f, int reg, int width);
68218822Sdimvoid		pcib_write_config(device_t dev, int b, int s, int f, int reg, u_int32_t val, int width);
69218822Sdim
70218822Sdimextern devclass_t pcib_devclass;
7160484Sobrien
7260484Sobrien#endif
7360484Sobrien