Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/i386/i386 Moved to sys/arch/x86/x86



details:   https://anonhg.NetBSD.org/src/rev/e2cde65b10f0
branches:  trunk
changeset: 547030:e2cde65b10f0
user:      fvdl <fvdl%NetBSD.org@localhost>
date:      Sun May 11 18:23:17 2003 +0000

description:
Moved to sys/arch/x86/x86

diffstat:

 sys/arch/i386/i386/mpacpi.c |  779 --------------------------------------------
 1 files changed, 0 insertions(+), 779 deletions(-)

diffs (truncated from 783 to 300 lines):

diff -r 5dfe44041e98 -r e2cde65b10f0 sys/arch/i386/i386/mpacpi.c
--- a/sys/arch/i386/i386/mpacpi.c       Sun May 11 18:21:16 2003 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,779 +0,0 @@
-/*     $NetBSD: mpacpi.c,v 1.7 2003/05/11 00:08:16 fvdl Exp $  */
-
-/*
- * Copyright (c) 2003 Wasabi Systems, Inc.
- * All rights reserved.
- *
- * Written by Frank van der Linden for Wasabi Systems, Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *      This product includes software developed for the NetBSD Project by
- *      Wasabi Systems, Inc.
- * 4. The name of Wasabi Systems, Inc. may not be used to endorse
- *    or promote products derived from this software without specific prior
- *    written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL WASABI SYSTEMS, INC
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "opt_acpi.h"
-#include "opt_mpbios.h"
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/device.h>
-#include <sys/malloc.h>
-#include <sys/queue.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <machine/specialreg.h>
-#include <machine/cputypes.h>
-#include <machine/cpuvar.h>
-#include <machine/bus.h>
-#include <machine/mpacpi.h>
-#include <machine/mpbiosvar.h>
-
-#include <machine/i82093reg.h>
-#include <machine/i82093var.h>
-#include <machine/i82489reg.h>
-#include <machine/i82489var.h>
-#include <dev/isa/isareg.h>
-#include <dev/pci/pcivar.h>
-#include <dev/pci/ppbreg.h>
-
-
-#include <dev/acpi/acpivar.h>
-#include <dev/acpi/acpi_madt.h>
-/* XXX */
-#include <dev/acpi/acpica/Subsystem/actables.h>
-#include <dev/acpi/acpica/Subsystem/acnamesp.h>
-
-#include "pci.h"
-
-#if NPCI > 0
-struct mpacpi_pcibus {
-       TAILQ_ENTRY(mpacpi_pcibus) mpr_list;
-       ACPI_NAMESPACE_NODE *mpr_node;
-       ACPI_HANDLE *mpr_handle;                /* Same thing really, but.. */
-       int mpr_bus;
-       int mpr_level;
-       struct mpacpi_pcibus *mpr_parent;
-};
-
-TAILQ_HEAD(, mpacpi_pcibus) mpacpi_pcibusses;
-
-#endif
-
-int mpacpi_print(void *, const char *);
-int mpacpi_match(struct device *, struct cfdata *, void *);
-
-/*
- * acpi_madt_walk callbacks
- */
-static ACPI_STATUS mpacpi_count(APIC_HEADER *, void *);
-static ACPI_STATUS mpacpi_config_cpu(APIC_HEADER *, void *);
-static ACPI_STATUS mpacpi_config_ioapic(APIC_HEADER *, void *);
-static ACPI_STATUS mpacpi_nonpci_intr(APIC_HEADER *, void *);
-
-#if NPCI > 0
-/*
- * Callbacks for the device namespace walk.
- */
-static ACPI_STATUS mpacpi_pcibus_cb(ACPI_HANDLE, UINT32, void *, void **);
-static int mpacpi_pcircount(struct mpacpi_pcibus *);
-static int mpacpi_pciroute(struct mpacpi_pcibus *);
-static void mpacpi_pcihier(struct acpi_softc *, struct mpacpi_pcibus *);
-static struct mpacpi_pcibus *mpacpi_find_pcibus(ACPI_NAMESPACE_NODE *);
-static int mpacpi_find_pcibusses(struct acpi_softc *);
-
-static void mpacpi_print_pci_intr(int);
-#endif
-
-static void mpacpi_config_irouting(struct acpi_softc *);
-
-static void mpacpi_print_intr(struct mp_intr_map *);
-static void mpacpi_print_isa_intr(int);
-
-int mpacpi_nioapic;
-int mpacpi_ncpu;
-int mpacpi_nintsrc;
-
-#if NPCI > 0
-int mpacpi_npci;
-int mpacpi_maxpci;
-static int mpacpi_maxbuslevel;
-static int mpacpi_npciroots;
-#endif
-
-static int mpacpi_intr_index;
-static paddr_t mpacpi_lapic_base = LAPIC_BASE;
-
-int
-mpacpi_print(void *aux, const char *pnp)
-{
-       struct cpu_attach_args * caa = (struct cpu_attach_args *) aux;
-       if (pnp)
-               printf("%s at %s:",caa->caa_name, pnp);
-       return (UNCONF);
-}
-
-int
-mpacpi_match(struct device *parent, struct cfdata *cf, void *aux)
-{
-       struct cpu_attach_args * caa = (struct cpu_attach_args *) aux;
-       if (strcmp(caa->caa_name, cf->cf_name))
-               return 0;
-
-       return (config_match(parent, cf, aux));
-}
-
-/*
- * Handle special interrupt sources and overrides from the MADT.
- * This is a callback function for acpi_madt_walk().
- */
-static ACPI_STATUS
-mpacpi_nonpci_intr(APIC_HEADER *hdrp, void *aux)
-{
-       int *index = aux, pin, lindex;
-       struct mp_intr_map *mpi;
-       INT_IOAPIC_SOURCE_NMI *ioapic_nmi;
-       INT_LAPIC_SOURCE_NMI *lapic_nmi;
-       INT_SOURCE_OVERRIDE *isa_ovr;
-       struct ioapic_softc *ioapic;
-
-       switch (hdrp->Type) {
-       case APIC_INTSRC_NMI:
-               ioapic_nmi = (INT_IOAPIC_SOURCE_NMI *)hdrp;
-               ioapic = ioapic_find_bybase(ioapic_nmi->GlobalInt);
-               if (ioapic == NULL)
-                       break;
-               mpi = &mp_intrs[*index];
-               (*index)++;
-               mpi->next = NULL;
-               mpi->bus = NULL;
-               mpi->type = MPS_INTTYPE_NMI;
-               mpi->ioapic = ioapic;
-               pin = ioapic_nmi->GlobalInt - ioapic->sc_apic_vecbase;
-               mpi->ioapic_pin = pin;
-               mpi->bus_pin = -1;
-               mpi->redir = (IOAPIC_REDLO_DEL_NMI<<IOAPIC_REDLO_DEL_SHIFT);
-               ioapic->sc_pins[pin].ip_map = mpi;
-               mpi->ioapic_ih = APIC_INT_VIA_APIC |
-                   (ioapic->sc_apicid << APIC_INT_APIC_SHIFT) |
-                   (pin << APIC_INT_PIN_SHIFT); 
-               mpi->flags = ioapic_nmi->Polarity | (ioapic_nmi->Trigger << 2);
-               mpi->global_int = ioapic_nmi->GlobalInt;
-               break;
-       case APIC_LAPIC_NMI:
-               lapic_nmi = (INT_LAPIC_SOURCE_NMI *)hdrp;
-               mpi = &mp_intrs[*index];
-               (*index)++;
-               mpi->next = NULL;
-               mpi->bus = NULL;
-               mpi->ioapic = NULL;
-               mpi->type = MPS_INTTYPE_NMI;
-               mpi->ioapic_pin = lapic_nmi->Lint;
-               mpi->cpu_id = lapic_nmi->ApicId;
-               mpi->redir = (IOAPIC_REDLO_DEL_NMI<<IOAPIC_REDLO_DEL_SHIFT);
-               mpi->global_int = -1;
-               break;
-       case APIC_INTSRC_OVR:
-               isa_ovr = (INT_SOURCE_OVERRIDE *)hdrp;
-               if (isa_ovr->Source > 15 || isa_ovr->Source == 2)
-                       break;
-               ioapic = ioapic_find_bybase(isa_ovr->GlobalInt);
-               if (ioapic == NULL)
-                       break;
-               pin = isa_ovr->GlobalInt - ioapic->sc_apic_vecbase;
-               lindex = isa_ovr->Source;
-               /*
-                * IRQ 2 was skipped in the default setup.
-                */
-               if (lindex > 2)
-                       lindex--;
-               mpi = &mp_intrs[lindex];
-               mpi->ioapic_ih = APIC_INT_VIA_APIC |
-                   (ioapic->sc_apicid << APIC_INT_APIC_SHIFT) |
-                   (pin << APIC_INT_PIN_SHIFT);
-               mpi->bus_pin = isa_ovr->Source;
-               mpi->ioapic_pin = pin;
-               mpi->redir = 0;
-               switch (isa_ovr->Polarity) {
-               case MPS_INTPO_ACTHI:
-                       mpi->redir &= ~IOAPIC_REDLO_ACTLO;
-                       break;
-               case MPS_INTPO_DEF:
-               case MPS_INTPO_ACTLO:
-                       mpi->redir |= IOAPIC_REDLO_ACTLO;
-                       break;
-               }
-               mpi->redir |= (IOAPIC_REDLO_DEL_LOPRI<<IOAPIC_REDLO_DEL_SHIFT);
-               switch (isa_ovr->Trigger) {
-               case MPS_INTTR_DEF:
-               case MPS_INTTR_LEVEL:
-                       mpi->redir |= IOAPIC_REDLO_LEVEL;
-                       break;
-               case MPS_INTTR_EDGE:
-                       mpi->redir &= ~IOAPIC_REDLO_LEVEL;
-                       break;
-               }
-               mpi->flags = isa_ovr->Polarity | (isa_ovr->Trigger << 2);
-               ioapic->sc_pins[pin].ip_map = mpi;
-       default:
-               break;
-       }
-       return AE_OK;
-}
-
-/*
- * Count various MP resources present in the MADT.
- * This is a callback function for acpi_madt_walk().
- */
-static ACPI_STATUS
-mpacpi_count(APIC_HEADER *hdrp, void *aux)
-{
-       LAPIC_ADDR_OVR *lop;
-
-       switch (hdrp->Type) {
-       case APIC_PROC:
-               mpacpi_ncpu++;
-               break;
-       case APIC_IO:
-               mpacpi_nioapic++;
-               break;
-       case APIC_INTSRC_NMI:
-       case APIC_LAPIC_NMI:
-               mpacpi_nintsrc++;
-               break;
-       case APIC_ADDR_OVR:
-               lop = (LAPIC_ADDR_OVR *)hdrp;
-               mpacpi_lapic_base = lop->LocalApicAddress;
-       default:
-               break;
-       }
-       return AE_OK;
-}
-
-static ACPI_STATUS
-mpacpi_config_cpu(APIC_HEADER *hdrp, void *aux)
-{
-       struct device *parent = aux;
-       PROCESSOR_APIC *p;
-       struct cpu_attach_args caa;
-
-       if (hdrp->Type == APIC_PROC) {
-               p = (PROCESSOR_APIC *)hdrp;
-               if (p->ProcessorEnabled) {
-                       /*
-                        * Assume ACPI Id 0 == BSP.
-                        * XXX check if that's correct.
-                        * XXX field name in structure is wrong.
-                        */
-                       if (p->ProcessorApicId == 0)
-                               caa.cpu_role = CPU_ROLE_BP;
-                       else
-                               caa.cpu_role = CPU_ROLE_AP;



Home | Main Index | Thread Index | Old Index