bios.c revision 89980
1/*-
2 * Copyright (c) 1997 Michael Smith
3 * Copyright (c) 1998 Jonathan Lemon
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 *    notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 *    notice, this list of conditions and the following disclaimer in the
13 *    documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 * $FreeBSD: head/sys/amd64/amd64/bios.c 89980 2002-01-30 12:41:12Z bde $
28 */
29
30/*
31 * Code for dealing with the BIOS in x86 PC systems.
32 */
33
34#include "opt_isa.h"
35
36#include <sys/param.h>
37#include <sys/systm.h>
38#include <sys/kernel.h>
39#include <sys/malloc.h>
40#include <sys/bus.h>
41#include <sys/pcpu.h>
42#include <vm/vm.h>
43#include <vm/pmap.h>
44#include <machine/md_var.h>
45#include <machine/segments.h>
46#include <machine/stdarg.h>
47#include <machine/vmparam.h>
48#include <machine/pc/bios.h>
49#ifdef DEV_ISA
50#include <isa/isavar.h>
51#include <isa/pnpreg.h>
52#include <isa/pnpvar.h>
53#endif
54
55#define BIOS_START	0xe0000
56#define BIOS_SIZE	0x20000
57
58/* exported lookup results */
59struct bios32_SDentry		PCIbios = {entry : 0};
60struct PnPBIOS_table		*PnPBIOStable = 0;
61
62static u_int			bios32_SDCI = 0;
63
64/* start fairly early */
65static void			bios32_init(void *junk);
66SYSINIT(bios32, SI_SUB_CPU, SI_ORDER_ANY, bios32_init, NULL);
67
68/*
69 * bios32_init
70 *
71 * Locate various bios32 entities.
72 */
73static void
74bios32_init(void *junk)
75{
76    u_long			sigaddr;
77    struct bios32_SDheader	*sdh;
78    struct PnPBIOS_table	*pt;
79    u_int8_t			ck, *cv;
80    int				i;
81    char			*p;
82
83    /*
84     * BIOS32 Service Directory, PCI BIOS
85     */
86
87    /* look for the signature */
88    if ((sigaddr = bios_sigsearch(0, "_32_", 4, 16, 0)) != 0) {
89
90	/* get a virtual pointer to the structure */
91	sdh = (struct bios32_SDheader *)(uintptr_t)BIOS_PADDRTOVADDR(sigaddr);
92	for (cv = (u_int8_t *)sdh, ck = 0, i = 0; i < (sdh->len * 16); i++) {
93	    ck += cv[i];
94	}
95	/* If checksum is OK, enable use of the entrypoint */
96	if ((ck == 0) && (sdh->entry < (BIOS_START + BIOS_SIZE))) {
97	    bios32_SDCI = BIOS_PADDRTOVADDR(sdh->entry);
98	    if (bootverbose) {
99		printf("bios32: Found BIOS32 Service Directory header at %p\n", sdh);
100		printf("bios32: Entry = 0x%x (%x)  Rev = %d  Len = %d\n",
101		       sdh->entry, bios32_SDCI, sdh->revision, sdh->len);
102	    }
103
104#ifndef PC98
105	    /* Allow user override of PCI BIOS search */
106	    if (((p = getenv("machdep.bios.pci")) == NULL) || strcmp(p, "disable")) {
107
108		/* See if there's a PCI BIOS entrypoint here */
109		PCIbios.ident.id = 0x49435024;	/* PCI systems should have this */
110		if (!bios32_SDlookup(&PCIbios) && bootverbose)
111		    printf("pcibios: PCI BIOS entry at 0x%x+0x%x\n", PCIbios.base, PCIbios.entry);
112	    }
113#endif
114	} else {
115	    printf("bios32: Bad BIOS32 Service Directory\n");
116	}
117    }
118
119    /*
120     * PnP BIOS
121     *
122     * Allow user override of PnP BIOS search
123     */
124    if ((((p = getenv("machdep.bios.pnp")) == NULL) || strcmp(p, "disable")) &&
125	((sigaddr = bios_sigsearch(0, "$PnP", 4, 16, 0)) != 0)) {
126
127	/* get a virtual pointer to the structure */
128	pt = (struct PnPBIOS_table *)(uintptr_t)BIOS_PADDRTOVADDR(sigaddr);
129	for (cv = (u_int8_t *)pt, ck = 0, i = 0; i < pt->len; i++) {
130	    ck += cv[i];
131	}
132	/* If checksum is OK, enable use of the entrypoint */
133	if (ck == 0) {
134	    PnPBIOStable = pt;
135	    if (bootverbose) {
136		printf("pnpbios: Found PnP BIOS data at %p\n", pt);
137		printf("pnpbios: Entry = %x:%x  Rev = %d.%d\n",
138		       pt->pmentrybase, pt->pmentryoffset, pt->version >> 4, pt->version & 0xf);
139		if ((pt->control & 0x3) == 0x01)
140		    printf("pnpbios: Event flag at %x\n", pt->evflagaddr);
141		if (pt->oemdevid != 0)
142		    printf("pnpbios: OEM ID %x\n", pt->oemdevid);
143
144	    }
145	} else {
146	    printf("pnpbios: Bad PnP BIOS data checksum\n");
147	}
148    }
149    if (bootverbose) {
150	    /* look for other know signatures */
151	    printf("Other BIOS signatures found:\n");
152    }
153}
154
155/*
156 * bios32_SDlookup
157 *
158 * Query the BIOS32 Service Directory for the service named in (ent),
159 * returns nonzero if the lookup fails.  The caller must fill in
160 * (ent->ident), the remainder are populated on a successful lookup.
161 */
162int
163bios32_SDlookup(struct bios32_SDentry *ent)
164{
165    struct bios_regs args;
166
167    if (bios32_SDCI == 0)
168	return (1);
169
170    args.eax = ent->ident.id;		/* set up arguments */
171    args.ebx = args.ecx = args.edx = 0;
172    bios32(&args, bios32_SDCI, GSEL(GCODE_SEL, SEL_KPL));
173    if ((args.eax & 0xff) == 0) {	/* success? */
174	ent->base = args.ebx;
175	ent->len = args.ecx;
176	ent->entry = args.edx;
177	ent->ventry = BIOS_PADDRTOVADDR(ent->base + ent->entry);
178	return (0);			/* all OK */
179    }
180    return (1);				/* failed */
181}
182
183
184/*
185 * bios_sigsearch
186 *
187 * Search some or all of the BIOS region for a signature string.
188 *
189 * (start)	Optional offset returned from this function
190 *		(for searching for multiple matches), or NULL
191 *		to start the search from the base of the BIOS.
192 *		Note that this will be a _physical_ address in
193 *		the range 0xe0000 - 0xfffff.
194 * (sig)	is a pointer to the byte(s) of the signature.
195 * (siglen)	number of bytes in the signature.
196 * (paralen)	signature paragraph (alignment) size.
197 * (sigofs)	offset of the signature within the paragraph.
198 *
199 * Returns the _physical_ address of the found signature, 0 if the
200 * signature was not found.
201 */
202
203u_int32_t
204bios_sigsearch(u_int32_t start, u_char *sig, int siglen, int paralen, int sigofs)
205{
206    u_char	*sp, *end;
207
208    /* compute the starting address */
209    if ((start >= BIOS_START) && (start <= (BIOS_START + BIOS_SIZE))) {
210	sp = (char *)BIOS_PADDRTOVADDR(start);
211    } else if (start == 0) {
212	sp = (char *)BIOS_PADDRTOVADDR(BIOS_START);
213    } else {
214	return 0;				/* bogus start address */
215    }
216
217    /* compute the end address */
218    end = (u_char *)BIOS_PADDRTOVADDR(BIOS_START + BIOS_SIZE);
219
220    /* loop searching */
221    while ((sp + sigofs + siglen) < end) {
222
223	/* compare here */
224	if (!bcmp(sp + sigofs, sig, siglen)) {
225	    /* convert back to physical address */
226	    return((u_int32_t)BIOS_VADDRTOPADDR(sp));
227	}
228	sp += paralen;
229    }
230    return(0);
231}
232
233/*
234 * do not staticize, used by bioscall.s
235 */
236union {
237    struct {
238	u_short	offset;
239	u_short	segment;
240    } vec16;
241    struct {
242	u_int	offset;
243	u_short	segment;
244    } vec32;
245} bioscall_vector;			/* bios jump vector */
246
247void
248set_bios_selectors(struct bios_segments *seg, int flags)
249{
250    struct soft_segment_descriptor ssd = {
251	0,			/* segment base address (overwritten) */
252	0,			/* length (overwritten) */
253	SDT_MEMERA,		/* segment type (overwritten) */
254	0,			/* priority level */
255	1,			/* descriptor present */
256	0, 0,
257	1,			/* descriptor size (overwritten) */
258	0			/* granularity == byte units */
259    };
260    union descriptor *p_gdt;
261
262#ifdef SMP
263    p_gdt = &gdt[PCPU_GET(cpuid) * NGDT];
264#else
265    p_gdt = gdt;
266#endif
267
268    ssd.ssd_base = seg->code32.base;
269    ssd.ssd_limit = seg->code32.limit;
270    ssdtosd(&ssd, &p_gdt[GBIOSCODE32_SEL].sd);
271
272    ssd.ssd_def32 = 0;
273    if (flags & BIOSCODE_FLAG) {
274	ssd.ssd_base = seg->code16.base;
275	ssd.ssd_limit = seg->code16.limit;
276	ssdtosd(&ssd, &p_gdt[GBIOSCODE16_SEL].sd);
277    }
278
279    ssd.ssd_type = SDT_MEMRWA;
280    if (flags & BIOSDATA_FLAG) {
281	ssd.ssd_base = seg->data.base;
282	ssd.ssd_limit = seg->data.limit;
283	ssdtosd(&ssd, &p_gdt[GBIOSDATA_SEL].sd);
284    }
285
286    if (flags & BIOSUTIL_FLAG) {
287	ssd.ssd_base = seg->util.base;
288	ssd.ssd_limit = seg->util.limit;
289	ssdtosd(&ssd, &p_gdt[GBIOSUTIL_SEL].sd);
290    }
291
292    if (flags & BIOSARGS_FLAG) {
293	ssd.ssd_base = seg->args.base;
294	ssd.ssd_limit = seg->args.limit;
295	ssdtosd(&ssd, &p_gdt[GBIOSARGS_SEL].sd);
296    }
297}
298
299extern int vm86pa;
300extern void bios16_jmp(void);
301
302/*
303 * this routine is really greedy with selectors, and uses 5:
304 *
305 * 32-bit code selector:	to return to kernel
306 * 16-bit code selector:	for running code
307 *        data selector:	for 16-bit data
308 *        util selector:	extra utility selector
309 *        args selector:	to handle pointers
310 *
311 * the util selector is set from the util16 entry in bios16_args, if a
312 * "U" specifier is seen.
313 *
314 * See <machine/pc/bios.h> for description of format specifiers
315 */
316int
317bios16(struct bios_args *args, char *fmt, ...)
318{
319    char	*p, *stack, *stack_top;
320    va_list 	ap;
321    int 	flags = BIOSCODE_FLAG | BIOSDATA_FLAG;
322    u_int 	i, arg_start, arg_end;
323    u_int 	*pte, *ptd;
324
325    arg_start = 0xffffffff;
326    arg_end = 0;
327
328    /*
329     * Some BIOS entrypoints attempt to copy the largest-case
330     * argument frame (in order to generalise handling for
331     * different entry types).  If our argument frame is
332     * smaller than this, the BIOS will reach off the top of
333     * our constructed stack segment.  Pad the top of the stack
334     * with some garbage to avoid this.
335     */
336    stack = (caddr_t)PAGE_SIZE - 32;
337
338    va_start(ap, fmt);
339    for (p = fmt; p && *p; p++) {
340	switch (*p) {
341	case 'p':			/* 32-bit pointer */
342	    i = va_arg(ap, u_int);
343	    arg_start = min(arg_start, i);
344	    arg_end = max(arg_end, i);
345	    flags |= BIOSARGS_FLAG;
346	    stack -= 4;
347	    break;
348
349	case 'i':			/* 32-bit integer */
350	    i = va_arg(ap, u_int);
351	    stack -= 4;
352	    break;
353
354	case 'U':			/* 16-bit selector */
355	    flags |= BIOSUTIL_FLAG;
356	    /* FALLTHROUGH */
357	case 'D':			/* 16-bit selector */
358	case 'C':			/* 16-bit selector */
359	    stack -= 2;
360	    break;
361
362	case 's':			/* 16-bit integer */
363	    i = va_arg(ap, u_short);
364	    stack -= 2;
365	    break;
366
367	default:
368	    return (EINVAL);
369	}
370    }
371
372    if (flags & BIOSARGS_FLAG) {
373	if (arg_end - arg_start > ctob(16))
374	    return (EACCES);
375	args->seg.args.base = arg_start;
376	args->seg.args.limit = 0xffff;
377    }
378
379    args->seg.code32.base = (u_int)&bios16_jmp & PG_FRAME;
380    args->seg.code32.limit = 0xffff;
381
382    ptd = (u_int *)rcr3();
383    if (ptd == IdlePTD) {
384	/*
385	 * no page table, so create one and install it.
386	 */
387	pte = (u_int *)malloc(PAGE_SIZE, M_TEMP, M_WAITOK);
388	ptd = (u_int *)((u_int)ptd + KERNBASE);
389	*ptd = vtophys(pte) | PG_RW | PG_V;
390    } else {
391	/*
392	 * this is a user-level page table
393	 */
394	pte = (u_int *)&PTmap;
395    }
396    /*
397     * install pointer to page 0.  we don't need to flush the tlb,
398     * since there should not be a previous mapping for page 0.
399     */
400    *pte = (vm86pa - PAGE_SIZE) | PG_RW | PG_V;
401
402    stack_top = stack;
403    va_start(ap, fmt);
404    for (p = fmt; p && *p; p++) {
405	switch (*p) {
406	case 'p':			/* 32-bit pointer */
407	    i = va_arg(ap, u_int);
408	    *(u_int *)stack = (i - arg_start) |
409		(GSEL(GBIOSARGS_SEL, SEL_KPL) << 16);
410	    stack += 4;
411	    break;
412
413	case 'i':			/* 32-bit integer */
414	    i = va_arg(ap, u_int);
415	    *(u_int *)stack = i;
416	    stack += 4;
417	    break;
418
419	case 'U':			/* 16-bit selector */
420	    *(u_short *)stack = GSEL(GBIOSUTIL_SEL, SEL_KPL);
421	    stack += 2;
422	    break;
423
424	case 'D':			/* 16-bit selector */
425	    *(u_short *)stack = GSEL(GBIOSDATA_SEL, SEL_KPL);
426	    stack += 2;
427	    break;
428
429	case 'C':			/* 16-bit selector */
430	    *(u_short *)stack = GSEL(GBIOSCODE16_SEL, SEL_KPL);
431	    stack += 2;
432	    break;
433
434	case 's':			/* 16-bit integer */
435	    i = va_arg(ap, u_short);
436	    *(u_short *)stack = i;
437	    stack += 2;
438	    break;
439
440	default:
441	    return (EINVAL);
442	}
443    }
444
445    set_bios_selectors(&args->seg, flags);
446    bioscall_vector.vec16.offset = (u_short)args->entry;
447    bioscall_vector.vec16.segment = GSEL(GBIOSCODE16_SEL, SEL_KPL);
448
449    i = bios16_call(&args->r, stack_top);
450
451    if (pte == (u_int *)&PTmap) {
452	*pte = 0;			/* remove entry */
453    } else {
454	*ptd = 0;			/* remove page table */
455	free(pte, M_TEMP);		/* ... and free it */
456    }
457
458    /*
459     * XXX only needs to be invlpg(0) but that doesn't work on the 386
460     */
461    invltlb();
462
463    return (i);
464}
465
466#ifdef DEV_ISA
467/*
468 * PnP BIOS interface; enumerate devices only known to the system
469 * BIOS and save information about them for later use.
470 */
471
472struct pnp_sysdev
473{
474    u_int16_t	size;
475    u_int8_t	handle;
476    u_int32_t	devid;
477    u_int8_t	type[3];
478    u_int16_t	attrib;
479#define PNPATTR_NODISABLE	(1<<0)	/* can't be disabled */
480#define PNPATTR_NOCONFIG	(1<<1)	/* can't be configured */
481#define PNPATTR_OUTPUT		(1<<2)	/* can be primary output */
482#define PNPATTR_INPUT		(1<<3)	/* can be primary input */
483#define PNPATTR_BOOTABLE	(1<<4)	/* can be booted from */
484#define PNPATTR_DOCK		(1<<5)	/* is a docking station */
485#define PNPATTR_REMOVEABLE	(1<<6)	/* device is removeable */
486#define PNPATTR_CONFIG_STATIC	(0)
487#define PNPATTR_CONFIG_DYNAMIC	(1)
488#define PNPATTR_CONFIG_DYNONLY	(3)
489#define PNPATTR_CONFIG(a)	(((a) >> 7) & 0x3)
490    /* device-specific data comes here */
491    u_int8_t	devdata[0];
492} __attribute__ ((packed));
493
494/* We have to cluster arguments within a 64k range for the bios16 call */
495struct pnp_sysdevargs
496{
497    u_int16_t	next;
498    struct pnp_sysdev node;
499};
500
501/*
502 * This function is called after the bus has assigned resource
503 * locations for a logical device.
504 */
505static void
506pnpbios_set_config(void *arg, struct isa_config *config, int enable)
507{
508}
509
510/*
511 * Quiz the PnP BIOS, build a list of PNP IDs and resource data.
512 */
513static void
514pnpbios_identify(driver_t *driver, device_t parent)
515{
516    struct PnPBIOS_table	*pt = PnPBIOStable;
517    struct bios_args		args;
518    struct pnp_sysdev		*pd;
519    struct pnp_sysdevargs	*pda;
520    u_int16_t			ndevs, bigdev;
521    int				error, currdev;
522    u_int8_t			*devnodebuf, tag;
523    u_int32_t			*devid, *compid;
524    int				idx, left;
525    device_t			dev;
526
527    /* no PnP BIOS information */
528    if (pt == NULL)
529	return;
530
531    /* ACPI already active */
532    if (devclass_get_softc(devclass_find("ACPI"), 0) != NULL)
533	return;
534
535    /* get count of PnP devices */
536    bzero(&args, sizeof(args));
537    args.seg.code16.base = BIOS_PADDRTOVADDR(pt->pmentrybase);
538    args.seg.code16.limit = 0xffff;		/* XXX ? */
539    args.seg.data.base = BIOS_PADDRTOVADDR(pt->pmdataseg);
540    args.seg.data.limit = 0xffff;
541    args.entry = pt->pmentryoffset;
542
543    if ((error = bios16(&args, PNP_COUNT_DEVNODES, &ndevs, &bigdev)) || (args.r.eax & 0xff))
544	printf("pnpbios: error %d/%x getting device count/size limit\n", error, args.r.eax);
545    ndevs &= 0xff;				/* clear high byte garbage */
546    if (bootverbose)
547	printf("pnpbios: %d devices, largest %d bytes\n", ndevs, bigdev);
548
549    devnodebuf = malloc(bigdev + (sizeof(struct pnp_sysdevargs) - sizeof(struct pnp_sysdev)),
550			M_DEVBUF, M_NOWAIT);
551    pda = (struct pnp_sysdevargs *)devnodebuf;
552    pd = &pda->node;
553
554    for (currdev = 0, left = ndevs; (currdev != 0xff) && (left > 0); left--) {
555
556	bzero(pd, bigdev);
557	pda->next = currdev;
558	/* get current configuration */
559	if ((error = bios16(&args, PNP_GET_DEVNODE, &pda->next, &pda->node, (u_int16_t)1))) {
560	    printf("pnpbios: error %d making BIOS16 call\n", error);
561	    break;
562	}
563	if ((error = (args.r.eax & 0xff))) {
564	    if (bootverbose)
565		printf("pnpbios: %s 0x%x fetching node %d\n", error & 0x80 ? "error" : "warning", error, currdev);
566	    if (error & 0x80)
567		break;
568	}
569	currdev = pda->next;
570	if (pd->size < sizeof(struct pnp_sysdev)) {
571	    printf("pnpbios: bogus system node data, aborting scan\n");
572	    break;
573	}
574
575	/*
576	 * If we are in APIC_IO mode, we should ignore the ISA PIC if it
577	 * shows up.  Likewise, in !APIC_IO mode, we should ignore the
578	 * APIC (less important).
579	 * This is significant because the ISA PIC will claim IRQ 2 (which
580	 * it uses for chaining), while in APIC mode this is a valid IRQ
581	 * available for general use.
582	 */
583#ifdef APIC_IO
584	if (!strcmp(pnp_eisaformat(pd->devid), "PNP0000"))	/* ISA PIC */
585	    continue;
586#else
587	if (!strcmp(pnp_eisaformat(pd->devid), "PNP0003"))	/* APIC */
588	    continue;
589#endif
590
591	/* Add the device and parse its resources */
592	dev = BUS_ADD_CHILD(parent, ISA_ORDER_PNP, NULL, -1);
593	isa_set_vendorid(dev, pd->devid);
594	isa_set_logicalid(dev, pd->devid);
595	/*
596	 * It appears that some PnP BIOS doesn't allow us to re-enable
597	 * the embedded system device once it is disabled.  We shall
598	 * mark all system device nodes as "cannot be disabled", regardless
599	 * of actual settings in the device attribute byte.
600	 * XXX
601	isa_set_configattr(dev,
602	    ((pd->attrib & PNPATTR_NODISABLE) ?  0 : ISACFGATTR_CANDISABLE) |
603	    ((!(pd->attrib & PNPATTR_NOCONFIG) &&
604		PNPATTR_CONFIG(pd->attrib) != PNPATTR_CONFIG_STATIC)
605		? ISACFGATTR_DYNAMIC : 0));
606	 */
607	isa_set_configattr(dev,
608	    (!(pd->attrib & PNPATTR_NOCONFIG) &&
609		PNPATTR_CONFIG(pd->attrib) != PNPATTR_CONFIG_STATIC)
610		? ISACFGATTR_DYNAMIC : 0);
611	ISA_SET_CONFIG_CALLBACK(parent, dev, pnpbios_set_config, 0);
612	pnp_parse_resources(dev, &pd->devdata[0],
613			    pd->size - sizeof(struct pnp_sysdev), 0);
614	if (!device_get_desc(dev))
615	    device_set_desc_copy(dev, pnp_eisaformat(pd->devid));
616
617	/* Find device IDs */
618	devid = &pd->devid;
619	compid = NULL;
620
621	/* look for a compatible device ID too */
622	left = pd->size - sizeof(struct pnp_sysdev);
623	idx = 0;
624	while (idx < left) {
625	    tag = pd->devdata[idx++];
626	    if (PNP_RES_TYPE(tag) == 0) {
627		/* Small resource */
628		switch (PNP_SRES_NUM(tag)) {
629		case PNP_TAG_COMPAT_DEVICE:
630		    compid = (u_int32_t *)(pd->devdata + idx);
631		    if (bootverbose)
632			printf("pnpbios: node %d compat ID 0x%08x\n", pd->handle, *compid);
633		    /* FALLTHROUGH */
634		case PNP_TAG_END:
635		    idx = left;
636		    break;
637		default:
638		    idx += PNP_SRES_LEN(tag);
639		    break;
640		}
641	    } else
642		/* Large resource, skip it */
643		idx += *(u_int16_t *)(pd->devdata + idx) + 2;
644	}
645	if (bootverbose) {
646	    printf("pnpbios: handle %d device ID %s (%08x)",
647		   pd->handle, pnp_eisaformat(*devid), *devid);
648	    if (compid != NULL)
649		printf(" compat ID %s (%08x)",
650		       pnp_eisaformat(*compid), *compid);
651	    printf("\n");
652	}
653    }
654}
655
656static device_method_t pnpbios_methods[] = {
657	/* Device interface */
658	DEVMETHOD(device_identify,	pnpbios_identify),
659
660	{ 0, 0 }
661};
662
663static driver_t pnpbios_driver = {
664	"pnpbios",
665	pnpbios_methods,
666	1,			/* no softc */
667};
668
669static devclass_t pnpbios_devclass;
670
671DRIVER_MODULE(pnpbios, isa, pnpbios_driver, pnpbios_devclass, 0, 0);
672#endif /* DEV_ISA */
673