Wed Jan 14 19:31:25 2009 UTC ()
use KM_SLEEP per request from ad@


(cegger)
diff -r1.74 -r1.75 src/sys/arch/x86/x86/mpacpi.c
diff -r1.51 -r1.52 src/sys/arch/x86/x86/mpbios.c

cvs diff -r1.74 -r1.75 src/sys/arch/x86/x86/mpacpi.c (expand / switch to unified diff)

--- src/sys/arch/x86/x86/mpacpi.c 2009/01/12 08:36:36 1.74
+++ src/sys/arch/x86/x86/mpacpi.c 2009/01/14 19:31:25 1.75
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: mpacpi.c,v 1.74 2009/01/12 08:36:36 sborrill Exp $ */ 1/* $NetBSD: mpacpi.c,v 1.75 2009/01/14 19:31:25 cegger Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2003 Wasabi Systems, Inc. 4 * Copyright (c) 2003 Wasabi Systems, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Written by Frank van der Linden for Wasabi Systems, Inc. 7 * Written by Frank van der Linden for Wasabi Systems, Inc.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -26,27 +26,27 @@ @@ -26,27 +26,27 @@
26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
27 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 27 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC 28 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
29 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 29 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE. 35 * POSSIBILITY OF SUCH DAMAGE.
36 */ 36 */
37 37
38#include <sys/cdefs.h> 38#include <sys/cdefs.h>
39__KERNEL_RCSID(0, "$NetBSD: mpacpi.c,v 1.74 2009/01/12 08:36:36 sborrill Exp $"); 39__KERNEL_RCSID(0, "$NetBSD: mpacpi.c,v 1.75 2009/01/14 19:31:25 cegger Exp $");
40 40
41#include "acpi.h" 41#include "acpi.h"
42#include "opt_acpi.h" 42#include "opt_acpi.h"
43#include "opt_mpbios.h" 43#include "opt_mpbios.h"
44#include "opt_multiprocessor.h" 44#include "opt_multiprocessor.h"
45#include "pchb.h" 45#include "pchb.h"
46 46
47#include <sys/param.h> 47#include <sys/param.h>
48#include <sys/systm.h> 48#include <sys/systm.h>
49#include <sys/kernel.h> 49#include <sys/kernel.h>
50#include <sys/device.h> 50#include <sys/device.h>
51#include <sys/kmem.h> 51#include <sys/kmem.h>
52#include <sys/queue.h> 52#include <sys/queue.h>
@@ -882,32 +882,31 @@ mpacpi_config_irouting(struct acpi_softc @@ -882,32 +882,31 @@ mpacpi_config_irouting(struct acpi_softc
882 nintr = mpacpi_nintsrc + NUM_LEGACY_IRQS - 1; 882 nintr = mpacpi_nintsrc + NUM_LEGACY_IRQS - 1;
883#if NPCI > 0 883#if NPCI > 0
884 TAILQ_FOREACH(mpr, &mpacpi_pcibusses, mpr_list) { 884 TAILQ_FOREACH(mpr, &mpacpi_pcibusses, mpr_list) {
885 nintr += mpacpi_pcircount(mpr); 885 nintr += mpacpi_pcircount(mpr);
886 } 886 }
887 887
888 mp_isa_bus = mpacpi_maxpci + BUS_BUFFER; /* XXX */ 888 mp_isa_bus = mpacpi_maxpci + BUS_BUFFER; /* XXX */
889#else 889#else
890 mp_isa_bus = 0; 890 mp_isa_bus = 0;
891#endif 891#endif
892 mp_nbus = mp_isa_bus + 1; 892 mp_nbus = mp_isa_bus + 1;
893 mp_nintr = nintr; 893 mp_nintr = nintr;
894 894
895 mp_busses = kmem_zalloc(sizeof(struct mp_bus) * mp_nbus, KM_NOSLEEP); 895 mp_busses = kmem_zalloc(sizeof(struct mp_bus) * mp_nbus, KM_SLEEP);
896 if (mp_busses == NULL) 896 if (mp_busses == NULL)
897 panic("can't allocate mp_busses"); 897 panic("can't allocate mp_busses");
898 898
899 mp_intrs = kmem_zalloc(sizeof(struct mp_intr_map) * mp_nintr, 899 mp_intrs = kmem_zalloc(sizeof(struct mp_intr_map) * mp_nintr, KM_SLEEP);
900 KM_NOSLEEP); 
901 if (mp_intrs == NULL) 900 if (mp_intrs == NULL)
902 panic("can't allocate mp_intrs"); 901 panic("can't allocate mp_intrs");
903 902
904 mbp = &mp_busses[mp_isa_bus]; 903 mbp = &mp_busses[mp_isa_bus];
905 mbp->mb_name = "isa"; 904 mbp->mb_name = "isa";
906 mbp->mb_idx = 0; 905 mbp->mb_idx = 0;
907 mbp->mb_intr_print = mpacpi_print_isa_intr; 906 mbp->mb_intr_print = mpacpi_print_isa_intr;
908 mbp->mb_intr_cfg = NULL; 907 mbp->mb_intr_cfg = NULL;
909 mbp->mb_intrs = &mp_intrs[0]; 908 mbp->mb_intrs = &mp_intrs[0];
910 mbp->mb_data = 0; 909 mbp->mb_data = 0;
911 910
912 pic = intr_findpic(0); 911 pic = intr_findpic(0);
913 if (pic == NULL) 912 if (pic == NULL)

cvs diff -r1.51 -r1.52 src/sys/arch/x86/x86/mpbios.c (expand / switch to unified diff)

--- src/sys/arch/x86/x86/mpbios.c 2008/12/23 15:31:20 1.51
+++ src/sys/arch/x86/x86/mpbios.c 2009/01/14 19:31:25 1.52
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: mpbios.c,v 1.51 2008/12/23 15:31:20 cegger Exp $ */ 1/* $NetBSD: mpbios.c,v 1.52 2009/01/14 19:31:25 cegger Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2000 The NetBSD Foundation, Inc. 4 * Copyright (c) 2000 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by RedBack Networks Inc. 8 * by RedBack Networks Inc.
9 * 9 *
10 * Author: Bill Sommerfeld 10 * Author: Bill Sommerfeld
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions 13 * modification, are permitted provided that the following conditions
14 * are met: 14 * are met:
@@ -86,27 +86,27 @@ @@ -86,27 +86,27 @@
86 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 86 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
87 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 87 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
88 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 88 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
89 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 89 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
90 * SUCH DAMAGE. 90 * SUCH DAMAGE.
91 */ 91 */
92 92
93/* 93/*
94 * The Intel MP-stuff is just one way of x86 SMP systems 94 * The Intel MP-stuff is just one way of x86 SMP systems
95 * so only Intel MP specific stuff is here. 95 * so only Intel MP specific stuff is here.
96 */ 96 */
97 97
98#include <sys/cdefs.h> 98#include <sys/cdefs.h>
99__KERNEL_RCSID(0, "$NetBSD: mpbios.c,v 1.51 2008/12/23 15:31:20 cegger Exp $"); 99__KERNEL_RCSID(0, "$NetBSD: mpbios.c,v 1.52 2009/01/14 19:31:25 cegger Exp $");
100 100
101#include "acpi.h" 101#include "acpi.h"
102#include "lapic.h" 102#include "lapic.h"
103#include "ioapic.h" 103#include "ioapic.h"
104#include "opt_acpi.h" 104#include "opt_acpi.h"
105#include "opt_mpbios.h" 105#include "opt_mpbios.h"
106 106
107#include <sys/param.h> 107#include <sys/param.h>
108#include <sys/systm.h> 108#include <sys/systm.h>
109#include <sys/kernel.h> 109#include <sys/kernel.h>
110#include <sys/device.h> 110#include <sys/device.h>
111#include <sys/kmem.h> 111#include <sys/kmem.h>
112#include <sys/bus.h> 112#include <sys/bus.h>
@@ -606,29 +606,31 @@ mpbios_scan(device_t self, int *ncpup) @@ -606,29 +606,31 @@ mpbios_scan(device_t self, int *ncpup)
606 if (type == MPS_MCT_IOINT) { 606 if (type == MPS_MCT_IOINT) {
607 iep = (const struct mpbios_int *)position; 607 iep = (const struct mpbios_int *)position;
608 if (iep->dst_apic_id == MPS_ALL_APICS) 608 if (iep->dst_apic_id == MPS_ALL_APICS)
609 intr_cnt += 609 intr_cnt +=
610 mp_conf[MPS_MCT_IOAPIC].count; 610 mp_conf[MPS_MCT_IOAPIC].count;
611 else 611 else
612 intr_cnt++; 612 intr_cnt++;
613 } else if (type == MPS_MCT_LINT) 613 } else if (type == MPS_MCT_LINT)
614 intr_cnt++; 614 intr_cnt++;
615 position += mp_conf[type].length; 615 position += mp_conf[type].length;
616 } 616 }
617 617
618 mp_busses = kmem_zalloc(sizeof(struct mp_bus)*mp_nbus, 618 mp_busses = kmem_zalloc(sizeof(struct mp_bus)*mp_nbus,
619 KM_NOSLEEP); 619 KM_SLEEP);
 620 KASSERT(mp_busses != NULL);
620 mp_intrs = kmem_zalloc(sizeof(struct mp_intr_map)*intr_cnt, 621 mp_intrs = kmem_zalloc(sizeof(struct mp_intr_map)*intr_cnt,
621 KM_NOSLEEP); 622 KM_SLEEP);
 623 KASSERT(mp_intrs != NULL);
622 mp_nintr = intr_cnt; 624 mp_nintr = intr_cnt;
623 625
624 /* re-walk the table, recording info of interest */ 626 /* re-walk the table, recording info of interest */
625 position = (const uint8_t *) mp_cth + sizeof(*mp_cth); 627 position = (const uint8_t *) mp_cth + sizeof(*mp_cth);
626 count = mp_cth->entry_count; 628 count = mp_cth->entry_count;
627 cur_intr = 0; 629 cur_intr = 0;
628 630
629 while ((count--) && (position < end)) { 631 while ((count--) && (position < end)) {
630 switch (type = *position) { 632 switch (type = *position) {
631 case MPS_MCT_CPU: 633 case MPS_MCT_CPU:
632#if NACPI > 0 634#if NACPI > 0
633 /* ACPI has done this for us */ 635 /* ACPI has done this for us */
634 if (mpacpi_ncpu) 636 if (mpacpi_ncpu)