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