11.1Sdyoung/*	$NetBSD: x86_userconf.c,v 1.1 2011/05/31 23:28:53 dyoung Exp $	*/
21.1Sdyoung
31.1Sdyoung/*-
41.1Sdyoung * Copyright (c) 2005, 2008, 2009, 2011 The NetBSD Foundation, Inc.
51.1Sdyoung * All rights reserved.
61.1Sdyoung *
71.1Sdyoung * This code is derived from software contributed to The NetBSD Foundation
81.1Sdyoung * by Julio M. Merino Vidal.
91.1Sdyoung *
101.1Sdyoung * Redistribution and use in source and binary forms, with or without
111.1Sdyoung * modification, are permitted provided that the following conditions
121.1Sdyoung * are met:
131.1Sdyoung * 1. Redistributions of source code must retain the above copyright
141.1Sdyoung *    notice, this list of conditions and the following disclaimer.
151.1Sdyoung * 2. Redistributions in binary form must reproduce the above copyright
161.1Sdyoung *    notice, this list of conditions and the following disclaimer in the
171.1Sdyoung *    documentation and/or other materials provided with the distribution.
181.1Sdyoung *
191.1Sdyoung * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
201.1Sdyoung * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
211.1Sdyoung * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
221.1Sdyoung * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
231.1Sdyoung * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
241.1Sdyoung * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
251.1Sdyoung * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
261.1Sdyoung * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
271.1Sdyoung * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
281.1Sdyoung * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
291.1Sdyoung * POSSIBILITY OF SUCH DAMAGE.
301.1Sdyoung */
311.1Sdyoung
321.1Sdyoung#include <sys/cdefs.h>
331.1Sdyoung__KERNEL_RCSID(0, "$NetBSD: x86_userconf.c,v 1.1 2011/05/31 23:28:53 dyoung Exp $");
341.1Sdyoung
351.1Sdyoung#include <sys/types.h>
361.1Sdyoung#include <sys/param.h>
371.1Sdyoung#include <sys/systm.h>
381.1Sdyoung
391.1Sdyoung#include <sys/userconf.h>
401.1Sdyoung
411.1Sdyoung#include <machine/bootinfo.h>
421.1Sdyoung
431.1Sdyoungvoid
441.1Sdyounguserconf_bootinfo(void)
451.1Sdyoung{
461.1Sdyoung	struct btinfo_userconfcommands *biuc;
471.1Sdyoung	struct bi_userconfcommand *bi, *bimax;
481.1Sdyoung
491.1Sdyoung	biuc = lookup_bootinfo(BTINFO_USERCONFCOMMANDS);
501.1Sdyoung	if (biuc == NULL) {
511.1Sdyoung		aprint_debug("No bootinfo commands at boot\n");
521.1Sdyoung		return;
531.1Sdyoung	}
541.1Sdyoung
551.1Sdyoung	bi = (struct bi_userconfcommand *)((uint8_t *)biuc + sizeof(*biuc));
561.1Sdyoung	bimax = bi + biuc->num;
571.1Sdyoung	for (; bi < bimax; bi++) {
581.1Sdyoung		aprint_debug("Processing userconf command: %s\n", bi->text);
591.1Sdyoung		userconf_parse(bi->text);
601.1Sdyoung	}
611.1Sdyoung}
62