txioman.c revision 1.7
11.7Slukem/* $NetBSD: txioman.c,v 1.7 2003/07/15 02:29:33 lukem 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.7Slukem 391.7Slukem#include <sys/cdefs.h> 401.7Slukem__KERNEL_RCSID(0, "$NetBSD: txioman.c,v 1.7 2003/07/15 02:29:33 lukem Exp $"); 411.1Such 421.1Such#include <sys/param.h> 431.1Such#include <sys/systm.h> 441.1Such#include <sys/device.h> 451.1Such 461.1Such#include <machine/bus.h> 471.1Such#include <hpcmips/tx/tx39var.h> 481.1Such 491.3Such#include <dev/hpc/hpciovar.h> 501.1Such 511.3Suchint txioman_match(struct device *, struct cfdata *, void *); 521.3Suchvoid txioman_attach(struct device *, struct device *, void *); 531.3Suchvoid txioman_callback(struct device *); 541.3Suchint txioman_print(void *, const char *); 551.3Suchhpcio_chip_t tx_conf_reference_ioman(void *, int); 561.1Such 571.6SthorpejCFATTACH_DECL(txioman, sizeof(struct device), 581.6Sthorpej txioman_match, txioman_attach, NULL, NULL); 591.1Such 601.1Suchint 611.2Suchtxioman_match(struct device *parent, struct cfdata *cf, void *aux) 621.1Such{ 631.3Such return (1); 641.1Such} 651.1Such 661.1Suchvoid 671.2Suchtxioman_attach(struct device *parent, struct device *self, void *aux) 681.1Such{ 691.2Such printf("\n"); 701.1Such 711.3Such config_defer(self, txioman_callback); 721.1Such} 731.1Such 741.3Suchvoid 751.3Suchtxioman_callback(struct device *self) 761.1Such{ 771.3Such struct hpcio_attach_args haa; 781.1Such 791.3Such haa.haa_busname = HPCIO_BUSNAME; 801.3Such haa.haa_sc = tx_conf_get_tag(); 811.3Such haa.haa_getchip = tx_conf_reference_ioman; 821.3Such haa.haa_iot = 0; /* not needed for TX */ 831.3Such 841.3Such config_found(self, &haa, txioman_print); 851.1Such} 861.1Such 871.1Suchint 881.2Suchtxioman_print(void *aux, const char *pnp) 891.1Such{ 901.3Such 911.3Such return (QUIET); 921.3Such} 931.3Such 941.3Suchvoid 951.3Suchtx_conf_register_ioman(tx_chipset_tag_t t, struct hpcio_chip *hc) 961.3Such{ 971.3Such KASSERT(t == tx_conf_get_tag()); 981.3Such KASSERT(hc); 991.3Such 1001.3Such t->tc_iochip[hc->hc_chipid] = hc; 1011.3Such} 1021.3Such 1031.3Suchhpcio_chip_t 1041.3Suchtx_conf_reference_ioman(void *ctx, int iochip) 1051.3Such{ 1061.3Such struct tx_chipset_tag *t = tx_conf_get_tag(); 1071.3Such KASSERT(iochip >= 0 && iochip < NTXIO_GROUP); 1081.3Such 1091.3Such return (t->tc_iochip[iochip]); 1101.1Such} 111