bootops.c revision 53391baf4e45c693cf123555e9617b5e1e0b641a
/*
* 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.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Definitions of interfaces that provide services from the secondary
* boot program to its clients (primarily Solaris, krtld, kmdb and their
* successors.) This interface replaces the bootops (BOP) implementation
* as the interface to be called by boot clients.
*
*/
#include <sys/bootconf.h>
#include <sys/bootstat.h>
/*
* Implementation of the "version" boot service.
* Return the compiled version number of this implementation.
*
* Note: An individual service can be tested for and versioned with
* bop_serviceavail();
*
* Calling spec:
* args[0] Service name string
* args[1] #argument cells
* args[2] #result cells
* args[3] Res0: returned version number
*/
{
return (bop->bsys_version);
}
/*
* 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
*
*/
int
{
int (*bsys_1275_call)(void *);
/* use uintptr_t to suppress the gcc warning */
(void) (bsys_1275_call)(args);
}
/*
* 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
*
*/
int
{
int (*bsys_1275_call)(void *);
/* use uintptr_t to suppress the gcc warning */
(void) (bsys_1275_call)(args);
}
/*
* 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
*/
int
{
int (*bsys_1275_call)(void *);
/* use uintptr_t to suppress the gcc warning */
(void) (bsys_1275_call)(args);
}
/*
* 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
*/
int
{
int (*bsys_1275_call)(void *);
/* use uintptr_t to suppress the gcc warning */
(void) (bsys_1275_call)(args);
}
/*
* 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
*/
{
int (*bsys_1275_call)(void *);
/* use uintptr_t to suppress the gcc warning */
(void) (bsys_1275_call)(args);
}
/*
* Implementation of the "alloc_virt" boot service
*
* Calling spec:
* args[0] Service name string
* args[1] #argument cells
* args[2] #result cells
* args[3] virtual address
* args[4] size to allocate
* args[5] Resi: returned result
*/
{
int (*bsys_1275_call)(void *);
/* use uintptr_t to suppress the gcc warning */
(void) (bsys_1275_call)(args);
}
/*
* Implementation of the "free" 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 free
* args[5] Res0: returned result
*/
/*ARGSUSED*/
void
{
int (*bsys_1275_call)(void *);
/* use uintptr_t to suppress the gcc warning */
(void) (bsys_1275_call)(args);
}
/*
* 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*/
{
int (*bsys_1275_call)(void *);
/* use uintptr_t to suppress the gcc warning */
(void) (bsys_1275_call)(args);
}
/*
* 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*/
void
{
int (*bsys_1275_call)(void *);
/* use uintptr_t to suppress the gcc warning */
(void) (bsys_1275_call)(args);
}
/*
* 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*/
void
{
int (*bsys_1275_call)(void *);
/* use uintptr_t to suppress the gcc warning */
args[1] = 0;
(void) (bsys_1275_call)(args);
}
/*
* 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*/
int
{
int (*bsys_1275_call)(void *);
/* use uintptr_t to suppress the gcc warning */
(void) (bsys_1275_call)(args);
}
/*
* 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*/
int
{
int (*bsys_1275_call)(void *);
/* use uintptr_t to suppress the gcc warning */
(void) (bsys_1275_call)(args);
}
/*
* 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*/
char *
{
int (*bsys_1275_call)(void *);
/* use uintptr_t to suppress the gcc warning */
(void) (bsys_1275_call)(args);
}
/*
* 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*/
void
{
int (*bsys_1275_call)(void *);
void (*bsys_printf)(struct bootops *, char *, ...);
/* so new kernel, old boot can print a message before dying */
if (!BOOTOPS_ARE_1275(bop)) {
/* use uintptr_t to suppress the gcc warning */
bsys_printf = (void (*)(struct bootops *, char *, ...))
return;
}
args[2] = 0;
(void) (bsys_1275_call)(args);
}
/*
* 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
*/
/*ARGSUSED*/
void
{
int (*bsys_1275_call)(void *);
void (*bsys_printf)(struct bootops *, char *, ...);
int ells = 0;
/*
* We need to do the minimum printf-like stuff here to figure
* out the size of argument, if present.
*/
while (*fmt) {
if (*fmt++ != '%')
continue;
if (*fmt == '%') {
fmt++;
continue;
}
fmt++;
ells++;
switch (*fmt) {
case 's':
/* use uintptr_t to suppress the gcc warning */
break;
case 'p':
break;
case 'd':
case 'D':
case 'x':
case 'X':
case 'u':
case 'U':
case 'o':
case 'O':
if (ells == 0)
else if (ells == 1)
else
break;
default:
break;
}
break;
}
/* so new kernel, old boot can print a message before dying */
if (!BOOTOPS_ARE_1275(bop)) {
/* use uintptr_t to suppress the gcc warning */
bsys_printf = (void (*)(struct bootops *, char *, ...))
return;
}
args[2] = 0;
(void) (bsys_1275_call)(args);
}
/*
* 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*/
int
{
int (*bsys_1275_call)(void *);
/* use uintptr_t to suppress the gcc warning */
(void) (bsys_1275_call)(args);
}
/*
* Implementation of the "unmountroot" boot service.
*
* Calling spec:
* args[0] Service name string
* args[1] #argument cells
* args[2] #result cells
* args[3] Res0: returned result
*/
/*ARGSUSED*/
int
{
int (*bsys_1275_call)(void *);
/* use uintptr_t to suppress the gcc warning */
args[1] = 0;
(void) (bsys_1275_call)(args);
}
/*
* 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*/
int
{
/* use uintptr_t to suppress the gcc warning */
int (*bsys_1275_call)(void *) =
(void) (bsys_1275_call)(args);
}
/*
* 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
{
int (*bsys_1275_call)(void *);
/* use uintptr_t to suppress the gcc warning */
(void) (bsys_1275_call)(args);
}
/*
* Implementation of the "enter_mon" boot service.
*
* Calling spec:
* args[0] Service name string
* args[1] #argument cells (0)
* args[2] #result cells (0)
*/
void
{
int (*bsys_1275_call)(void *);
/* use uintptr_t to suppress the gcc warning */
args[1] = 0;
args[2] = 0;
(void) (bsys_1275_call)(args);
}