Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 02 Apr 2003 16:10:38 +0300
From:      Panagiotis Astithas <past@noc.ntua.gr>
To:        current@freebsd.org
Cc:        Sam Leffler <sam@errno.com>
Subject:   [PATCH] ubsec driver update for Sun Crypto Accelerator 1000
Message-ID:  <3E8AE14E.8070408@noc.ntua.gr>

next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------040201080802090209020500
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

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@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@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

--------------040201080802090209020500
Content-Type: text/plain;
 name="ubsec.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="ubsec.patch"

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
@@ -194,6 +194,10 @@
 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))
@@ -232,6 +236,11 @@
 		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";
 }
@@ -284,6 +293,15 @@
 	    (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
@@ -46,6 +46,10 @@
 
 #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 */

--------------040201080802090209020500--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3E8AE14E.8070408>