From owner-freebsd-current@FreeBSD.ORG Wed Apr 2 05:10:46 2003 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 426F537B41C; Wed, 2 Apr 2003 05:10:45 -0800 (PST) Received: from diomedes.noc.ntua.gr (diomedes.noc.ntua.gr [147.102.222.220]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6C24D43FD7; Wed, 2 Apr 2003 05:10:43 -0800 (PST) (envelope-from past@noc.ntua.gr) Received: from ajax.noc.ntua.gr (ajax.noc.ntua.gr [147.102.220.1]) by diomedes.noc.ntua.gr (8.11.6p2/8.11.6) with ESMTP id h32DAdd67605; Wed, 2 Apr 2003 16:10:39 +0300 (EEST) Received: from noc.ntua.gr (hal.noc.ntua.gr [147.102.220.45]) by ajax.noc.ntua.gr (8.12.6p2/8.12.6) with ESMTP id h32DAc4v031485; Wed, 2 Apr 2003 16:10:38 +0300 (EEST) (envelope-from past@noc.ntua.gr) Message-ID: <3E8AE14E.8070408@noc.ntua.gr> Date: Wed, 02 Apr 2003 16:10:38 +0300 From: Panagiotis Astithas Organization: NTUA/NMC User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2.1) Gecko/20021130 X-Accept-Language: en-us, en, el MIME-Version: 1.0 To: current@freebsd.org X-Enigmail-Version: 0.71.0.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: multipart/mixed; boundary="------------040201080802090209020500" cc: Sam Leffler Subject: [PATCH] ubsec driver update for Sun Crypto Accelerator 1000 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Apr 2003 13:10:47 -0000 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--