/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Support for the V3 Semiconductor i960 PCI bus controller. This appears
* on some MIPS boards (notably Algorithmics P-4032 and P-5064).
*
* Some help was provided by the Algorithmics PMON sources.
*/
void vtpbc_attach_hook(device_t, device_t,
struct pcibus_attach_args *);
int vtpbc_bus_maxdevs(void *, int);
pcitag_t vtpbc_make_tag(void *, int, int, int);
void vtpbc_decompose_tag(void *, pcitag_t, int *, int *, int *);
pcireg_t vtpbc_conf_read(void *, pcitag_t, int);
void vtpbc_conf_write(void *, pcitag_t, int, pcireg_t);
/*
* vtpbc_init:
*
* Initialize the V3 PCI controller's software state. We
* simply use the existing windows that the firmware has
* set up for us.
*/
void
vtpbc_init(pci_chipset_tag_t pc, struct vtpbc_config *vt)
{
/*
* Determine the PCI I/O space base that our PCI
* I/O window maps to. NOTE: We disable this on
* PBC rev < B2.
*
* Also note that PMON has disabled the I/O space
* if the old-style PCI address map is in-use.
*/
if (vt->vt_rev < V96X_VREV_B2)
vt->vt_pci_iobase = (bus_addr_t) -1;
else {
if ((V96X_LB_BASE2(vt) & V96X_LB_BASEx_ENABLE) == 0)
vt->vt_pci_iobase = (bus_addr_t) -1;
else
vt->vt_pci_iobase =
(V96X_LB_MAP2(vt) & V96X_LB_MAPx_MAP_ADR) << 16;
}
/*
* Determine the PCI memory space base that our PCI
* memory window maps to.
*/
vt->vt_pci_membase = (V96X_LB_MAP1(vt) & V96X_LB_MAPx_MAP_ADR) << 16;
/*
* Determine the PCI window base that maps host RAM for
* DMA.
*/
vt->vt_dma_winbase = V96X_PCI_BASE1(vt) & 0xfffffff0;
}