[PATCH] ubsec driver update for Sun Crypto Accelerator 1000

From: Panagiotis Astithas <past_at_noc.ntua.gr>
Date: Wed, 02 Apr 2003 16:10:38 +0300
Hi,
I have made a few modifications to the ubsec driver, in order to 
recognize and configure the Sun Crypto Accelerator 1000 PCI card. The 
card uses a Broadcom 5821 chip, so the modifications were minimal, but I 
still don't get very verbose info using "pciconf -lv":

ubsec0_at_pci0:18:0:       class=0x100000 card=0x5455108e chip=0x5454108e 
rev=0x01 hdr=0x00
     vendor   = 'Sun Microsystems'

You can see that the card number and the chip number are slightly 
different, but not in any way similar to the other cards in my machine, 
so I can't figure out what to do. I also don't know how to parse the 
class number. dmesg output shows:

ubsec0 mem 0xe2000000-0xe200ffff irq 12 at device 18.0 on pci0
ubsec0: Sun 5821

and the machine functions OK. The system is:

FreeBSD devil.test.noc.ntua.gr 5.0-CURRENT FreeBSD 5.0-CURRENT #3: Wed 
Apr  2 10:24:39 GMT 2003 
root_at_devil.test.noc.ntua.gr:/usr/obj/usr/src/sys/DEVIL  i386

and the affected file version are:

ubsec/ubsec.c:
      $FreeBSD: src/sys/dev/ubsec/ubsec.c,v 1.20 2003/03/18 08:45:22 phk 
Exp $
      $OpenBSD: ubsec.c,v 1.115 2002/09/24 18:33:26 jason Exp $

ubsec/ubsecreg.h:
      $FreeBSD: src/sys/dev/ubsec/ubsecreg.h,v 1.4 2003/02/27 21:10:20 
sam Exp $
      $OpenBSD: ubsecreg.h,v 1.27 2002/09/11 22:40:31 jason Exp $

Comments are welcome.
Cheers,
-- 
Panagiotis Astithas
Electrical & Computer Engineer, PhD
Network Management Center
National Technical University of Athens, Greece

diff -wu ubsec/ubsec.c /sys/dev/ubsec/ubsec.c
--- ubsec/ubsec.c	Tue Apr  1 15:53:55 2003
+++ /sys/dev/ubsec/ubsec.c	Wed Apr  2 09:24:36 2003
_at__at_ -194,6 +194,10 _at__at_
 static int
 ubsec_probe(device_t dev)
 {
+	if (pci_get_vendor(dev) == PCI_VENDOR_SUN &&
+	    pci_get_device(dev) == PCI_PRODUCT_SUN_5821
+	    )
+		return (0);
 	if (pci_get_vendor(dev) == PCI_VENDOR_BLUESTEEL &&
 	    (pci_get_device(dev) == PCI_PRODUCT_BLUESTEEL_5501 ||
 	     pci_get_device(dev) == PCI_PRODUCT_BLUESTEEL_5601))
_at__at_ -232,6 +236,11 _at__at_
 		case PCI_PRODUCT_BLUESTEEL_5601: return "Bluesteel 5601";
 		}
 		return "Bluesteel unknown-part";
+	case PCI_VENDOR_SUN:
+		switch (pci_get_device(sc->sc_dev)) {
+		case PCI_PRODUCT_SUN_5821: return "Sun 5821";
+		}
+		return "Sun unknown-part";
 	}
 	return "Unknown-vendor unknown-part";
 }
_at__at_ -284,6 +293,15 _at__at_
 	    (pci_get_device(dev) == PCI_PRODUCT_BROADCOM_5821 ||
 	     pci_get_device(dev) == PCI_PRODUCT_BROADCOM_5822 ||
 	     pci_get_device(dev) == PCI_PRODUCT_BROADCOM_5823 )) {
+		/* NB: the 5821/5822 defines some additional status bits */
+		sc->sc_statmask |= BS_STAT_MCR1_ALLEMPTY |
+		    BS_STAT_MCR2_ALLEMPTY;
+		sc->sc_flags |= UBS_FLAGS_KEY | UBS_FLAGS_RNG |
+		    UBS_FLAGS_LONGCTX | UBS_FLAGS_HWNORM | UBS_FLAGS_BIGKEY;
+	}
+ 
+	if (pci_get_vendor(dev) == PCI_VENDOR_SUN &&
+	    pci_get_device(dev) == PCI_PRODUCT_SUN_5821) {
 		/* NB: the 5821/5822 defines some additional status bits */
 		sc->sc_statmask |= BS_STAT_MCR1_ALLEMPTY |
 		    BS_STAT_MCR2_ALLEMPTY;
diff -wu ubsec/ubsecreg.h /sys/dev/ubsec/ubsecreg.h
--- ubsec/ubsecreg.h	Tue Apr  1 15:18:21 2003
+++ /sys/dev/ubsec/ubsecreg.h	Wed Apr  2 09:24:45 2003
_at__at_ -46,6 +46,10 _at__at_
 
 #define	PCI_VENDOR_BROADCOM	0x14e4		/* Broadcom */
 #define	PCI_VENDOR_BLUESTEEL	0x15ab		/* Bluesteel Networks */
+#define	PCI_VENDOR_SUN		0x108e		/* Sun Microsystems */
+
+/* Sun Microsystems */
+#define PCI_PRODUCT_SUN_5821		0x5454		/* BCM5821 */
 
 /* Bluesteel Networks */
 #define	PCI_PRODUCT_BLUESTEEL_5501	0x0000		/* 5501 */
Received on Wed Apr 02 2003 - 03:10:46 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:02 UTC