11.11Sdyoung/*	$NetBSD: pchb.c,v 1.11 2011/07/01 20:37:08 dyoung 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.6Slukem
281.6Slukem#include <sys/cdefs.h>
291.11Sdyoung__KERNEL_RCSID(0, "$NetBSD: pchb.c,v 1.11 2011/07/01 20:37:08 dyoung 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.1Ssoren
361.11Sdyoung#include <sys/bus.h>
371.1Ssoren
381.1Ssoren#include <dev/pci/pcivar.h>
391.1Ssoren#include <dev/pci/pcireg.h>
401.1Ssoren
411.1Ssoren#include <dev/pci/pcidevs.h>
421.1Ssoren
431.10Stsutsuistatic int	pchb_match(device_t, cfdata_t, void *);
441.10Stsutsuistatic void	pchb_attach(device_t, device_t, void *);
451.1Ssoren
461.10StsutsuiCFATTACH_DECL_NEW(pchb, 0,
471.5Sthorpej    pchb_match, pchb_attach, NULL, NULL);
481.1Ssoren
491.1Ssorenstatic int
501.10Stsutsuipchb_match(device_t parent, cfdata_t cf, void *aux)
511.1Ssoren{
521.1Ssoren	struct pci_attach_args *pa = aux;
531.1Ssoren
541.9Sriz	if ((PCI_VENDOR(pa->pa_id) == PCI_VENDOR_MARVELL) &&
551.9Sriz	    (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_MARVELL_GT64011))
561.1Ssoren		return 1;
571.1Ssoren
581.1Ssoren	return 0;
591.1Ssoren}
601.1Ssoren
611.1Ssorenstatic void
621.10Stsutsuipchb_attach(device_t parent, device_t self, void *aux)
631.1Ssoren{
641.1Ssoren	struct pci_attach_args *pa = aux;
651.3Ssoren	int major, minor;
661.1Ssoren
671.3Ssoren	major = PCI_REVISION(pa->pa_class) >> 4;
681.3Ssoren	minor = PCI_REVISION(pa->pa_class) & 0x0f;
691.3Ssoren
701.3Ssoren	if (major == 0)
711.10Stsutsui		aprint_normal(": Galileo GT-64011 System Controller, rev %d\n",
721.10Stsutsui		    minor);
731.3Ssoren	else
741.10Stsutsui		aprint_normal(": Galileo GT-64111 System Controller, rev %d\n",
751.10Stsutsui		    minor);
761.1Ssoren}
77