p64h2apic.c revision 1.9
11.9Sthorpej/* $NetBSD: p64h2apic.c,v 1.9 2006/02/19 14:59:23 thorpej 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.9Sthorpej__KERNEL_RCSID(0, "$NetBSD: p64h2apic.c,v 1.9 2006/02/19 14:59:23 thorpej 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.7Sperrystatic int p64h2match(struct device *, struct cfdata *, void *); 601.7Sperrystatic void p64h2attach(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.7Sperryint p64h2print(void *, const char *pnp); 711.2Sfvdl 721.2Sfvdl 731.2Sfvdlstatic int 741.7Sperryp64h2match(struct device *parent, struct cfdata *match, void *aux) 751.2Sfvdl{ 761.2Sfvdl struct pci_attach_args *pa = aux; 771.2Sfvdl 781.2Sfvdl if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_INTEL && 791.2Sfvdl PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_INTEL_82870P2_IOxAPIC) 801.2Sfvdl return (1); 811.2Sfvdl 821.2Sfvdl return (0); 831.2Sfvdl} 841.2Sfvdl 851.2Sfvdlstatic void 861.7Sperryp64h2attach(struct device *parent, struct device *self, void *aux) 871.2Sfvdl{ 881.2Sfvdl struct p64h2apic_softc *sc = (void *) self; 891.2Sfvdl struct pci_attach_args *pa = aux; 901.2Sfvdl char devinfo[256]; 911.2Sfvdl 921.9Sthorpej aprint_naive("\n"); 931.9Sthorpej aprint_normal("\n"); 941.9Sthorpej 951.6Sitojun pci_devinfo(pa->pa_id, pa->pa_class, 0, devinfo, sizeof(devinfo)); 961.9Sthorpej aprint_normal("%s: %s (rev. 0x%02x)\n", sc->sc_dev.dv_xname, devinfo, 971.9Sthorpej PCI_REVISION(pa->pa_class)); 981.2Sfvdl 991.2Sfvdl sc->sc_tag = pa->pa_tag; 1001.2Sfvdl} 101