17c478bdstevel@tonic-gate/*
27c478bdstevel@tonic-gate * CDDL HEADER START
37c478bdstevel@tonic-gate *
47c478bdstevel@tonic-gate * The contents of this file are subject to the terms of the
57c478bdstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only
67c478bdstevel@tonic-gate * (the "License").  You may not use this file except in compliance
77c478bdstevel@tonic-gate * with the License.
87c478bdstevel@tonic-gate *
97c478bdstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bdstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
117c478bdstevel@tonic-gate * See the License for the specific language governing permissions
127c478bdstevel@tonic-gate * and limitations under the License.
137c478bdstevel@tonic-gate *
147c478bdstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
157c478bdstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bdstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
177c478bdstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
187c478bdstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bdstevel@tonic-gate *
207c478bdstevel@tonic-gate * CDDL HEADER END
217c478bdstevel@tonic-gate */
227c478bdstevel@tonic-gate/*
237c478bdstevel@tonic-gate * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
247c478bdstevel@tonic-gate * Use is subject to license terms.
257c478bdstevel@tonic-gate */
267c478bdstevel@tonic-gate
277c478bdstevel@tonic-gate/*
287c478bdstevel@tonic-gate * This is the PCMCIA Card Services kernel stubs module. It provides
297c478bdstevel@tonic-gate *	the various PCMCIA kernel framework entry points.
307c478bdstevel@tonic-gate */
317c478bdstevel@tonic-gate
327c478bdstevel@tonic-gate#if defined(DEBUG)
337c478bdstevel@tonic-gate#define	CS_STUBS_DEBUG
347c478bdstevel@tonic-gate#endif
357c478bdstevel@tonic-gate
367c478bdstevel@tonic-gate#include <sys/types.h>
377c478bdstevel@tonic-gate#include <sys/systm.h>
387c478bdstevel@tonic-gate#include <sys/user.h>
397c478bdstevel@tonic-gate#include <sys/buf.h>
407c478bdstevel@tonic-gate#include <sys/file.h>
417c478bdstevel@tonic-gate#include <sys/uio.h>
427c478bdstevel@tonic-gate#include <sys/conf.h>
437c478bdstevel@tonic-gate#include <sys/stat.h>
447c478bdstevel@tonic-gate#include <sys/autoconf.h>
457c478bdstevel@tonic-gate#include <sys/vtoc.h>
467c478bdstevel@tonic-gate#include <sys/dkio.h>
477c478bdstevel@tonic-gate#include <sys/ddi.h>
487c478bdstevel@tonic-gate#include <sys/sunddi.h>
497c478bdstevel@tonic-gate#include <sys/debug.h>
507c478bdstevel@tonic-gate#include <sys/varargs.h>
517c478bdstevel@tonic-gate#include <sys/var.h>
527c478bdstevel@tonic-gate#include <sys/proc.h>
537c478bdstevel@tonic-gate#include <sys/thread.h>
547c478bdstevel@tonic-gate#include <sys/utsname.h>
557c478bdstevel@tonic-gate#include <sys/vtrace.h>
567c478bdstevel@tonic-gate#include <sys/kstat.h>
577c478bdstevel@tonic-gate#include <sys/kmem.h>
587c478bdstevel@tonic-gate#include <sys/modctl.h>
597c478bdstevel@tonic-gate#include <sys/kobj.h>
607c478bdstevel@tonic-gate#include <sys/callb.h>
617c478bdstevel@tonic-gate
627c478bdstevel@tonic-gate#include <sys/pctypes.h>
637c478bdstevel@tonic-gate#include <pcmcia/sys/cs_types.h>
647c478bdstevel@tonic-gate#include <sys/pcmcia.h>
657c478bdstevel@tonic-gate#include <sys/sservice.h>
667c478bdstevel@tonic-gate#include <pcmcia/sys/cis.h>
677c478bdstevel@tonic-gate#include <pcmcia/sys/cis_handlers.h>
687c478bdstevel@tonic-gate#include <pcmcia/sys/cs.h>
697c478bdstevel@tonic-gate#include <pcmcia/sys/cs_priv.h>
707c478bdstevel@tonic-gate#include <pcmcia/sys/cs_stubs.h>
717c478bdstevel@tonic-gate
727c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
737c478bdstevel@tonic-gateint cs_stubs_debug = 0;
747c478bdstevel@tonic-gate#endif
757c478bdstevel@tonic-gate
767c478bdstevel@tonic-gatestatic csfunction_t *cardservices = NULL;
777c478bdstevel@tonic-gatestatic int do_cs_call = 0;
78ebf3735Toomas Soomestatic int cs_no_carservices(int32_t, ...);
797c478bdstevel@tonic-gate
807c478bdstevel@tonic-gate#define	CardServices	(do_cs_call ? (*cardservices) :		\
81ebf3735Toomas Soome			(cs_no_carservices))
827c478bdstevel@tonic-gate
837c478bdstevel@tonic-gate#ifdef	USE_CS_STUBS_MODULE
847c478bdstevel@tonic-gate
857c478bdstevel@tonic-gate/*
867c478bdstevel@tonic-gate * Module linkage information for the kernel.
877c478bdstevel@tonic-gate */
887c478bdstevel@tonic-gatestatic struct modlmisc modlmisc = {
897c478bdstevel@tonic-gate	&mod_miscops,
907c478bdstevel@tonic-gate	"PCMCIA Card Services stub module"
917c478bdstevel@tonic-gate};
927c478bdstevel@tonic-gate
937c478bdstevel@tonic-gatestatic struct modlinkage modlinkage = {
947c478bdstevel@tonic-gate	MODREV_1,
957c478bdstevel@tonic-gate	(void *)&modlmisc,
967c478bdstevel@tonic-gate	NULL
977c478bdstevel@tonic-gate};
987c478bdstevel@tonic-gate
997c478bdstevel@tonic-gateint
1007c478bdstevel@tonic-gate_init(void)
1017c478bdstevel@tonic-gate{
1027c478bdstevel@tonic-gate	return (mod_install(&modlinkage));
1037c478bdstevel@tonic-gate}
1047c478bdstevel@tonic-gate
1057c478bdstevel@tonic-gateint
1067c478bdstevel@tonic-gate_fini(void)
1077c478bdstevel@tonic-gate{
1087c478bdstevel@tonic-gate	if (!do_cs_call)
1097c478bdstevel@tonic-gate	    return (mod_remove(&modlinkage));
1107c478bdstevel@tonic-gate	else
1117c478bdstevel@tonic-gate	    return (EBUSY);
1127c478bdstevel@tonic-gate}
1137c478bdstevel@tonic-gate
1147c478bdstevel@tonic-gateint
1157c478bdstevel@tonic-gate_info(struct modinfo *modinfop)
1167c478bdstevel@tonic-gate{
1177c478bdstevel@tonic-gate	return (mod_info(&modlinkage, modinfop));
1187c478bdstevel@tonic-gate}
1197c478bdstevel@tonic-gate#endif	/* USE_CS_STUBS_MODULE */
1207c478bdstevel@tonic-gate
1217c478bdstevel@tonic-gate/*
1227c478bdstevel@tonic-gate * csx_register_cardservices - The Card Services loadable module
1237c478bdstevel@tonic-gate *	calls this runction to register it's entry point.
1247c478bdstevel@tonic-gate *
1257c478bdstevel@tonic-gate * Returns:	CS_SUCCESS - if operation sucessful
1267c478bdstevel@tonic-gate *		CS_UNSUPPORTED_FUNCTION - if invalid function code
1277c478bdstevel@tonic-gate *		CS_BAD_HANDLE - if Card Services is not registered
1287c478bdstevel@tonic-gate */
1297c478bdstevel@tonic-gateint32_t
1307c478bdstevel@tonic-gatecsx_register_cardservices(cs_register_cardservices_t *rcs)
1317c478bdstevel@tonic-gate{
1327c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
1337c478bdstevel@tonic-gate	if (cs_stubs_debug > 2)
1347c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_register_cardservices: "
1357c478bdstevel@tonic-gate		"magic: 0x%x function: 0x%x cardservices: 0x%p\n",
1367c478bdstevel@tonic-gate		rcs->magic, rcs->function, (void *)rcs->cardservices);
1377c478bdstevel@tonic-gate#endif
1387c478bdstevel@tonic-gate
1397c478bdstevel@tonic-gate	if (rcs->magic != CS_STUBS_MAGIC)
1407c478bdstevel@tonic-gate	    return (CS_BAD_ARGS);
1417c478bdstevel@tonic-gate
1427c478bdstevel@tonic-gate	switch (rcs->function) {
1437c478bdstevel@tonic-gate	    case CS_ENTRY_REGISTER:
1447c478bdstevel@tonic-gate		cardservices = rcs->cardservices;
1457c478bdstevel@tonic-gate		do_cs_call = 1;
1467c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
1477c478bdstevel@tonic-gate	if (cs_stubs_debug > 2)
1487c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_register_cardservices: CS_ENTRY_REGISTER\n");
1497c478bdstevel@tonic-gate#endif
1507c478bdstevel@tonic-gate
1517c478bdstevel@tonic-gate		return (CS_SUCCESS);
1527c478bdstevel@tonic-gate
1537c478bdstevel@tonic-gate	    case CS_ENTRY_DEREGISTER:
1547c478bdstevel@tonic-gate		do_cs_call = 0;
155ebf3735Toomas Soome		cardservices = cs_no_carservices;
1567c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
1577c478bdstevel@tonic-gate	if (cs_stubs_debug > 2)
1587c478bdstevel@tonic-gate	    cmn_err(CE_CONT,
1597c478bdstevel@tonic-gate		"csx_register_cardservices: CS_ENTRY_DEREGISTER\n");
1607c478bdstevel@tonic-gate#endif
1617c478bdstevel@tonic-gate		return (CS_UNSUPPORTED_FUNCTION);
1627c478bdstevel@tonic-gate
1637c478bdstevel@tonic-gate	    case CS_ENTRY_INQUIRE:
1647c478bdstevel@tonic-gate		rcs->cardservices = cardservices;
1657c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
1667c478bdstevel@tonic-gate	if (cs_stubs_debug > 2)
1677c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_register_cardservices: CS_ENTRY_INQUIRE\n");
1687c478bdstevel@tonic-gate#endif
1697c478bdstevel@tonic-gate
1707c478bdstevel@tonic-gate		if (do_cs_call)
1717c478bdstevel@tonic-gate		    return (CS_SUCCESS);
1727c478bdstevel@tonic-gate		else
1737c478bdstevel@tonic-gate		    return (CS_BAD_HANDLE);
1747c478bdstevel@tonic-gate
1757c478bdstevel@tonic-gate	    default:
1767c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
1777c478bdstevel@tonic-gate	if (cs_stubs_debug > 2)
1787c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_register_cardservices: (unknown function)\n");
1797c478bdstevel@tonic-gate#endif
1807c478bdstevel@tonic-gate		return (CS_UNSUPPORTED_FUNCTION);
1817c478bdstevel@tonic-gate	}
1827c478bdstevel@tonic-gate
1837c478bdstevel@tonic-gate}
1847c478bdstevel@tonic-gate
1857c478bdstevel@tonic-gateint32_t
1867c478bdstevel@tonic-gatecsx_RegisterClient(client_handle_t *ch, client_reg_t *cr)
1877c478bdstevel@tonic-gate{
1887c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
1897c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
1907c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_RegisterClient: (no handle yet)\n");
1917c478bdstevel@tonic-gate#endif
1927c478bdstevel@tonic-gate	return (CardServices(RegisterClient, ch, cr));
1937c478bdstevel@tonic-gate}
1947c478bdstevel@tonic-gate
1957c478bdstevel@tonic-gateint32_t
1967c478bdstevel@tonic-gatecsx_DeregisterClient(client_handle_t ch)
1977c478bdstevel@tonic-gate{
1987c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
1997c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
2007c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_DeregisterClient: handle: 0x%x\n", ch);
2017c478bdstevel@tonic-gate#endif
2027c478bdstevel@tonic-gate	return (CardServices(DeregisterClient, ch));
2037c478bdstevel@tonic-gate}
2047c478bdstevel@tonic-gate
2057c478bdstevel@tonic-gateint32_t
2067c478bdstevel@tonic-gatecsx_GetStatus(client_handle_t ch, get_status_t *gs)
2077c478bdstevel@tonic-gate{
2087c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
2097c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
2107c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_GetStatus: handle: 0x%x\n", ch);
2117c478bdstevel@tonic-gate#endif
2127c478bdstevel@tonic-gate	return (CardServices(GetStatus, ch, gs));
2137c478bdstevel@tonic-gate}
2147c478bdstevel@tonic-gate
2157c478bdstevel@tonic-gateint32_t
2167c478bdstevel@tonic-gatecsx_SetEventMask(client_handle_t ch, sockevent_t *se)
2177c478bdstevel@tonic-gate{
2187c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
2197c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
2207c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_SetEventMask: handle: 0x%x\n", ch);
2217c478bdstevel@tonic-gate#endif
2227c478bdstevel@tonic-gate	return (CardServices(SetEventMask, ch, se));
2237c478bdstevel@tonic-gate}
2247c478bdstevel@tonic-gate
2257c478bdstevel@tonic-gateint32_t
2267c478bdstevel@tonic-gatecsx_GetEventMask(client_handle_t ch, sockevent_t *se)
2277c478bdstevel@tonic-gate{
2287c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
2297c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
2307c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_GetEventMask: handle: 0x%x\n", ch);
2317c478bdstevel@tonic-gate#endif
2327c478bdstevel@tonic-gate	return (CardServices(GetEventMask, ch, se));
2337c478bdstevel@tonic-gate}
2347c478bdstevel@tonic-gate
2357c478bdstevel@tonic-gateint32_t
2367c478bdstevel@tonic-gatecsx_RequestIO(client_handle_t ch, io_req_t *ior)
2377c478bdstevel@tonic-gate{
2387c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
2397c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
2407c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_RequestIO: handle: 0x%x\n", ch);
2417c478bdstevel@tonic-gate#endif
2427c478bdstevel@tonic-gate	return (CardServices(RequestIO, ch, ior));
2437c478bdstevel@tonic-gate}
2447c478bdstevel@tonic-gate
2457c478bdstevel@tonic-gateint32_t
2467c478bdstevel@tonic-gatecsx_ReleaseIO(client_handle_t ch, io_req_t *ior)
2477c478bdstevel@tonic-gate{
2487c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
2497c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
2507c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_ReleaseIO: handle: 0x%x\n", ch);
2517c478bdstevel@tonic-gate#endif
2527c478bdstevel@tonic-gate	return (CardServices(ReleaseIO, ch, ior));
2537c478bdstevel@tonic-gate}
2547c478bdstevel@tonic-gate
2557c478bdstevel@tonic-gateint32_t
2567c478bdstevel@tonic-gatecsx_RequestIRQ(client_handle_t ch, irq_req_t *irqr)
2577c478bdstevel@tonic-gate{
2587c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
2597c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
2607c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_RequestIRQ: handle: 0x%x\n", ch);
2617c478bdstevel@tonic-gate#endif
2627c478bdstevel@tonic-gate	return (CardServices(RequestIRQ, ch, irqr));
2637c478bdstevel@tonic-gate}
2647c478bdstevel@tonic-gate
2657c478bdstevel@tonic-gateint32_t
2667c478bdstevel@tonic-gatecsx_ReleaseIRQ(client_handle_t ch, irq_req_t *irqr)
2677c478bdstevel@tonic-gate{
2687c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
2697c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
2707c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_ReleaseIRQ: handle: 0x%x\n", ch);
2717c478bdstevel@tonic-gate#endif
2727c478bdstevel@tonic-gate	return (CardServices(ReleaseIRQ, ch, irqr));
2737c478bdstevel@tonic-gate}
2747c478bdstevel@tonic-gate
2757c478bdstevel@tonic-gateint32_t
2767c478bdstevel@tonic-gatecsx_RequestWindow(client_handle_t ch, window_handle_t *wh, win_req_t *wr)
2777c478bdstevel@tonic-gate{
2787c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
2797c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
2807c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_RequestWindow: handle: 0x%x\n", ch);
2817c478bdstevel@tonic-gate#endif
2827c478bdstevel@tonic-gate	return (CardServices(RequestWindow, ch, wh, wr));
2837c478bdstevel@tonic-gate}
2847c478bdstevel@tonic-gate
2857c478bdstevel@tonic-gateint32_t
2867c478bdstevel@tonic-gatecsx_ReleaseWindow(window_handle_t wh)
2877c478bdstevel@tonic-gate{
2887c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
2897c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
2907c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_ReleaseWindow: handle: 0x%x\n", wh);
2917c478bdstevel@tonic-gate#endif
2927c478bdstevel@tonic-gate	return (CardServices(ReleaseWindow, wh));
2937c478bdstevel@tonic-gate}
2947c478bdstevel@tonic-gate
2957c478bdstevel@tonic-gateint32_t
2967c478bdstevel@tonic-gatecsx_ModifyWindow(window_handle_t wh, modify_win_t *mw)
2977c478bdstevel@tonic-gate{
2987c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
2997c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
3007c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_ModifyWindow: handle: 0x%x\n", wh);
3017c478bdstevel@tonic-gate#endif
3027c478bdstevel@tonic-gate	return (CardServices(ModifyWindow, wh, mw));
3037c478bdstevel@tonic-gate}
3047c478bdstevel@tonic-gate
3057c478bdstevel@tonic-gateint32_t
3067c478bdstevel@tonic-gatecsx_MapMemPage(window_handle_t wh, map_mem_page_t *mmp)
3077c478bdstevel@tonic-gate{
3087c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
3097c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
3107c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_MapMemPage: handle: 0x%x\n", wh);
3117c478bdstevel@tonic-gate#endif
3127c478bdstevel@tonic-gate	return (CardServices(MapMemPage, wh, mmp));
3137c478bdstevel@tonic-gate}
3147c478bdstevel@tonic-gate
3157c478bdstevel@tonic-gateint32_t
3167c478bdstevel@tonic-gatecsx_RequestSocketMask(client_handle_t ch, request_socket_mask_t *sm)
3177c478bdstevel@tonic-gate{
3187c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
3197c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
3207c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_RequestSocketMask: handle: 0x%x\n", ch);
3217c478bdstevel@tonic-gate#endif
3227c478bdstevel@tonic-gate	return (CardServices(RequestSocketMask, ch, sm));
3237c478bdstevel@tonic-gate}
3247c478bdstevel@tonic-gate
3257c478bdstevel@tonic-gateint32_t
3267c478bdstevel@tonic-gatecsx_ReleaseSocketMask(client_handle_t ch, release_socket_mask_t *rsm)
3277c478bdstevel@tonic-gate{
3287c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
3297c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
3307c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_ReleaseSocketMask: handle: 0x%x\n", ch);
3317c478bdstevel@tonic-gate#endif
3327c478bdstevel@tonic-gate	return (CardServices(ReleaseSocketMask, ch, rsm));
3337c478bdstevel@tonic-gate}
3347c478bdstevel@tonic-gate
3357c478bdstevel@tonic-gateint32_t
3367c478bdstevel@tonic-gatecsx_RequestConfiguration(client_handle_t ch, config_req_t *cr)
3377c478bdstevel@tonic-gate{
3387c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
3397c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
3407c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_RequestConfiguration: handle: 0x%x\n", ch);
3417c478bdstevel@tonic-gate#endif
3427c478bdstevel@tonic-gate	return (CardServices(RequestConfiguration, ch, cr));
3437c478bdstevel@tonic-gate}
3447c478bdstevel@tonic-gate
3457c478bdstevel@tonic-gateint32_t
3467c478bdstevel@tonic-gatecsx_ModifyConfiguration(client_handle_t ch, modify_config_t *mc)
3477c478bdstevel@tonic-gate{
3487c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
3497c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
3507c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_ModifyConfiguration: handle: 0x%x\n", ch);
3517c478bdstevel@tonic-gate#endif
3527c478bdstevel@tonic-gate	return (CardServices(ModifyConfiguration, ch, mc));
3537c478bdstevel@tonic-gate}
3547c478bdstevel@tonic-gate
3557c478bdstevel@tonic-gateint32_t
3567c478bdstevel@tonic-gatecsx_ReleaseConfiguration(client_handle_t ch, release_config_t *rc)
3577c478bdstevel@tonic-gate{
3587c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
3597c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
3607c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_ReleaseConfiguration: handle: 0x%x\n", ch);
3617c478bdstevel@tonic-gate#endif
3627c478bdstevel@tonic-gate	return (CardServices(ReleaseConfiguration, ch, rc));
3637c478bdstevel@tonic-gate}
3647c478bdstevel@tonic-gate
3657c478bdstevel@tonic-gateint32_t
3667c478bdstevel@tonic-gatecsx_AccessConfigurationRegister(client_handle_t ch, access_config_reg_t *acr)
3677c478bdstevel@tonic-gate{
3687c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
3697c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
3707c478bdstevel@tonic-gate	    cmn_err(CE_CONT,
3717c478bdstevel@tonic-gate		"csx_AccessConfigurationRegister: handle: 0x%x\n", ch);
3727c478bdstevel@tonic-gate#endif
3737c478bdstevel@tonic-gate	return (CardServices(AccessConfigurationRegister, ch, acr));
3747c478bdstevel@tonic-gate}
3757c478bdstevel@tonic-gate
3767c478bdstevel@tonic-gateint32_t
3777c478bdstevel@tonic-gatecsx_GetFirstTuple(client_handle_t ch, tuple_t *tp)
3787c478bdstevel@tonic-gate{
3797c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
3807c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
3817c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_GetFirstTuple: handle: 0x%x\n", ch);
3827c478bdstevel@tonic-gate#endif
3837c478bdstevel@tonic-gate	return (CardServices(GetFirstTuple, ch, tp));
3847c478bdstevel@tonic-gate}
3857c478bdstevel@tonic-gate
3867c478bdstevel@tonic-gateint32_t
3877c478bdstevel@tonic-gatecsx_GetNextTuple(client_handle_t ch, tuple_t *tp)
3887c478bdstevel@tonic-gate{
3897c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
3907c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
3917c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_GetNextTuple: handle: 0x%x\n", ch);
3927c478bdstevel@tonic-gate#endif
3937c478bdstevel@tonic-gate	return (CardServices(GetNextTuple, ch, tp));
3947c478bdstevel@tonic-gate}
3957c478bdstevel@tonic-gate
3967c478bdstevel@tonic-gateint32_t
3977c478bdstevel@tonic-gatecsx_GetTupleData(client_handle_t ch, tuple_t *tp)
3987c478bdstevel@tonic-gate{
3997c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
4007c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
4017c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_GetTupleData: handle: 0x%x\n", ch);
4027c478bdstevel@tonic-gate#endif
4037c478bdstevel@tonic-gate	return (CardServices(GetTupleData, ch, tp));
4047c478bdstevel@tonic-gate}
4057c478bdstevel@tonic-gate
4067c478bdstevel@tonic-gateint32_t
4077c478bdstevel@tonic-gatecsx_MapLogSocket(client_handle_t ch, map_log_socket_t *mls)
4087c478bdstevel@tonic-gate{
4097c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
4107c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
4117c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_MapLogSocket: handle: 0x%x\n", ch);
4127c478bdstevel@tonic-gate#endif
4137c478bdstevel@tonic-gate	return (CardServices(MapLogSocket, ch, mls));
4147c478bdstevel@tonic-gate}
4157c478bdstevel@tonic-gate
4167c478bdstevel@tonic-gateint32_t
4177c478bdstevel@tonic-gatecsx_ValidateCIS(client_handle_t ch, cisinfo_t *ci)
4187c478bdstevel@tonic-gate{
4197c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
4207c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
4217c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_ValidateCIS: handle: 0x%x\n", ch);
4227c478bdstevel@tonic-gate#endif
4237c478bdstevel@tonic-gate	return (CardServices(ValidateCIS, ch, ci));
4247c478bdstevel@tonic-gate}
4257c478bdstevel@tonic-gate
4267c478bdstevel@tonic-gateint32_t
4277c478bdstevel@tonic-gatecsx_MakeDeviceNode(client_handle_t ch, make_device_node_t *mdn)
4287c478bdstevel@tonic-gate{
4297c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
4307c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
4317c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_MakeDeviceNode: handle: 0x%x\n", ch);
4327c478bdstevel@tonic-gate#endif
4337c478bdstevel@tonic-gate	return (CardServices(MakeDeviceNode, ch, mdn));
4347c478bdstevel@tonic-gate}
4357c478bdstevel@tonic-gate
4367c478bdstevel@tonic-gateint32_t
4377c478bdstevel@tonic-gatecsx_RemoveDeviceNode(client_handle_t ch, remove_device_node_t *rdn)
4387c478bdstevel@tonic-gate{
4397c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
4407c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
4417c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_RemoveDeviceNode: handle: 0x%x\n", ch);
4427c478bdstevel@tonic-gate#endif
4437c478bdstevel@tonic-gate	return (CardServices(RemoveDeviceNode, ch, rdn));
4447c478bdstevel@tonic-gate}
4457c478bdstevel@tonic-gate
4467c478bdstevel@tonic-gateint32_t
4477c478bdstevel@tonic-gatecsx_ConvertSpeed(convert_speed_t *cp)
4487c478bdstevel@tonic-gate{
4497c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
4507c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
4517c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_ConvertSpeed\n");
4527c478bdstevel@tonic-gate#endif
4537c478bdstevel@tonic-gate	return (CardServices(ConvertSpeed, cp));
4547c478bdstevel@tonic-gate}
4557c478bdstevel@tonic-gate
4567c478bdstevel@tonic-gateint32_t
4577c478bdstevel@tonic-gatecsx_ConvertSize(convert_size_t *cp)
4587c478bdstevel@tonic-gate{
4597c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
4607c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
4617c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_ConvertSize\n");
4627c478bdstevel@tonic-gate#endif
4637c478bdstevel@tonic-gate	return (CardServices(ConvertSize, cp));
4647c478bdstevel@tonic-gate}
4657c478bdstevel@tonic-gate
4667c478bdstevel@tonic-gateint32_t
4677c478bdstevel@tonic-gatecsx_Event2Text(event2text_t *e2t)
4687c478bdstevel@tonic-gate{
4697c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
4707c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
4717c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_Event2Text\n");
4727c478bdstevel@tonic-gate#endif
4737c478bdstevel@tonic-gate	return (CardServices(Event2Text, e2t));
4747c478bdstevel@tonic-gate}
4757c478bdstevel@tonic-gate
4767c478bdstevel@tonic-gateint32_t
4777c478bdstevel@tonic-gatecsx_Error2Text(error2text_t *e2t)
4787c478bdstevel@tonic-gate{
4797c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
4807c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
4817c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_Error2Text\n");
4827c478bdstevel@tonic-gate#endif
4837c478bdstevel@tonic-gate	return (CardServices(Error2Text, e2t));
4847c478bdstevel@tonic-gate}
4857c478bdstevel@tonic-gate
4867c478bdstevel@tonic-gateint32_t
4877c478bdstevel@tonic-gatecsx_CS_DDI_Info(cs_ddi_info_t *cp)
4887c478bdstevel@tonic-gate{
4897c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
4907c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
4917c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_CS_DDI_Info\n");
4927c478bdstevel@tonic-gate#endif
4937c478bdstevel@tonic-gate	return (CardServices(CS_DDI_Info, cp));
4947c478bdstevel@tonic-gate}
4957c478bdstevel@tonic-gate
4967c478bdstevel@tonic-gateint32_t
4977c478bdstevel@tonic-gatecsx_CS_Sys_Ctl(cs_sys_ctl_t *csc)
4987c478bdstevel@tonic-gate{
4997c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
5007c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
5017c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_CS_Sys_Ctl\n");
5027c478bdstevel@tonic-gate#endif
5037c478bdstevel@tonic-gate	return (CardServices(CS_Sys_Ctl, csc));
5047c478bdstevel@tonic-gate}
5057c478bdstevel@tonic-gate
5067c478bdstevel@tonic-gateint32_t
5077c478bdstevel@tonic-gatecsx_GetClientInfo(client_handle_t ch, client_info_t *ci)
5087c478bdstevel@tonic-gate{
5097c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
5107c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
5117c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_GetClientInfo: handle: 0x%x\n", ch);
5127c478bdstevel@tonic-gate#endif
5137c478bdstevel@tonic-gate
5147c478bdstevel@tonic-gate	return (CardServices(GetClientInfo, ch, ci));
5157c478bdstevel@tonic-gate}
5167c478bdstevel@tonic-gate
5177c478bdstevel@tonic-gateint32_t
5187c478bdstevel@tonic-gatecsx_GetFirstClient(get_firstnext_client_t *fnc)
5197c478bdstevel@tonic-gate{
5207c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
5217c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
5227c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_GetFirstClient\n");
5237c478bdstevel@tonic-gate#endif
5247c478bdstevel@tonic-gate
5257c478bdstevel@tonic-gate	return (CardServices(GetFirstClient, fnc));
5267c478bdstevel@tonic-gate}
5277c478bdstevel@tonic-gate
5287c478bdstevel@tonic-gateint32_t
5297c478bdstevel@tonic-gatecsx_GetNextClient(get_firstnext_client_t *fnc)
5307c478bdstevel@tonic-gate{
5317c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
5327c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
5337c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_GetNextClient\n");
5347c478bdstevel@tonic-gate#endif
5357c478bdstevel@tonic-gate
5367c478bdstevel@tonic-gate	return (CardServices(GetNextClient, fnc));
5377c478bdstevel@tonic-gate}
5387c478bdstevel@tonic-gate
5397c478bdstevel@tonic-gateint32_t
5407c478bdstevel@tonic-gatecsx_ResetFunction(client_handle_t ch, reset_function_t *rf)
5417c478bdstevel@tonic-gate{
5427c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
5437c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
5447c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_ResetFunction: handle: 0x%x\n", ch);
5457c478bdstevel@tonic-gate#endif
5467c478bdstevel@tonic-gate
5477c478bdstevel@tonic-gate	return (CardServices(ResetFunction, ch, rf));
5487c478bdstevel@tonic-gate}
5497c478bdstevel@tonic-gate
5507c478bdstevel@tonic-gateint32_t
5517c478bdstevel@tonic-gatecsx_GetCardServicesInfo(client_handle_t ch, get_cardservices_info_t *gcsi)
5527c478bdstevel@tonic-gate{
5537c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
5547c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
5557c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_GetCardServicesInfo: handle: 0x%x\n", ch);
5567c478bdstevel@tonic-gate#endif
5577c478bdstevel@tonic-gate
5587c478bdstevel@tonic-gate	return (CardServices(GetCardServicesInfo, ch, gcsi));
5597c478bdstevel@tonic-gate}
5607c478bdstevel@tonic-gate
5617c478bdstevel@tonic-gateint32_t
5627c478bdstevel@tonic-gatecsx_GetConfigurationInfo(client_handle_t *ch, get_configuration_info_t *gci)
5637c478bdstevel@tonic-gate{
5647c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
5657c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
5667c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_GetConfigurationInfo: "
5677c478bdstevel@tonic-gate		"handle: (no handle yet)\n");
5687c478bdstevel@tonic-gate#endif
5697c478bdstevel@tonic-gate
5707c478bdstevel@tonic-gate	return (CardServices(GetConfigurationInfo, ch, gci));
5717c478bdstevel@tonic-gate}
5727c478bdstevel@tonic-gate
5737c478bdstevel@tonic-gateint32_t
5747c478bdstevel@tonic-gatecsx_GetPhysicalAdapterInfo(client_handle_t ch, get_physical_adapter_info_t *gp)
5757c478bdstevel@tonic-gate{
5767c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
5777c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
5787c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_GetPhysicalAdapterInfo: handle: 0x%x\n", ch);
5797c478bdstevel@tonic-gate#endif
5807c478bdstevel@tonic-gate
5817c478bdstevel@tonic-gate	return (CardServices(GetPhysicalAdapterInfo, ch, gp));
5827c478bdstevel@tonic-gate}
5837c478bdstevel@tonic-gate
5847c478bdstevel@tonic-gate/*
5857c478bdstevel@tonic-gate * CIS tuple parsing functions - one entrypoint per tuple that we know
5867c478bdstevel@tonic-gate *	how to parse
5877c478bdstevel@tonic-gate */
5887c478bdstevel@tonic-gateint32_t
5897c478bdstevel@tonic-gatecsx_Parse_CISTPL_CONFIG(client_handle_t ch, tuple_t *tp, cistpl_config_t *pt)
5907c478bdstevel@tonic-gate{
5917c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
5927c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
5937c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_Parse_CISTPL_CONFIG: handle: 0x%x\n", ch);
5947c478bdstevel@tonic-gate#endif
5957c478bdstevel@tonic-gate	tp->DesiredTuple = CISTPL_CONFIG;
5967c478bdstevel@tonic-gate	return (CardServices(ParseTuple, ch, tp, pt));
5977c478bdstevel@tonic-gate}
5987c478bdstevel@tonic-gate
5997c478bdstevel@tonic-gateint32_t
6007c478bdstevel@tonic-gatecsx_Parse_CISTPL_DEVICE(client_handle_t ch, tuple_t *tp, cistpl_device_t *pt)
6017c478bdstevel@tonic-gate{
6027c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
6037c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
6047c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_Parse_CISTPL_DEVICE: handle: 0x%x\n", ch);
6057c478bdstevel@tonic-gate#endif
6067c478bdstevel@tonic-gate	tp->DesiredTuple = CISTPL_DEVICE;
6077c478bdstevel@tonic-gate	return (CardServices(ParseTuple, ch, tp, pt));
6087c478bdstevel@tonic-gate}
6097c478bdstevel@tonic-gate
6107c478bdstevel@tonic-gateint32_t
6117c478bdstevel@tonic-gatecsx_Parse_CISTPL_DEVICE_A(client_handle_t ch, tuple_t *tp, cistpl_device_t *pt)
6127c478bdstevel@tonic-gate{
6137c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
6147c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
6157c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_Parse_CISTPL_DEVICE_A: handle: 0x%x\n", ch);
6167c478bdstevel@tonic-gate#endif
6177c478bdstevel@tonic-gate	tp->DesiredTuple = CISTPL_DEVICE_A;
6187c478bdstevel@tonic-gate	return (CardServices(ParseTuple, ch, tp, pt));
6197c478bdstevel@tonic-gate}
6207c478bdstevel@tonic-gate
6217c478bdstevel@tonic-gateint32_t
6227c478bdstevel@tonic-gatecsx_Parse_CISTPL_DEVICE_OA(client_handle_t ch, tuple_t *tp, cistpl_device_t *pt)
6237c478bdstevel@tonic-gate{
6247c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
6257c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
6267c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_Parse_CISTPL_DEVICE_OA: handle: 0x%x\n", ch);
6277c478bdstevel@tonic-gate#endif
6287c478bdstevel@tonic-gate	tp->DesiredTuple = CISTPL_DEVICE_OA;
6297c478bdstevel@tonic-gate	return (CardServices(ParseTuple, ch, tp, pt));
6307c478bdstevel@tonic-gate}
6317c478bdstevel@tonic-gate
6327c478bdstevel@tonic-gateint32_t
6337c478bdstevel@tonic-gatecsx_Parse_CISTPL_DEVICE_OC(client_handle_t ch, tuple_t *tp, cistpl_device_t *pt)
6347c478bdstevel@tonic-gate{
6357c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
6367c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
6377c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_Parse_CISTPL_DEVICE_OC: handle: 0x%x\n", ch);
6387c478bdstevel@tonic-gate#endif
6397c478bdstevel@tonic-gate	tp->DesiredTuple = CISTPL_DEVICE_OC;
6407c478bdstevel@tonic-gate	return (CardServices(ParseTuple, ch, tp, pt));
6417c478bdstevel@tonic-gate}
6427c478bdstevel@tonic-gate
6437c478bdstevel@tonic-gateint32_t
6447c478bdstevel@tonic-gatecsx_Parse_CISTPL_VERS_1(client_handle_t ch, tuple_t *tp, cistpl_vers_1_t *pt)
6457c478bdstevel@tonic-gate{
6467c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
6477c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
6487c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_Parse_CISTPL_VERS_1: handle: 0x%x\n", ch);
6497c478bdstevel@tonic-gate#endif
6507c478bdstevel@tonic-gate	tp->DesiredTuple = CISTPL_VERS_1;
6517c478bdstevel@tonic-gate	return (CardServices(ParseTuple, ch, tp, pt));
6527c478bdstevel@tonic-gate}
6537c478bdstevel@tonic-gate
6547c478bdstevel@tonic-gateint32_t
6557c478bdstevel@tonic-gatecsx_Parse_CISTPL_VERS_2(client_handle_t ch, tuple_t *tp, cistpl_vers_2_t *pt)
6567c478bdstevel@tonic-gate{
6577c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
6587c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
6597c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_Parse_CISTPL_VERS_2: handle: 0x%x\n", ch);
6607c478bdstevel@tonic-gate#endif
6617c478bdstevel@tonic-gate	tp->DesiredTuple = CISTPL_VERS_2;
6627c478bdstevel@tonic-gate	return (CardServices(ParseTuple, ch, tp, pt));
6637c478bdstevel@tonic-gate}
6647c478bdstevel@tonic-gate
6657c478bdstevel@tonic-gateint32_t
6667c478bdstevel@tonic-gatecsx_Parse_CISTPL_JEDEC_A(client_handle_t ch, tuple_t *tp, cistpl_jedec_t *pt)
6677c478bdstevel@tonic-gate{
6687c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
6697c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
6707c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_Parse_CISTPL_JEDEC_A: handle: 0x%x\n", ch);
6717c478bdstevel@tonic-gate#endif
6727c478bdstevel@tonic-gate	tp->DesiredTuple = CISTPL_JEDEC_A;
6737c478bdstevel@tonic-gate	return (CardServices(ParseTuple, ch, tp, pt));
6747c478bdstevel@tonic-gate}
6757c478bdstevel@tonic-gate
6767c478bdstevel@tonic-gateint32_t
6777c478bdstevel@tonic-gatecsx_Parse_CISTPL_JEDEC_C(client_handle_t ch, tuple_t *tp, cistpl_jedec_t *pt)
6787c478bdstevel@tonic-gate{
6797c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
6807c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
6817c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_Parse_CISTPL_JEDEC_C: handle: 0x%x\n", ch);
6827c478bdstevel@tonic-gate#endif
6837c478bdstevel@tonic-gate	tp->DesiredTuple = CISTPL_JEDEC_C;
6847c478bdstevel@tonic-gate	return (CardServices(ParseTuple, ch, tp, pt));
6857c478bdstevel@tonic-gate}
6867c478bdstevel@tonic-gate
6877c478bdstevel@tonic-gateint32_t
6887c478bdstevel@tonic-gatecsx_Parse_CISTPL_FORMAT(client_handle_t ch, tuple_t *tp, cistpl_format_t *pt)
6897c478bdstevel@tonic-gate{
6907c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
6917c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
6927c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_Parse_CISTPL_FORMAT: handle: 0x%x\n", ch);
6937c478bdstevel@tonic-gate#endif
6947c478bdstevel@tonic-gate	tp->DesiredTuple = CISTPL_FORMAT;
6957c478bdstevel@tonic-gate	return (CardServices(ParseTuple, ch, tp, pt));
6967c478bdstevel@tonic-gate}
6977c478bdstevel@tonic-gate
6987c478bdstevel@tonic-gateint32_t
6997c478bdstevel@tonic-gatecsx_Parse_CISTPL_FORMAT_A(client_handle_t ch, tuple_t *tp, cistpl_format_t *pt)
7007c478bdstevel@tonic-gate{
7017c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
7027c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
7037c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_Parse_CISTPL_FORMAT_A: handle: 0x%x\n", ch);
7047c478bdstevel@tonic-gate#endif
7057c478bdstevel@tonic-gate	tp->DesiredTuple = CISTPL_FORMAT_A;
7067c478bdstevel@tonic-gate	return (CardServices(ParseTuple, ch, tp, pt));
7077c478bdstevel@tonic-gate}
7087c478bdstevel@tonic-gate
7097c478bdstevel@tonic-gateint32_t
7107c478bdstevel@tonic-gatecsx_Parse_CISTPL_GEOMETRY(client_handle_t ch, tuple_t *tp,
7117c478bdstevel@tonic-gate    cistpl_geometry_t *pt)
7127c478bdstevel@tonic-gate{
7137c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
7147c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
7157c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_Parse_CISTPL_GEOMETRY: handle: 0x%x\n", ch);
7167c478bdstevel@tonic-gate#endif
7177c478bdstevel@tonic-gate	tp->DesiredTuple = CISTPL_GEOMETRY;
7187c478bdstevel@tonic-gate	return (CardServices(ParseTuple, ch, tp, pt));
7197c478bdstevel@tonic-gate}
7207c478bdstevel@tonic-gate
7217c478bdstevel@tonic-gateint32_t
7227c478bdstevel@tonic-gatecsx_Parse_CISTPL_BYTEORDER(client_handle_t ch, tuple_t *tp,
7237c478bdstevel@tonic-gate    cistpl_byteorder_t *pt)
7247c478bdstevel@tonic-gate{
7257c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
7267c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
7277c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_Parse_CISTPL_BYTEORDER: handle: 0x%x\n", ch);
7287c478bdstevel@tonic-gate#endif
7297c478bdstevel@tonic-gate	tp->DesiredTuple = CISTPL_BYTEORDER;
7307c478bdstevel@tonic-gate	return (CardServices(ParseTuple, ch, tp, pt));
7317c478bdstevel@tonic-gate}
7327c478bdstevel@tonic-gate
7337c478bdstevel@tonic-gateint32_t
7347c478bdstevel@tonic-gatecsx_Parse_CISTPL_DATE(client_handle_t ch, tuple_t *tp, cistpl_date_t *pt)
7357c478bdstevel@tonic-gate{
7367c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
7377c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
7387c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_Parse_CISTPL_DATE: handle: 0x%x\n", ch);
7397c478bdstevel@tonic-gate#endif
7407c478bdstevel@tonic-gate	tp->DesiredTuple = CISTPL_DATE;
7417c478bdstevel@tonic-gate	return (CardServices(ParseTuple, ch, tp, pt));
7427c478bdstevel@tonic-gate}
7437c478bdstevel@tonic-gate
7447c478bdstevel@tonic-gateint32_t
7457c478bdstevel@tonic-gatecsx_Parse_CISTPL_BATTERY(client_handle_t ch, tuple_t *tp, cistpl_battery_t *pt)
7467c478bdstevel@tonic-gate{
7477c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
7487c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
7497c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_Parse_CISTPL_BATTERY: handle: 0x%x\n", ch);
7507c478bdstevel@tonic-gate#endif
7517c478bdstevel@tonic-gate	tp->DesiredTuple = CISTPL_BATTERY;
7527c478bdstevel@tonic-gate	return (CardServices(ParseTuple, ch, tp, pt));
7537c478bdstevel@tonic-gate}
7547c478bdstevel@tonic-gate
7557c478bdstevel@tonic-gateint32_t
7567c478bdstevel@tonic-gatecsx_Parse_CISTPL_ORG(client_handle_t ch, tuple_t *tp, cistpl_org_t *pt)
7577c478bdstevel@tonic-gate{
7587c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
7597c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
7607c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_Parse_CISTPL_ORG: handle: 0x%x\n", ch);
7617c478bdstevel@tonic-gate#endif
7627c478bdstevel@tonic-gate	tp->DesiredTuple = CISTPL_ORG;
7637c478bdstevel@tonic-gate	return (CardServices(ParseTuple, ch, tp, pt));
7647c478bdstevel@tonic-gate}
7657c478bdstevel@tonic-gate
7667c478bdstevel@tonic-gateint32_t
7677c478bdstevel@tonic-gatecsx_Parse_CISTPL_MANFID(client_handle_t ch, tuple_t *tp, cistpl_manfid_t *pt)
7687c478bdstevel@tonic-gate{
7697c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
7707c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
7717c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_Parse_CISTPL_MANFID: handle: 0x%x\n", ch);
7727c478bdstevel@tonic-gate#endif
7737c478bdstevel@tonic-gate	tp->DesiredTuple = CISTPL_MANFID;
7747c478bdstevel@tonic-gate	return (CardServices(ParseTuple, ch, tp, pt));
7757c478bdstevel@tonic-gate}
7767c478bdstevel@tonic-gate
7777c478bdstevel@tonic-gateint32_t
7787c478bdstevel@tonic-gatecsx_Parse_CISTPL_FUNCID(client_handle_t ch, tuple_t *tp, cistpl_funcid_t *pt)
7797c478bdstevel@tonic-gate{
7807c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
7817c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
7827c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_Parse_CISTPL_FUNCID: handle: 0x%x\n", ch);
7837c478bdstevel@tonic-gate#endif
7847c478bdstevel@tonic-gate	tp->DesiredTuple = CISTPL_FUNCID;
7857c478bdstevel@tonic-gate	return (CardServices(ParseTuple, ch, tp, pt));
7867c478bdstevel@tonic-gate}
7877c478bdstevel@tonic-gate
7887c478bdstevel@tonic-gateint32_t
7897c478bdstevel@tonic-gatecsx_Parse_CISTPL_FUNCE(client_handle_t ch, tuple_t *tp,
7907c478bdstevel@tonic-gate    cistpl_funce_t *pt, uint32_t function)
7917c478bdstevel@tonic-gate{
7927c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
7937c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
7947c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_Parse_CISTPL_FUNCE: handle: 0x%x\n", ch);
7957c478bdstevel@tonic-gate#endif
7967c478bdstevel@tonic-gate	tp->DesiredTuple = CISTPL_FUNCE;
7977c478bdstevel@tonic-gate	return (CardServices(ParseTuple, ch, tp, pt, function));
7987c478bdstevel@tonic-gate}
7997c478bdstevel@tonic-gate
8007c478bdstevel@tonic-gateint32_t
8017c478bdstevel@tonic-gatecsx_Parse_CISTPL_CFTABLE_ENTRY(client_handle_t ch, tuple_t *tp,
8027c478bdstevel@tonic-gate    cistpl_cftable_entry_t *pt)
8037c478bdstevel@tonic-gate{
8047c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
8057c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
8067c478bdstevel@tonic-gate	    cmn_err(CE_CONT,
8077c478bdstevel@tonic-gate		"csx_Parse_CISTPL_CFTABLE_ENTRY: handle: 0x%x\n", ch);
8087c478bdstevel@tonic-gate#endif
8097c478bdstevel@tonic-gate	tp->DesiredTuple = CISTPL_CFTABLE_ENTRY;
8107c478bdstevel@tonic-gate	return (CardServices(ParseTuple, ch, tp, pt));
8117c478bdstevel@tonic-gate}
8127c478bdstevel@tonic-gate
8137c478bdstevel@tonic-gateint32_t
8147c478bdstevel@tonic-gatecsx_Parse_CISTPL_LINKTARGET(client_handle_t ch, tuple_t *tp,
8157c478bdstevel@tonic-gate    cistpl_linktarget_t *pt)
8167c478bdstevel@tonic-gate{
8177c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
8187c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
8197c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_Parse_CISTPL_LINKTARGET: handle: 0x%x\n", ch);
8207c478bdstevel@tonic-gate#endif
8217c478bdstevel@tonic-gate	tp->DesiredTuple = CISTPL_LINKTARGET;
8227c478bdstevel@tonic-gate	return (CardServices(ParseTuple, ch, tp, pt));
8237c478bdstevel@tonic-gate}
8247c478bdstevel@tonic-gate
8257c478bdstevel@tonic-gateint32_t
8267c478bdstevel@tonic-gatecsx_Parse_CISTPL_LONGLINK_A(client_handle_t ch, tuple_t *tp,
8277c478bdstevel@tonic-gate    cistpl_longlink_ac_t *pt)
8287c478bdstevel@tonic-gate{
8297c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
8307c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
8317c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_Parse_CISTPL_LONGLINK_A: handle: 0x%x\n", ch);
8327c478bdstevel@tonic-gate#endif
8337c478bdstevel@tonic-gate	tp->DesiredTuple = CISTPL_LONGLINK_A;
8347c478bdstevel@tonic-gate	return (CardServices(ParseTuple, ch, tp, pt));
8357c478bdstevel@tonic-gate}
8367c478bdstevel@tonic-gate
8377c478bdstevel@tonic-gateint32_t
8387c478bdstevel@tonic-gatecsx_Parse_CISTPL_LONGLINK_C(client_handle_t ch, tuple_t *tp,
8397c478bdstevel@tonic-gate    cistpl_longlink_ac_t *pt)
8407c478bdstevel@tonic-gate{
8417c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
8427c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
8437c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_Parse_CISTPL_LONGLINK_C: handle: 0x%x\n", ch);
8447c478bdstevel@tonic-gate#endif
8457c478bdstevel@tonic-gate	tp->DesiredTuple = CISTPL_LONGLINK_C;
8467c478bdstevel@tonic-gate	return (CardServices(ParseTuple, ch, tp, pt));
8477c478bdstevel@tonic-gate}
8487c478bdstevel@tonic-gate
8497c478bdstevel@tonic-gateint32_t
8507c478bdstevel@tonic-gatecsx_Parse_CISTPL_LONGLINK_MFC(client_handle_t ch, tuple_t *tp,
8517c478bdstevel@tonic-gate    cistpl_longlink_mfc_t *pt)
8527c478bdstevel@tonic-gate{
8537c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
8547c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
8557c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_Parse_CISTPL_LONGLINK_MFC: "
8567c478bdstevel@tonic-gate						"handle: 0x%x\n", ch);
8577c478bdstevel@tonic-gate#endif
8587c478bdstevel@tonic-gate	tp->DesiredTuple = CISTPL_LONGLINK_MFC;
8597c478bdstevel@tonic-gate	return (CardServices(ParseTuple, ch, tp, pt));
8607c478bdstevel@tonic-gate}
8617c478bdstevel@tonic-gate
8627c478bdstevel@tonic-gateint32_t csx_Parse_CISTPL_LONGLINK_CB(client_handle_t ch, tuple_t *tp,
8637c478bdstevel@tonic-gate    cistpl_longlink_cb_t *pt)
8647c478bdstevel@tonic-gate{
8657c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
8667c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
8677c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_Parse_CISTPL_LONGLINK_CB: "
8687c478bdstevel@tonic-gate						"handle: 0x%x\n", ch);
8697c478bdstevel@tonic-gate#endif
8707c478bdstevel@tonic-gate	tp->DesiredTuple = CISTPL_LONGLINK_CB;
8717c478bdstevel@tonic-gate	return (CardServices(ParseTuple, ch, tp, pt));
8727c478bdstevel@tonic-gate}
8737c478bdstevel@tonic-gate
8747c478bdstevel@tonic-gateint32_t
8757c478bdstevel@tonic-gatecsx_Parse_CISTPL_SPCL(client_handle_t ch, tuple_t *tp,
8767c478bdstevel@tonic-gate    cistpl_spcl_t *pt)
8777c478bdstevel@tonic-gate{
8787c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
8797c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
8807c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_Parse_CISTPL_SPCL: handle: 0x%x\n", ch);
8817c478bdstevel@tonic-gate#endif
8827c478bdstevel@tonic-gate	tp->DesiredTuple = CISTPL_SPCL;
8837c478bdstevel@tonic-gate	return (CardServices(ParseTuple, ch, tp, pt));
8847c478bdstevel@tonic-gate}
8857c478bdstevel@tonic-gate
8867c478bdstevel@tonic-gateint32_t
8877c478bdstevel@tonic-gatecsx_Parse_CISTPL_SWIL(client_handle_t ch, tuple_t *tp,
8887c478bdstevel@tonic-gate    cistpl_swil_t *pt)
8897c478bdstevel@tonic-gate{
8907c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
8917c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
8927c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_Parse_CISTPL_SWIL: handle: 0x%x\n", ch);
8937c478bdstevel@tonic-gate#endif
8947c478bdstevel@tonic-gate	tp->DesiredTuple = CISTPL_SWIL;
8957c478bdstevel@tonic-gate	return (CardServices(ParseTuple, ch, tp, pt));
8967c478bdstevel@tonic-gate}
8977c478bdstevel@tonic-gate
8987c478bdstevel@tonic-gateint32_t csx_Parse_CISTPL_BAR(client_handle_t ch, tuple_t *tp,
8997c478bdstevel@tonic-gate    cistpl_bar_t *pt)
9007c478bdstevel@tonic-gate{
9017c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
9027c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
9037c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_Parse_CISTPL_BAR: handle: 0x%x\n", ch);
9047c478bdstevel@tonic-gate#endif
9057c478bdstevel@tonic-gate	tp->DesiredTuple = CISTPL_BAR;
9067c478bdstevel@tonic-gate	return (CardServices(ParseTuple, ch, tp, pt));
9077c478bdstevel@tonic-gate}
9087c478bdstevel@tonic-gate
9097c478bdstevel@tonic-gateint32_t
9107c478bdstevel@tonic-gatecsx_Parse_CISTPL_DEVICEGEO(client_handle_t ch, tuple_t *tp,
9117c478bdstevel@tonic-gate    cistpl_devicegeo_t *pt)
9127c478bdstevel@tonic-gate{
9137c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
9147c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
9157c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_Parse_CISTPL_DEVICEGEO: handle: 0x%x\n", ch);
9167c478bdstevel@tonic-gate#endif
9177c478bdstevel@tonic-gate	tp->DesiredTuple = CISTPL_DEVICEGEO;
9187c478bdstevel@tonic-gate	return (CardServices(ParseTuple, ch, tp, pt));
9197c478bdstevel@tonic-gate}
9207c478bdstevel@tonic-gate
9217c478bdstevel@tonic-gateint32_t
9227c478bdstevel@tonic-gatecsx_Parse_CISTPL_DEVICEGEO_A(client_handle_t ch, tuple_t *tp,
9237c478bdstevel@tonic-gate    cistpl_devicegeo_t *pt)
9247c478bdstevel@tonic-gate{
9257c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
9267c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
9277c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_Parse_CISTPL_DEVICEGEO_A: "
9287c478bdstevel@tonic-gate						"handle: 0x%x\n", ch);
9297c478bdstevel@tonic-gate#endif
9307c478bdstevel@tonic-gate	tp->DesiredTuple = CISTPL_DEVICEGEO_A;
9317c478bdstevel@tonic-gate	return (CardServices(ParseTuple, ch, tp, pt));
9327c478bdstevel@tonic-gate}
9337c478bdstevel@tonic-gate
9347c478bdstevel@tonic-gateint32_t
9357c478bdstevel@tonic-gatecsx_ParseTuple(client_handle_t ch, tuple_t *tp, cisparse_t *cp, uint32_t ef)
9367c478bdstevel@tonic-gate{
9377c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
9387c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
9397c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_ParseTuple: handle: 0x%x\n", ch);
9407c478bdstevel@tonic-gate#endif
9417c478bdstevel@tonic-gate	return (CardServices(ParseTuple, ch, tp, cp, ef));
9427c478bdstevel@tonic-gate}
9437c478bdstevel@tonic-gate
9447c478bdstevel@tonic-gate/*
9457c478bdstevel@tonic-gate * The following functions are used to access various datatypes.
9467c478bdstevel@tonic-gate *	These functions are not specific to PCMCIA client drivers
9477c478bdstevel@tonic-gate *	and they don't depend on Card Services being present to
9487c478bdstevel@tonic-gate *	operate.
9497c478bdstevel@tonic-gate */
9507c478bdstevel@tonic-gatevoid
9517c478bdstevel@tonic-gatecsx_Put8(acc_handle_t handle, uint32_t offset, uint8_t value)
9527c478bdstevel@tonic-gate{
9537c478bdstevel@tonic-gate	ddi_acc_hdl_t *hp = impl_acc_hdl_get(handle);
9547c478bdstevel@tonic-gate
9557c478bdstevel@tonic-gate	ddi_put8(handle, (uint8_t *)(hp->ah_addr + offset), value);
9567c478bdstevel@tonic-gate}
9577c478bdstevel@tonic-gate
9587c478bdstevel@tonic-gatevoid
9597c478bdstevel@tonic-gatecsx_Put16(acc_handle_t handle, uint32_t offset, uint16_t value)
9607c478bdstevel@tonic-gate{
9617c478bdstevel@tonic-gate	ddi_acc_hdl_t *hp = impl_acc_hdl_get(handle);
9627c478bdstevel@tonic-gate
9637c478bdstevel@tonic-gate	ddi_put16(handle, (uint16_t *)(hp->ah_addr + offset), value);
9647c478bdstevel@tonic-gate}
9657c478bdstevel@tonic-gate
9667c478bdstevel@tonic-gatevoid
9677c478bdstevel@tonic-gatecsx_Put32(acc_handle_t handle, uint32_t offset, uint32_t value)
9687c478bdstevel@tonic-gate{
9697c478bdstevel@tonic-gate	ddi_acc_hdl_t *hp = impl_acc_hdl_get(handle);
9707c478bdstevel@tonic-gate
9717c478bdstevel@tonic-gate	ddi_put32(handle, (uint32_t *)(hp->ah_addr + offset), value);
9727c478bdstevel@tonic-gate}
9737c478bdstevel@tonic-gate
9747c478bdstevel@tonic-gatevoid
9757c478bdstevel@tonic-gatecsx_Put64(acc_handle_t handle, uint32_t offset, uint64_t value)
9767c478bdstevel@tonic-gate{
9777c478bdstevel@tonic-gate	ddi_acc_hdl_t *hp = impl_acc_hdl_get(handle);
9787c478bdstevel@tonic-gate
9797c478bdstevel@tonic-gate	ddi_put64(handle, (uint64_t *)(hp->ah_addr + offset), value);
9807c478bdstevel@tonic-gate}
9817c478bdstevel@tonic-gate
9827c478bdstevel@tonic-gateuint8_t
9837c478bdstevel@tonic-gatecsx_Get8(acc_handle_t handle, uint32_t offset)
9847c478bdstevel@tonic-gate{
9857c478bdstevel@tonic-gate	ddi_acc_hdl_t *hp = impl_acc_hdl_get(handle);
9867c478bdstevel@tonic-gate
9877c478bdstevel@tonic-gate	return (ddi_get8(handle, (uint8_t *)(hp->ah_addr + offset)));
9887c478bdstevel@tonic-gate}
9897c478bdstevel@tonic-gate
9907c478bdstevel@tonic-gateuint16_t
9917c478bdstevel@tonic-gatecsx_Get16(acc_handle_t handle, uint32_t offset)
9927c478bdstevel@tonic-gate{
9937c478bdstevel@tonic-gate	ddi_acc_hdl_t *hp = impl_acc_hdl_get(handle);
9947c478bdstevel@tonic-gate
9957c478bdstevel@tonic-gate	return (ddi_get16(handle, (uint16_t *)(hp->ah_addr + offset)));
9967c478bdstevel@tonic-gate}
9977c478bdstevel@tonic-gate
9987c478bdstevel@tonic-gateuint32_t
9997c478bdstevel@tonic-gatecsx_Get32(acc_handle_t handle, uint32_t offset)
10007c478bdstevel@tonic-gate{
10017c478bdstevel@tonic-gate	ddi_acc_hdl_t *hp = impl_acc_hdl_get(handle);
10027c478bdstevel@tonic-gate
10037c478bdstevel@tonic-gate	return (ddi_get32(handle, (uint32_t *)(hp->ah_addr + offset)));
10047c478bdstevel@tonic-gate}
10057c478bdstevel@tonic-gate
10067c478bdstevel@tonic-gateuint64_t
10077c478bdstevel@tonic-gatecsx_Get64(acc_handle_t handle, uint32_t offset)
10087c478bdstevel@tonic-gate{
10097c478bdstevel@tonic-gate	ddi_acc_hdl_t *hp = impl_acc_hdl_get(handle);
10107c478bdstevel@tonic-gate
10117c478bdstevel@tonic-gate	return (ddi_get64(handle, (uint64_t *)(hp->ah_addr + offset)));
10127c478bdstevel@tonic-gate}
10137c478bdstevel@tonic-gate
10147c478bdstevel@tonic-gatevoid
10157c478bdstevel@tonic-gatecsx_RepPut8(acc_handle_t handle, uint8_t *hostaddr, uint32_t offset,
10167c478bdstevel@tonic-gate						uint32_t rc, uint32_t flags)
10177c478bdstevel@tonic-gate{
10187c478bdstevel@tonic-gate	ddi_acc_hdl_t *hp = impl_acc_hdl_get(handle);
10197c478bdstevel@tonic-gate
10207c478bdstevel@tonic-gate	ddi_rep_put8(handle, hostaddr, (uint8_t *)(hp->ah_addr + offset),
10217c478bdstevel@tonic-gate		rc, (uint32_t)flags);
10227c478bdstevel@tonic-gate}
10237c478bdstevel@tonic-gate
10247c478bdstevel@tonic-gatevoid
10257c478bdstevel@tonic-gatecsx_RepPut16(acc_handle_t handle, uint16_t *hostaddr, uint32_t offset,
10267c478bdstevel@tonic-gate						uint32_t rc, uint32_t flags)
10277c478bdstevel@tonic-gate{
10287c478bdstevel@tonic-gate	ddi_acc_hdl_t *hp = impl_acc_hdl_get(handle);
10297c478bdstevel@tonic-gate
10307c478bdstevel@tonic-gate	ddi_rep_put16(handle, hostaddr, (uint16_t *)(hp->ah_addr + offset),
10317c478bdstevel@tonic-gate		rc, (uint32_t)flags);
10327c478bdstevel@tonic-gate}
10337c478bdstevel@tonic-gate
10347c478bdstevel@tonic-gatevoid
10357c478bdstevel@tonic-gatecsx_RepPut32(acc_handle_t handle, uint32_t *hostaddr, uint32_t offset,
10367c478bdstevel@tonic-gate						uint32_t rc, uint32_t flags)
10377c478bdstevel@tonic-gate{
10387c478bdstevel@tonic-gate	ddi_acc_hdl_t *hp = impl_acc_hdl_get(handle);
10397c478bdstevel@tonic-gate
10407c478bdstevel@tonic-gate	ddi_rep_put32(handle, hostaddr, (uint32_t *)(hp->ah_addr + offset),
10417c478bdstevel@tonic-gate		rc, (uint32_t)flags);
10427c478bdstevel@tonic-gate}
10437c478bdstevel@tonic-gate
10447c478bdstevel@tonic-gatevoid
10457c478bdstevel@tonic-gatecsx_RepPut64(acc_handle_t handle, uint64_t *hostaddr, uint32_t offset,
10467c478bdstevel@tonic-gate						uint32_t rc, uint32_t flags)
10477c478bdstevel@tonic-gate{
10487c478bdstevel@tonic-gate	ddi_acc_hdl_t *hp = impl_acc_hdl_get(handle);
10497c478bdstevel@tonic-gate
10507c478bdstevel@tonic-gate	ddi_rep_put64(handle, hostaddr, (uint64_t *)(hp->ah_addr + offset),
10517c478bdstevel@tonic-gate		rc, (uint32_t)flags);
10527c478bdstevel@tonic-gate}
10537c478bdstevel@tonic-gate
10547c478bdstevel@tonic-gatevoid
10557c478bdstevel@tonic-gatecsx_RepGet8(acc_handle_t handle, uint8_t *hostaddr, uint32_t offset,
10567c478bdstevel@tonic-gate						uint32_t rc, uint32_t flags)
10577c478bdstevel@tonic-gate{
10587c478bdstevel@tonic-gate	ddi_acc_hdl_t *hp = impl_acc_hdl_get(handle);
10597c478bdstevel@tonic-gate
10607c478bdstevel@tonic-gate	ddi_rep_get8(handle, hostaddr, (uint8_t *)(hp->ah_addr + offset),
10617c478bdstevel@tonic-gate		rc, (uint32_t)flags);
10627c478bdstevel@tonic-gate}
10637c478bdstevel@tonic-gate
10647c478bdstevel@tonic-gatevoid
10657c478bdstevel@tonic-gatecsx_RepGet16(acc_handle_t handle, uint16_t *hostaddr, uint32_t offset,
10667c478bdstevel@tonic-gate						uint32_t rc, uint32_t flags)
10677c478bdstevel@tonic-gate{
10687c478bdstevel@tonic-gate	ddi_acc_hdl_t *hp = impl_acc_hdl_get(handle);
10697c478bdstevel@tonic-gate
10707c478bdstevel@tonic-gate	ddi_rep_get16(handle, hostaddr, (uint16_t *)(hp->ah_addr + offset),
10717c478bdstevel@tonic-gate		rc, (uint32_t)flags);
10727c478bdstevel@tonic-gate}
10737c478bdstevel@tonic-gate
10747c478bdstevel@tonic-gatevoid
10757c478bdstevel@tonic-gatecsx_RepGet32(acc_handle_t handle, uint32_t *hostaddr, uint32_t offset,
10767c478bdstevel@tonic-gate						uint32_t rc, uint32_t flags)
10777c478bdstevel@tonic-gate{
10787c478bdstevel@tonic-gate	ddi_acc_hdl_t *hp = impl_acc_hdl_get(handle);
10797c478bdstevel@tonic-gate
10807c478bdstevel@tonic-gate	ddi_rep_get32(handle, hostaddr, (uint32_t *)(hp->ah_addr + offset),
10817c478bdstevel@tonic-gate		rc, (uint32_t)flags);
10827c478bdstevel@tonic-gate}
10837c478bdstevel@tonic-gate
10847c478bdstevel@tonic-gatevoid
10857c478bdstevel@tonic-gatecsx_RepGet64(acc_handle_t handle, uint64_t *hostaddr, uint32_t offset,
10867c478bdstevel@tonic-gate						uint32_t rc, uint32_t flags)
10877c478bdstevel@tonic-gate{
10887c478bdstevel@tonic-gate	ddi_acc_hdl_t *hp = impl_acc_hdl_get(handle);
10897c478bdstevel@tonic-gate
10907c478bdstevel@tonic-gate	ddi_rep_get64(handle, hostaddr, (uint64_t *)(hp->ah_addr + offset),
10917c478bdstevel@tonic-gate		rc, (uint32_t)flags);
10927c478bdstevel@tonic-gate}
10937c478bdstevel@tonic-gate
10947c478bdstevel@tonic-gate/*
10957c478bdstevel@tonic-gate * The following two functions return the mapped (virtual) or physical
10967c478bdstevel@tonic-gate *	base address associated with the passed handle if the address
10977c478bdstevel@tonic-gate *	can be directly accessed by the caller. If the object represented
10987c478bdstevel@tonic-gate *	by the handle needs to be accessed through a common access
10997c478bdstevel@tonic-gate *	function, CS_BAD_BASE is returned.
11007c478bdstevel@tonic-gate *
11017c478bdstevel@tonic-gate * XXX - Need to figure out how to determine when to return CS_BAD_BASE
11027c478bdstevel@tonic-gate *	and also we need more generic return codes not tied to CS.
11037c478bdstevel@tonic-gate */
11047c478bdstevel@tonic-gateint32_t
11057c478bdstevel@tonic-gatecsx_GetMappedAddr(acc_handle_t handle, void **addr)
11067c478bdstevel@tonic-gate{
11077c478bdstevel@tonic-gate	ddi_acc_hdl_t *hp = impl_acc_hdl_get(handle);
11087c478bdstevel@tonic-gate
11097c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
11107c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
11117c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_GetMappedAddr: handle: 0x%p\n", handle);
11127c478bdstevel@tonic-gate#endif
11137c478bdstevel@tonic-gate
11147c478bdstevel@tonic-gate	*addr = hp->ah_addr;
11157c478bdstevel@tonic-gate
11167c478bdstevel@tonic-gate	return (CS_SUCCESS);	/* XXX should be generic return code */
11177c478bdstevel@tonic-gate}
11187c478bdstevel@tonic-gate
11197c478bdstevel@tonic-gateint32_t
11207c478bdstevel@tonic-gatecsx_GetPhysAddr(acc_handle_t handle, void **addr)
11217c478bdstevel@tonic-gate{
11227c478bdstevel@tonic-gate#ifndef	lint
11237c478bdstevel@tonic-gate	ddi_acc_hdl_t *hp = impl_acc_hdl_get(handle);
11247c478bdstevel@tonic-gate#endif	/* lint */
11257c478bdstevel@tonic-gate
11267c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
11277c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
11287c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_GetPhysAddr: handle: 0x%p\n", handle);
11297c478bdstevel@tonic-gate#endif
11307c478bdstevel@tonic-gate
11317c478bdstevel@tonic-gate	*addr = NULL;
11327c478bdstevel@tonic-gate
11337c478bdstevel@tonic-gate	return (CS_BAD_BASE);
11347c478bdstevel@tonic-gate}
11357c478bdstevel@tonic-gate
11367c478bdstevel@tonic-gate/*ARGSUSED*/
11377c478bdstevel@tonic-gateint32_t
11387c478bdstevel@tonic-gatecsx_DupHandle(acc_handle_t handle, acc_handle_t *dup, uint32_t flags)
11397c478bdstevel@tonic-gate{
11407c478bdstevel@tonic-gate#ifndef	lint
11417c478bdstevel@tonic-gate	ddi_acc_hdl_t *hp = impl_acc_hdl_get(handle);
11427c478bdstevel@tonic-gate#endif	/* lint */
11437c478bdstevel@tonic-gate
11447c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
11457c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
11467c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_DupHandle: handle: 0x%p\n", handle);
11477c478bdstevel@tonic-gate#endif
11487c478bdstevel@tonic-gate
11497c478bdstevel@tonic-gate	return (CS_BAD_HANDLE);
11507c478bdstevel@tonic-gate
11517c478bdstevel@tonic-gate#ifdef	XXX
11527c478bdstevel@tonic-gate	*dup = (acc_handle_t)kmem_alloc(sizeof (acc_hdl_t), KM_SLEEP);
11537c478bdstevel@tonic-gate	((acc_hdl_t *)*dup)->ddi_handle =
11547c478bdstevel@tonic-gate		(ddi_acc_handle_t *)kmem_alloc(sizeof (ddi_acc_impl_t),
11557c478bdstevel@tonic-gate		    KM_SLEEP);
11567c478bdstevel@tonic-gate
11577c478bdstevel@tonic-gate	bcopy((caddr_t)hp, (caddr_t)((acc_hdl_t *)*dup)->ddi_handle,
11587c478bdstevel@tonic-gate	    sizeof (ddi_acc_impl_t));
11597c478bdstevel@tonic-gate
11607c478bdstevel@tonic-gate	return (CS_SUCCESS);
11617c478bdstevel@tonic-gate#endif
11627c478bdstevel@tonic-gate}
11637c478bdstevel@tonic-gate
11647c478bdstevel@tonic-gateint32_t
11657c478bdstevel@tonic-gatecsx_FreeHandle(acc_handle_t *handle)
11667c478bdstevel@tonic-gate{
11677c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
11687c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
11697c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_FreeHandle: handle: 0x%p\n", *handle);
11707c478bdstevel@tonic-gate#endif
11717c478bdstevel@tonic-gate	return (CS_BAD_HANDLE);
11727c478bdstevel@tonic-gate
11737c478bdstevel@tonic-gate#ifdef	XXX
11747c478bdstevel@tonic-gate
11757c478bdstevel@tonic-gate	kmem_free((void *)((acc_hdl_t *)*handle)->ddi_handle,
11767c478bdstevel@tonic-gate		sizeof (ddi_acc_impl_t));
11777c478bdstevel@tonic-gate	kmem_free((void *)(acc_hdl_t *)*handle, sizeof (acc_hdl_t));
11787c478bdstevel@tonic-gate
11797c478bdstevel@tonic-gate	return (CS_SUCCESS);
11807c478bdstevel@tonic-gate#endif
11817c478bdstevel@tonic-gate}
11827c478bdstevel@tonic-gate
11837c478bdstevel@tonic-gate/*
11847c478bdstevel@tonic-gate * XXX - Probably want to remove these fucntions soon
11857c478bdstevel@tonic-gate */
11867c478bdstevel@tonic-gateint32_t
11877c478bdstevel@tonic-gatecsx_GetHandleOffset(acc_handle_t handle, uint32_t *offset)
11887c478bdstevel@tonic-gate{
11897c478bdstevel@tonic-gate	ddi_acc_hdl_t *hp = impl_acc_hdl_get(handle);
11907c478bdstevel@tonic-gate
11917c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
11927c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
11937c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_GetHandleOffset: handle: 0x%p\n", handle);
11947c478bdstevel@tonic-gate#endif
11957c478bdstevel@tonic-gate
11967c478bdstevel@tonic-gate	*offset = hp->ah_offset;
11977c478bdstevel@tonic-gate
11987c478bdstevel@tonic-gate	return (CS_SUCCESS);
11997c478bdstevel@tonic-gate}
12007c478bdstevel@tonic-gate
12017c478bdstevel@tonic-gateint32_t
12027c478bdstevel@tonic-gatecsx_SetHandleOffset(acc_handle_t handle, uint32_t offset)
12037c478bdstevel@tonic-gate{
12047c478bdstevel@tonic-gate	ddi_acc_hdl_t *hp = impl_acc_hdl_get(handle);
12057c478bdstevel@tonic-gate
12067c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
12077c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
12087c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "csx_SetHandleOffset: handle: 0x%p\n", handle);
12097c478bdstevel@tonic-gate#endif
12107c478bdstevel@tonic-gate
12117c478bdstevel@tonic-gate	hp->ah_offset = offset;
12127c478bdstevel@tonic-gate
12137c478bdstevel@tonic-gate	return (CS_SUCCESS);
12147c478bdstevel@tonic-gate}
12157c478bdstevel@tonic-gate
12167c478bdstevel@tonic-gatestatic int
1217ebf3735Toomas Soomecs_no_carservices(int32_t arg __unused, ...)
12187c478bdstevel@tonic-gate{
12197c478bdstevel@tonic-gate#ifdef	CS_STUBS_DEBUG
12207c478bdstevel@tonic-gate	if (cs_stubs_debug > 3)
12217c478bdstevel@tonic-gate	    cmn_err(CE_CONT, "cs_no_carservices\n");
12227c478bdstevel@tonic-gate#endif
12237c478bdstevel@tonic-gate	return (CS_UNSUPPORTED_FUNCTION);
12247c478bdstevel@tonic-gate}
1225