biospnp.c revision 199767f8919635c4928607450d9e0abb932109ce
/*-
* Copyright (c) 1998 Michael Smith <msmith@freebsd.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
__FBSDID("$FreeBSD$");
/*
* PnP BIOS enumerator.
*/
#include <stand.h>
#include <bootstrap.h>
#include <isapnp.h>
#include <btxv86.h>
static int biospnp_init(void);
static void biospnp_enumerate(void);
struct pnphandler biospnphandler =
{
"PnP BIOS",
};
struct pnp_ICstructure
{
} __packed;
struct pnp_devNode
{
} __packed;
struct pnp_isaConfiguration
{
} __packed;
static u_int16_t pnp_NumNodes;
static u_int16_t pnp_NodeSize;
#define biospnp_f01(Node, devNodeBuffer, Control) biospnp_call(0x01, "llw", Node, devNodeBuffer, Control)
/* PnP BIOS return codes */
#define PNP_SUCCESS 0x00
#define PNP_FUNCTION_NOT_SUPPORTED 0x80
/*
* Initialisation: locate the PnP BIOS, test that we can call it.
* Returns nonzero if the PnP BIOS is not usable on this system.
*/
static int
biospnp_init(void)
{
struct pnp_isaConfiguration icfg;
char *sigptr;
int result;
/* Search for the $PnP signature */
pnp_Icheck = NULL;
break;
}
/* No signature, no BIOS */
if (pnp_Icheck == NULL)
return(1);
/*
* Fetch the system table parameters as a test of the BIOS
*/
if (result != PNP_SUCCESS) {
return(1);
}
/*
* Look for the PnP ISA configuration table
*/
switch (result) {
case PNP_SUCCESS:
/* If the BIOS found some PnP devices, take its hint for the read port */
break;
/* The BIOS says there is no ISA bus (should we trust that this works?) */
printf("PnP BIOS claims no ISA bus\n");
isapnp_readport = -1;
break;
}
return(0);
}
static void
biospnp_enumerate(void)
{
struct pnp_devNode *devNodeBuffer;
int result;
int count;
if (biospnp_init())
return;
Node = 0;
count = 1000;
if (result != PNP_SUCCESS) {
} else {
pi = pnp_allocinfo();
}
}
}
/*
* Scan the resource data in the node's data area for compatible device IDs
* and descriptions.
*/
static void
{
u_int8_t *p;
char *str;
tag = p[i];
i++;
if (PNP_RES_TYPE(tag) == 0) {
/* small resource */
switch (PNP_SRES_NUM(tag)) {
case COMP_DEVICE_ID:
/* got a compatible device ID */
break;
case END_TAG:
return;
}
} else {
/* large resource */
i += sizeof(u_int16_t);
switch(PNP_LRES_NUM(tag)) {
case ID_STRING_ANSI:
} else {
}
break;
}
}
}
}
/*
* Make a 16-bit realmode PnP BIOS call.
*
* The first argument passed is the function number, the last is the
* BIOS data segment selector. Intermediate arguments may be 16 or
* 32 bytes in length, and are described by the format string.
*
* Arguments to the BIOS functions must be packed on the stack, hence
* this evil.
*/
static int
{
const char *p;
u_int32_t i;
/* function number first */
/* take args according to format */
for (p = fmt; *p != 0; p++) {
switch(*p) {
case 'w':
break;
case 'l':
break;
}
}
/* BIOS segment last */
/* prepare for call */
/* call with packed stack and return */
}