/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Copyright 2012 Garrett D'Amore <garrett@damore.org>. All rights reserved.
*/
/*
* nx1394.c
* 1394 Services Layer Nexus Support Routines
* Routines in this file implement nexus bus_ops.
*/
#include <sys/ddi_impldefs.h>
#include <sys/tnf_probe.h>
nullbusmap, /* bus_map */
NULL, /* bus_get_intrspec */
NULL, /* bus_add_intrspec */
NULL, /* bus_remove_intrspec */
i_ddi_map_fault, /* XXXX bus_map_fault */
NULL, /* bus_dma_map */
ddi_dma_mctl, /* bus_dma_ctl */
nx1394_bus_ctl, /* bus_ctl */
ddi_bus_prop_op, /* bus_prop_op */
nx1394_get_event_cookie, /* (*bus_get_eventcookie() */
nx1394_add_eventcall, /* (*bus_add_eventcall)(); */
nx1394_remove_eventcall, /* (*bus_remove_eventcall)(); */
nx1394_post_event, /* (*bus_post_event)(); */
0, /* (*interrupt control)(); */
0, /* (*bus_config)(); */
0, /* (*bus_unconfig)(); */
0, /* (*bus_fm_init)(); */
0, /* (*bus_fm_fini)(); */
0, /* (*bus_fm_access_enter)(); */
0, /* (*bus_fm_access_exit)(); */
0, /* (*bus_power)(); */
i_ddi_intr_ops /* (*bus_intr_op)(); */
};
/*
*/
#define NX1394_EVENT_TAG_HOT_REMOVAL 0
};
#define NX1394_N_EVENTS \
(sizeof (nx1394_event_defs) / sizeof (ndi_event_definition_t))
};
/*
* nx1394_bus_ctl()
* This routine implements nexus bus ctl operations. Of importance are
* DDI_CTLOPS_REPORTDEV, DDI_CTLOPS_INITCHILD, DDI_CTLOPS_UNINITCHILD
* and DDI_CTLOPS_POWER. For DDI_CTLOPS_INITCHILD, it tries to lookup
* reg property on the child node and builds and sets the name
* (name is of the form GGGGGGGGGGGGGGGG[,AAAAAAAAAAAA], where
* GGGGGGGGGGGGGGGG is the GUID and AAAAAAAAAAAA is the optional unit
* address).
*/
static int
void *result)
{
int status;
switch (op) {
case DDI_CTLOPS_REPORTDEV: {
"");
return (DDI_SUCCESS);
}
case DDI_CTLOPS_INITCHILD: {
int reglen, i;
if (i != DDI_PROP_SUCCESS) {
"initchild");
return (DDI_NOT_WELL_FORMED);
}
/*
* addr is of the format GGGGGGGGGGGGGGGG[,AAAAAAAAAAAA]
*/
} else {
}
/*
* Check for a node with the same name & addr as the current
* node. If such a node exists, return failure.
*/
"!%s(%d): Duplicate dev_info node found %s@%s",
"Duplicate nodes");
"initchild");
return (DDI_NOT_WELL_FORMED);
}
/*
* If HAL (parent dip) has "active-dma-flush" property, then
* add property to child as well. Workaround for active
* context flushing bug in Schizo rev 2.1 and 2.2.
*/
"active-dma-flush") != 0) {
"active-dma-flush", 1);
if (status != NDI_SUCCESS) {
"\"active-dma-flush\" property",
msg, "Unable to add \"active-dma-flush\" "
"property");
op, "initchild");
return (DDI_NOT_WELL_FORMED);
}
}
return (DDI_SUCCESS);
}
case DDI_CTLOPS_UNINITCHILD: {
return (DDI_SUCCESS);
}
case DDI_CTLOPS_IOMIN: {
return (status);
}
case DDI_CTLOPS_POWER: {
return (DDI_SUCCESS);
}
/*
* These ops correspond to functions that "shouldn't" be called
* by a 1394 client driver.
*/
case DDI_CTLOPS_DMAPMAPC:
case DDI_CTLOPS_REPORTINT:
case DDI_CTLOPS_REGSIZE:
case DDI_CTLOPS_NREGS:
case DDI_CTLOPS_SIDDEV:
case DDI_CTLOPS_SLAVEONLY:
case DDI_CTLOPS_AFFINITY:
case DDI_CTLOPS_POKE:
case DDI_CTLOPS_PEEK: {
"");
return (DDI_FAILURE);
}
/*
*/
default: {
"");
return (status);
}
}
}
/*
* nx1394_dma_allochdl()
* Merges the ddi_dma_attr_t passed in by the target (using
* ddi_dma_alloc_handle() call) with that of the hal and passes the alloc
* handle request up the device by calling ddi_dma_allochdl().
*/
static int
{
int status;
"");
/*
* If hal calls ddi_dma_alloc_handle, dip == rdip == hal dip.
* Unfortunately, we cannot verify this (by way of looking up for hal
* dip) here because h1394_attach() may happen much later.
*/
}
return (status);
}
/*
* nx1394_get_event_cookie()
* Called when a child node calls ddi_get_eventcookie().
* Returns event cookie corresponding to event "name".
*/
static int
{
int ret;
return (ret);
}
/*
* nx1394_add_eventcall()
* This gets called when a child node calls ddi_add_eventcall(). Registers
* the specified callback for the requested event cookie with the ndi
* event framework.
* dip is the hal dip. This routine calls ndi_event_add_callback(),
* allowing requests for events we don't generate to pass up the tree.
*/
static int
{
int ret;
#if defined(DEBUG)
#endif
"");
#if defined(DEBUG)
if (event_name == NULL)
event_name = "";
#endif
return (ret);
}
/*
* nx1394_remove_eventcall()
* Called as a result of a child node calling ddi_remove_eventcall().
* Unregisters the callback corresponding to the callback id passed in.
*/
static int
{
int ret;
#if defined(DEBUG)
#endif
S1394_TNF_SL_NEXUS_STACK, "");
#if defined(DEBUG)
if (event_name == NULL)
event_name = "";
#endif
return (ret);
}
/*
* nx1394_post_event()
* Called when a child node calls ddi_post_event. If the event is one of
* a t1394_localinfo_t structure and calls ndi_event_run_callbacks(). This
* will result in all registered callbacks being invoked with
* t1394_localinfo_t as the impl_data. (see ddi_add_eventcall for callback
* arguments.) If the event is not defined by us, the request is
* propagated up the device tree by calling ndi_post_event().
*/
static int
void *impl_data)
{
int ret;
char *name;
"");
/* name is NULL if we don't generate the event */
return (ret);
} else {
return (ret);
}
}
/*
* nx1394_define_events()
* Allocates event handle for the hal dip and binds event set to it.
*/
int
{
int ret;
"");
/* get event handle */
if (ret != NDI_SUCCESS) {
} else {
/* and bind to it */
if (ret != NDI_SUCCESS) {
S1394_TNF_SL_NEXUS_STACK, "");
return (DDI_FAILURE);
}
}
"");
return (DDI_SUCCESS);
}
/*
* nx1394_undefine_events()
* Unbinds event set bound to the hal and frees the event handle.
*/
void
{
int ret;
S1394_TNF_SL_NEXUS_STACK, "");
if (ret != NDI_SUCCESS) {
} else {
if (ret != NDI_SUCCESS) {
}
}
S1394_TNF_SL_NEXUS_STACK, "");
}