isa_common.c (c3959391205ed8e27ed60988ab117c6c8ed5a173) isa_common.c (01f1aed25930c0c11fe222fd88475b81959ae981)
1/*-
2 * Copyright (c) 1999 Doug Rabson
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 78 unchanged lines hidden (view full) ---

87 * At 'probe' time, we add all the devices which we know about to the
88 * bus. The generic attach routine will probe and attach them if they
89 * are alive.
90 */
91static int
92isa_probe(device_t dev)
93{
94 device_set_desc(dev, "ISA bus");
1/*-
2 * Copyright (c) 1999 Doug Rabson
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 78 unchanged lines hidden (view full) ---

87 * At 'probe' time, we add all the devices which we know about to the
88 * bus. The generic attach routine will probe and attach them if they
89 * are alive.
90 */
91static int
92isa_probe(device_t dev)
93{
94 device_set_desc(dev, "ISA bus");
95 isa_init(); /* Allow machdep code to initialise */
95 isa_init(dev); /* Allow machdep code to initialise */
96 return 0;
97}
98
99extern device_t isa_bus_device;
100
101static int
102isa_attach(device_t dev)
103{

--- 525 unchanged lines hidden (view full) ---

629
630 child = device_add_child_ordered(dev, order, name, unit);
631 device_set_ivars(child, idev);
632
633 return child;
634}
635
636static int
96 return 0;
97}
98
99extern device_t isa_bus_device;
100
101static int
102isa_attach(device_t dev)
103{

--- 525 unchanged lines hidden (view full) ---

629
630 child = device_add_child_ordered(dev, order, name, unit);
631 device_set_ivars(child, idev);
632
633 return child;
634}
635
636static int
637isa_print_resources(struct resource_list *rl, const char *name, int type,
638 int count, const char *format)
639{
640 struct resource_list_entry *rle;
641 int printed;
642 int i, retval = 0;;
643
644 printed = 0;
645 for (i = 0; i < count; i++) {
646 rle = resource_list_find(rl, type, i);
647 if (rle) {
648 if (printed == 0)
649 retval += printf(" %s ", name);
650 else if (printed > 0)
651 retval += printf(",");
652 printed++;
653 retval += printf(format, rle->start);
654 if (rle->count > 1) {
655 retval += printf("-");
656 retval += printf(format,
657 rle->start + rle->count - 1);
658 }
659 } else if (i > 3) {
660 /* check the first few regardless */
661 break;
662 }
663 }
664 return retval;
665}
666
667static int
668isa_print_all_resources(device_t dev)
669{
670 struct isa_device *idev = DEVTOISA(dev);
671 struct resource_list *rl = &idev->id_resources;
672 int retval = 0;
673
674 if (SLIST_FIRST(rl) || device_get_flags(dev))
675 retval += printf(" at");
676
637isa_print_all_resources(device_t dev)
638{
639 struct isa_device *idev = DEVTOISA(dev);
640 struct resource_list *rl = &idev->id_resources;
641 int retval = 0;
642
643 if (SLIST_FIRST(rl) || device_get_flags(dev))
644 retval += printf(" at");
645
677 retval += isa_print_resources(rl, "port", SYS_RES_IOPORT,
678 ISA_NPORT, "%#lx");
679 retval += isa_print_resources(rl, "iomem", SYS_RES_MEMORY,
680 ISA_NMEM, "%#lx");
681 retval += isa_print_resources(rl, "irq", SYS_RES_IRQ,
682 ISA_NIRQ, "%ld");
683 retval += isa_print_resources(rl, "drq", SYS_RES_DRQ,
684 ISA_NDRQ, "%ld");
646 retval += resource_list_print_type(rl, "port", SYS_RES_IOPORT, "%#lx");
647 retval += resource_list_print_type(rl, "iomem", SYS_RES_MEMORY, "%#lx");
648 retval += resource_list_print_type(rl, "irq", SYS_RES_IRQ, "%ld");
649 retval += resource_list_print_type(rl, "drq", SYS_RES_DRQ, "%ld");
685 if (device_get_flags(dev))
686 retval += printf(" flags %#x", device_get_flags(dev));
687
688 return retval;
689}
690
691static int
692isa_print_child(device_t bus, device_t dev)

--- 450 unchanged lines hidden ---
650 if (device_get_flags(dev))
651 retval += printf(" flags %#x", device_get_flags(dev));
652
653 return retval;
654}
655
656static int
657isa_print_child(device_t bus, device_t dev)

--- 450 unchanged lines hidden ---