/*
* 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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* fcgp2.c: Framework gp2 (Safari) fcode ops
*/
#include <sys/ddidmareq.h>
#include <sys/ndi_impldefs.h>
#include <sys/promimpl.h>
int prom_get_fcode_size(char *);
int prom_get_fcode(char *, char *);
int fcpci_unloadable;
int no_advisory_dma;
/*
* Module linkage information for the kernel.
*/
&mod_miscops, "FCode gp2 (safari) bus functions"
};
};
int
_init(void)
{
return (mod_install(&modlinkage));
}
int
_fini(void)
{
if (fcpci_unloadable)
return (mod_remove(&modlinkage));
return (EBUSY);
}
int
{
}
struct gfc_ops_v {
char *svc_name;
fc_ops_t *f;
};
{ "map-in", gfc_map_in},
{ "map-out", gfc_map_out},
{ "rx@", gfc_register_fetch},
{ "rl@", gfc_register_fetch},
{ "rw@", gfc_register_fetch},
{ "rb@", gfc_register_fetch},
{ "rx!", gfc_register_store},
{ "rl!", gfc_register_store},
{ "rw!", gfc_register_store},
{ "rb!", gfc_register_store},
{ "claim-address", gfc_claim_address},
{ "master-interrupt", gfc_master_intr},
{ "claim-memory", gfc_claim_memory},
{ "release-memory", gfc_release_memory},
{ "vtop", gfc_vtop},
};
};
static void gp2_unmap_phys(ddi_acc_handle_t *);
char *my_args)
{
phandle_t h;
unit_address, NULL);
if (unit_address) {
char *buf;
}
/*
* Add the child's nodeid to our table...
*/
return (rp);
}
void
{
if (rp->next_handle)
if (rp->unit_address)
/*
* Release all the resources from the resource list
*/
case RT_MAP:
break;
case RT_DMA:
/* DMA has to be freed up at exit time */
break;
case RT_CONTIGIOUS:
"Free claim-memory resource 0x%lx size 0x%x\n",
(void) ndi_ra_free(ddi_root_node(),
break;
default:
break;
}
}
}
int
{
/*
* First try the generic fc_ops. If the ops is a shared op,
* also call our local function.
*/
return (0);
}
return (-1);
}
/*
* map-in (phys.lo phys.hi size -- virt )
*/
static int
{
int error;
struct regspec r;
"address 0x%08x.%08x length %x\n", r.regspec_bustype,
r.regspec_addr, r.regspec_size);
if (error) {
"address 0x%08x.%08x length %x\n", r.regspec_bustype,
r.regspec_addr, r.regspec_size);
}
/*
* Log this resource ...
*/
ip->fc_map_handle = h;
}
/*
* map-out ( virt size -- )
*/
static int
{
/*
* Find if this request matches a mapping resource we set up.
*/
continue;
continue;
break;
}
"known mapping"));
/*
* remove the resource from the list and release it.
*/
}
static int
{
int error = 0;
uint64_t x;
uint32_t l;
uint16_t w;
uint8_t b;
/*
* Determine the access width .. we can switch on the 2nd
* character of the name which is "rx@", "rl@", "rb@" or "rw@"
*/
switch (*(name + 1)) {
case 'x': len = sizeof (x); break;
case 'l': len = sizeof (l); break;
case 'w': len = sizeof (w); break;
case 'b': len = sizeof (b); break;
}
/*
* Check the alignment ...
*/
/*
* Find if this virt is 'within' a request we know about
*/
break;
break;
}
}
"known mapping or contigious adddress"));
}
switch (len) {
case sizeof (x):
else /* RT_CONTIGIOUS */
break;
case sizeof (l):
else /* RT_CONTIGIOUS */
break;
case sizeof (w):
else /* RT_CONTIGIOUS */
break;
case sizeof (b):
else /* RT_CONTIGIOUS */
break;
}
if (error) {
}
switch (len) {
}
}
static int
{
uint64_t x;
uint32_t l;
uint16_t w;
uint8_t b;
int error = 0;
/*
* Determine the access width .. we can switch on the 2nd
* character of the name which is "rx!", "rl!", "rb!" or "rw!"
*/
switch (*(name + 1)) {
}
/*
* Check the alignment ...
*/
/*
* Find if this virt is 'within' a request we know about
*/
break;
break;
}
}
"known mapping or contigious address"));
switch (len) {
case sizeof (x):
break;
case sizeof (l):
break;
case sizeof (w):
break;
case sizeof (b):
break;
}
if (error == DDI_FAILURE) {
}
}
static int
{
}
/*
* gfc_claim_address
*
*/
static int
{
switch (bar) {
case 0: /* PCI IO Bus A */
break;
case 1: /* PCI Memory Bus A */
break;
case 2: /* PCI IO Bus B */
break;
case 3: /* PCI Memory Bus B */
break;
default:
"gfc_claim_address - invalid BAR=0x%x\n", bar);
}
}
/*
* gfc_claim_memory
*
* claim-memory ( align size vhint -- vaddr)
*/
static int
{
if (size == 0) {
"contigiuos memory of size zero\n");
}
if (vhint) {
"vhint=0x%x - Ignoring Argument\n", vhint);
}
request.ra_boundbase = 0;
"contigiuos memory\n");
}
/*
* Log this resource ...
*/
}
/*
* gfc_release_memory
*
* release-memory ( size vaddr -- )
*/
static int
{
/*
* Find if this request matches a mapping resource we set up.
*/
continue;
continue;
break;
}
"known mapping"));
/*
* remove the resource from the list and release it.
*/
}
/*
* gfc_vtop
*
* vtop ( vaddr -- paddr.lo paddr.hi)
*/
static int
{
int vaddr;
/*
* Find if this request matches a mapping resource we set up.
*/
continue;
break;
}
"known mapping"));
}
static int
{
fc_phandle_t h;
}
static int
{
"fault copying in drop in name %p\n", name_virt);
status = 0;
} else {
fcode_len)) {
"to copy out fcode image\n");
status = 0;
}
}
}
}
static int
{
char *name;
int len;
"fault copying in drop in name %p\n", virt);
len = 0;
} else {
}
}
static int
{
int result;
hp->ah_rnumber = 0;
if (result != DDI_SUCCESS) {
} else {
}
return (result);
}
static void
{
}