sda_host.c revision 4bb7efa72ed531c10f097919636e67724ec4c25a
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore * CDDL HEADER START
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 * 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 * 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 * CDDL HEADER END
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore * Use is subject to license terms.
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore * SD card host support. This is the API that host drivers access.
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore * Static Variables.
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore NULL, /* sda_nexus_bus_config, */ /* bus_config */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore NULL, /* sda_nexus_bus_unconfig, */ /* bus_unconfig */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore * Implementation.
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amoresda_host_alloc(dev_info_t *dip, int nslot, sda_ops_t *ops, ddi_dma_attr_t *dma)
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore h->h_slots = kmem_zalloc(sizeof (sda_slot_t) * nslot, KM_SLEEP);
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore /* initialize each slot */
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore for (i = 0; i < nslot; i++) {
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore for (i = 0; i < h->h_nslot; i++) {
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'Amoresda_host_set_private(sda_host_t *h, int num, void *private)
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore * Attach slots.
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore for (i = 0; i < h->h_nslot; i++) {
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore * Initiate card detection.
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore * Register (create) nexus minor nodes.
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore * Unregister nexus minor nodes.
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore * Detach slots.
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore for (i = 0; i < h->h_nslot; i++) {
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amoresda_host_transfer(sda_host_t *h, int num, sda_err_t errno)
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amoresda_host_fault(sda_host_t *h, int num, sda_fault_t fail)
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amoresda_host_log(sda_host_t *h, int snum, const char *fmt, ...)