i386_module.c revision 119482
138465Smsmith/*- 238465Smsmith * Copyright (c) 1998 Michael Smith <msmith@freebsd.org> 338465Smsmith * All rights reserved. 438465Smsmith * 538465Smsmith * Redistribution and use in source and binary forms, with or without 638465Smsmith * modification, are permitted provided that the following conditions 738465Smsmith * are met: 838465Smsmith * 1. Redistributions of source code must retain the above copyright 938465Smsmith * notice, this list of conditions and the following disclaimer. 1038465Smsmith * 2. Redistributions in binary form must reproduce the above copyright 1138465Smsmith * notice, this list of conditions and the following disclaimer in the 1238465Smsmith * documentation and/or other materials provided with the distribution. 1338465Smsmith * 1438465Smsmith * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1538465Smsmith * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1638465Smsmith * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1738465Smsmith * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1838465Smsmith * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1938465Smsmith * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2038465Smsmith * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2138465Smsmith * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2238465Smsmith * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2338465Smsmith * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2438465Smsmith * SUCH DAMAGE. 2538465Smsmith */ 2638465Smsmith 27119482Sobrien#include <sys/cdefs.h> 28119482Sobrien__FBSDID("$FreeBSD: head/sys/boot/i386/libi386/i386_module.c 119482 2003-08-25 23:28:32Z obrien $"); 29119482Sobrien 3038465Smsmith/* 3138465Smsmith * i386-specific module functionality. 3238465Smsmith * 3338465Smsmith */ 3438465Smsmith 3538465Smsmith#include <stand.h> 3638465Smsmith#include <string.h> 3738465Smsmith 3838465Smsmith#include "bootstrap.h" 3938465Smsmith#include "libi386.h" 4038465Smsmith 4138465Smsmith/* 4238465Smsmith * Use voodoo to load modules required by current hardware. 4338465Smsmith */ 4438465Smsmithint 4538465Smsmithi386_autoload(void) 4638465Smsmith{ 4782531Smsmith int error; 48102960Siwasaki int disabled; 49102960Siwasaki char *rv; 5082531Smsmith 5138465Smsmith /* XXX use PnP to locate stuff here */ 5282531Smsmith 53101558Sobrien /* autoload ACPI support */ 54101558Sobrien /* XXX should be in 4th keyed off acpi_load */ 55102960Siwasaki disabled = 0; 56102960Siwasaki rv = getenv("hint.acpi.0.disabled"); 57102960Siwasaki if (rv != NULL && strncmp(rv, "0", 1) != 0) { 58102960Siwasaki disabled = 1; 59102960Siwasaki } 60102960Siwasaki 61102960Siwasaki if (getenv("acpi_load") && (!disabled)) { 62101558Sobrien error = mod_load("acpi", NULL, 0, NULL); 63101558Sobrien if (error != 0) 64101558Sobrien printf("ACPI autoload failed - %s\n", strerror(error)); 65101558Sobrien } 66102960Siwasaki 6738465Smsmith return(0); 6838465Smsmith} 69