Path: blob/main/sys/powerpc/mpc85xx/pci_mpc85xx_pcib.c
39507 views
/*-1* Copyright 2015 Justin Hibbits2* All rights reserved.3*4* Redistribution and use in source and binary forms, with or without5* modification, are permitted provided that the following conditions6* are met:7* 1. Redistributions of source code must retain the above copyright8* notice, this list of conditions and the following disclaimer.9* 2. Redistributions in binary form must reproduce the above copyright10* notice, this list of conditions and the following disclaimer in the11* documentation and/or other materials provided with the distribution.12* 3. The name of the author may not be used to endorse or promote products13* derived from this software without specific prior written permission.14*15* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR16* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES17* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.18* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,19* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,20* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;21* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED22* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,23* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY24* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF25* SUCH DAMAGE.26*27* From: FreeBSD: src/sys/powerpc/mpc85xx/pci_ocp.c,v 1.9 2010/03/23 23:46:28 marcel28*/2930#include <sys/param.h>31#include <sys/systm.h>32#include <sys/ktr.h>33#include <sys/sockio.h>34#include <sys/mbuf.h>35#include <sys/malloc.h>36#include <sys/kernel.h>37#include <sys/module.h>38#include <sys/socket.h>39#include <sys/queue.h>40#include <sys/bus.h>41#include <sys/lock.h>42#include <sys/mutex.h>43#include <sys/rman.h>44#include <sys/endian.h>4546#include <vm/vm.h>47#include <vm/pmap.h>4849#include <dev/ofw/openfirm.h>50#include <dev/ofw/ofw_pci.h>51#include <dev/ofw/ofw_bus.h>52#include <dev/ofw/ofw_bus_subr.h>5354#include <dev/pci/pcivar.h>55#include <dev/pci/pcireg.h>56#include <dev/pci/pcib_private.h>5758#include <machine/intr_machdep.h>5960#include "pcib_if.h"6162DECLARE_CLASS(ofw_pcib_pci_driver);6364struct fsl_pcib_softc {65/*66* This is here so that we can use pci bridge methods, too - the67* generic routines only need the dev, secbus and subbus members68* filled.69*70* XXX: This should be extracted from ofw_pcib_pci.c, and shared in a71* header.72*/73struct pcib_softc ops_pcib_sc;74phandle_t ops_node;75struct ofw_bus_iinfo ops_iinfo;76};7778static int79fsl_pcib_rc_probe(device_t dev)80{8182if (pci_get_vendor(dev) != 0x1957)83return (ENXIO);84if (pci_get_progif(dev) != 0)85return (ENXIO);86if (pci_get_class(dev) != PCIC_PROCESSOR)87return (ENXIO);88if (pci_get_subclass(dev) != PCIS_PROCESSOR_POWERPC)89return (ENXIO);9091device_set_desc(dev, "MPC85xx Root Complex bridge");9293return (BUS_PROBE_DEFAULT);94}9596static device_method_t fsl_pcib_rc_methods[] = {97DEVMETHOD(device_probe, fsl_pcib_rc_probe),98DEVMETHOD_END99};100101DEFINE_CLASS_1(pcib, fsl_pcib_rc_driver, fsl_pcib_rc_methods,102sizeof(struct fsl_pcib_softc), ofw_pcib_pci_driver);103EARLY_DRIVER_MODULE(rcpcib, pci, fsl_pcib_rc_driver, 0, 0, BUS_PASS_BUS);104105106