p64h2apic.c revision 1.5
11.5Slukem/* $NetBSD: p64h2apic.c,v 1.5 2003/07/14 22:13:10 lukem Exp $ */ 21.4Sthorpej 31.4Sthorpej/*- 41.4Sthorpej * Copyright (c) 2002 The NetBSD Foundation, Inc. 51.4Sthorpej * All rights reserved. 61.4Sthorpej * 71.4Sthorpej * This code is derived from software contributed to The NetBSD Foundation 81.4Sthorpej * by Bill Sommerfeld. 91.4Sthorpej * 101.4Sthorpej * Redistribution and use in source and binary forms, with or without 111.4Sthorpej * modification, are permitted provided that the following conditions 121.4Sthorpej * are met: 131.4Sthorpej * 1. Redistributions of source code must retain the above copyright 141.4Sthorpej * notice, this list of conditions and the following disclaimer. 151.4Sthorpej * 2. Redistributions in binary form must reproduce the above copyright 161.4Sthorpej * notice, this list of conditions and the following disclaimer in the 171.4Sthorpej * documentation and/or other materials provided with the distribution. 181.4Sthorpej * 3. All advertising materials mentioning features or use of this software 191.4Sthorpej * must display the following acknowledgement: 201.4Sthorpej * This product includes software developed by the NetBSD 211.4Sthorpej * Foundation, Inc. and its contributors. 221.4Sthorpej * 4. Neither the name of The NetBSD Foundation nor the names of its 231.4Sthorpej * contributors may be used to endorse or promote products derived 241.4Sthorpej * from this software without specific prior written permission. 251.4Sthorpej * 261.4Sthorpej * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 271.4Sthorpej * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 281.4Sthorpej * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 291.4Sthorpej * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 301.4Sthorpej * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 311.4Sthorpej * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 321.4Sthorpej * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 331.4Sthorpej * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 341.4Sthorpej * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 351.4Sthorpej * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 361.4Sthorpej * POSSIBILITY OF SUCH DAMAGE. 371.4Sthorpej */ 381.4Sthorpej 391.2Sfvdl/* 401.2Sfvdl * Driver for P64H2 IOxAPIC 411.2Sfvdl * 421.2Sfvdl * This is an ioapic which appears in PCI space. 431.2Sfvdl * This driver currently does nothing useful but will eventually 441.2Sfvdl * thwak the ioapic into working correctly. 451.2Sfvdl */ 461.5Slukem 471.5Slukem#include <sys/cdefs.h> 481.5Slukem__KERNEL_RCSID(0, "$NetBSD: p64h2apic.c,v 1.5 2003/07/14 22:13:10 lukem Exp $"); 491.2Sfvdl 501.2Sfvdl#include <sys/param.h> 511.2Sfvdl#include <sys/systm.h> 521.2Sfvdl#include <sys/kernel.h> 531.2Sfvdl#include <sys/device.h> 541.2Sfvdl 551.2Sfvdl#include <dev/pci/pcireg.h> 561.2Sfvdl#include <dev/pci/pcivar.h> 571.2Sfvdl#include <dev/pci/pcidevs.h> 581.2Sfvdl 591.2Sfvdlstatic int p64h2match __P((struct device *, struct cfdata *, void *)); 601.2Sfvdlstatic void p64h2attach __P((struct device *, struct device *, void *)); 611.2Sfvdl 621.4Sthorpejstruct p64h2apic_softc { 631.4Sthorpej struct device sc_dev; 641.2Sfvdl pcitag_t sc_tag; 651.2Sfvdl}; 661.2Sfvdl 671.3SthorpejCFATTACH_DECL(p64h2apic, sizeof(struct p64h2apic_softc), 681.3Sthorpej p64h2match, p64h2attach, NULL, NULL); 691.2Sfvdl 701.2Sfvdlint p64h2print __P((void *, const char *pnp)); 711.2Sfvdl 721.2Sfvdl 731.2Sfvdlstatic int 741.2Sfvdlp64h2match(parent, match, aux) 751.2Sfvdl struct device *parent; 761.2Sfvdl struct cfdata *match; 771.2Sfvdl void *aux; 781.2Sfvdl{ 791.2Sfvdl struct pci_attach_args *pa = aux; 801.2Sfvdl 811.2Sfvdl if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_INTEL && 821.2Sfvdl PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_INTEL_82870P2_IOxAPIC) 831.2Sfvdl return (1); 841.2Sfvdl 851.2Sfvdl return (0); 861.2Sfvdl} 871.2Sfvdl 881.2Sfvdlstatic void 891.2Sfvdlp64h2attach(parent, self, aux) 901.2Sfvdl struct device *parent, *self; 911.2Sfvdl void *aux; 921.2Sfvdl{ 931.2Sfvdl struct p64h2apic_softc *sc = (void *) self; 941.2Sfvdl struct pci_attach_args *pa = aux; 951.2Sfvdl char devinfo[256]; 961.2Sfvdl 971.2Sfvdl pci_devinfo(pa->pa_id, pa->pa_class, 0, devinfo); 981.2Sfvdl printf(": %s (rev. 0x%02x)\n", devinfo, PCI_REVISION(pa->pa_class)); 991.2Sfvdl 1001.2Sfvdl sc->sc_tag = pa->pa_tag; 1011.2Sfvdl} 102