dwlpx_bus_io.c revision 1.14
11.14Sdyoung/* $NetBSD: dwlpx_bus_io.c,v 1.14 2011/07/01 19:19:49 dyoung 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.14Sdyoung__KERNEL_RCSID(1, "$NetBSD: dwlpx_bus_io.c,v 1.14 2011/07/01 19:19:49 dyoung Exp $"); 361.1Scgd 371.1Scgd#include <sys/param.h> 381.1Scgd#include <sys/systm.h> 391.1Scgd#include <sys/malloc.h> 401.1Scgd#include <sys/syslog.h> 411.1Scgd#include <sys/device.h> 421.12Smrg 431.14Sdyoung#include <sys/bus.h> 441.1Scgd 451.1Scgd#include <alpha/pci/dwlpxreg.h> 461.1Scgd#include <alpha/pci/dwlpxvar.h> 471.1Scgd 481.1Scgd#define CHIP dwlpx 491.1Scgd 501.1Scgd#define CHIP_EX_MALLOC_SAFE(v) (1) 511.1Scgd#define CHIP_IO_EXTENT(v) (((struct dwlpx_config *)(v))->cc_io_ex) 521.1Scgd#define CHIP_IO_EX_STORE(v) (((struct dwlpx_config *)(v))->cc_io_exstorage) 531.1Scgd#define CHIP_IO_EX_STORE_SIZE(v) \ 541.1Scgd (sizeof (((struct dwlpx_config *)(v))->cc_io_exstorage)) 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