txioman.c revision 1.3
11.3Such/* $NetBSD: txioman.c,v 1.3 2001/06/13 19:09:08 uch Exp $ */ 21.1Such 31.2Such/*- 41.2Such * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc. 51.1Such * All rights reserved. 61.1Such * 71.2Such * This code is derived from software contributed to The NetBSD Foundation 81.2Such * by UCHIYAMA Yasushi. 91.2Such * 101.1Such * Redistribution and use in source and binary forms, with or without 111.1Such * modification, are permitted provided that the following conditions 121.1Such * are met: 131.1Such * 1. Redistributions of source code must retain the above copyright 141.1Such * notice, this list of conditions and the following disclaimer. 151.2Such * 2. Redistributions in binary form must reproduce the above copyright 161.2Such * notice, this list of conditions and the following disclaimer in the 171.2Such * documentation and/or other materials provided with the distribution. 181.2Such * 3. All advertising materials mentioning features or use of this software 191.2Such * must display the following acknowledgement: 201.2Such * This product includes software developed by the NetBSD 211.2Such * Foundation, Inc. and its contributors. 221.2Such * 4. Neither the name of The NetBSD Foundation nor the names of its 231.2Such * contributors may be used to endorse or promote products derived 241.2Such * from this software without specific prior written permission. 251.1Such * 261.2Such * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 271.2Such * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 281.2Such * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 291.2Such * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 301.2Such * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 311.2Such * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 321.2Such * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 331.2Such * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 341.2Such * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 351.2Such * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 361.2Such * POSSIBILITY OF SUCH DAMAGE. 371.1Such */ 381.1Such#include "opt_tx39_debug.h" 391.1Such 401.1Such#include <sys/param.h> 411.1Such#include <sys/systm.h> 421.1Such#include <sys/device.h> 431.1Such 441.1Such#include <machine/bus.h> 451.1Such#include <hpcmips/tx/tx39var.h> 461.1Such 471.3Such#include <dev/hpc/hpciovar.h> 481.1Such 491.3Suchint txioman_match(struct device *, struct cfdata *, void *); 501.3Suchvoid txioman_attach(struct device *, struct device *, void *); 511.3Suchvoid txioman_callback(struct device *); 521.3Suchint txioman_print(void *, const char *); 531.3Suchhpcio_chip_t tx_conf_reference_ioman(void *, int); 541.1Such 551.1Suchstruct cfattach txioman_ca = { 561.3Such sizeof(struct device), txioman_match, txioman_attach 571.1Such}; 581.1Such 591.1Suchint 601.2Suchtxioman_match(struct device *parent, struct cfdata *cf, void *aux) 611.1Such{ 621.3Such return (1); 631.1Such} 641.1Such 651.1Suchvoid 661.2Suchtxioman_attach(struct device *parent, struct device *self, void *aux) 671.1Such{ 681.2Such printf("\n"); 691.1Such 701.3Such config_defer(self, txioman_callback); 711.1Such} 721.1Such 731.3Suchvoid 741.3Suchtxioman_callback(struct device *self) 751.1Such{ 761.3Such struct hpcio_attach_args haa; 771.1Such 781.3Such haa.haa_busname = HPCIO_BUSNAME; 791.3Such haa.haa_sc = tx_conf_get_tag(); 801.3Such haa.haa_getchip = tx_conf_reference_ioman; 811.3Such haa.haa_iot = 0; /* not needed for TX */ 821.3Such 831.3Such config_found(self, &haa, txioman_print); 841.1Such} 851.1Such 861.1Suchint 871.2Suchtxioman_print(void *aux, const char *pnp) 881.1Such{ 891.3Such 901.3Such return (QUIET); 911.3Such} 921.3Such 931.3Suchvoid 941.3Suchtx_conf_register_ioman(tx_chipset_tag_t t, struct hpcio_chip *hc) 951.3Such{ 961.3Such KASSERT(t == tx_conf_get_tag()); 971.3Such KASSERT(hc); 981.3Such 991.3Such t->tc_iochip[hc->hc_chipid] = hc; 1001.3Such} 1011.3Such 1021.3Suchhpcio_chip_t 1031.3Suchtx_conf_reference_ioman(void *ctx, int iochip) 1041.3Such{ 1051.3Such struct tx_chipset_tag *t = tx_conf_get_tag(); 1061.3Such KASSERT(iochip >= 0 && iochip < NTXIO_GROUP); 1071.3Such 1081.3Such return (t->tc_iochip[iochip]); 1091.1Such} 110