sda_host.c revision 1cb84fbf006414a451b65e461cfdb78736884f53
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore/*
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore * CDDL HEADER START
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore *
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore * The contents of this file are subject to the terms of the
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore * Common Development and Distribution License (the "License").
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore * You may not use this file except in compliance with the License.
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore *
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore * or http://www.opensolaris.org/os/licensing.
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore * See the License for the specific language governing permissions
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore * and limitations under the License.
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore *
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore * When distributing Covered Code, include this CDDL HEADER in each
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore * If applicable, add the following below this CDDL HEADER, with the
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore * fields enclosed by brackets "[]" replaced with your own identifying
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore * information: Portions Copyright [yyyy] [name of copyright owner]
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore *
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore * CDDL HEADER END
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore/*
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore * Use is subject to license terms.
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore/*
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore * SD card host support. This is the API that host drivers access.
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore#include <sys/types.h>
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore#include <sys/conf.h>
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore#include <sys/cmn_err.h>
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore#include <sys/varargs.h>
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore#include <sys/ddi.h>
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore#include <sys/sunddi.h>
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore#include <sys/sdcard/sda.h>
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore#include <sys/sdcard/sda_impl.h>
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore/*
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore * Static Variables.
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amorestatic struct bus_ops sda_host_bus_ops = {
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore BUSO_REV, /* busops_rev */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore nullbusmap, /* bus_map */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore NULL, /* bus_get_intrspec (OBSOLETE) */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore NULL, /* bus_add_intrspec (OBSOLETE) */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore NULL, /* bus_remove_intrspec (OBSOLETE) */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore i_ddi_map_fault, /* bus_map_fault */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore ddi_dma_map, /* bus_dma_map */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore ddi_dma_allochdl, /* bus_dma_allochdl */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore ddi_dma_freehdl, /* bus_dma_freehdl */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore ddi_dma_bindhdl, /* bus_dma_bindhdl */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore ddi_dma_unbindhdl, /* bus_dma_unbindhdl */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore ddi_dma_flush, /* bus_dma_flush */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore ddi_dma_win, /* bus_dma_win */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore ddi_dma_mctl, /* bus_dma_ctl */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore sda_nexus_bus_ctl, /* bus_ctl */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore ddi_bus_prop_op, /* bus_prop_op */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore NULL, /* bus_get_eventcookie */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore NULL, /* bus_add_eventcall */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore NULL, /* bus_remove_eventcall */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore NULL, /* bus_post_event */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore NULL, /* bus_intr_ctl (OBSOLETE) */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore NULL, /* sda_nexus_bus_config, */ /* bus_config */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore NULL, /* sda_nexus_bus_unconfig, */ /* bus_unconfig */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore NULL, /* bus_fm_init */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore NULL, /* bus_fm_fini */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore NULL, /* bus_fm_access_enter */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore NULL, /* bus_fm_access_exit */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore NULL, /* bus_power */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore NULL, /* bus_intr_op */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore};
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amorestatic struct cb_ops sda_host_cb_ops = {
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore sda_nexus_open, /* cb_open */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore sda_nexus_close, /* cb_close */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore nodev, /* cb_strategy */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore nodev, /* cb_print */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore nodev, /* cb_dump */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore nodev, /* cb_read */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore nodev, /* cb_write */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore sda_nexus_ioctl, /* cb_ioctl */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore nodev, /* cb_devmap */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore nodev, /* cb_mmap */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore nodev, /* cb_segmap */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore nochpoll, /* cb_poll */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore ddi_prop_op, /* cb_prop_op */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore NULL, /* cb_str */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore D_MP, /* cb_flag */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore CB_REV, /* cb_rev */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore nodev, /* cb_aread */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore nodev, /* cb_awrite */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore};
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore/*
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore * Implementation.
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amorevoid
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amoresda_host_init_ops(struct dev_ops *devops)
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore{
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore devops->devo_getinfo = sda_nexus_getinfo;
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore devops->devo_cb_ops = &sda_host_cb_ops;
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore devops->devo_bus_ops = &sda_host_bus_ops;
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore}
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amorevoid
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amoresda_host_fini_ops(struct dev_ops *devops)
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore{
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore devops->devo_bus_ops = NULL;
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore}
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amoresda_host_t *
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amoresda_host_alloc(dev_info_t *dip, int nslot, sda_ops_t *ops, ddi_dma_attr_t *dma)
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore{
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore sda_host_t *h;
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore int i;
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore if (ops->so_version != SDA_OPS_VERSION) {
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore return (NULL);
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore }
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore h = kmem_zalloc(sizeof (*h), KM_SLEEP);
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore h->h_nslot = nslot;
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore h->h_slots = kmem_zalloc(sizeof (sda_slot_t) * nslot, KM_SLEEP);
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore h->h_dma = dma;
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore h->h_dip = dip;
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore /* initialize each slot */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore for (i = 0; i < nslot; i++) {
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore sda_slot_t *slot = &h->h_slots[i];
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore
1cb84fbf006414a451b65e461cfdb78736884f53Garrett D'Amore slot->s_hostp = h;
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore slot->s_slot_num = i;
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore slot->s_ops = *ops;
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore sda_slot_init(slot);
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore }
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore return (h);
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore}
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amorevoid
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amoresda_host_free(sda_host_t *h)
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore{
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore int i;
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore for (i = 0; i < h->h_nslot; i++) {
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore sda_slot_fini(&h->h_slots[i]);
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore }
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore kmem_free(h->h_slots, sizeof (sda_slot_t) * h->h_nslot);
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore kmem_free(h, sizeof (*h));
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore}
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amorevoid
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amoresda_host_set_private(sda_host_t *h, int num, void *private)
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore{
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore h->h_slots[num].s_prv = private;
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore}
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amoreint
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amoresda_host_attach(sda_host_t *h)
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore{
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore int i;
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore /*
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore * Attach slots.
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore for (i = 0; i < h->h_nslot; i++) {
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore sda_slot_attach(&h->h_slots[i]);
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore /*
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore * Initiate card detection.
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore sda_host_detect(h, i);
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore }
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore /*
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore * Register (create) nexus minor nodes.
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore sda_nexus_register(h);
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore return (DDI_SUCCESS);
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore}
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amorevoid
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amoresda_host_detach(sda_host_t *h)
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore{
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore int i;
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore /*
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore * Unregister nexus minor nodes.
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore sda_nexus_unregister(h);
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore /*
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore * Detach slots.
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore for (i = 0; i < h->h_nslot; i++) {
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore sda_slot_detach(&h->h_slots[i]);
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore }
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore}
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amorevoid
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amoresda_host_transfer(sda_host_t *h, int num, sda_err_t errno)
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore{
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore sda_slot_transfer(&h->h_slots[num], errno);
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore}
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amorevoid
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amoresda_host_detect(sda_host_t *h, int num)
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore{
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore sda_slot_detect(&h->h_slots[num]);
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore}
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amorevoid
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amoresda_host_fault(sda_host_t *h, int num, sda_fault_t fail)
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore{
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore sda_slot_fault(&h->h_slots[num], fail);
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore}
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amorevoid
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amoresda_host_log(sda_host_t *h, int snum, const char *fmt, ...)
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore{
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore va_list ap;
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore va_start(ap, fmt);
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore if (h != NULL) {
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore sda_slot_log(&h->h_slots[snum], fmt, ap);
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore } else {
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore sda_slot_log(NULL, fmt, ap);
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore }
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore va_end(ap);
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore}