pcib.c revision 1.19
11.19Stsutsui/* $NetBSD: pcib.c,v 1.19 2008/05/09 10:59:55 tsutsui Exp $ */ 21.1Ssoren 31.1Ssoren/* 41.1Ssoren * Copyright (c) 2000 Soren S. Jorvang. All rights reserved. 51.1Ssoren * 61.1Ssoren * Redistribution and use in source and binary forms, with or without 71.1Ssoren * modification, are permitted provided that the following conditions 81.1Ssoren * are met: 91.1Ssoren * 1. Redistributions of source code must retain the above copyright 101.1Ssoren * notice, this list of conditions, and the following disclaimer. 111.1Ssoren * 2. Redistributions in binary form must reproduce the above copyright 121.1Ssoren * notice, this list of conditions and the following disclaimer in the 131.1Ssoren * documentation and/or other materials provided with the distribution. 141.1Ssoren * 151.1Ssoren * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 161.1Ssoren * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 171.1Ssoren * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 181.1Ssoren * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 191.1Ssoren * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 201.1Ssoren * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 211.1Ssoren * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 221.1Ssoren * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 231.1Ssoren * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 241.1Ssoren * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 251.1Ssoren * SUCH DAMAGE. 261.1Ssoren */ 271.7Slukem 281.7Slukem#include <sys/cdefs.h> 291.19Stsutsui__KERNEL_RCSID(0, "$NetBSD: pcib.c,v 1.19 2008/05/09 10:59:55 tsutsui Exp $"); 301.1Ssoren 311.1Ssoren#include <sys/types.h> 321.1Ssoren#include <sys/param.h> 331.1Ssoren#include <sys/systm.h> 341.1Ssoren#include <sys/device.h> 351.2Ssoren#include <sys/malloc.h> 361.1Ssoren 371.2Ssoren#include <machine/cpu.h> 381.1Ssoren#include <machine/bus.h> 391.8Stsutsui#include <machine/autoconf.h> 401.1Ssoren 411.1Ssoren#include <dev/pci/pcivar.h> 421.1Ssoren#include <dev/pci/pcireg.h> 431.2Ssoren#include <dev/pci/pcidevs.h> 441.1Ssoren 451.19Stsutsuistatic int pcib_match(device_t, cfdata_t, void *); 461.19Stsutsuistatic void pcib_attach(device_t, device_t, void *); 471.1Ssoren 481.19StsutsuiCFATTACH_DECL_NEW(pcib, 0, 491.6Sthorpej pcib_match, pcib_attach, NULL, NULL); 501.1Ssoren 511.1Ssorenstatic int 521.19Stsutsuipcib_match(device_t parent, cfdata_t cf, void *aux) 531.1Ssoren{ 541.1Ssoren struct pci_attach_args *pa = aux; 551.1Ssoren 561.1Ssoren if ((PCI_VENDOR(pa->pa_id) == PCI_VENDOR_VIATECH) && 571.1Ssoren (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_VIATECH_VT82C586_ISA)) 581.1Ssoren return 1; 591.1Ssoren 601.1Ssoren return 0; 611.1Ssoren} 621.1Ssoren 631.1Ssorenstatic void 641.19Stsutsuipcib_attach(device_t parent, device_t self, void *aux) 651.1Ssoren{ 661.1Ssoren struct pci_attach_args *pa = aux; 671.1Ssoren char devinfo[256]; 681.1Ssoren 691.19Stsutsui aprint_normal("\n"); 701.10Sitojun pci_devinfo(pa->pa_id, pa->pa_class, 0, devinfo, sizeof(devinfo)); 711.19Stsutsui aprint_normal_dev(self, "%s, rev %d\n", devinfo, 721.12Stsutsui PCI_REVISION(pa->pa_class)); 731.2Ssoren 741.1Ssoren} 75