dwlpx_bus_io.c revision 1.2
11.2Scgd/*	$NetBSD: dwlpx_bus_io.c,v 1.2 1997/03/12 21:09:56 cgd Exp $	*/
21.1Scgd
31.1Scgd/*
41.2Scgd * Copyright (c) 1997 by Matthew Jacob
51.1Scgd * NASA AMES Research Center.
61.1Scgd * All rights reserved.
71.1Scgd *
81.1Scgd * Redistribution and use in source and binary forms, with or without
91.1Scgd * modification, are permitted provided that the following conditions
101.1Scgd * are met:
111.1Scgd * 1. Redistributions of source code must retain the above copyright
121.1Scgd *    notice immediately at the beginning of the file, without modification,
131.1Scgd *    this list of conditions, and the following disclaimer.
141.1Scgd * 2. Redistributions in binary form must reproduce the above copyright
151.1Scgd *    notice, this list of conditions and the following disclaimer in the
161.1Scgd *    documentation and/or other materials provided with the distribution.
171.1Scgd * 3. The name of the author may not be used to endorse or promote products
181.1Scgd *    derived from this software without specific prior written permission.
191.1Scgd *
201.1Scgd * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
211.1Scgd * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
221.1Scgd * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
231.1Scgd * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
241.1Scgd * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
251.1Scgd * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
261.1Scgd * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
271.1Scgd * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
281.1Scgd * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
291.1Scgd * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
301.1Scgd * SUCH DAMAGE.
311.1Scgd */
321.1Scgd
331.1Scgd#include <sys/param.h>
341.1Scgd#include <sys/systm.h>
351.1Scgd#include <sys/malloc.h>
361.1Scgd#include <sys/syslog.h>
371.1Scgd#include <sys/device.h>
381.1Scgd#include <vm/vm.h>
391.1Scgd
401.1Scgd#include <machine/bus.h>
411.1Scgd
421.1Scgd#include <alpha/pci/dwlpxreg.h>
431.1Scgd#include <alpha/pci/dwlpxvar.h>
441.1Scgd
451.1Scgd#define	CHIP		dwlpx
461.1Scgd
471.1Scgd#define	CHIP_EX_MALLOC_SAFE(v)	(1)
481.1Scgd#define	CHIP_IO_EXTENT(v)	(((struct dwlpx_config *)(v))->cc_io_ex)
491.1Scgd#define	CHIP_IO_EX_STORE(v)	(((struct dwlpx_config *)(v))->cc_io_exstorage)
501.1Scgd#define	CHIP_IO_EX_STORE_SIZE(v)					\
511.1Scgd	(sizeof (((struct dwlpx_config *)(v))->cc_io_exstorage))
521.1Scgd
531.1Scgd/* IO Region 1 */
541.1Scgd#define	CHIP_IO_W1_BUS_START(v)	0x00000000UL
551.1Scgd#define	CHIP_IO_W1_BUS_END(v)	0x00ffffffUL
561.1Scgd#define	CHIP_IO_W1_SYS_START(v)						\
571.1Scgd	(((struct dwlpx_config *)(v))->cc_sysbase | DWLPX_PCI_IOSPACE)
581.1Scgd#define	CHIP_IO_W1_SYS_END(v)						\
591.1Scgd	(CHIP_IO_W1_SYS_START(v) + ((CHIP_IO_W1_BUS_END(v) + 1) << 5) - 1)
601.1Scgd
611.1Scgd/* IO Region 2 */
621.1Scgd#define	CHIP_IO_W2_BUS_START(v)						\
631.1Scgd	(((0x0 << 27) & 0xf8000000) + 0x01000000UL)
641.1Scgd#define	CHIP_IO_W2_BUS_END(v)						\
651.1Scgd	(CHIP_IO_W2_BUS_START(v) + 0x07ffffffUL)
661.1Scgd#define	CHIP_IO_W2_SYS_START(v)						\
671.1Scgd	(((struct dwlpx_config *)(v))->cc_sysbase + DWLPX_PCI_IOSPACE +	\
681.1Scgd	    (0x01000000UL << 5))
691.1Scgd#define	CHIP_IO_W2_SYS_END(v)						\
701.1Scgd	(((struct dwlpx_config *)(v))->cc_sysbase + DWLPX_PCI_IOSPACE +	\
711.1Scgd	    (0x08000000UL << 5) - 1)
721.1Scgd
731.1Scgd#include "pcs_bus_io_common.c"
74