1*7759a958Smaxv /* $NetBSD: bootinfo.c,v 1.6 2016/06/05 14:13:57 maxv Exp $ */
2f7b795d3Sdrochner
3f7b795d3Sdrochner /*
4f7b795d3Sdrochner * Copyright (c) 1997
5f7b795d3Sdrochner * Matthias Drochner. All rights reserved.
6f7b795d3Sdrochner *
7f7b795d3Sdrochner * Redistribution and use in source and binary forms, with or without
8f7b795d3Sdrochner * modification, are permitted provided that the following conditions
9f7b795d3Sdrochner * are met:
10f7b795d3Sdrochner * 1. Redistributions of source code must retain the above copyright
11f7b795d3Sdrochner * notice, this list of conditions and the following disclaimer.
12f7b795d3Sdrochner * 2. Redistributions in binary form must reproduce the above copyright
13f7b795d3Sdrochner * notice, this list of conditions and the following disclaimer in the
14f7b795d3Sdrochner * documentation and/or other materials provided with the distribution.
15f7b795d3Sdrochner *
16f7b795d3Sdrochner * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17f7b795d3Sdrochner * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18f7b795d3Sdrochner * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19f7b795d3Sdrochner * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20f7b795d3Sdrochner * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21f7b795d3Sdrochner * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22f7b795d3Sdrochner * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23f7b795d3Sdrochner * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24f7b795d3Sdrochner * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25f7b795d3Sdrochner * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26f7b795d3Sdrochner *
27f7b795d3Sdrochner */
28f7b795d3Sdrochner
29f7b795d3Sdrochner #include <lib/libsa/stand.h>
30f7b795d3Sdrochner #include <lib/libkern/libkern.h>
31f7b795d3Sdrochner
32f7b795d3Sdrochner #include "libi386.h"
33f7b795d3Sdrochner #include "bootinfo.h"
34f7b795d3Sdrochner
35f7b795d3Sdrochner struct bootinfo *bootinfo;
36f7b795d3Sdrochner
37334f5e8fSchristos void
bi_add(struct btinfo_common * what,int type,int size)38334f5e8fSchristos bi_add(struct btinfo_common *what, int type, int size)
39f7b795d3Sdrochner {
40f7b795d3Sdrochner what->len = size;
41f7b795d3Sdrochner what->type = type;
42f7b795d3Sdrochner
43*7759a958Smaxv if (bootinfo == NULL) {
44*7759a958Smaxv return;
45*7759a958Smaxv }
46*7759a958Smaxv if (bootinfo->nentries >= BTINFO_MAX) {
47*7759a958Smaxv panic("bootinfo too big");
48*7759a958Smaxv }
49f7b795d3Sdrochner bootinfo->entry[bootinfo->nentries++] = vtophys(what);
50f7b795d3Sdrochner }
51