Move PROM interface prototypes into openprom.h

Use the `openprom_addr' structure for passing around physical addresses.
This commit is contained in:
pk 1998-09-26 18:20:19 +00:00
parent 09a4cf6caa
commit 43c1cb852c
2 changed files with 54 additions and 47 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: autoconf.h,v 1.28 1998/08/30 21:31:24 pk Exp $ */
/* $NetBSD: autoconf.h,v 1.29 1998/09/26 18:20:19 pk Exp $ */
/*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@ -85,6 +85,7 @@
*/
#include <machine/bus.h>
#include <machine/bsd_openprom.h>
#include <dev/sbus/sbusvar.h>
/*
@ -160,33 +161,6 @@ int obio_find_rom_map __P((bus_addr_t, bus_type_t, int,
bus_space_handle_t *));
/*
* The various getprop* functions obtain `properties' from the ROMs.
* getprop() obtains a property as a byte-sequence, and returns its
* length; the others convert or make some other guarantee.
*/
int getproplen __P((int node, char *name));
int getprop __P((int, char *, int, int *, void **));
char *getpropstring __P((int node, char *name));
int getpropint __P((int node, char *name, int deflt));
/* Frequently used options node */
extern int optionsnode;
/* new interfaces: */
char *getpropstringA __P((int, char *, char *));
/*
* Helper routines to get some of the more common properties. These
* only get the first item in case the property value is an array.
* Drivers that "need to know it all" can call getprop() directly.
*/
int getprop_reg1 __P((int, struct rom_reg *));
int getprop_intr1 __P((int, int *));
int getprop_address1 __P((int, void **));
/*
* The matchbyname function is useful in drivers that are matched
* by romaux name, i.e., all `mainbus attached' devices. It expects
@ -216,9 +190,6 @@ int makememarr(struct memarr *, int max, int which);
#define MEMARR_AVAILPHYS 0
#define MEMARR_TOTALPHYS 1
/* Pass a string to the FORTH interpreter. May fail silently. */
void rominterpret __P((char *));
/* Openprom V2 style boot path */
struct bootpath {
char name[16]; /* name of this node */
@ -238,13 +209,17 @@ void mountroot_hook_establish __P((void (*) __P((struct device *)),
void configure __P((void));
void bootstrap __P((void));
int firstchild __P((int));
int nextsibling __P((int));
void callrom __P((void));
struct device *getdevunit __P((char *, int));
void *findzs __P((int));
int romgetcursoraddr __P((int **, int **));
#if 0
/* Pass a string to the FORTH interpreter. May fail silently. */
void rominterpret __P((char *));
int firstchild __P((int));
int nextsibling __P((int));
void callrom __P((void));
int findroot __P((void));
int findnode __P((int, const char *));
int opennode __P((char *));
int node_has_property __P((int, const char *));
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: bsd_openprom.h,v 1.12 1998/09/12 13:34:38 pk Exp $ */
/* $NetBSD: bsd_openprom.h,v 1.13 1998/09/26 18:20:19 pk Exp $ */
/*
* Copyright (c) 1992, 1993
@ -44,6 +44,9 @@
* All rights reserved.
*/
#ifndef _BSD_OPENPROM_H_
#define _BSD_OPENPROM_H_
/*
* This file defines the interface between the kernel and the Openboot PROM.
* N.B.: this has been tested only on interface versions 0 and 2 (we have
@ -174,6 +177,15 @@ struct v2bootargs {
int *v2_fd1; /* V2: Stdout descriptor */
};
/*
* The format used by the PROM to describe a physical address.
*/
struct openprom_addr {
int oa_space; /* address space (may be relative) */
u_int oa_base; /* address within space */
u_int oa_size; /* extent (number of bytes) */
};
/*
* The following structure defines the primary PROM vector interface.
* The Boot PROM hands the kernel a pointer to this structure in %o0.
@ -262,7 +274,8 @@ struct promvec {
* The following are V3 ROM functions to handle MP machines in the
* Sun4m series. They have undefined results when run on a uniprocessor!
*/
int (*pv_v3cpustart) __P((u_int module, u_int ctxtbl,
int (*pv_v3cpustart) __P((u_int module,
struct openprom_addr *ctxtbl,
int context, caddr_t pc));
int (*pv_v3cpustop) __P((u_int module));
int (*pv_v3cpuidle) __P((u_int module));
@ -284,8 +297,8 @@ struct promvec {
* sometimes not, depending on the the interface version; v0 seems to
* terminate and v2 not. Many others are simply integers stored as four
* bytes in machine order: you just get them and go. The third popular
* format is an `address', which is made up of one or more sets of three
* integers as defined below.
* format is an `physical address', which is made up of one or more sets
* of three integers as defined above.
*
* N.B.: for the `next' functions, next(0) = first, and next(last) = 0.
* Whoever designed this part had good taste. On the other hand, these
@ -293,11 +306,6 @@ struct promvec {
* are not in the openprom vectors but rather found by indirection from
* there. So the taste balances out.
*/
struct openprom_addr {
int oa_space; /* address space (may be relative) */
u_int oa_base; /* address within space */
u_int oa_size; /* extent (number of bytes) */
};
struct nodeops {
/*
@ -318,9 +326,33 @@ struct nodeops {
caddr_t (*no_nextprop) __P((int node, caddr_t name));
};
void romhalt __P((void))
__attribute__((__noreturn__));
void romboot __P((char *))
__attribute__((__noreturn__));
void romhalt __P((void)) __attribute__((__noreturn__));
void romboot __P((char *)) __attribute__((__noreturn__));
void rominterpret __P((char *));
void callrom __P((void));
int findroot __P((void));
int findnode __P((int, const char *));
int opennode __P((char *));
int firstchild __P((int));
int nextsibling __P((int));
/*
* The various getprop* functions obtain `properties' from the ROMs.
* getprop() obtains a property as a byte-sequence, and returns its
* length; the others convert or make some other guarantee.
*/
int getproplen __P((int node, char *name));
int getprop __P((int, char *, int, int *, void **));
int getpropint __P((int node, char *name, int deflt));
char *getpropstring __P((int node, char *name));
char *getpropstringA __P((int, char *, char *));
int search_prom __P((int, char *));
int node_has_property __P((int, const char *));
extern struct promvec *promvec;
/* Frequently used options node */
extern int optionsnode;
#endif /* _BSD_OPENPROM_H_ */