bus_if.m revision 39344
1#
2# Copyright (c) 1998 Doug Rabson
3# All rights reserved.
4#
5# Redistribution and use in source and binary forms, with or without
6# modification, are permitted provided that the following conditions
7# are met:
8# 1. Redistributions of source code must retain the above copyright
9#    notice, this list of conditions and the following disclaimer.
10# 2. Redistributions in binary form must reproduce the above copyright
11#    notice, this list of conditions and the following disclaimer in the
12#    documentation and/or other materials provided with the distribution.
13#
14# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24# SUCH DAMAGE.
25#
26#	$Id: bus_if.m,v 1.2 1998/07/12 16:20:51 dfr Exp $
27#
28
29INTERFACE bus
30
31#
32# This is called from system code which prints out a description of a
33# device.  It should describe the attachment that the child has with
34# the parent.  For instance the TurboLaser bus prints which node the
35# device is attached to.
36#
37METHOD void print_child {
38	device_t dev;
39	device_t child;
40};
41
42#
43# These two methods manage a bus specific set of instance variables of
44# a child device.  The intention is that each different type of bus
45# defines a set of appropriate instance variables (such as ports and
46# irqs for ISA bus etc.)
47#
48# This information could be given to the child device as a struct but
49# that makes it hard for a bus to add or remove variables without
50# forcing an edit and recompile for all drivers which may not be
51# possible for vendor supplied binary drivers.
52
53#
54# Read an instance variable.  Return 0 on success.
55#
56METHOD int read_ivar {
57	device_t dev;
58	device_t child;
59	int index;
60	u_long *result;
61};
62
63#
64# Write an instance variable.  Return 0 on success.
65#
66METHOD int write_ivar {
67	device_t dev;
68	device_t child;
69	int index;
70	u_long value;
71};
72
73#
74# Create an interrupt handler for the child device.  The handler will
75# be called with the value 'arg' as its only argument.  This method
76# does not activate the handler.
77#
78METHOD void* create_intr {
79	device_t dev;
80	device_t child;
81	int irq;
82	driver_intr_t *intr;
83	void *arg;
84};
85
86#
87# Activate an interrupt handler previously created with
88# BUS_CREATE_INTR.
89#
90METHOD int connect_intr {
91	device_t dev;
92	void *ih;
93};
94