pcmem.c revision d67944fbe3fa0b31893a7116a09b0718eecf6078
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* PCMCIA Memory Nexus Driver
*
*/
/*
* PCMCIA and DDI related header files
*/
#include <sys/ddi_impldefs.h>
#ifdef DEBUG
int pcmem_debug = 0;
#else
#define PCMEM_DEBUG(args)
#endif
/*
* Device Operations (dev_ops) Structure
*/
/*
* bus nexus operations.
*/
static int
void *a, void *v);
static struct bus_ops pcmem__bus_ops = {
BUSO_REV, /* XXX */
0, /* ddi_intrspec_t (*bus_get_intrspec)(); */
0, /* int (*bus_add_intrspec)(); */
0, /* void (*bus_remove_intrspec)(); */
pcmem_ctlops, /* ddi_ctlops */
#else
0, /* ddi_intrspec_t (*bus_get_intrspec)(); */
0, /* int (*bus_add_intrspec)(); */
0, /* void (*bus_remove_intrspec)(); */
pcmem_ctlops, /* ddi_ctlops */
#endif
};
DEVO_REV, /* devo_rev */
0, /* refcnt */
ddi_no_info, /* info */
nulldev, /* identify */
nulldev, /* probe */
pcmem_attach, /* attach */
pcmem_detach, /* detach */
nulldev, /* reset (currently not supported) */
&pcmem__bus_ops, /* bus_ops pointer for nexus driver */
NULL, /* power */
ddi_quiesce_not_needed, /* quiesce */
};
/*
* Module linkage information for the kernel
*/
extern struct mod_ops mod_driverops;
&mod_driverops, /* Type of module */
"PCMCIA Memory Nexus", /* Name of the module */
&pcmem_ops, /* Device Operation Structure */
};
static struct modlinkage modlinkage = {
&md,
};
int
_init(void)
{
return (mod_install(&modlinkage));
}
int
{
}
int
_fini(void)
{
return (mod_remove(&modlinkage));
}
static void pcmem_create_pcram_node(dev_info_t *);
/*
* pcmem_attach()
*
*/
static int
{
/* resume from a checkpoint */
if (cmd == DDI_RESUME) {
return (DDI_SUCCESS);
}
(void) pcmem_create_pcram_node(dip);
return (DDI_SUCCESS);
}
/* ARGSUSED */
static int
{
/* suspend */
if (cmd == DDI_SUSPEND) {
return (DDI_SUCCESS);
}
if (cmd != DDI_DETACH) {
return (DDI_FAILURE);
}
/* Do not need to do ddi_prop_remove_all */
return (DDI_SUCCESS);
}
/*ARGSUSED*/
static int
{
char name[MAXNAMELEN];
switch (ctlop) {
case DDI_CTLOPS_REPORTDEV:
if (rdip == (dev_info_t *)0) {
return (DDI_FAILURE);
}
"?pcmem_ctlops: %s%d at %s in socket %d\n",
return (DDI_SUCCESS);
case DDI_CTLOPS_INITCHILD:
"pcmem_ctlops - DDI_CTLOPS_INITCHILD persistent=%x\n",
return (DDI_FAILURE);
/*
* XXXX - Read card CIS to determine technology
* region(tn) and CIS space(dn).
* Refer to Bugid 1179336.
*/
/*
* see cis_handler.h for CISTPL_DEVICE
* and CISTPL_DEVICE_A
*
* CISTPL_DEVICE_DTYPE_NULL 0x00 NULL device
* CISTPL_DEVICE_DTYPE_ROM 0x01 ROM
* CISTPL_DEVICE_DTYPE_OTPROM 0x02 OTPROM
* CISTPL_DEVICE_DTYPE_EPROM 0x03 EPROM
* CISTPL_DEVICE_DTYPE_EEPROM 0x04 EEPROM
* CISTPL_DEVICE_DTYPE_FLASH 0x05 FLASH
* CISTPL_DEVICE_DTYPE_SRAM 0x06 SRAM
* CISTPL_DEVICE_DTYPE_DRAM 0x07 DRAM
*
*/
/*
* XXXX - For now set to default SRAM device
*/
cissp = 0;
"pcmem_ctlops - DDI_CTLOPS_INITCHILD name=%s\n", name));
return (DDI_SUCCESS);
case DDI_CTLOPS_UNINITCHILD:
"pcmem_ctlops - DDI_CTLOPS_UNINITCHILD child: %s(%d)\n",
return (DDI_SUCCESS);
default:
}
}
/*
* Create the pcram node with this routine instead of letting the framework
* create the node from the pcram.conf file. The pcram.conf file is no
* longer required and should be removed.
*/
static void
{
"pcmem_create_pcram_node dip=%p\n", (void *)dip));
NDI_SUCCESS) {
"pcmem: unable to create node [%s]\n", "pcram");
return;
}
"pcmem: ndi_devi_online failure\n");
(void) ndi_devi_free(child);
return;
}
}