boot_services.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* 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 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Definitions of interfaces that provide services from the secondary
* boot program to its clients (primarily unix, krtld and their successors.)
* This interface replaces the bootops (BOP) implementation as the interface
* to be called by boot clients. The BOP macros are still used to make the
* integration easier.
*
* The bootops vector is vestigial.
*
* The kern_* routines used to implement many of the services here
*
*/
#include <sys/bootconf.h>
extern void kern_killboot(void);
static int boot1275_serviceavail(void *p);
/*
* Implementation of the "version" service.
* Return the compiled version number of this implementation of boot.
*
* Calling spec:
* args[0] Service name string
* args[1] #argument cells
* args[2] #result cells
* args[3] Res0: returned version number
*/
static int boot_version = BO_VERSION;
static int
boot1275_getversion(void *p)
{
return (BOOT_SVC_OK);
}
/*
* Implementation of the "open" boot service.
*
* Calling spec:
* args[0] Service name string
* args[1] #argument cells
* args[2] #result cells
* args[3] filename string
* args[4] flags
* args[5] Res0: returned result
*
*/
static int
boot1275_open(void *p)
{
int rc;
int flags;
char *name;
return (BOOT_SVC_OK);
}
/*
* Implementation of the "read" boot service.
*
* Calling spec:
* args[0] Service name string
* args[1] #argument cells
* args[2] #result cells
* args[3] boot-opened file descriptor
* args[4] client's buffer
* args[5] size of read request
* args[6] Res0: returned result
*
*/
static int
boot1275_read(void *p)
{
int rc;
/* XXX use different routine to support larger I/O ? */
int fd;
return (BOOT_SVC_OK);
}
/*
* Implementation of the "seek" boot service.
*
* Calling spec:
* args[0] Service name string
* args[1] #argument cells
* args[2] #result cells
* args[3] boot-opened file descriptor
* args[4] offset hi XXX just use one cell for offset?
* args[5] offset lo
* args[6] Res0: returned result
*
*/
static int
boot1275_seek(void *p)
{
int fd;
return (BOOT_SVC_OK);
}
/*
* Implementation of the "close" boot service.
*
* Calling spec:
* args[0] Service name string
* args[1] #argument cells
* args[2] #result cells
* args[3] boot-opened file descriptor
* args[4] Res0: returned result
*
*/
static int
boot1275_close(void *p)
{
int rc;
int fd;
return (BOOT_SVC_OK);
}
/*
* Implementation of the "alloc" boot service.
*
* Calling spec:
* args[0] Service name string
* args[1] #argument cells
* args[2] #result cells
* args[3] virtual hint
* args[4] size to allocate
* args[5] alignment
* args[6] Res0: returned result
*/
static int
boot1275_alloc(void *p)
{
int align;
return (BOOT_SVC_OK);
}
/*
* Implementation of the "alloc_virt" boot service.
*
* Calling spec:
* args[0] Service name string
* args[1] #arguments cells
* args[2] #result cells
* args[3] virtual address
* args[4] size to allocate
* args[5] Res0: returned result
*/
static int
boot1275_alloc_virt(void *p)
{
return (BOOT_SVC_OK);
}
/*
* Implementation of the "free" boot service.
*
* Calling spec:
* args[0] Service name string
* args[1] #argument cells
* args[2] #result cells
* args[3] virtual addr
* args[4] size to free
* args[5] Res0: returned result
*/
/*ARGSUSED*/
static int
boot1275_free(void *p)
{
return (BOOT_SVC_OK);
}
/*
* Implementation of the "map" boot service.
*
* Calling spec:
* args[0] Service name string
* args[1] #argument cells
* args[2] #result cells
* args[3] virtual address
* args[4] space of phys addr
* args[5] phys addr
* args[6] size
* args[7] Res0: returned result
*/
/*ARGSUSED*/
static int
boot1275_map(void *p)
{
return (BOOT_SVC_OK);
}
/*
* Implementation of the "unmap" boot service.
*
* Calling spec:
* args[0] Service name string
* args[1] #argument cells
* args[2] #result cells
* args[3] virtual address
* args[4] size of chunk
* args[5] Res0: returned result
*/
/*ARGSUSED*/
static int
boot1275_unmap(void *p)
{
return (BOOT_SVC_OK);
}
/*
* Implementation of the "quiesce" boot service.
*
* Calling spec:
* args[0] Service name string
* args[1] #argument cells
* args[2] #result cells
* args[3] Res0: returned result
*/
/*ARGSUSED*/
static int
boot1275_quiesce(void *p)
{
return (BOOT_SVC_OK);
}
/*
* Implementation of the "getproplen" boot service.
*
* Calling spec:
* args[0] Service name string
* args[1] #argument cells
* args[2] #result cells
* args[3] property name string
* args[4] Res0: returned result
*/
/*ARGSUSED*/
static int
boot1275_getproplen(void *p)
{
int rc;
char *name;
return (BOOT_SVC_OK);
}
/*
* Implementation of the "getprop" boot service.
*
* Calling spec:
* args[0] Service name string
* args[1] #argument cells
* args[2] #result cells
* args[3] property name string
* args[4] buffer pointer to hold value of the property
* args[5] Res0: returned result
*/
/*ARGSUSED*/
static int
boot1275_getprop(void *p)
{
int rc;
char *name;
void *buf;
return (BOOT_SVC_OK);
}
/*
* Implementation of the "putsarg" boot service.
*
* Calling spec:
* args[0] Service name string
* args[1] #argument cells
* args[2] #result cells
* args[3] string to print (with '%*' format)
* args[4] 64-bit thing to print
*
* The bootops interface can only pass one additional
* argument. Abusing the format string can cause failures
* in interesting ways that could be hard to debug when
* an argument is pulled off the stack or dereferenced,
* so if the format string indicates more than one argument,
* we note the problem rather print garbage or panic.
*/
/*ARGSUSED*/
static int
boot1275_putsarg(void *p)
{
const char *string;
const char *fmt;
int ells = 0;
int arg_is_ptr = 0;
int nargs = 0;
/*
* We need to do the minimum printf-like stuff here to figure
* out the size of argument, if present.
*/
if (*fmt != '%')
continue;
if (*(++fmt) == '%')
continue;
nargs++;
fmt++;
ells++;
switch (*fmt) {
case 's':
case 'p':
arg_is_ptr = 1;
break;
}
}
if (nargs > 1) {
printf("boot1275_putsarg: unsupported format: \"%s\"\n",
string);
} else if (arg_is_ptr) {
} else {
switch (ells) {
case 0:
break;
case 1:
break;
default:
break;
}
}
return (BOOT_SVC_OK);
}
/*
* Implementation of the "puts" boot service.
*
* Calling spec:
* args[0] Service name string
* args[1] #argument cells
* args[2] #result cells
* args[3] string to print
*/
/*ARGSUSED*/
static int
boot1275_puts(void *p)
{
char *string;
return (BOOT_SVC_OK);
}
/*
* Implementation of the "nextprop" boot service.
*
* Calling spec:
* args[0] Service name string
* args[1] #argument cells
* args[2] #result cells
* args[3] previous property name string
* args[4] Res0: returned result
*/
/*ARGSUSED*/
static int
boot1275_nextprop(void *p)
{
return (BOOT_SVC_OK);
}
/*
* Implementation of the "mount" boot service.
*
* Calling spec:
* args[0] Service name string
* args[1] #argument cells
* args[2] #result cells
* args[3] pathname string
* args[4] Res0: returned result
*/
/*ARGSUSED*/
static int
boot1275_mountroot(void *p)
{
int rc;
char *name;
return (BOOT_SVC_OK);
}
/*
* Implementation of the "unmount" boot service.
*
* Calling spec:
* args[0] Service name string
* args[1] #argument cells
* args[2] #result cells
* args[3] Res0: returned result
*/
/*ARGSUSED*/
static int
boot1275_unmountroot(void *p)
{
int rc;
rc = kern_unmountroot();
return (BOOT_SVC_OK);
}
/*
* Implementation of the "fstat" boot service.
*
* Calling spec:
* args[0] Service name string
* args[1] #argument cells
* args[2] #result cells
* args[3] fd
* args[4] client's stat structure
*/
int
boot1275_fstat(void *p)
{
return (BOOT_SVC_OK);
}
/*
* Implementation of the "interpret" boot service.
*
* Calling spec:
* args[0] Service name string
* args[1] #argument cells (1)
* args[2] #result cells (0)
* args[3] string to interpret
*/
int
boot1275_interpret(void *p)
{
prom_interpret(str, 0, 0, 0, 0, 0);
return (BOOT_SVC_OK);
}
/*
* Implementation of the "enter_mon" boot service.
*
* Calling spec:
* args[0] Service name string
* args[1] #argument cells (0)
* args[2] #result cells (0)
*/
/*ARGSUSED*/
int
boot1275_enter_mon(void *p)
{
return (BOOT_SVC_OK);
}
/*
* The lookup table akin to the old bootops vec
* for boot. Not part of the exported interface.
*/
static struct boot_nm2svc {
char *b_name;
int (*b_funcptr)(void *);
int b_svcversion;
} boot_nm2svc[] = {
{ 0, 0, 0 }
};
static struct boot_nm2svc *
{
pnm2svc++;
else {
return (pnm2svc);
}
}
return (NULL);
}
/*
* Implementation of the "serviceavail" boot service.
*
* Calling spec:
* args[0] Service name string
* args[1] #argument cells
* args[2] #result cells
* args[3] name string of service to be tested for
* args[4] Res0: returned version number or 0
*/
/*ARGSUSED*/
static int
boot1275_serviceavail(void *p)
{
char *name;
struct boot_nm2svc *pnm2svc;
int version = 0; /* 0 means service not avail */
if (pnm2svc != 0)
return (BOOT_SVC_OK);
}
int
boot1275_entry(void *p)
{
int rc = 0;
char *name;
int (*fp)();
struct boot_nm2svc *pnm2svc;
} else {
}
return (rc);
}