11.3Sdyoung/*	$NetBSD: rmixl_pci_mem_space.c,v 1.3 2011/07/01 19:01:31 dyoung Exp $	*/
21.2Smatt
31.2Smatt/*-
41.2Smatt * Copyright (c) 2001 The NetBSD Foundation, Inc.
51.2Smatt * All rights reserved.
61.2Smatt *
71.2Smatt * This code is derived from software contributed to The NetBSD Foundation
81.2Smatt * by Jason R. Thorpe.
91.2Smatt *
101.2Smatt * Redistribution and use in source and binary forms, with or without
111.2Smatt * modification, are permitted provided that the following conditions
121.2Smatt * are met:
131.2Smatt * 1. Redistributions of source code must retain the above copyright
141.2Smatt *    notice, this list of conditions and the following disclaimer.
151.2Smatt * 2. Redistributions in binary form must reproduce the above copyright
161.2Smatt *    notice, this list of conditions and the following disclaimer in the
171.2Smatt *    documentation and/or other materials provided with the distribution.
181.2Smatt *
191.2Smatt * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
201.2Smatt * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
211.2Smatt * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
221.2Smatt * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
231.2Smatt * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
241.2Smatt * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
251.2Smatt * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
261.2Smatt * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
271.2Smatt * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
281.2Smatt * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
291.2Smatt * POSSIBILITY OF SUCH DAMAGE.
301.2Smatt */
311.2Smatt
321.2Smatt/*
331.2Smatt * Little Endian bus_space(9) support for PCI MEM access
341.2Smatt * on RMI {XLP,XLR,XLS} chips
351.2Smatt */
361.2Smatt
371.2Smatt#include <sys/cdefs.h>
381.3Sdyoung__KERNEL_RCSID(0, "$NetBSD: rmixl_pci_mem_space.c,v 1.3 2011/07/01 19:01:31 dyoung Exp $");
391.2Smatt
401.2Smatt#include <sys/types.h>
411.2Smatt#include <sys/param.h>
421.2Smatt
431.3Sdyoung#include <sys/bus.h>
441.2Smatt#include <mips/rmi/rmixl_obiovar.h>
451.2Smatt#include <mips/rmi/rmixlreg.h>
461.2Smatt#include <mips/rmi/rmixlvar.h>
471.2Smatt
481.2Smatt#define	CHIP			rmixl_pci
491.2Smatt#define	CHIP_MEM		/* defined */
501.2Smatt#define	CHIP_ACCESS_SIZE	1
511.2Smatt#define CHIP_LITTLE_ENDIAN
521.2Smatt
531.2Smatt#define CHIP_EX_MALLOC_SAFE(v)	(((struct rmixl_config *)(v))->rc_mallocsafe)
541.2Smatt#define CHIP_EXTENT(v)		(((struct rmixl_config *)(v))->rc_pci_mem_ex)
551.2Smatt
561.2Smatt/* MEM region 1 */
571.2Smatt#define	CHIP_W1_BUS_START(v)	(((struct rmixl_config *)(v))->rc_pci_mem_pbase)
581.2Smatt#define	CHIP_W1_BUS_END(v)	(CHIP_W1_SYS_START(v) + \
591.2Smatt					(((struct rmixl_config *)(v))->rc_pci_mem_size) - 1)
601.2Smatt#define CHIP_W1_SYS_START(v)	CHIP_W1_BUS_START(v)
611.2Smatt#define CHIP_W1_SYS_END(v)	CHIP_W1_BUS_END(v)
621.2Smatt
631.2Smatt#include <mips/mips/bus_space_alignstride_chipdep.c>
64