obio_space.c revision 1.1
11.1Sthorpej/*	$NetBSD: obio_space.c,v 1.1 2002/03/27 21:51:30 thorpej Exp $	*/
21.1Sthorpej
31.1Sthorpej/*
41.1Sthorpej * Copyright (c) 2001 Wasabi Systems, Inc.
51.1Sthorpej * All rights reserved.
61.1Sthorpej *
71.1Sthorpej * Written by Jason R. Thorpe for Wasabi Systems, Inc.
81.1Sthorpej *
91.1Sthorpej * Redistribution and use in source and binary forms, with or without
101.1Sthorpej * modification, are permitted provided that the following conditions
111.1Sthorpej * are met:
121.1Sthorpej * 1. Redistributions of source code must retain the above copyright
131.1Sthorpej *    notice, this list of conditions and the following disclaimer.
141.1Sthorpej * 2. Redistributions in binary form must reproduce the above copyright
151.1Sthorpej *    notice, this list of conditions and the following disclaimer in the
161.1Sthorpej *    documentation and/or other materials provided with the distribution.
171.1Sthorpej * 3. All advertising materials mentioning features or use of this software
181.1Sthorpej *    must display the following acknowledgement:
191.1Sthorpej *	This product includes software developed for the NetBSD Project by
201.1Sthorpej *	Wasabi Systems, Inc.
211.1Sthorpej * 4. The name of Wasabi Systems, Inc. may not be used to endorse
221.1Sthorpej *    or promote products derived from this software without specific prior
231.1Sthorpej *    written permission.
241.1Sthorpej *
251.1Sthorpej * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
261.1Sthorpej * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
271.1Sthorpej * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
281.1Sthorpej * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL WASABI SYSTEMS, INC
291.1Sthorpej * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
301.1Sthorpej * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
311.1Sthorpej * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
321.1Sthorpej * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
331.1Sthorpej * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
341.1Sthorpej * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
351.1Sthorpej * POSSIBILITY OF SUCH DAMAGE.
361.1Sthorpej */
371.1Sthorpej
381.1Sthorpej/*
391.1Sthorpej * bus_space functions for IQ80321 on-board devices
401.1Sthorpej */
411.1Sthorpej
421.1Sthorpej#include <sys/param.h>
431.1Sthorpej#include <sys/systm.h>
441.1Sthorpej
451.1Sthorpej#include <uvm/uvm_extern.h>
461.1Sthorpej
471.1Sthorpej#include <machine/bus.h>
481.1Sthorpej
491.1Sthorpej/* Prototypes for all the bus_space structure functions */
501.1Sthorpejbs_protos(obio);
511.1Sthorpejbs_protos(bs_notimpl);
521.1Sthorpej
531.1Sthorpej/*
541.1Sthorpej * The obio bus space tag.  This is constant for all instances, so
551.1Sthorpej * we never have to explicitly "create" it.
561.1Sthorpej */
571.1Sthorpejstruct bus_space obio_bs_tag = {
581.1Sthorpej	/* cookie */
591.1Sthorpej	(void *) 0,
601.1Sthorpej
611.1Sthorpej	/* mapping/unmapping */
621.1Sthorpej	obio_bs_map,
631.1Sthorpej	obio_bs_unmap,
641.1Sthorpej	obio_bs_subregion,
651.1Sthorpej
661.1Sthorpej	/* allocation/deallocation */
671.1Sthorpej	obio_bs_alloc,
681.1Sthorpej	obio_bs_free,
691.1Sthorpej
701.1Sthorpej	/* get kernel virtual address */
711.1Sthorpej	obio_bs_vaddr,
721.1Sthorpej
731.1Sthorpej	/* mmap */
741.1Sthorpej	bs_notimpl_bs_mmap,
751.1Sthorpej
761.1Sthorpej	/* barrier */
771.1Sthorpej	obio_bs_barrier,
781.1Sthorpej
791.1Sthorpej	/* read (single) */
801.1Sthorpej	obio_bs_r_1,
811.1Sthorpej	bs_notimpl_bs_r_2,
821.1Sthorpej	obio_bs_r_4,
831.1Sthorpej	bs_notimpl_bs_r_8,
841.1Sthorpej
851.1Sthorpej	/* read multiple */
861.1Sthorpej	obio_bs_rm_1,
871.1Sthorpej	bs_notimpl_bs_rm_2,
881.1Sthorpej	bs_notimpl_bs_rm_4,
891.1Sthorpej	bs_notimpl_bs_rm_8,
901.1Sthorpej
911.1Sthorpej	/* read region */
921.1Sthorpej	bs_notimpl_bs_rr_1,
931.1Sthorpej	bs_notimpl_bs_rr_2,
941.1Sthorpej	bs_notimpl_bs_rr_4,
951.1Sthorpej	bs_notimpl_bs_rr_8,
961.1Sthorpej
971.1Sthorpej	/* write (single) */
981.1Sthorpej	obio_bs_w_1,
991.1Sthorpej	bs_notimpl_bs_w_2,
1001.1Sthorpej	obio_bs_w_4,
1011.1Sthorpej	bs_notimpl_bs_w_8,
1021.1Sthorpej
1031.1Sthorpej	/* write multiple */
1041.1Sthorpej	obio_bs_wm_1,
1051.1Sthorpej	bs_notimpl_bs_wm_2,
1061.1Sthorpej	bs_notimpl_bs_wm_4,
1071.1Sthorpej	bs_notimpl_bs_wm_8,
1081.1Sthorpej
1091.1Sthorpej	/* write region */
1101.1Sthorpej	bs_notimpl_bs_wr_1,
1111.1Sthorpej	bs_notimpl_bs_wr_2,
1121.1Sthorpej	bs_notimpl_bs_wr_4,
1131.1Sthorpej	bs_notimpl_bs_wr_8,
1141.1Sthorpej
1151.1Sthorpej	/* set multiple */
1161.1Sthorpej	bs_notimpl_bs_sm_1,
1171.1Sthorpej	bs_notimpl_bs_sm_2,
1181.1Sthorpej	bs_notimpl_bs_sm_4,
1191.1Sthorpej	bs_notimpl_bs_sm_8,
1201.1Sthorpej
1211.1Sthorpej	/* set region */
1221.1Sthorpej	bs_notimpl_bs_sr_1,
1231.1Sthorpej	bs_notimpl_bs_sr_2,
1241.1Sthorpej	bs_notimpl_bs_sr_4,
1251.1Sthorpej	bs_notimpl_bs_sr_8,
1261.1Sthorpej
1271.1Sthorpej	/* copy */
1281.1Sthorpej	bs_notimpl_bs_c_1,
1291.1Sthorpej	bs_notimpl_bs_c_2,
1301.1Sthorpej	bs_notimpl_bs_c_4,
1311.1Sthorpej	bs_notimpl_bs_c_8,
1321.1Sthorpej};
1331.1Sthorpej
1341.1Sthorpejint
1351.1Sthorpejobio_bs_map(void *t, bus_addr_t bpa, bus_size_t size, int flags,
1361.1Sthorpej    bus_space_handle_t *bshp)
1371.1Sthorpej{
1381.1Sthorpej
1391.1Sthorpej	/*
1401.1Sthorpej	 * IQ80321 on-board devices are mapped VA==PA.  All addresses
1411.1Sthorpej	 * we're provided, therefore, don't need any additional mapping.
1421.1Sthorpej	 */
1431.1Sthorpej	*bshp = bpa;
1441.1Sthorpej
1451.1Sthorpej	return 0;
1461.1Sthorpej}
1471.1Sthorpej
1481.1Sthorpejint
1491.1Sthorpejobio_bs_alloc(void *t, bus_addr_t rstart, bus_addr_t rend, bus_size_t size,
1501.1Sthorpej    bus_size_t alignment, bus_size_t boundary, int flags, bus_addr_t *bpap,
1511.1Sthorpej    bus_space_handle_t *bshp)
1521.1Sthorpej{
1531.1Sthorpej
1541.1Sthorpej	panic("obio_bs_alloc(): not implemented\n");
1551.1Sthorpej}
1561.1Sthorpej
1571.1Sthorpej
1581.1Sthorpejvoid
1591.1Sthorpejobio_bs_unmap(void *t, bus_space_handle_t bsh, bus_size_t size)
1601.1Sthorpej{
1611.1Sthorpej
1621.1Sthorpej	/* Nothing to do. */
1631.1Sthorpej}
1641.1Sthorpej
1651.1Sthorpejvoid
1661.1Sthorpejobio_bs_free(void *t, bus_space_handle_t bsh, bus_size_t size)
1671.1Sthorpej{
1681.1Sthorpej
1691.1Sthorpej	panic("obio_bs_free(): not implemented\n");
1701.1Sthorpej}
1711.1Sthorpej
1721.1Sthorpejint
1731.1Sthorpejobio_bs_subregion(void *t, bus_space_handle_t bsh, bus_size_t offset,
1741.1Sthorpej    bus_size_t size, bus_space_handle_t *nbshp)
1751.1Sthorpej{
1761.1Sthorpej
1771.1Sthorpej	*nbshp = bsh + offset;
1781.1Sthorpej	return (0);
1791.1Sthorpej}
1801.1Sthorpej
1811.1Sthorpejvoid *
1821.1Sthorpejobio_bs_vaddr(void *t, bus_space_handle_t bsh)
1831.1Sthorpej{
1841.1Sthorpej
1851.1Sthorpej	return ((void *)bsh);
1861.1Sthorpej}
1871.1Sthorpej
1881.1Sthorpejvoid
1891.1Sthorpejobio_bs_barrier(void *t, bus_space_handle_t bsh, bus_size_t offset,
1901.1Sthorpej    bus_size_t len, int flags)
1911.1Sthorpej{
1921.1Sthorpej
1931.1Sthorpej	/* Nothing to do. */
1941.1Sthorpej}
195