LCOV - code coverage report
Current view: top level - arch/amd64/pci - pcib.c (source / functions) Hit Total Coverage
Test: 6.4 Lines: 0 31 0.0 %
Date: 2018-10-19 03:25:38 Functions: 0 4 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*      $OpenBSD: pcib.c,v 1.6 2013/05/30 16:15:01 deraadt Exp $        */
       2             : /*      $NetBSD: pcib.c,v 1.6 1997/06/06 23:29:16 thorpej Exp $ */
       3             : 
       4             : /*-
       5             :  * Copyright (c) 1996 The NetBSD Foundation, Inc.
       6             :  * All rights reserved.
       7             :  *
       8             :  * This code is derived from software contributed to The NetBSD Foundation
       9             :  * by Jason R. Thorpe.
      10             :  *
      11             :  * Redistribution and use in source and binary forms, with or without
      12             :  * modification, are permitted provided that the following conditions
      13             :  * are met:
      14             :  * 1. Redistributions of source code must retain the above copyright
      15             :  *    notice, this list of conditions and the following disclaimer.
      16             :  * 2. Redistributions in binary form must reproduce the above copyright
      17             :  *    notice, this list of conditions and the following disclaimer in the
      18             :  *    documentation and/or other materials provided with the distribution.
      19             :  *
      20             :  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
      21             :  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
      22             :  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
      23             :  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
      24             :  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
      25             :  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
      26             :  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
      27             :  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
      28             :  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
      29             :  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
      30             :  * POSSIBILITY OF SUCH DAMAGE.
      31             :  */
      32             : 
      33             : #include <sys/param.h>
      34             : #include <sys/systm.h>
      35             : #include <sys/device.h>
      36             : 
      37             : #include <machine/bus.h>
      38             : #include <dev/isa/isavar.h>
      39             : 
      40             : #include <dev/pci/pcivar.h>
      41             : #include <dev/pci/pcireg.h>
      42             : 
      43             : #include <dev/pci/pcidevs.h>
      44             : 
      45             : #include "isa.h"
      46             : 
      47             : int     pcibmatch(struct device *, void *, void *);
      48             : void    pcibattach(struct device *, struct device *, void *);
      49             : void    pcib_callback(struct device *);
      50             : int     pcib_print(void *, const char *);
      51             : 
      52             : struct cfattach pcib_ca = {
      53             :         sizeof(struct device), pcibmatch, pcibattach
      54             : };
      55             : 
      56             : struct cfdriver pcib_cd = {
      57             :         NULL, "pcib", DV_DULL
      58             : };
      59             : 
      60             : int
      61           0 : pcibmatch(struct device *parent, void *match, void *aux)
      62             : {
      63           0 :         struct pci_attach_args *pa = aux;
      64             : 
      65           0 :         switch (PCI_VENDOR(pa->pa_id)) {
      66             :         case PCI_VENDOR_INTEL:
      67           0 :                 switch (PCI_PRODUCT(pa->pa_id)) {
      68             :                 case PCI_PRODUCT_INTEL_SIO:
      69             :                 case PCI_PRODUCT_INTEL_82371MX:
      70             :                 case PCI_PRODUCT_INTEL_82371AB_ISA:
      71             :                 case PCI_PRODUCT_INTEL_82440MX_ISA:
      72             :                         /* The above bridges mis-identify themselves */
      73           0 :                         return (1);
      74             :                 }
      75             :                 break;
      76             :         case PCI_VENDOR_SIS:
      77           0 :                 switch (PCI_PRODUCT(pa->pa_id)) {
      78             :                 case PCI_PRODUCT_SIS_85C503:
      79             :                         /* mis-identifies itself as a miscellaneous prehistoric */
      80           0 :                         return (1);
      81             :                 }
      82             :                 break;
      83             :         case PCI_VENDOR_VIATECH:
      84           0 :                 switch (PCI_PRODUCT(pa->pa_id)) {
      85             :                 case PCI_PRODUCT_VIATECH_VT82C686A_SMB:
      86             :                         /* mis-identifies itself as a ISA bridge */
      87           0 :                         return (0);
      88             :                 }
      89             :                 break;
      90             :         }
      91             : 
      92           0 :         if (PCI_CLASS(pa->pa_class) == PCI_CLASS_BRIDGE &&
      93           0 :             PCI_SUBCLASS(pa->pa_class) == PCI_SUBCLASS_BRIDGE_ISA)
      94           0 :                 return (1);
      95             : 
      96           0 :         return (0);
      97           0 : }
      98             : 
      99             : void
     100           0 : pcibattach(struct device *parent, struct device *self, void *aux)
     101             : {
     102             :         /*
     103             :          * Cannot attach isa bus now; must postpone for various reasons
     104             :          */
     105           0 :         printf("\n");
     106             : 
     107           0 :         config_defer(self, pcib_callback);
     108           0 : }
     109             : 
     110             : void
     111           0 : pcib_callback(struct device *self)
     112             : {
     113           0 :         struct isabus_attach_args iba;
     114             : 
     115             :         /*
     116             :          * Attach the ISA bus behind this bridge.
     117             :          */
     118           0 :         memset(&iba, 0, sizeof(iba));
     119           0 :         iba.iba_busname = "isa";
     120           0 :         iba.iba_iot = X86_BUS_SPACE_IO;
     121           0 :         iba.iba_memt = X86_BUS_SPACE_MEM;
     122             : #if NISADMA > 0
     123           0 :         iba.iba_dmat = &isa_bus_dma_tag;
     124             : #endif
     125           0 :         config_found(self, &iba, pcib_print);
     126           0 : }
     127             : 
     128             : int
     129           0 : pcib_print(void *aux, const char *pnp)
     130             : {
     131             :         /* Only ISAs can attach to pcib's; easy. */
     132           0 :         if (pnp)
     133           0 :                 printf("isa at %s", pnp);
     134           0 :         return (UNCONF);
     135             : }

Generated by: LCOV version 1.13