diff options
author | msmith <msmith@FreeBSD.org> | 1998-10-21 20:07:05 +0000 |
---|---|---|
committer | msmith <msmith@FreeBSD.org> | 1998-10-21 20:07:05 +0000 |
commit | 880061ca43c5eb7110f8b122628b447b5df729e9 (patch) | |
tree | c03d04e81f549d7c5f9fdd53d289b5ef2e77e1e7 /sys/boot/common/bootstrap.h | |
parent | a9435964cae6bb08cf72cd42f4f2e90b5721bbcb (diff) | |
download | FreeBSD-src-880061ca43c5eb7110f8b122628b447b5df729e9.zip FreeBSD-src-880061ca43c5eb7110f8b122628b447b5df729e9.tar.gz |
Make ISA PnP work. This successfully enumerates as many ISA devices as I
can fit into my test machine.
- Move to using STAILQs rather than ad-hoc singly-linked lists.
- Use a mostly procedural interface to the PnP information. This
improves data-hiding.
Implement a new linker-set technique (currently on i386 only but should work
on Alpha as well). This is a good candidate for replacing the current
gensetdefs cruft completely.
Diffstat (limited to 'sys/boot/common/bootstrap.h')
-rw-r--r-- | sys/boot/common/bootstrap.h | 81 |
1 files changed, 65 insertions, 16 deletions
diff --git a/sys/boot/common/bootstrap.h b/sys/boot/common/bootstrap.h index 84f6d48..88adc27 100644 --- a/sys/boot/common/bootstrap.h +++ b/sys/boot/common/bootstrap.h @@ -23,10 +23,11 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: bootstrap.h,v 1.12 1998/10/09 07:09:22 msmith Exp $ + * $Id: bootstrap.h,v 1.13 1998/10/09 23:11:05 peter Exp $ */ #include <sys/types.h> +#include <sys/queue.h> /* XXX debugging */ extern struct console vidconsole; @@ -94,33 +95,36 @@ extern void cons_probe(void); /* * Plug-and-play enumerator/configurator interface. */ -struct pnpident +struct pnphandler { - char *id_ident; /* ASCII identifier, actual format varies with bus/handler */ - struct pnpident *id_next; /* the next identifier */ + char *pp_name; /* handler/bus name */ + void (* pp_enumerate)(void); /* enumerate PnP devices, add to chain */ }; -struct pnphandler; -struct pnpinfo +struct pnpident { - struct pnpident *pi_ident; /* list of identifiers */ - int pi_revision; /* optional revision (or -1) if not supported */ - char *pi_module; /* module/args nominated to handle device */ - int pi_argc; /* module arguments */ - char **pi_argv; - struct pnphandler *pi_handler; /* handler which detected this device */ - struct pnpinfo *pi_next; + char *id_ident; /* ASCII identifier, actual format varies with bus/handler */ + STAILQ_ENTRY(pnpident) id_link; }; -struct pnphandler +struct pnpinfo { - char *pp_name; /* handler/bus name */ - void (* pp_enumerate)(struct pnpinfo **); /* add detected devices to chain */ + char *pi_desc; /* ASCII description, optional */ + int pi_revision; /* optional revision (or -1) if not supported */ + char *pi_module; /* module/args nominated to handle device */ + int pi_argc; /* module arguments */ + char **pi_argv; + struct pnphandler *pi_handler; /* handler which detected this device */ + STAILQ_HEAD(,pnpident) pi_ident; /* list of identifiers */ + STAILQ_ENTRY(pnpinfo) pi_link; }; extern struct pnphandler *pnphandlers[]; /* provided by MD code */ extern void pnp_addident(struct pnpinfo *pi, char *ident); +extern struct pnpinfo *pnp_allocinfo(void); +extern void pnp_freeinfo(struct pnpinfo *pi); +extern void pnp_addinfo(struct pnpinfo *pi); /* * Module metadata header. @@ -180,6 +184,7 @@ extern vm_offset_t aout_findsym(char *name, struct loaded_module *mp); extern int elf_loadmodule(char *filename, vm_offset_t dest, struct loaded_module **result); +#ifndef NEW_LINKER_SET #if defined(__ELF__) /* @@ -232,6 +237,50 @@ struct linker_set { const void *ls_items[1]; /* really ls_length of them, trailing NULL */ }; +/* XXX just for conversion's sake, until we move to the new linker set code */ + +#define SET_FOREACH(pvar, set) \ + for (pvar = set.ls_items; \ + pvar < set.ls_items + set.ls_length; \ + pvar++) + +#else /* NEW_LINKER_SET */ + +/* + * Private macros, not to be used outside this header file. + */ +#define __MAKE_SET(set, sym) \ + static void *__CONCAT(__setentry,__LINE__) \ + __attribute__((__section__("set_" #set),__unused__)) = &sym +#define __SET_BEGIN(set) \ + ({ extern void *__CONCAT(__start_set_,set); \ + &__CONCAT(__start_set_,set); }) +#define __SET_END(set) \ + ({ extern void *__CONCAT(__stop_set_,set); \ + &__CONCAT(__stop_set_,set); }) + +/* + * Public macros. + */ + +/* Add an entry to a set. */ +#define TEXT_SET(set, sym) __MAKE_SET(set, sym) +#define DATA_SET(set, sym) __MAKE_SET(set, sym) +#define BSS_SET(set, sym) __MAKE_SET(set, sym) +#define ABS_SET(set, sym) __MAKE_SET(set, sym) + +/* + * Iterate over all the elements of a set. + * + * Sets always contain addresses of things, and "pvar" points to words + * containing those addresses. Thus is must be declared as "type **pvar", + * and the address of each set item is obtained inside the loop by "*pvar". + */ +#define SET_FOREACH(pvar, set) \ + for (pvar = (__typeof__(pvar))__SET_BEGIN(set); \ + pvar < (__typeof__(pvar))__SET_END(set); pvar++) +#endif + /* * Support for commands */ |