153895Smckusick /* 2*63304Sbostic * Copyright (c) 1992, 1993 3*63304Sbostic * The Regents of the University of California. All rights reserved. 453895Smckusick * 553895Smckusick * This code is derived from software contributed to Berkeley by 653895Smckusick * Sony Corp. and Kazumasa Utashiro of Software Research Associates, Inc. 753895Smckusick * 853895Smckusick * %sccs.include.redist.c% 953895Smckusick * 1053895Smckusick * from: $Hdr: hbvar.h,v 4.300 91/06/09 06:21:52 root Rel41 $ SONY 1153895Smckusick * 12*63304Sbostic * @(#)hbvar.h 8.1 (Berkeley) 06/11/93 1353895Smckusick */ 1453895Smckusick 1553895Smckusick /* 1653895Smckusick * Copyright (c) 1987,1988 by SONY Corporation. 1753895Smckusick */ 1853895Smckusick 1953895Smckusick /* 2053895Smckusick * hbvar.h.c ver 0.1 2153895Smckusick * Form Fri Dec 11 16:07:41 JST 1987 2253895Smckusick * Modify Thu Feb 2 08:57:52 JST 1989 2353895Smckusick * 2453895Smckusick */ 2553895Smckusick 2653895Smckusick #ifndef __HBVAR__ 2753895Smckusick #define __HBVAR__ 1 2853895Smckusick 2953895Smckusick /* 3053895Smckusick * This file contains definitions related to the kernel structures 3153895Smckusick * for dealing with the HYPER-BUS interface. 3253895Smckusick * 3353895Smckusick * Each HYPER-BUS has a hb_hd structure. 3453895Smckusick * Each HYPER-BUS controller which is not a device has a hb_ctlr structure. 3553895Smckusick * Each HYPER-BUS device has a hb_device structure. 3653895Smckusick */ 3753895Smckusick 3853895Smckusick #ifndef LOCORE 3953895Smckusick /* 4053895Smckusick * Per-HYPER-BUS structure. 4153895Smckusick * 4253895Smckusick * This structure holds the interrupt vector for the HYPER-BUS, 4353895Smckusick * and its address in physical and virtual space. At boot time 4453895Smckusick * we determine the devices attached to the HYPER-BUS and their 4553895Smckusick * interrupt vectors, filling in vh_vec. We free the map 4653895Smckusick * register resources of the HYPER-BUS into the structures 4753895Smckusick * defined here. 4853895Smckusick * 4953895Smckusick * During normal operation, resources are allocated and returned 5053895Smckusick * to the structures here. We watch the number of passive releases 5153895Smckusick * on each HYPER-BUS, and if the number is excessive may reset the HYPER-BUS. 5253895Smckusick * 5353895Smckusick * When HYPER-BUS resources are needed and not available, 5453895Smckusick * then device drivers may have to wait to get to the bus and are 5553895Smckusick * queued here. It is also possible for processes to block in 5653895Smckusick * the HYPER-BUS driver in resource wait (mrwant); these 5753895Smckusick * wait states are also recorded here. 5853895Smckusick */ 5953895Smckusick struct hb_hd { 6053895Smckusick caddr_t hh_phys; /* Not used and init now. */ 6153895Smckusick }; 6253895Smckusick 6353895Smckusick /* 6453895Smckusick * Per-controller structure. 6553895Smckusick * 6653895Smckusick * If a controller has devices attached, then there are 6753895Smckusick * cross-referenced hb_drive structures. 6853895Smckusick * This structure is the one which is queued in HYPER-BUS resource wait, 6953895Smckusick * and saves the information about HYPER-BUS resources which are used. 7053895Smckusick * The queue of devices waiting to transfer is also attached here. 7153895Smckusick */ 7253895Smckusick struct hb_ctlr { 7353895Smckusick struct hb_driver *hm_driver; 7453895Smckusick short hm_ctlr; /* controller index in driver */ 7553895Smckusick short hm_alive; /* controller exists */ 7653895Smckusick caddr_t hm_addr; /* address of command area */ 7753895Smckusick int hm_intr; /* interrupt number */ 7853895Smckusick short hm_scnum ; /* the scsi it is on */ 7953895Smckusick struct hb_hd *hm_hd; 8053895Smckusick int hm_hbinfo; /* save map registers, etc */ 8153895Smckusick struct buf hm_tab; /* queue of devices for this controller */ 8253895Smckusick }; 8353895Smckusick 8453895Smckusick /* 8553895Smckusick * Per ``device'' structure. 8653895Smckusick * 8753895Smckusick * If a controller has many drives attached, then there will 8853895Smckusick * be several hb_device structures associated with a single hb_ctlr 8953895Smckusick * structure. 9053895Smckusick */ 9153895Smckusick struct hb_device { 9253895Smckusick struct hb_driver *hi_driver; 9353895Smckusick short hi_unit; /* unit number on the system */ 9453895Smckusick short hi_ctlr; /* mass ctlr number; -1 if none */ 9553895Smckusick short hi_slave; /* slave on controller */ 9653895Smckusick caddr_t hi_addr; /* address of command area */ 9753895Smckusick int hi_intr; /* interrupt number */ 9853895Smckusick short hi_dk; /* if init 1 set to number for iostat */ 9953895Smckusick int hi_flags; /* parameter from system specification */ 10053895Smckusick short hi_alive; /* device exists */ 10153895Smckusick short hi_type; /* driver specific type information */ 10253895Smckusick /* caddr_t hi_physaddr; /* phys addr, for standalone (dump) code */ 10353895Smckusick /* this is the forward link in a list of devices on a controller */ 10453895Smckusick struct hb_device *hi_forw; 10553895Smckusick /* if the device is connected to a controller, this is the controller */ 10653895Smckusick struct hb_ctlr *hi_mi; 10753895Smckusick struct hb_hd *hi_hd; 10853895Smckusick }; 10953895Smckusick 11053895Smckusick /* 11153895Smckusick * Per-driver structure. 11253895Smckusick * 11353895Smckusick * Each HYPER-BUS driver defines entries for a set of routines 11453895Smckusick * as well as an array of types which are acceptable to it. 11553895Smckusick * These are used at boot time by the configuration program. 11653895Smckusick */ 11753895Smckusick struct hb_driver { 11853895Smckusick int (*hd_probe)(); /* see if a driver is really there */ 11953895Smckusick int (*hd_slave)(); /* see if a slave is there */ 12053895Smckusick int (*hd_attach)(); /* setup driver for a slave */ 12153895Smckusick int (*hd_dgo)(); /* start transfer */ 12253895Smckusick int (*hd_intr)(); /* interrupt handler */ 12353895Smckusick char *hd_dname; /* name of a device */ 12453895Smckusick struct hb_device **hd_dinfo; /* backpointers to hdinit structs */ 12553895Smckusick char *hd_mname; /* name of a controller */ 12653895Smckusick struct hb_ctlr **hd_minfo; /* backpointers to hminit structs */ 12753895Smckusick short hd_xclu; /* want exclusive use */ 12853895Smckusick }; 12953895Smckusick 13053895Smckusick #ifdef KERNEL 13153895Smckusick 13253895Smckusick /* 13353895Smckusick * HYPER-BUS related kernel variables 13453895Smckusick */ 13553895Smckusick struct hb_hd hb_hd; 13653895Smckusick 13753895Smckusick /* 13853895Smckusick * Hbinit and hdinit initialize the mass storage controller and 13953895Smckusick * device tables specifying possible devices. 14053895Smckusick */ 14153895Smckusick extern struct hb_ctlr hminit[]; 14253895Smckusick extern struct hb_device hdinit[]; 14353895Smckusick 14453895Smckusick #endif /* KERNEL */ 14553895Smckusick 14653895Smckusick #endif /* !LOCORE */ 14753895Smckusick 14853895Smckusick #endif /* !__HBVAR__ */ 149