Share Intel hardware random number generator support between amd64 and

i386 port. This will benefit EM64T systems using Intel i9xx chipsets.
This commit is contained in:
tron 2006-02-12 18:16:01 +00:00
parent 699ad05e6e
commit cbb0e8c88b
9 changed files with 35 additions and 86 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: files.amd64,v 1.20 2006/02/09 19:18:56 manu Exp $
# $NetBSD: files.amd64,v 1.21 2006/02/12 18:16:01 tron Exp $
#
# new style config file for amd64 architecture
#
@ -111,6 +111,7 @@ defparam PCI_CONF_MODE
device pchb: pcibus
attach pchb at pci
file arch/amd64/pci/pchb.c pchb
file arch/x86/pci/pchb_rnd.c pchb & rnd
# PCI-ISA bridges
device pcib: isabus

View File

@ -1,4 +1,4 @@
/* $NetBSD: pchb.c,v 1.5 2005/12/11 12:16:26 christos Exp $ */
/* $NetBSD: pchb.c,v 1.6 2006/02/12 18:16:01 tron Exp $ */
/*-
* Copyright (c) 1996, 1998, 2000 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pchb.c,v 1.5 2005/12/11 12:16:26 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: pchb.c,v 1.6 2006/02/12 18:16:01 tron Exp $");
#include <sys/types.h>
#include <sys/param.h>
@ -51,7 +51,7 @@ __KERNEL_RCSID(0, "$NetBSD: pchb.c,v 1.5 2005/12/11 12:16:26 christos Exp $");
#include <dev/pci/pcidevs.h>
#include <arch/i386/pci/pchbvar.h>
#include <arch/x86/pci/pchbvar.h>
#include "rnd.h"
@ -75,17 +75,14 @@ __KERNEL_RCSID(0, "$NetBSD: pchb.c,v 1.5 2005/12/11 12:16:26 christos Exp $");
#define I82424_BCTL_PCIMEM_BURSTEN 0x01
#define I82424_BCTL_PCI_BURSTEN 0x02
int pchbmatch __P((struct device *, struct cfdata *, void *));
void pchbattach __P((struct device *, struct device *, void *));
int pchbmatch(struct device *, struct cfdata *, void *);
void pchbattach(struct device *, struct device *, void *);
CFATTACH_DECL(pchb, sizeof(struct pchb_softc),
pchbmatch, pchbattach, NULL, NULL);
int
pchbmatch(parent, match, aux)
struct device *parent;
struct cfdata *match;
void *aux;
pchbmatch(struct device *parent, struct cfdata *match, void *aux)
{
struct pci_attach_args *pa = aux;
@ -98,10 +95,11 @@ pchbmatch(parent, match, aux)
}
void
pchbattach(parent, self, aux)
struct device *parent, *self;
void *aux;
pchbattach(struct device *parent, struct device *self, void *aux)
{
#if NRND > 0
struct pchb_softc *sc = (void *) self;
#endif
struct pci_attach_args *pa = aux;
char devinfo[256];
@ -121,4 +119,10 @@ pchbattach(parent, self, aux)
break;
}
#if NRND > 0
/*
* Attach a random number generator, if there is one.
*/
pchb_attach_rnd(sc, pa);
#endif
}

View File

@ -1,60 +0,0 @@
/* $NetBSD: pchbvar.h,v 1.1 2003/04/26 18:39:51 fvdl Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _I386_PCI_PCHBVAR_H_
#define _I386_PCI_PCHBVAR_H_
#include <sys/callout.h>
#include <sys/rnd.h>
struct pchb_softc {
struct device sc_dev;
bus_space_tag_t sc_st;
bus_space_handle_t sc_sh;
struct callout sc_rnd_ch;
rndsource_element_t sc_rnd_source;
int sc_rnd_i;
u_int32_t sc_rnd_ax;
};
void pchb_attach_rnd(struct pchb_softc *, struct pci_attach_args *);
#endif /* _I386_PCI_PCHBVAR_H_ */

View File

@ -1,4 +1,4 @@
# $NetBSD: files.i386,v 1.277 2006/02/03 11:08:23 jmmv Exp $
# $NetBSD: files.i386,v 1.278 2006/02/12 18:16:01 tron Exp $
#
# new style config file for i386 architecture
#
@ -188,7 +188,7 @@ device pchb: pcibus, agpbus, agp_ali, agp_amd, agp_i810, agp_intel, agp_sis,
agp_via
attach pchb at pci
file arch/i386/pci/pchb.c pchb needs-flag
file arch/i386/pci/pchb_rnd.c pchb & rnd
file arch/x86/pci/pchb_rnd.c pchb & rnd
# AMD Elan SC520 System Controller (PCI-Host bridge)
device elansc: sysmon_wdog, gpiobus

View File

@ -1,4 +1,4 @@
/* $NetBSD: pchb.c,v 1.57 2006/01/16 22:59:36 christos Exp $ */
/* $NetBSD: pchb.c,v 1.58 2006/02/12 18:16:01 tron Exp $ */
/*-
* Copyright (c) 1996, 1998, 2000 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pchb.c,v 1.57 2006/01/16 22:59:36 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: pchb.c,v 1.58 2006/02/12 18:16:01 tron Exp $");
#include <sys/types.h>
#include <sys/param.h>
@ -54,7 +54,7 @@ __KERNEL_RCSID(0, "$NetBSD: pchb.c,v 1.57 2006/01/16 22:59:36 christos Exp $");
#include <dev/pci/agpreg.h>
#include <dev/pci/agpvar.h>
#include <arch/i386/pci/pchbvar.h>
#include <arch/x86/pci/pchbvar.h>
#include "rnd.h"

View File

@ -1,4 +1,4 @@
/* $NetBSD: i82802reg.h,v 1.3 2005/12/11 12:17:43 christos Exp $ */
/* $NetBSD: i82802reg.h,v 1.1 2006/02/12 18:16:01 tron Exp $ */
/*
* Copyright (c) 2000 Michael Shalayeff

View File

@ -1,4 +1,4 @@
/* $NetBSD: pchb_rnd.c,v 1.18 2006/02/12 16:37:31 tron Exp $ */
/* $NetBSD: pchb_rnd.c,v 1.1 2006/02/12 18:16:01 tron Exp $ */
/*
* Copyright (c) 2000 Michael Shalayeff
@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pchb_rnd.c,v 1.18 2006/02/12 16:37:31 tron Exp $");
__KERNEL_RCSID(0, "$NetBSD: pchb_rnd.c,v 1.1 2006/02/12 18:16:01 tron Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -47,8 +47,8 @@ __KERNEL_RCSID(0, "$NetBSD: pchb_rnd.c,v 1.18 2006/02/12 16:37:31 tron Exp $");
#include <dev/pci/pcireg.h>
#include <dev/pci/pcidevs.h>
#include <arch/i386/pci/i82802reg.h>
#include <arch/i386/pci/pchbvar.h>
#include <arch/x86/pci/i82802reg.h>
#include <arch/x86/pci/pchbvar.h>
void pchb_rnd_callout(void *v);
@ -61,6 +61,8 @@ pchb_attach_rnd(struct pchb_softc *sc, struct pci_attach_args *pa)
switch (PCI_VENDOR(pa->pa_id)) {
case PCI_VENDOR_INTEL:
switch (PCI_PRODUCT(pa->pa_id)) {
#if defined(__i386__)
/* Old chipsets which only support IA32 CPUs. */
case PCI_PRODUCT_INTEL_82810E_MCH:
case PCI_PRODUCT_INTEL_82810_DC100_MCH:
case PCI_PRODUCT_INTEL_82810_MCH:
@ -75,6 +77,8 @@ pchb_attach_rnd(struct pchb_softc *sc, struct pci_attach_args *pa)
case PCI_PRODUCT_INTEL_82860_HB:
case PCI_PRODUCT_INTEL_82865_HB:
case PCI_PRODUCT_INTEL_82875P_HB:
#endif /* defined((__i386__) */
/* New chipsets which support EM64T CPUs. */
case PCI_PRODUCT_INTEL_82915G_HB:
case PCI_PRODUCT_INTEL_82915GM_HB:
case PCI_PRODUCT_INTEL_82925X_HB:

View File

@ -1,4 +1,4 @@
/* $NetBSD: pchbvar.h,v 1.2 2005/12/26 19:24:00 perry Exp $ */
/* $NetBSD: pchbvar.h,v 1.1 2006/02/12 18:16:01 tron Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.

View File

@ -1,4 +1,4 @@
# $NetBSD: files.xen,v 1.33 2006/01/15 22:09:51 bouyer Exp $
# $NetBSD: files.xen,v 1.34 2006/02/12 18:16:01 tron Exp $
# NetBSD: files.x86,v 1.10 2003/10/08 17:30:00 bouyer Exp
# NetBSD: files.i386,v 1.254 2004/03/25 23:32:10 jmc Exp
@ -180,7 +180,7 @@ device pchb: pcibus, agpbus, agp_ali, agp_amd, agp_i810, agp_intel, agp_sis,
agp_via
attach pchb at pci
file arch/i386/pci/pchb.c pchb needs-flag
file arch/i386/pci/pchb_rnd.c pchb & rnd
file arch/x86/pci/pchb_rnd.c pchb & rnd
# PCI-ISA bridges
device pcib: isabus