bus_if.m revision 37592
136973Sdfr# 236973Sdfr# Copyright (c) 1998 Doug Rabson 336973Sdfr# All rights reserved. 436973Sdfr# 536973Sdfr# Redistribution and use in source and binary forms, with or without 636973Sdfr# modification, are permitted provided that the following conditions 736973Sdfr# are met: 836973Sdfr# 1. Redistributions of source code must retain the above copyright 936973Sdfr# notice, this list of conditions and the following disclaimer. 1036973Sdfr# 2. Redistributions in binary form must reproduce the above copyright 1136973Sdfr# notice, this list of conditions and the following disclaimer in the 1236973Sdfr# documentation and/or other materials provided with the distribution. 1336973Sdfr# 1436973Sdfr# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1536973Sdfr# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1636973Sdfr# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1736973Sdfr# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1836973Sdfr# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1936973Sdfr# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2036973Sdfr# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2136973Sdfr# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2236973Sdfr# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2336973Sdfr# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2436973Sdfr# SUCH DAMAGE. 2536973Sdfr# 2637592Sdfr# $Id: bus_if.m,v 1.1 1998/06/14 13:53:08 dfr Exp $ 2736973Sdfr# 2836973Sdfr 2936973SdfrINTERFACE bus 3036973Sdfr 3136973Sdfr# 3236973Sdfr# This is called from system code which prints out a description of a 3336973Sdfr# device. It should describe the attachment that the child has with 3436973Sdfr# the parent. For instance the TurboLaser bus prints which node the 3536973Sdfr# device is attached to. 3636973Sdfr# 3736973SdfrMETHOD void print_child { 3836973Sdfr device_t dev; 3936973Sdfr device_t child; 4036973Sdfr}; 4136973Sdfr 4236973Sdfr# 4336973Sdfr# These two methods manage a bus specific set of instance variables of 4436973Sdfr# a child device. The intention is that each different type of bus 4536973Sdfr# defines a set of appropriate instance variables (such as ports and 4636973Sdfr# irqs for ISA bus etc.) 4736973Sdfr# 4836973Sdfr# This information could be given to the child device as a struct but 4936973Sdfr# that makes it hard for a bus to add or remove variables without 5036973Sdfr# forcing an edit and recompile for all drivers which may not be 5136973Sdfr# possible for vendor supplied binary drivers. 5236973Sdfr 5336973Sdfr# 5436973Sdfr# Read an instance variable. Return 0 on success. 5536973Sdfr# 5636973SdfrMETHOD int read_ivar { 5736973Sdfr device_t dev; 5836973Sdfr device_t child; 5936973Sdfr int index; 6036973Sdfr u_long *result; 6136973Sdfr}; 6236973Sdfr 6336973Sdfr# 6436973Sdfr# Write an instance variable. Return 0 on success. 6536973Sdfr# 6636973SdfrMETHOD int write_ivar { 6736973Sdfr device_t dev; 6836973Sdfr device_t child; 6936973Sdfr int index; 7036973Sdfr u_long value; 7136973Sdfr}; 7236973Sdfr 7336973Sdfr# 7436973Sdfr# Register an interrupt handler for the child device. The handler 7536973Sdfr# will be called with the value 'arg' as its only argument. 7636973Sdfr# 7737592SdfrMETHOD void* create_intr { 7836973Sdfr device_t dev; 7936973Sdfr device_t child; 8037592Sdfr int irq; 8136973Sdfr driver_intr_t *intr; 8236973Sdfr void *arg; 8336973Sdfr}; 8437592Sdfr 8537592SdfrMETHOD int connect_intr { 8637592Sdfr device_t dev; 8737592Sdfr void *ih; 8837592Sdfr}; 89