150825Smdodd/*- 250825Smdodd * Copyright (c) 1999 Matthew N. Dodd <winter@jurai.net> 350825Smdodd * All rights reserved. 450825Smdodd * 550825Smdodd * Redistribution and use in source and binary forms, with or without 650825Smdodd * modification, are permitted provided that the following conditions 750825Smdodd * are met: 850825Smdodd * 1. Redistributions of source code must retain the above copyright 950825Smdodd * notice, this list of conditions and the following disclaimer. 1050825Smdodd * 2. Redistributions in binary form must reproduce the above copyright 1150825Smdodd * notice, this list of conditions and the following disclaimer in the 1250825Smdodd * documentation and/or other materials provided with the distribution. 1350825Smdodd * 1450825Smdodd * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1550825Smdodd * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1650825Smdodd * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1750825Smdodd * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1850825Smdodd * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1950825Smdodd * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2050825Smdodd * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2150825Smdodd * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2250825Smdodd * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2350825Smdodd * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2450825Smdodd * SUCH DAMAGE. 2550825Smdodd * 2650825Smdodd * $FreeBSD$ 2750825Smdodd */ 2850825Smdodd 2950825Smdoddtypedef u_int16_t mca_id_t; 3050825Smdodd 3150825Smdoddstruct mca_ident { 3250825Smdodd mca_id_t id; 3350825Smdodd char *name; 3450825Smdodd}; 3550825Smdodd 3650825Smdoddconst char * mca_match_id (u_int16_t, struct mca_ident *); 3750825Smdodd 3850825Smdodd/* 3950825Smdodd * Simplified accessors for isa devices 4050825Smdodd */ 4150825Smdodd 4250825Smdoddenum mca_device_ivars { 4350825Smdodd MCA_IVAR_SLOT, 4450825Smdodd MCA_IVAR_ID, 4550825Smdodd MCA_IVAR_ENABLED, 4650825Smdodd}; 4750825Smdodd 4850825Smdodd#define MCA_ACCESSOR(A, B, T) \ 4950825Smdodd \ 5050825Smdoddstatic __inline T mca_get_ ## A(device_t dev) \ 5150825Smdodd{ \ 5250825Smdodd uintptr_t v; \ 5350825Smdodd BUS_READ_IVAR(device_get_parent(dev), dev, MCA_IVAR_ ## B, &v); \ 5450825Smdodd return (T) v; \ 5550825Smdodd} 5650825Smdodd 5750825SmdoddMCA_ACCESSOR(slot, SLOT, int) 5850825SmdoddMCA_ACCESSOR(id, ID, mca_id_t) 5950825SmdoddMCA_ACCESSOR(enabled, ENABLED, int) 6050825Smdodd 6150825Smdodd/* don't use these! */ 6250825Smdoddvoid mca_pos_set (device_t, u_int8_t, u_int8_t); 6350825Smdoddu_int8_t mca_pos_get (device_t, u_int8_t); 6450825Smdodd 6550825Smdoddu_int8_t mca_pos_read (device_t, u_int8_t); 6650825Smdodd 6751674Smdoddvoid mca_add_irq (device_t, int); 6851674Smdoddvoid mca_add_drq (device_t, int); 6951674Smdoddvoid mca_add_iospace (device_t, u_long, u_long); 7051674Smdoddvoid mca_add_mspace (device_t, u_long, u_long); 71