pcib_private.h revision 169221
133965Sjdp/*- 2218822Sdim * Copyright (c) 1994,1995 Stefan Esser, Wolfgang StanglMeier 3218822Sdim * Copyright (c) 2000 Michael Smith <msmith@freebsd.org> 433965Sjdp * Copyright (c) 2000 BSDi 533965Sjdp * All rights reserved. 633965Sjdp * 733965Sjdp * Redistribution and use in source and binary forms, with or without 833965Sjdp * modification, are permitted provided that the following conditions 933965Sjdp * are met: 1033965Sjdp * 1. Redistributions of source code must retain the above copyright 1133965Sjdp * notice, this list of conditions and the following disclaimer. 1233965Sjdp * 2. Redistributions in binary form must reproduce the above copyright 1333965Sjdp * notice, this list of conditions and the following disclaimer in the 1433965Sjdp * documentation and/or other materials provided with the distribution. 1533965Sjdp * 3. The name of the author may not be used to endorse or promote products 1633965Sjdp * derived from this software without specific prior written permission. 1733965Sjdp * 1833965Sjdp * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19218822Sdim * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2033965Sjdp * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2133965Sjdp * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 2233965Sjdp * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2333965Sjdp * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2433965Sjdp * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2533965Sjdp * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2633965Sjdp * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2733965Sjdp * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2833965Sjdp * SUCH DAMAGE. 29218822Sdim * 3033965Sjdp * $FreeBSD: head/sys/dev/pci/pcib_private.h 169221 2007-05-02 17:50:36Z jhb $ 3133965Sjdp */ 3233965Sjdp 3333965Sjdp#ifndef __PCIB_PRIVATE_H__ 3433965Sjdp#define __PCIB_PRIVATE_H__ 3533965Sjdp 3633965Sjdp/* 3733965Sjdp * Export portions of generic PCI:PCI bridge support so that it can be 3889857Sobrien * used by subclasses. 3989857Sobrien */ 4089857Sobrien 4189857Sobrien/* 4289857Sobrien * Bridge-specific data. 4333965Sjdp */ 4433965Sjdpstruct pcib_softc 4533965Sjdp{ 4633965Sjdp device_t dev; 4733965Sjdp uint32_t flags; /* flags */ 4833965Sjdp#define PCIB_SUBTRACTIVE 0x1 4933965Sjdp#define PCIB_DISABLE_MSI 0x2 5033965Sjdp uint16_t command; /* command register */ 5133965Sjdp uint8_t secbus; /* secondary bus number */ 5233965Sjdp uint8_t subbus; /* subordinate bus number */ 53130561Sobrien pci_addr_t pmembase; /* base address of prefetchable memory */ 5433965Sjdp pci_addr_t pmemlimit; /* topmost address of prefetchable memory */ 55130561Sobrien pci_addr_t membase; /* base address of memory window */ 5633965Sjdp pci_addr_t memlimit; /* topmost address of memory window */ 57130561Sobrien uint32_t iobase; /* base address of port window */ 5833965Sjdp uint32_t iolimit; /* topmost address of port window */ 5933965Sjdp uint16_t secstat; /* secondary bus status register */ 6033965Sjdp uint16_t bridgectl; /* bridge control register */ 6133965Sjdp uint8_t seclat; /* secondary bus latency timer */ 6233965Sjdp}; 6333965Sjdp 6433965Sjdptypedef uint32_t pci_read_config_fn(int b, int s, int f, int reg, int width); 6533965Sjdp 6633965Sjdpint host_pcib_get_busno(pci_read_config_fn read_config, int bus, 6733965Sjdp int slot, int func, uint8_t *busnum); 6833965Sjdpint pcib_attach(device_t dev); 6933965Sjdpvoid pcib_attach_common(device_t dev); 70130561Sobrienint pcib_read_ivar(device_t dev, device_t child, int which, uintptr_t *result); 7133965Sjdpint pcib_write_ivar(device_t dev, device_t child, int which, uintptr_t value); 7233965Sjdpstruct resource *pcib_alloc_resource(device_t dev, device_t child, int type, int *rid, 7333965Sjdp u_long start, u_long end, u_long count, u_int flags); 7433965Sjdpint pcib_maxslots(device_t dev); 7533965Sjdpuint32_t pcib_read_config(device_t dev, int b, int s, int f, int reg, int width); 7633965Sjdpvoid pcib_write_config(device_t dev, int b, int s, int f, int reg, uint32_t val, int width); 7733965Sjdpint pcib_route_interrupt(device_t pcib, device_t dev, int pin); 7833965Sjdpint pcib_alloc_msi(device_t pcib, device_t dev, int count, int maxcount, int *irqs); 7933965Sjdpint pcib_release_msi(device_t pcib, device_t dev, int count, int *irqs); 8033965Sjdpint pcib_alloc_msix(device_t pcib, device_t dev, int *irq); 8133965Sjdpint pcib_release_msix(device_t pcib, device_t dev, int irq); 8233965Sjdpint pcib_map_msi(device_t pcib, device_t dev, int irq, uint64_t *addr, uint32_t *data); 83130561Sobrien 8433965Sjdp#endif 8533965Sjdp