11.16Sthorpej/* $NetBSD: dwlpx_bus_io.c,v 1.16 2023/12/04 00:32:10 thorpej 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.4Scgd
331.5Scgd#include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
341.5Scgd
351.16Sthorpej__KERNEL_RCSID(1, "$NetBSD: dwlpx_bus_io.c,v 1.16 2023/12/04 00:32:10 thorpej Exp $");
361.1Scgd
371.1Scgd#include <sys/param.h>
381.1Scgd#include <sys/systm.h>
391.1Scgd#include <sys/syslog.h>
401.1Scgd#include <sys/device.h>
411.12Smrg
421.14Sdyoung#include <sys/bus.h>
431.1Scgd
441.1Scgd#include <alpha/pci/dwlpxreg.h>
451.1Scgd#include <alpha/pci/dwlpxvar.h>
461.1Scgd
471.1Scgd#define	CHIP		dwlpx
481.1Scgd
491.16Sthorpej#define	CHIP_IO_ARENA(v)	(((struct dwlpx_config *)(v))->cc_io_arena)
501.16Sthorpej#define	CHIP_IO_ARENA_STORE(v)	\
511.16Sthorpej	(&(((struct dwlpx_config *)(v))->cc_io_arena_store))
521.16Sthorpej#define	CHIP_IO_BTAG_STORE(v)	\
531.16Sthorpej	(((struct dwlpx_config *)(v))->cc_io_btag_store)
541.16Sthorpej#define	CHIP_IO_BTAG_COUNT(v)	DWLPX_IO_NBTS
551.1Scgd
561.1Scgd/* IO Region 1 */
571.1Scgd#define	CHIP_IO_W1_BUS_START(v)	0x00000000UL
581.1Scgd#define	CHIP_IO_W1_BUS_END(v)	0x00ffffffUL
591.1Scgd#define	CHIP_IO_W1_SYS_START(v)						\
601.1Scgd	(((struct dwlpx_config *)(v))->cc_sysbase | DWLPX_PCI_IOSPACE)
611.1Scgd#define	CHIP_IO_W1_SYS_END(v)						\
621.1Scgd	(CHIP_IO_W1_SYS_START(v) + ((CHIP_IO_W1_BUS_END(v) + 1) << 5) - 1)
631.1Scgd
641.1Scgd/* IO Region 2 */
651.1Scgd#define	CHIP_IO_W2_BUS_START(v)						\
661.1Scgd	(((0x0 << 27) & 0xf8000000) + 0x01000000UL)
671.1Scgd#define	CHIP_IO_W2_BUS_END(v)						\
681.1Scgd	(CHIP_IO_W2_BUS_START(v) + 0x07ffffffUL)
691.1Scgd#define	CHIP_IO_W2_SYS_START(v)						\
701.1Scgd	(((struct dwlpx_config *)(v))->cc_sysbase + DWLPX_PCI_IOSPACE +	\
711.1Scgd	    (0x01000000UL << 5))
721.1Scgd#define	CHIP_IO_W2_SYS_END(v)						\
731.1Scgd	(((struct dwlpx_config *)(v))->cc_sysbase + DWLPX_PCI_IOSPACE +	\
741.1Scgd	    (0x08000000UL << 5) - 1)
751.1Scgd
761.9Sthorpej#include <alpha/pci/pci_swiz_bus_io_chipdep.c>
77