]> CyberLeo.Net >> Repos - FreeBSD/releng/8.0.git/blob - sys/amd64/amd64/nexus.c
Adjust to reflect 8.0-RELEASE.
[FreeBSD/releng/8.0.git] / sys / amd64 / amd64 / nexus.c
1 /*-
2  * Copyright 1998 Massachusetts Institute of Technology
3  *
4  * Permission to use, copy, modify, and distribute this software and
5  * its documentation for any purpose and without fee is hereby
6  * granted, provided that both the above copyright notice and this
7  * permission notice appear in all copies, that both the above
8  * copyright notice and this permission notice appear in all
9  * supporting documentation, and that the name of M.I.T. not be used
10  * in advertising or publicity pertaining to distribution of the
11  * software without specific, written prior permission.  M.I.T. makes
12  * no representations about the suitability of this software for any
13  * purpose.  It is provided "as is" without express or implied
14  * warranty.
15  * 
16  * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''.  M.I.T. DISCLAIMS
17  * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
18  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
20  * SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
26  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27  * SUCH DAMAGE.
28  */
29
30 #include <sys/cdefs.h>
31 __FBSDID("$FreeBSD$");
32
33 /*
34  * This code implements a `root nexus' for Intel Architecture
35  * machines.  The function of the root nexus is to serve as an
36  * attachment point for both processors and buses, and to manage
37  * resources which are common to all of them.  In particular,
38  * this code implements the core resource managers for interrupt
39  * requests, DMA requests (which rightfully should be a part of the
40  * ISA code but it's easier to do it here for now), I/O port addresses,
41  * and I/O memory address space.
42  */
43
44 #include "opt_isa.h"
45
46 #include <sys/param.h>
47 #include <sys/systm.h>
48 #include <sys/bus.h>
49 #include <sys/kernel.h>
50 #include <sys/linker.h>
51 #include <sys/malloc.h>
52 #include <sys/module.h>
53 #include <machine/bus.h>
54 #include <machine/intr_machdep.h>
55 #include <sys/rman.h>
56 #include <sys/interrupt.h>
57
58 #include <machine/vmparam.h>
59 #include <vm/vm.h>
60 #include <vm/pmap.h>
61 #include <machine/pmap.h>
62
63 #include <machine/metadata.h>
64 #include <machine/nexusvar.h>
65 #include <machine/resource.h>
66 #include <machine/pc/bios.h>
67
68 #include "pcib_if.h"
69
70 #ifdef DEV_ISA
71 #include <isa/isavar.h>
72 #include <amd64/isa/isa.h>
73 #endif
74 #include <sys/rtprio.h>
75
76 static MALLOC_DEFINE(M_NEXUSDEV, "nexusdev", "Nexus device");
77
78 #define DEVTONX(dev)    ((struct nexus_device *)device_get_ivars(dev))
79
80 struct rman irq_rman, drq_rman, port_rman, mem_rman;
81
82 static  int nexus_probe(device_t);
83 static  int nexus_attach(device_t);
84 static  int nexus_print_all_resources(device_t dev);
85 static  int nexus_print_child(device_t, device_t);
86 static device_t nexus_add_child(device_t bus, int order, const char *name,
87                                 int unit);
88 static  struct resource *nexus_alloc_resource(device_t, device_t, int, int *,
89                                               u_long, u_long, u_long, u_int);
90 #ifdef SMP
91 static  int nexus_bind_intr(device_t, device_t, struct resource *, int);
92 #endif
93 static  int nexus_config_intr(device_t, int, enum intr_trigger,
94                               enum intr_polarity);
95 static  int nexus_activate_resource(device_t, device_t, int, int,
96                                     struct resource *);
97 static  int nexus_deactivate_resource(device_t, device_t, int, int,
98                                       struct resource *);
99 static  int nexus_release_resource(device_t, device_t, int, int,
100                                    struct resource *);
101 static  int nexus_setup_intr(device_t, device_t, struct resource *, int flags,
102                              driver_filter_t filter, void (*)(void *), void *, 
103                              void **);
104 static  int nexus_teardown_intr(device_t, device_t, struct resource *,
105                                 void *);
106 static struct resource_list *nexus_get_reslist(device_t dev, device_t child);
107 static  int nexus_set_resource(device_t, device_t, int, int, u_long, u_long);
108 static  int nexus_get_resource(device_t, device_t, int, int, u_long *, u_long *);
109 static void nexus_delete_resource(device_t, device_t, int, int);
110 static  int nexus_alloc_msi(device_t pcib, device_t dev, int count, int maxcount, int *irqs);
111 static  int nexus_release_msi(device_t pcib, device_t dev, int count, int *irqs);
112 static  int nexus_alloc_msix(device_t pcib, device_t dev, int *irq);
113 static  int nexus_release_msix(device_t pcib, device_t dev, int irq);
114 static  int nexus_map_msi(device_t pcib, device_t dev, int irq, uint64_t *addr, uint32_t *data);
115
116 static device_method_t nexus_methods[] = {
117         /* Device interface */
118         DEVMETHOD(device_probe,         nexus_probe),
119         DEVMETHOD(device_attach,        nexus_attach),
120         DEVMETHOD(device_detach,        bus_generic_detach),
121         DEVMETHOD(device_shutdown,      bus_generic_shutdown),
122         DEVMETHOD(device_suspend,       bus_generic_suspend),
123         DEVMETHOD(device_resume,        bus_generic_resume),
124
125         /* Bus interface */
126         DEVMETHOD(bus_print_child,      nexus_print_child),
127         DEVMETHOD(bus_add_child,        nexus_add_child),
128         DEVMETHOD(bus_alloc_resource,   nexus_alloc_resource),
129         DEVMETHOD(bus_release_resource, nexus_release_resource),
130         DEVMETHOD(bus_activate_resource, nexus_activate_resource),
131         DEVMETHOD(bus_deactivate_resource, nexus_deactivate_resource),
132         DEVMETHOD(bus_setup_intr,       nexus_setup_intr),
133         DEVMETHOD(bus_teardown_intr,    nexus_teardown_intr),
134 #ifdef SMP
135         DEVMETHOD(bus_bind_intr,        nexus_bind_intr),
136 #endif
137         DEVMETHOD(bus_config_intr,      nexus_config_intr),
138         DEVMETHOD(bus_get_resource_list, nexus_get_reslist),
139         DEVMETHOD(bus_set_resource,     nexus_set_resource),
140         DEVMETHOD(bus_get_resource,     nexus_get_resource),
141         DEVMETHOD(bus_delete_resource,  nexus_delete_resource),
142
143         /* pcib interface */
144         DEVMETHOD(pcib_alloc_msi,       nexus_alloc_msi),
145         DEVMETHOD(pcib_release_msi,     nexus_release_msi),
146         DEVMETHOD(pcib_alloc_msix,      nexus_alloc_msix),
147         DEVMETHOD(pcib_release_msix,    nexus_release_msix),
148         DEVMETHOD(pcib_map_msi,         nexus_map_msi),
149
150         { 0, 0 }
151 };
152
153 DEFINE_CLASS_0(nexus, nexus_driver, nexus_methods, 1);
154 static devclass_t nexus_devclass;
155
156 DRIVER_MODULE(nexus, root, nexus_driver, nexus_devclass, 0, 0);
157
158 static int
159 nexus_probe(device_t dev)
160 {
161
162         device_quiet(dev);      /* suppress attach message for neatness */
163         return (BUS_PROBE_GENERIC);
164 }
165   
166 void
167 nexus_init_resources(void)
168 {
169         int irq;
170
171         /* 
172          * XXX working notes:
173          *
174          * - IRQ resource creation should be moved to the PIC/APIC driver.
175          * - DRQ resource creation should be moved to the DMAC driver.
176          * - The above should be sorted to probe earlier than any child busses.
177          *
178          * - Leave I/O and memory creation here, as child probes may need them.
179          *   (especially eg. ACPI)
180          */
181
182         /*
183          * IRQ's are on the mainboard on old systems, but on the ISA part
184          * of PCI->ISA bridges.  There would be multiple sets of IRQs on
185          * multi-ISA-bus systems.  PCI interrupts are routed to the ISA
186          * component, so in a way, PCI can be a partial child of an ISA bus(!).
187          * APIC interrupts are global though.
188          */
189         irq_rman.rm_start = 0;
190         irq_rman.rm_type = RMAN_ARRAY;
191         irq_rman.rm_descr = "Interrupt request lines";
192         irq_rman.rm_end = NUM_IO_INTS - 1;
193         if (rman_init(&irq_rman))
194                 panic("nexus_init_resources irq_rman");
195
196         /*
197          * We search for regions of existing IRQs and add those to the IRQ
198          * resource manager.
199          */
200         for (irq = 0; irq < NUM_IO_INTS; irq++)
201                 if (intr_lookup_source(irq) != NULL)
202                         if (rman_manage_region(&irq_rman, irq, irq) != 0)
203                                 panic("nexus_init_resources irq_rman add");
204
205         /*
206          * ISA DMA on PCI systems is implemented in the ISA part of each
207          * PCI->ISA bridge and the channels can be duplicated if there are
208          * multiple bridges.  (eg: laptops with docking stations)
209          */
210         drq_rman.rm_start = 0;
211         drq_rman.rm_end = 7;
212         drq_rman.rm_type = RMAN_ARRAY;
213         drq_rman.rm_descr = "DMA request lines";
214         /* XXX drq 0 not available on some machines */
215         if (rman_init(&drq_rman)
216             || rman_manage_region(&drq_rman,
217                                   drq_rman.rm_start, drq_rman.rm_end))
218                 panic("nexus_init_resources drq_rman");
219
220         /*
221          * However, IO ports and Memory truely are global at this level,
222          * as are APIC interrupts (however many IO APICS there turn out
223          * to be on large systems..)
224          */
225         port_rman.rm_start = 0;
226         port_rman.rm_end = 0xffff;
227         port_rman.rm_type = RMAN_ARRAY;
228         port_rman.rm_descr = "I/O ports";
229         if (rman_init(&port_rman)
230             || rman_manage_region(&port_rman, 0, 0xffff))
231                 panic("nexus_init_resources port_rman");
232
233         mem_rman.rm_start = 0;
234         mem_rman.rm_end = ~0u;
235         mem_rman.rm_type = RMAN_ARRAY;
236         mem_rman.rm_descr = "I/O memory addresses";
237         if (rman_init(&mem_rman)
238             || rman_manage_region(&mem_rman, 0, ~0))
239                 panic("nexus_init_resources mem_rman");
240 }
241
242 static int
243 nexus_attach(device_t dev)
244 {
245
246         nexus_init_resources();
247         bus_generic_probe(dev);
248
249         /*
250          * Explicitly add the legacy0 device here.  Other platform
251          * types (such as ACPI), use their own nexus(4) subclass
252          * driver to override this routine and add their own root bus.
253          */
254         if (BUS_ADD_CHILD(dev, 10, "legacy", 0) == NULL)
255                 panic("legacy: could not attach");
256         bus_generic_attach(dev);
257         return 0;
258 }
259
260 static int
261 nexus_print_all_resources(device_t dev)
262 {
263         struct  nexus_device *ndev = DEVTONX(dev);
264         struct resource_list *rl = &ndev->nx_resources;
265         int retval = 0;
266
267         if (STAILQ_FIRST(rl))
268                 retval += printf(" at");
269         
270         retval += resource_list_print_type(rl, "port", SYS_RES_IOPORT, "%#lx");
271         retval += resource_list_print_type(rl, "iomem", SYS_RES_MEMORY, "%#lx");
272         retval += resource_list_print_type(rl, "irq", SYS_RES_IRQ, "%ld");
273
274         return retval;
275 }
276
277 static int
278 nexus_print_child(device_t bus, device_t child)
279 {
280         int retval = 0;
281
282         retval += bus_print_child_header(bus, child);
283         retval += nexus_print_all_resources(child);
284         if (device_get_flags(child))
285                 retval += printf(" flags %#x", device_get_flags(child));
286         retval += printf(" on motherboard\n");  /* XXX "motherboard", ick */
287
288         return (retval);
289 }
290
291 static device_t
292 nexus_add_child(device_t bus, int order, const char *name, int unit)
293 {
294         device_t                child;
295         struct nexus_device     *ndev;
296
297         ndev = malloc(sizeof(struct nexus_device), M_NEXUSDEV, M_NOWAIT|M_ZERO);
298         if (!ndev)
299                 return(0);
300         resource_list_init(&ndev->nx_resources);
301
302         child = device_add_child_ordered(bus, order, name, unit); 
303
304         /* should we free this in nexus_child_detached? */
305         device_set_ivars(child, ndev);
306
307         return(child);
308 }
309
310 /*
311  * Allocate a resource on behalf of child.  NB: child is usually going to be a
312  * child of one of our descendants, not a direct child of nexus0.
313  */
314 static struct resource *
315 nexus_alloc_resource(device_t bus, device_t child, int type, int *rid,
316                      u_long start, u_long end, u_long count, u_int flags)
317 {
318         struct nexus_device *ndev = DEVTONX(child);
319         struct  resource *rv;
320         struct resource_list_entry *rle;
321         struct  rman *rm;
322         int needactivate = flags & RF_ACTIVE;
323
324         /*
325          * If this is an allocation of the "default" range for a given RID, and
326          * we know what the resources for this device are (ie. they aren't maintained
327          * by a child bus), then work out the start/end values.
328          */
329         if ((start == 0UL) && (end == ~0UL) && (count == 1)) {
330                 if (ndev == NULL)
331                         return(NULL);
332                 rle = resource_list_find(&ndev->nx_resources, type, *rid);
333                 if (rle == NULL)
334                         return(NULL);
335                 start = rle->start;
336                 end = rle->end;
337                 count = rle->count;
338         }
339
340         flags &= ~RF_ACTIVE;
341
342         switch (type) {
343         case SYS_RES_IRQ:
344                 rm = &irq_rman;
345                 break;
346
347         case SYS_RES_DRQ:
348                 rm = &drq_rman;
349                 break;
350
351         case SYS_RES_IOPORT:
352                 rm = &port_rman;
353                 break;
354
355         case SYS_RES_MEMORY:
356                 rm = &mem_rman;
357                 break;
358
359         default:
360                 return 0;
361         }
362
363         rv = rman_reserve_resource(rm, start, end, count, flags, child);
364         if (rv == 0)
365                 return 0;
366         rman_set_rid(rv, *rid);
367
368         if (needactivate) {
369                 if (bus_activate_resource(child, type, *rid, rv)) {
370                         rman_release_resource(rv);
371                         return 0;
372                 }
373         }
374         
375         return rv;
376 }
377
378 static int
379 nexus_activate_resource(device_t bus, device_t child, int type, int rid,
380                         struct resource *r)
381 {
382
383         /*
384          * If this is a memory resource, map it into the kernel.
385          */
386         if (type == SYS_RES_MEMORY) {
387                 void *vaddr;
388
389                 vaddr = pmap_mapdev(rman_get_start(r), rman_get_size(r));
390                 rman_set_virtual(r, vaddr);
391                 rman_set_bustag(r, AMD64_BUS_SPACE_MEM);
392                 rman_set_bushandle(r, (bus_space_handle_t) vaddr);
393         } else if (type == SYS_RES_IOPORT) {
394                 rman_set_bustag(r, AMD64_BUS_SPACE_IO);
395                 rman_set_bushandle(r, rman_get_start(r));
396         }
397         return (rman_activate_resource(r));
398 }
399
400 static int
401 nexus_deactivate_resource(device_t bus, device_t child, int type, int rid,
402                           struct resource *r)
403 {
404         /*
405          * If this is a memory resource, unmap it.
406          */
407         if (type == SYS_RES_MEMORY) {
408                 pmap_unmapdev((vm_offset_t)rman_get_virtual(r),
409                     rman_get_size(r));
410         }
411                 
412         return (rman_deactivate_resource(r));
413 }
414
415 static int
416 nexus_release_resource(device_t bus, device_t child, int type, int rid,
417                        struct resource *r)
418 {
419         if (rman_get_flags(r) & RF_ACTIVE) {
420                 int error = bus_deactivate_resource(child, type, rid, r);
421                 if (error)
422                         return error;
423         }
424         return (rman_release_resource(r));
425 }
426
427 /*
428  * Currently this uses the really grody interface from kern/kern_intr.c
429  * (which really doesn't belong in kern/anything.c).  Eventually, all of
430  * the code in kern_intr.c and machdep_intr.c should get moved here, since
431  * this is going to be the official interface.
432  */
433 static int
434 nexus_setup_intr(device_t bus, device_t child, struct resource *irq,
435                  int flags, driver_filter_t filter, void (*ihand)(void *), 
436                  void *arg, void **cookiep)
437 {
438         int             error;
439
440         /* somebody tried to setup an irq that failed to allocate! */
441         if (irq == NULL)
442                 panic("nexus_setup_intr: NULL irq resource!");
443
444         *cookiep = 0;
445         if ((rman_get_flags(irq) & RF_SHAREABLE) == 0)
446                 flags |= INTR_EXCL;
447
448         /*
449          * We depend here on rman_activate_resource() being idempotent.
450          */
451         error = rman_activate_resource(irq);
452         if (error)
453                 return (error);
454
455         error = intr_add_handler(device_get_nameunit(child),
456             rman_get_start(irq), filter, ihand, arg, flags, cookiep);
457
458         return (error);
459 }
460
461 static int
462 nexus_teardown_intr(device_t dev, device_t child, struct resource *r, void *ih)
463 {
464         return (intr_remove_handler(ih));
465 }
466
467 #ifdef SMP
468 static int
469 nexus_bind_intr(device_t dev, device_t child, struct resource *irq, int cpu)
470 {
471         return (intr_bind(rman_get_start(irq), cpu));
472 }
473 #endif
474
475 static int
476 nexus_config_intr(device_t dev, int irq, enum intr_trigger trig,
477     enum intr_polarity pol)
478 {
479         return (intr_config_intr(irq, trig, pol));
480 }
481
482 static struct resource_list *
483 nexus_get_reslist(device_t dev, device_t child)
484 {
485         struct nexus_device *ndev = DEVTONX(child);
486
487         return (&ndev->nx_resources);
488 }
489
490 static int
491 nexus_set_resource(device_t dev, device_t child, int type, int rid, u_long start, u_long count)
492 {
493         struct nexus_device     *ndev = DEVTONX(child);
494         struct resource_list    *rl = &ndev->nx_resources;
495
496         /* XXX this should return a success/failure indicator */
497         resource_list_add(rl, type, rid, start, start + count - 1, count);
498         return(0);
499 }
500
501 static int
502 nexus_get_resource(device_t dev, device_t child, int type, int rid, u_long *startp, u_long *countp)
503 {
504         struct nexus_device     *ndev = DEVTONX(child);
505         struct resource_list    *rl = &ndev->nx_resources;
506         struct resource_list_entry *rle;
507
508         rle = resource_list_find(rl, type, rid);
509         if (!rle)
510                 return(ENOENT);
511         if (startp)
512                 *startp = rle->start;
513         if (countp)
514                 *countp = rle->count;
515         return(0);
516 }
517
518 static void
519 nexus_delete_resource(device_t dev, device_t child, int type, int rid)
520 {
521         struct nexus_device     *ndev = DEVTONX(child);
522         struct resource_list    *rl = &ndev->nx_resources;
523
524         resource_list_delete(rl, type, rid);
525 }
526
527 /* Called from the MSI code to add new IRQs to the IRQ rman. */
528 void
529 nexus_add_irq(u_long irq)
530 {
531
532         if (rman_manage_region(&irq_rman, irq, irq) != 0)
533                 panic("%s: failed", __func__);
534 }
535
536 static int
537 nexus_alloc_msix(device_t pcib, device_t dev, int *irq)
538 {
539
540         return (msix_alloc(dev, irq));
541 }
542
543 static int
544 nexus_release_msix(device_t pcib, device_t dev, int irq)
545 {
546
547         return (msix_release(irq));
548 }
549
550 static int
551 nexus_alloc_msi(device_t pcib, device_t dev, int count, int maxcount, int *irqs)
552 {
553
554         return (msi_alloc(dev, count, maxcount, irqs));
555 }
556
557 static int
558 nexus_release_msi(device_t pcib, device_t dev, int count, int *irqs)
559 {
560
561         return (msi_release(irqs, count));
562 }
563
564 static int
565 nexus_map_msi(device_t pcib, device_t dev, int irq, uint64_t *addr, uint32_t *data)
566 {
567
568         return (msi_map(irq, addr, data));
569 }
570
571 /* Placeholder for system RAM. */
572 static void
573 ram_identify(driver_t *driver, device_t parent)
574 {
575
576         if (resource_disabled("ram", 0))
577                 return; 
578         if (BUS_ADD_CHILD(parent, 0, "ram", 0) == NULL)
579                 panic("ram_identify");
580 }
581
582 static int
583 ram_probe(device_t dev)
584 {
585
586         device_quiet(dev);
587         device_set_desc(dev, "System RAM");
588         return (0);
589 }
590
591 static int
592 ram_attach(device_t dev)
593 {
594         struct bios_smap *smapbase, *smap, *smapend;
595         struct resource *res;
596         caddr_t kmdp;
597         uint32_t smapsize;
598         int error, rid;
599
600         /* Retrieve the system memory map from the loader. */
601         kmdp = preload_search_by_type("elf kernel");
602         if (kmdp == NULL)
603                 kmdp = preload_search_by_type("elf64 kernel");  
604         smapbase = (struct bios_smap *)preload_search_info(kmdp,
605             MODINFO_METADATA | MODINFOMD_SMAP);
606         smapsize = *((u_int32_t *)smapbase - 1);
607         smapend = (struct bios_smap *)((uintptr_t)smapbase + smapsize);
608
609         rid = 0;
610         for (smap = smapbase; smap < smapend; smap++) {
611                 if (smap->type != SMAP_TYPE_MEMORY || smap->length == 0)
612                         continue;
613                 error = bus_set_resource(dev, SYS_RES_MEMORY, rid, smap->base,
614                     smap->length);
615                 if (error)
616                         panic("ram_attach: resource %d failed set with %d", rid,
617                             error);
618                 res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, 0);
619                 if (res == NULL)
620                         panic("ram_attach: resource %d failed to attach", rid);
621                 rid++;
622         }
623         return (0);
624 }
625
626 static device_method_t ram_methods[] = {
627         /* Device interface */
628         DEVMETHOD(device_identify,      ram_identify),
629         DEVMETHOD(device_probe,         ram_probe),
630         DEVMETHOD(device_attach,        ram_attach),
631         { 0, 0 }
632 };
633
634 static driver_t ram_driver = {
635         "ram",
636         ram_methods,
637         1,              /* no softc */
638 };
639
640 static devclass_t ram_devclass;
641
642 DRIVER_MODULE(ram, nexus, ram_driver, ram_devclass, 0, 0);
643
644 #ifdef DEV_ISA
645 /*
646  * Placeholder which claims PnP 'devices' which describe system 
647  * resources.
648  */
649 static struct isa_pnp_id sysresource_ids[] = {
650         { 0x010cd041 /* PNP0c01 */, "System Memory" },
651         { 0x020cd041 /* PNP0c02 */, "System Resource" },
652         { 0 }
653 };
654
655 static int
656 sysresource_probe(device_t dev)
657 {
658         int     result;
659         
660         if ((result = ISA_PNP_PROBE(device_get_parent(dev), dev, sysresource_ids)) <= 0) {
661                 device_quiet(dev);
662         }
663         return(result);
664 }
665
666 static int
667 sysresource_attach(device_t dev)
668 {
669         return(0);
670 }
671
672 static device_method_t sysresource_methods[] = {
673         /* Device interface */
674         DEVMETHOD(device_probe,         sysresource_probe),
675         DEVMETHOD(device_attach,        sysresource_attach),
676         DEVMETHOD(device_detach,        bus_generic_detach),
677         DEVMETHOD(device_shutdown,      bus_generic_shutdown),
678         DEVMETHOD(device_suspend,       bus_generic_suspend),
679         DEVMETHOD(device_resume,        bus_generic_resume),
680         { 0, 0 }
681 };
682
683 static driver_t sysresource_driver = {
684         "sysresource",
685         sysresource_methods,
686         1,              /* no softc */
687 };
688
689 static devclass_t sysresource_devclass;
690
691 DRIVER_MODULE(sysresource, isa, sysresource_driver, sysresource_devclass, 0, 0);
692 #endif /* DEV_ISA */