From owner-freebsd-sparc64@FreeBSD.ORG Sun Jun 27 03:40:35 2004 Return-Path: Delivered-To: freebsd-sparc64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9627A16A4CE for ; Sun, 27 Jun 2004 03:40:35 +0000 (GMT) Received: from smtp3.server.rpi.edu (smtp3.server.rpi.edu [128.113.2.3]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1217A43D41 for ; Sun, 27 Jun 2004 03:40:35 +0000 (GMT) (envelope-from drosih@rpi.edu) Received: from [128.113.24.47] (gilead.netel.rpi.edu [128.113.24.47]) by smtp3.server.rpi.edu (8.12.8/8.12.8) with ESMTP id i5R3eHib019845; Sat, 26 Jun 2004 23:40:18 -0400 Mime-Version: 1.0 X-Sender: drosih@mail.rpi.edu Message-Id: In-Reply-To: <20040626132738.GA10639@electra.cse.Buffalo.EDU> References: <40CFC0A0.1000604@mWare.ca> <20040616034055.GE26532@electra.cse.Buffalo.EDU> <40DD15A3.5090905@mWare.ca> <20040626132738.GA10639@electra.cse.Buffalo.EDU> Date: Sat, 26 Jun 2004 23:40:16 -0400 To: Ken Smith , Mykel From: Garance A Drosihn Content-Type: text/plain; charset="us-ascii" ; format="flowed" X-Scanned-By: CanIt (www . canit . ca) cc: freebsd-sparc64@freebsd.org Subject: Re: IT! WORKS! X-BeenThere: freebsd-sparc64@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting FreeBSD to the Sparc List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jun 2004 03:40:35 -0000 At 9:27 AM -0400 6/26/04, Ken Smith wrote: >On Sat, Jun 26, 2004 at 02:20:19AM -0400, Mykel wrote: >> Are you going to spin this soon? >> >> Myke >> >> Ken Smith wrote: >> >FYI - I'm going to do another snapshot. Scott reported there was >> >more fixed recently than just tagged transfers. > >Sorry, things got a little bit flakey during the binutils import >(which is to be expected during a project that big) and I got a bit >sidetracked with something else shortly after that. > >I'll get back to doing this now, should take about two days. If it is not too much extra work, it might be a good idea to include packages for 64-bTT ezm3 and 64-bTT cvsup. -- Garance Alistair Drosehn = gad@gilead.netel.rpi.edu Senior Systems Programmer or gad@freebsd.org Rensselaer Polytechnic Institute or drosih@rpi.edu From owner-freebsd-sparc64@FreeBSD.ORG Sun Jun 27 14:00:44 2004 Return-Path: Delivered-To: freebsd-sparc64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 24A2616A4DB for ; Sun, 27 Jun 2004 14:00:44 +0000 (GMT) Received: from ida.interface-business.de (ida.interface-business.de [193.101.57.9]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9F98A43D3F for ; Sun, 27 Jun 2004 14:00:35 +0000 (GMT) (envelope-from j@ida.interface-business.de) Received: by ida.interface-business.de (Postfix, from userid 107) id A51027A49; Sun, 27 Jun 2004 16:00:33 +0200 (MET DST) Date: Sun, 27 Jun 2004 16:00:33 +0200 From: Joerg Wunsch To: dhcp-hackers@isc.org Message-ID: <20040627160033.G75210@ida.interface-business.de> References: <20040627005719.M38063@cvs.imp.ch> <20040627090642.A75210@ida.interface-business.de> <20040627101539.G38063@cvs.imp.ch> <20040627115951.C75210@ida.interface-business.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20040627115951.C75210@ida.interface-business.de>; from j@ida.interface-business.de on Sun, Jun 27, 2004 at 11:59:51AM +0200 X-Phone: +49-351-31809-14 X-PGP-Fingerprint: DC 47 E6 E4 FF A6 E9 8F 93 21 E0 7D F9 12 D6 4E Organization: interface systems GmbH, Dresden cc: sparc64@freebsd.org Subject: Re: 64-bit time_t safe lease time X-BeenThere: freebsd-sparc64@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Joerg Wunsch List-Id: Porting FreeBSD to the Sparc List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jun 2004 14:00:44 -0000 [Cc to sparc64@freebsd.org, since that's probably the group of users currently most interested in the matter.] As Joerg Wunsch wrote: > Ad Martin Blapp wrote: > > Does it help if you define TIME as int32_t ? > Yes, that helps quite a bit. Well, now it starts to send requests quickly, > but it sends the requests to a random dst port so the DHCP server never > responds: > > 11:57:57.075934 0.0.0.0.68 > 255.255.255.255.39463: (request) xid:0x4f353b0d vend-rfc1048 DHCP:DISCOVER PR:SM+BR+TZ+DG+DN+NS+HN [tos 0x10] > ^C The problem was that GET_TIME() (first called in script_go()) clobbered part of sockaddr_broadcast. The memory area it clobbers looks a bit surprising to me, but the actual error became obvious then: calling time() on a TIME* object, when sizeof(time_t) != sizeof(TIME) is just an error. As a workaround, I added the following inline function: Index: includes/cf/freebsd.h =================================================================== RCS file: /home/ncvs/src/contrib/isc-dhcp/includes/cf/freebsd.h,v retrieving revision 1.7 diff -u -r1.7 freebsd.h --- includes/cf/freebsd.h 26 Jun 2004 10:37:42 -0000 1.7 +++ includes/cf/freebsd.h 27 Jun 2004 13:47:48 -0000 @@ -79,8 +79,14 @@ /* Time stuff... */ #include -#define TIME time_t -#define GET_TIME(x) time ((x)) +#define TIME int32_t +static __inline void +freebsd_get_time(TIME *tp) { + time_t now; + time(&now); + *tp = (TIME)now; +} +#define GET_TIME(x) freebsd_get_time ((x)) #define HAVE_SA_LEN That suffices as a workaround, though I think the code should be fixed to not assume a particular integer width for time_t. OK, year 2038 is still somewhat ahead. ;-) # dhclient -v gem0 Internet Systems Consortium DHCP Client V3.0.1rc14 Copyright 2004 Internet Systems Consortium. All rights reserved. For info, please visit http://www.isc.org/products/DHCP Listening on BPF/gem0/08:00:20:fe:a2:6e Sending on BPF/gem0/08:00:20:fe:a2:6e Sending on Socket/fallback DHCPDISCOVER on gem0 to 255.255.255.255 port 67 interval 7 DHCPOFFER from 193.101.57.34 DHCPREQUEST on gem0 to 255.255.255.255 port 67 DHCPACK from 193.101.57.34 bound to 193.101.57.70 -- renewal in 40644 seconds. Btw., that's without Dag-Erling's patch. I cannot fully verifiy the validity of the 40644 seconds above, but the default lease time here is 86400, and the same lease has been given to that machine before. As a note to the sparc64@freebsd.org listeners, the above assumes you upgraded src/contrib/isc-dhcp and src/sbin/dhclient to Martin's yesterday's import of V3.0.1rc14. There seem to be no further side effects from this, i. e. you don't necessarily need to upgrade the entire world right now. -- J"org Wunsch Unix support engineer joerg_wunsch@interface-systems.de http://www.interface-systems.de/~j/ From owner-freebsd-sparc64@FreeBSD.ORG Sun Jun 27 15:27:19 2004 Return-Path: Delivered-To: freebsd-sparc64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id ED4CC16A545; Sun, 27 Jun 2004 15:27:18 +0000 (GMT) Received: from smtp3.sentex.ca (smtp3.sentex.ca [64.7.153.18]) by mx1.FreeBSD.org (Postfix) with ESMTP id 79FAB43D1D; Sun, 27 Jun 2004 15:27:18 +0000 (GMT) (envelope-from tinderbox@freebsd.org) Received: from smtp1.sentex.ca (smtp1.sentex.ca [199.212.134.4]) by smtp3.sentex.ca (8.12.11/8.12.11) with ESMTP id i5RFQspM044040; Sun, 27 Jun 2004 11:26:54 -0400 (EDT) (envelope-from tinderbox@freebsd.org) Received: from freebsd-current.sentex.ca (freebsd-current.sentex.ca [64.7.128.98]) by smtp1.sentex.ca (8.12.11/8.12.11) with ESMTP id i5RFQueH080686; Sun, 27 Jun 2004 11:26:57 -0400 (EDT) (envelope-from tinderbox@freebsd.org) Received: by freebsd-current.sentex.ca (Postfix, from userid 666) id DFAC87303F; Sun, 27 Jun 2004 11:26:56 -0400 (EDT) Sender: FreeBSD Tinderbox From: FreeBSD Tinderbox To: FreeBSD Tinderbox , , Precedence: bulk Message-Id: <20040627152656.DFAC87303F@freebsd-current.sentex.ca> Date: Sun, 27 Jun 2004 11:26:56 -0400 (EDT) Subject: [current tinderbox] failure on sparc64/sparc64 X-BeenThere: freebsd-sparc64@freebsd.org X-Mailman-Version: 2.1.1 List-Id: Porting FreeBSD to the Sparc List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jun 2004 15:27:19 -0000 TB --- 2004-06-27 14:44:03 - tinderbox 2.3 running on freebsd-current.sentex.ca TB --- 2004-06-27 14:44:03 - starting CURRENT tinderbox run for sparc64/sparc64 TB --- 2004-06-27 14:44:03 - checking out the source tree TB --- 2004-06-27 14:44:03 - cd /home/tinderbox/sandbox/CURRENT/sparc64/sparc64 TB --- 2004-06-27 14:44:03 - /usr/bin/cvs -f -R -q -d/home/ncvs update -Pd -A src TB --- 2004-06-27 14:45:52 - building world (CFLAGS=-O2 -pipe) TB --- 2004-06-27 14:45:52 - cd /home/tinderbox/sandbox/CURRENT/sparc64/sparc64/src TB --- 2004-06-27 14:45:52 - /usr/bin/make -B buildworld >>> Rebuilding the temporary build tree >>> stage 1.1: legacy release compatibility shims >>> stage 1.2: bootstrap tools >>> stage 2.1: cleaning up the object tree >>> stage 2.2: rebuilding the object tree >>> stage 2.3: build tools >>> stage 3: cross tools >>> stage 4.1: building includes >>> stage 4.2: building libraries >>> stage 4.3: make dependencies >>> stage 4.4: building everything [...] cc -O2 -pipe -DHAVE_CONFIG_H -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/lib -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/src -c /tinderbox/CURRENT/sparc64/sparc64/src/contrib/tar/lib/exclude.c cc -O2 -pipe -DHAVE_CONFIG_H -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/lib -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/src -c /tinderbox/CURRENT/sparc64/sparc64/src/contrib/tar/lib/full-write.c cc -O2 -pipe -DHAVE_CONFIG_H -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/lib -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/src -c /tinderbox/CURRENT/sparc64/sparc64/src/contrib/tar/lib/getdate.c cc -O2 -pipe -DHAVE_CONFIG_H -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/lib -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/src -c /tinderbox/CURRENT/sparc64/sparc64/src/contrib/tar/lib/getline.c cc -O2 -pipe -DHAVE_CONFIG_H -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/lib -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/src -c /tinderbox/CURRENT/sparc64/sparc64/src/contrib/tar/lib/getstr.c cc -O2 -pipe -DHAVE_CONFIG_H -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/lib -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/src -c /tinderbox/CURRENT/sparc64/sparc64/src/contrib/tar/lib/hash.c {standard input}: Assembler messages: {standard input}:1283: Error: Illegal operands *** Error code 1 Stop in /tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar. *** Error code 1 Stop in /tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin. *** Error code 1 Stop in /tinderbox/CURRENT/sparc64/sparc64/src/gnu. *** Error code 1 Stop in /tinderbox/CURRENT/sparc64/sparc64/src. *** Error code 1 Stop in /tinderbox/CURRENT/sparc64/sparc64/src. *** Error code 1 Stop in /tinderbox/CURRENT/sparc64/sparc64/src. TB --- 2004-06-27 15:26:56 - WARNING: /usr/bin/make returned exit code 1 TB --- 2004-06-27 15:26:56 - ERROR: failed to build world TB --- 2004-06-27 15:26:56 - tinderbox aborted From owner-freebsd-sparc64@FreeBSD.ORG Mon Jun 28 11:03:02 2004 Return-Path: Delivered-To: freebsd-sparc64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4AF6316A4CF for ; Mon, 28 Jun 2004 11:03:02 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4535243D53 for ; Mon, 28 Jun 2004 11:03:02 +0000 (GMT) (envelope-from owner-bugmaster@freebsd.org) Received: from freefall.freebsd.org (peter@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.11/8.12.11) with ESMTP id i5SB2GPW003948 for ; Mon, 28 Jun 2004 11:02:16 GMT (envelope-from owner-bugmaster@freebsd.org) Received: (from peter@localhost) by freefall.freebsd.org (8.12.11/8.12.11/Submit) id i5SB2GrJ003942 for freebsd-sparc64@freebsd.org; Mon, 28 Jun 2004 11:02:16 GMT (envelope-from owner-bugmaster@freebsd.org) Date: Mon, 28 Jun 2004 11:02:16 GMT Message-Id: <200406281102.i5SB2GrJ003942@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: peter set sender to owner-bugmaster@freebsd.org using -f From: FreeBSD bugmaster To: freebsd-sparc64@FreeBSD.org Subject: Current problem reports assigned to you X-BeenThere: freebsd-sparc64@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting FreeBSD to the Sparc List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jun 2004 11:03:02 -0000 Current FreeBSD problem reports Critical problems S Submitted Tracker Resp. Description ------------------------------------------------------------------------------- o [2003/12/16] sparc64/60300sparc64 Constant kernel messages: calcru: negativ o [2004/02/21] sparc64/63161sparc64 system panics when writing to an NFS moun 2 problems total. Serious problems S Submitted Tracker Resp. Description ------------------------------------------------------------------------------- o [2003/06/24] sparc64/53670sparc64 pthreads implementation on 5.1-Release sp o [2004/01/29] sparc64/62053sparc64 Using bridging on 5.2 Sparc64 causes imme 2 problems total. Non-critical problems S Submitted Tracker Resp. Description ------------------------------------------------------------------------------- a [2003/10/11] sparc64/57856sparc64 sparc64: IDE Raid controller no detect di o [2004/05/06] sparc64/66314sparc64 SMP kernel panic: ipi_send: couldn't send 2 problems total. From owner-freebsd-sparc64@FreeBSD.ORG Mon Jun 28 11:20:54 2004 Return-Path: Delivered-To: freebsd-sparc64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 895CC16A4CE for ; Mon, 28 Jun 2004 11:20:54 +0000 (GMT) Received: from smtp.des.no (flood.des.no [217.116.83.31]) by mx1.FreeBSD.org (Postfix) with ESMTP id A889A43D3F for ; Mon, 28 Jun 2004 11:20:53 +0000 (GMT) (envelope-from des@des.no) Received: by smtp.des.no (Pony Express, from userid 666) id 1E50F530C; Mon, 28 Jun 2004 13:20:42 +0200 (CEST) Received: from dwp.des.no (des.no [80.203.228.37]) by smtp.des.no (Pony Express) with ESMTP id 510D9530A; Mon, 28 Jun 2004 13:20:26 +0200 (CEST) Received: by dwp.des.no (Postfix, from userid 2602) id 04AF5B86C; Mon, 28 Jun 2004 13:20:26 +0200 (CEST) To: Joerg Wunsch References: <20040627005719.M38063@cvs.imp.ch> <20040627090642.A75210@ida.interface-business.de> <20040627101539.G38063@cvs.imp.ch> <20040627115951.C75210@ida.interface-business.de> <20040627160033.G75210@ida.interface-business.de> From: des@des.no (=?iso-8859-1?q?Dag-Erling_Sm=F8rgrav?=) Date: Mon, 28 Jun 2004 13:20:25 +0200 In-Reply-To: <20040627160033.G75210@ida.interface-business.de> (Joerg Wunsch's message of "Sun, 27 Jun 2004 16:00:33 +0200") Message-ID: User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on flood.des.no X-Spam-Level: X-Spam-Status: No, hits=0.0 required=5.0 tests=AWL autolearn=no version=2.63 cc: dhcp-hackers@isc.org cc: sparc64@freebsd.org Subject: Re: 64-bit time_t safe lease time X-BeenThere: freebsd-sparc64@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting FreeBSD to the Sparc List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jun 2004 11:20:54 -0000 --=-=-= Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Joerg Wunsch writes: > The problem was that GET_TIME() (first called in script_go()) > clobbered part of sockaddr_broadcast. The memory area it clobbers > looks a bit surprising to me, but the actual error became obvious > then: calling time() on a TIME* object, when sizeof(time_t) !=3D > sizeof(TIME) is just an error. your analysis does not jibe with my reading of the code, since TIME is defined as time_t: #define TIME time_t #define GET_TIME(x) time ((x)) there's nothing wrong with this as long as the argument to GET_TIME() is always a TIME (or time_t). GET_TIME() is called in three places, always with &cur_time as argument. cur_time is defined as a TIME in dhclient, and redefined as an int32_t in libomapip (which is linked statically into dhclient). The fact that it is defined twice is probably a bug; the fact that the linker does not warn about this is probably a bug, too. The attached patch addresses these inconsistencies, but I have not verified that it corrects the 64-bit time_t problem. DES --=20 Dag-Erling Sm=F8rgrav - des@des.no --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=cur_time.diff Index: client/dhclient.c =================================================================== RCS file: /home/ncvs/src/contrib/isc-dhcp/client/dhclient.c,v retrieving revision 1.37 diff -u -r1.37 dhclient.c --- client/dhclient.c 26 Jun 2004 10:37:41 -0000 1.37 +++ client/dhclient.c 28 Jun 2004 11:16:11 -0000 @@ -46,7 +46,7 @@ #include #endif -TIME cur_time; +extern TIME cur_time; TIME default_lease_time = 43200; /* 12 hours... */ TIME max_lease_time = 86400; /* 24 hours... */ Index: common/dispatch.c =================================================================== RCS file: /home/ncvs/src/contrib/isc-dhcp/common/dispatch.c,v retrieving revision 1.5 diff -u -r1.5 dispatch.c --- common/dispatch.c 26 Jun 2004 10:37:41 -0000 1.5 +++ common/dispatch.c 28 Jun 2004 11:16:41 -0000 @@ -95,7 +95,6 @@ struct timeval *tvp_new; #endif isc_result_t status; - TIME cur_time; tvp = NULL; #ifdef ENABLE_POLLING_MODE Index: omapip/dispatch.c =================================================================== RCS file: /home/ncvs/src/contrib/isc-dhcp/omapip/dispatch.c,v retrieving revision 1.1.1.2 diff -u -r1.1.1.2 dispatch.c --- omapip/dispatch.c 26 Jun 2004 10:34:24 -0000 1.1.1.2 +++ omapip/dispatch.c 28 Jun 2004 11:11:17 -0000 @@ -35,7 +35,7 @@ #include static omapi_io_object_t omapi_io_states; -u_int32_t cur_time; +TIME cur_time; OMAPI_OBJECT_ALLOC (omapi_io, omapi_io_object_t, omapi_type_io_object) Index: omapip/mrtrace.c =================================================================== RCS file: /home/ncvs/src/contrib/isc-dhcp/omapip/mrtrace.c,v retrieving revision 1.1.1.2 diff -u -r1.1.1.2 mrtrace.c --- omapip/mrtrace.c 26 Jun 2004 10:34:24 -0000 1.1.1.2 +++ omapip/mrtrace.c 28 Jun 2004 11:18:26 -0000 @@ -61,7 +61,7 @@ int trace_mr_select (int, fd_set *, fd_set *, fd_set *, struct timeval *); unsigned int trace_mr_res_randomid (unsigned int); -extern time_t cur_time; +extern TIME cur_time; #if defined (TRACING) void trace_mr_init () --=-=-=-- From owner-freebsd-sparc64@FreeBSD.ORG Mon Jun 28 13:20:37 2004 Return-Path: Delivered-To: freebsd-sparc64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0FCF116A4CE for ; Mon, 28 Jun 2004 13:20:37 +0000 (GMT) Received: from ida.interface-business.de (ida.interface-business.de [193.101.57.9]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9986E43D2D for ; Mon, 28 Jun 2004 13:20:36 +0000 (GMT) (envelope-from j@ida.interface-business.de) Received: by ida.interface-business.de (Postfix, from userid 107) id 45BE77A49; Mon, 28 Jun 2004 15:20:31 +0200 (MET DST) Date: Mon, 28 Jun 2004 15:20:31 +0200 From: Joerg Wunsch To: =?iso-8859-1?Q?Dag-Erling_Sm=F8rgrav?= Message-ID: <20040628152031.A21248@ida.interface-business.de> References: <20040627005719.M38063@cvs.imp.ch> <20040627090642.A75210@ida.interface-business.de> <20040627101539.G38063@cvs.imp.ch> <20040627115951.C75210@ida.interface-business.de> <20040627160033.G75210@ida.interface-business.de> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit User-Agent: Mutt/1.2.5i In-Reply-To: ; from des@des.no on Mon, Jun 28, 2004 at 01:20:25PM +0200 X-Phone: +49-351-31809-14 X-PGP-Fingerprint: DC 47 E6 E4 FF A6 E9 8F 93 21 E0 7D F9 12 D6 4E Organization: interface systems GmbH, Dresden cc: dhcp-hackers@isc.org cc: sparc64@freebsd.org Subject: Re: 64-bit time_t safe lease time X-BeenThere: freebsd-sparc64@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Joerg Wunsch List-Id: Porting FreeBSD to the Sparc List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jun 2004 13:20:37 -0000 As Dag-Erling Smørgrav wrote: > > The problem was that GET_TIME() (first called in script_go()) > > clobbered part of sockaddr_broadcast. The memory area it clobbers > > looks a bit surprising to me, but the actual error became obvious > > then: calling time() on a TIME* object, when sizeof(time_t) != > > sizeof(TIME) is just an error. > > your analysis does not jibe with my reading of the code, since TIME is > defined as time_t: Running with TIME=time_t yielded comletely erratical behaviour (dhclient didn't even send out the initial request since it was hanging around in a supposedly short select() timeout that grew into several thousand years). It's been Martin Blapp's suggestion to define TIME as int32_t instead, which fixes the erratical behaviour, but requires the hack for GET_TIME(). See the patch I've been attaching to my previous mail. Your previous patch didn't fix anything for my situation, sorry. -- J"org Wunsch Unix support engineer joerg_wunsch@interface-systems.de http://www.interface-systems.de/~j/ From owner-freebsd-sparc64@FreeBSD.ORG Mon Jun 28 14:09:38 2004 Return-Path: Delivered-To: freebsd-sparc64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id AF37A16A4CE for ; Mon, 28 Jun 2004 14:09:38 +0000 (GMT) Received: from ida.interface-business.de (ida.interface-business.de [193.101.57.9]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6F92E43D1F for ; Mon, 28 Jun 2004 14:09:38 +0000 (GMT) (envelope-from j@ida.interface-business.de) Received: by ida.interface-business.de (Postfix, from userid 107) id 778287A49; Mon, 28 Jun 2004 16:09:37 +0200 (MET DST) Date: Mon, 28 Jun 2004 16:09:37 +0200 From: Joerg Wunsch To: =?iso-8859-1?Q?Dag-Erling_Sm=F8rgrav?= Message-ID: <20040628160937.D21248@ida.interface-business.de> References: <20040627005719.M38063@cvs.imp.ch> <20040627090642.A75210@ida.interface-business.de> <20040627101539.G38063@cvs.imp.ch> <20040627115951.C75210@ida.interface-business.de> <20040627160033.G75210@ida.interface-business.de> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit User-Agent: Mutt/1.2.5i In-Reply-To: ; from des@des.no on Mon, Jun 28, 2004 at 01:20:25PM +0200 X-Phone: +49-351-31809-14 X-PGP-Fingerprint: DC 47 E6 E4 FF A6 E9 8F 93 21 E0 7D F9 12 D6 4E Organization: interface systems GmbH, Dresden cc: dhcp-hackers@isc.org cc: sparc64@freebsd.org Subject: Re: 64-bit time_t safe lease time X-BeenThere: freebsd-sparc64@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Joerg Wunsch List-Id: Porting FreeBSD to the Sparc List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jun 2004 14:09:38 -0000 As Dag-Erling Smørgrav wrote: > The attached patch addresses these inconsistencies, but I have not > verified that it corrects the 64-bit time_t problem. It seems to work, too. I backed out Martin Blapp's previous + my GET_TIME() patch, and applied your one. I get a few compilation warnings: cc -O -pipe -DCLIENT_PATH='"PATH=/sbin:/bin:/usr/sbin:/usr/bin"' -Dwarn=dhcp_warn -g -I/usr/src/sbin/dhclient/client/../../../contrib/isc-dhcp/includes -DENABLE_POLLING_MODE -DNOMINUM -c /usr/src/contrib/isc-dhcp/client/dhclient.c /usr/src/contrib/isc-dhcp/client/dhclient.c: In function `write_client_lease': /usr/src/contrib/isc-dhcp/client/dhclient.c:2458: warning: passing arg 1 of `gmtime' from incompatible pointer type /usr/src/contrib/isc-dhcp/client/dhclient.c:2468: warning: passing arg 1 of `gmtime' from incompatible pointer type /usr/src/contrib/isc-dhcp/client/dhclient.c:2478: warning: passing arg 1 of `gmtime' from incompatible pointer type but the resulting client appears to work fine: # dhclient -v gem0 Internet Systems Consortium DHCP Client V3.0.1rc14 Copyright 2004 Internet Systems Consortium. All rights reserved. For info, please visit http://www.isc.org/products/DHCP Listening on BPF/gem0/08:00:20:fe:a2:6e Sending on BPF/gem0/08:00:20:fe:a2:6e Sending on Socket/fallback DHCPDISCOVER on gem0 to 255.255.255.255 port 67 interval 8 DHCPOFFER from 193.101.57.34 DHCPREQUEST on gem0 to 255.255.255.255 port 67 DHCPACK from 193.101.57.34 bound to 193.101.57.70 -- renewal in 39365 seconds. That looks reasonable. -- J"org Wunsch Unix support engineer joerg_wunsch@interface-systems.de http://www.interface-systems.de/~j/ From owner-freebsd-sparc64@FreeBSD.ORG Mon Jun 28 14:47:05 2004 Return-Path: Delivered-To: freebsd-sparc64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B4D9E16A4CE; Mon, 28 Jun 2004 14:47:05 +0000 (GMT) Received: from smtp3b.sentex.ca (smtp3b.sentex.ca [205.211.164.50]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3B50843D58; Mon, 28 Jun 2004 14:47:05 +0000 (GMT) (envelope-from tinderbox@freebsd.org) Received: from smtp1.sentex.ca (smtp1.sentex.ca [199.212.134.4]) by smtp3b.sentex.ca (8.12.11/8.12.11) with ESMTP id i5SEl4ML046355; Mon, 28 Jun 2004 10:47:04 -0400 (EDT) (envelope-from tinderbox@freebsd.org) Received: from freebsd-current.sentex.ca (freebsd-current.sentex.ca [64.7.128.98]) by smtp1.sentex.ca (8.12.11/8.12.11) with ESMTP id i5SEl4S3056740; Mon, 28 Jun 2004 10:47:04 -0400 (EDT) (envelope-from tinderbox@freebsd.org) Received: by freebsd-current.sentex.ca (Postfix, from userid 666) id 731CF7303F; Mon, 28 Jun 2004 10:47:04 -0400 (EDT) Sender: FreeBSD Tinderbox From: FreeBSD Tinderbox To: FreeBSD Tinderbox , , Precedence: bulk Message-Id: <20040628144704.731CF7303F@freebsd-current.sentex.ca> Date: Mon, 28 Jun 2004 10:47:04 -0400 (EDT) Subject: [current tinderbox] failure on sparc64/sparc64 X-BeenThere: freebsd-sparc64@freebsd.org X-Mailman-Version: 2.1.1 List-Id: Porting FreeBSD to the Sparc List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jun 2004 14:47:06 -0000 TB --- 2004-06-28 14:04:23 - tinderbox 2.3 running on freebsd-current.sentex.ca TB --- 2004-06-28 14:04:23 - starting CURRENT tinderbox run for sparc64/sparc64 TB --- 2004-06-28 14:04:23 - checking out the source tree TB --- 2004-06-28 14:04:23 - cd /home/tinderbox/sandbox/CURRENT/sparc64/sparc64 TB --- 2004-06-28 14:04:23 - /usr/bin/cvs -f -R -q -d/home/ncvs update -Pd -A src TB --- 2004-06-28 14:06:11 - building world (CFLAGS=-O2 -pipe) TB --- 2004-06-28 14:06:11 - cd /home/tinderbox/sandbox/CURRENT/sparc64/sparc64/src TB --- 2004-06-28 14:06:11 - /usr/bin/make -B buildworld >>> Rebuilding the temporary build tree >>> stage 1.1: legacy release compatibility shims >>> stage 1.2: bootstrap tools >>> stage 2.1: cleaning up the object tree >>> stage 2.2: rebuilding the object tree >>> stage 2.3: build tools >>> stage 3: cross tools >>> stage 4.1: building includes >>> stage 4.2: building libraries >>> stage 4.3: make dependencies >>> stage 4.4: building everything [...] cc -O2 -pipe -DHAVE_CONFIG_H -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/lib -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/src -c /tinderbox/CURRENT/sparc64/sparc64/src/contrib/tar/lib/exclude.c cc -O2 -pipe -DHAVE_CONFIG_H -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/lib -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/src -c /tinderbox/CURRENT/sparc64/sparc64/src/contrib/tar/lib/full-write.c cc -O2 -pipe -DHAVE_CONFIG_H -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/lib -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/src -c /tinderbox/CURRENT/sparc64/sparc64/src/contrib/tar/lib/getdate.c cc -O2 -pipe -DHAVE_CONFIG_H -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/lib -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/src -c /tinderbox/CURRENT/sparc64/sparc64/src/contrib/tar/lib/getline.c cc -O2 -pipe -DHAVE_CONFIG_H -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/lib -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/src -c /tinderbox/CURRENT/sparc64/sparc64/src/contrib/tar/lib/getstr.c cc -O2 -pipe -DHAVE_CONFIG_H -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/lib -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/src -c /tinderbox/CURRENT/sparc64/sparc64/src/contrib/tar/lib/hash.c {standard input}: Assembler messages: {standard input}:1283: Error: Illegal operands *** Error code 1 Stop in /tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar. *** Error code 1 Stop in /tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin. *** Error code 1 Stop in /tinderbox/CURRENT/sparc64/sparc64/src/gnu. *** Error code 1 Stop in /tinderbox/CURRENT/sparc64/sparc64/src. *** Error code 1 Stop in /tinderbox/CURRENT/sparc64/sparc64/src. *** Error code 1 Stop in /tinderbox/CURRENT/sparc64/sparc64/src. TB --- 2004-06-28 14:47:04 - WARNING: /usr/bin/make returned exit code 1 TB --- 2004-06-28 14:47:04 - ERROR: failed to build world TB --- 2004-06-28 14:47:04 - tinderbox aborted From owner-freebsd-sparc64@FreeBSD.ORG Mon Jun 28 14:58:24 2004 Return-Path: Delivered-To: freebsd-sparc64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C890A16A4CE for ; Mon, 28 Jun 2004 14:58:24 +0000 (GMT) Received: from mail.b0rken.org (beastie.b0rken.org [213.48.48.213]) by mx1.FreeBSD.org (Postfix) with SMTP id D391D43D1D for ; Mon, 28 Jun 2004 14:58:23 +0000 (GMT) (envelope-from jason-freebsdlists@freebsd.org) Received: (qmail 40167 invoked by uid 1000); 28 Jun 2004 14:58:07 -0000 Date: Mon, 28 Jun 2004 15:58:07 +0100 From: Jason Mann To: freebsd-sparc64@freebsd.org Message-ID: <20040628145807.GE17878@beastie.b0rken.org> Mail-Followup-To: freebsd-sparc64@freebsd.org References: <20040625131431.GB17878@beastie.b0rken.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040625131431.GB17878@beastie.b0rken.org> User-Agent: Mutt/1.4.2.1i Subject: Re: Problem updating to 5.2.1-RELEASE-p8 X-BeenThere: freebsd-sparc64@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting FreeBSD to the Sparc List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jun 2004 14:58:24 -0000 On 20040625 1414, Jason Mann wrote: > I performed a fresh installation on 5.2.1-RELEASE on my Ultra 5 yesterday, > and then attempted to upgrade it to 5.2.1-RELEASE-p8, but this failed. > > buildworld, buildkernel, and installkernel went fine, but installworld > failed. > > The output I got from the failed installworld is here: > > http://www.b0rken.org/~jason/installworld.txt > > Does anyone know why this is happening? 'touch' is all present and correct > on my system. Google was my friend. The clock was about 6 months slow on my machine. Corrected that, and retried the upgrade, and all was fine. Jason From owner-freebsd-sparc64@FreeBSD.ORG Mon Jun 28 16:55:38 2004 Return-Path: Delivered-To: freebsd-sparc64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7E43816A4CE for ; Mon, 28 Jun 2004 16:55:38 +0000 (GMT) Received: from smtp.des.no (flood.des.no [217.116.83.31]) by mx1.FreeBSD.org (Postfix) with ESMTP id 727FF43D48 for ; Mon, 28 Jun 2004 16:55:37 +0000 (GMT) (envelope-from des@des.no) Received: by smtp.des.no (Pony Express, from userid 666) id 198D4530C; Mon, 28 Jun 2004 18:55:35 +0200 (CEST) Received: from dwp.des.no (des.no [80.203.228.37]) by smtp.des.no (Pony Express) with ESMTP id 94843530A; Mon, 28 Jun 2004 18:55:18 +0200 (CEST) Received: by dwp.des.no (Postfix, from userid 2602) id 71951B86C; Mon, 28 Jun 2004 18:55:18 +0200 (CEST) To: Joerg Wunsch References: <20040627005719.M38063@cvs.imp.ch> <20040627090642.A75210@ida.interface-business.de> <20040627101539.G38063@cvs.imp.ch> <20040627115951.C75210@ida.interface-business.de> <20040627160033.G75210@ida.interface-business.de> <20040628160937.D21248@ida.interface-business.de> From: des@des.no (=?iso-8859-1?q?Dag-Erling_Sm=F8rgrav?=) Date: Mon, 28 Jun 2004 18:55:18 +0200 In-Reply-To: <20040628160937.D21248@ida.interface-business.de> (Joerg Wunsch's message of "Mon, 28 Jun 2004 16:09:37 +0200") Message-ID: User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on flood.des.no X-Spam-Level: X-Spam-Status: No, hits=0.0 required=5.0 tests=AWL autolearn=no version=2.63 cc: dhcp-hackers@isc.org cc: sparc64@freebsd.org Subject: Re: 64-bit time_t safe lease time X-BeenThere: freebsd-sparc64@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting FreeBSD to the Sparc List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jun 2004 16:55:38 -0000 --=-=-= Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Joerg Wunsch writes: > As Dag-Erling Sm=F8rgrav wrote: > > The attached patch addresses these inconsistencies, but I have not > > verified that it corrects the 64-bit time_t problem. > It seems to work, too. I backed out Martin Blapp's previous + my > GET_TIME() patch, and applied your one. I get a few compilation > warnings: I believe these warnings are unrelated to the patch. there are plenty of places that use int32_t or even worse u_int32_t to hold time. items from dhcpd.h that look suspicious to me include: lease_state.expiry lease_state.renewal lease_state.rebind client_config.requested_lease set_time() nsupdateA() nsupdatePTR() I've attached a patch that includes the previous one and also fixes some of the above. it builds with zero warnings on i386, and one (unrelated) on alpha. unfortunately, time_t is not the only source of trouble for isc-dhcp on 64-bit platforms. parts the code also seem to assume that pointers are 32-bit (this triggers the aforementioned warning on alpha). btw, none of this actually gets to the dhcp lists since they are subscriber-only and I don't particularly feel like subscribing, so all my emails bounce. DES --=20 Dag-Erling Sm=F8rgrav - des@des.no --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=isc-dhcp.diff Index: client/dhclient.c =================================================================== RCS file: /home/ncvs/src/contrib/isc-dhcp/client/dhclient.c,v retrieving revision 1.37 diff -u -r1.37 dhclient.c --- client/dhclient.c 26 Jun 2004 10:37:41 -0000 1.37 +++ client/dhclient.c 28 Jun 2004 11:16:11 -0000 @@ -46,7 +46,7 @@ #include #endif -TIME cur_time; +extern TIME cur_time; TIME default_lease_time = 43200; /* 12 hours... */ TIME max_lease_time = 86400; /* 24 hours... */ Index: common/dispatch.c =================================================================== RCS file: /home/ncvs/src/contrib/isc-dhcp/common/dispatch.c,v retrieving revision 1.5 diff -u -r1.5 dispatch.c --- common/dispatch.c 26 Jun 2004 10:37:41 -0000 1.5 +++ common/dispatch.c 28 Jun 2004 16:49:16 -0000 @@ -47,7 +47,7 @@ extern int polling_interval; #endif -void set_time (u_int32_t t) +void set_time (TIME t) { /* Do any outstanding timeouts. */ if (cur_time != t) { @@ -95,7 +95,6 @@ struct timeval *tvp_new; #endif isc_result_t status; - TIME cur_time; tvp = NULL; #ifdef ENABLE_POLLING_MODE Index: includes/dhcpd.h =================================================================== RCS file: /home/ncvs/src/contrib/isc-dhcp/includes/dhcpd.h,v retrieving revision 1.9 diff -u -r1.9 dhcpd.h --- includes/dhcpd.h 26 Jun 2004 10:37:42 -0000 1.9 +++ includes/dhcpd.h 28 Jun 2004 16:49:23 -0000 @@ -335,7 +335,7 @@ struct option_state *options; struct data_string parameter_request_list; int max_message_size; - u_int32_t expiry, renewal, rebind; + TIME expiry, renewal, rebind; struct data_string filename, server_name; int got_requested_address; int got_server_identifier; @@ -1764,7 +1764,7 @@ void reinitialize_interfaces PROTO ((void)); /* dispatch.c */ -void set_time (u_int32_t); +void set_time (TIME); struct timeval *process_outstanding_timeouts (struct timeval *); void dispatch PROTO ((void)); isc_result_t got_one PROTO ((omapi_object_t *)); Index: omapip/dispatch.c =================================================================== RCS file: /home/ncvs/src/contrib/isc-dhcp/omapip/dispatch.c,v retrieving revision 1.1.1.2 diff -u -r1.1.1.2 dispatch.c --- omapip/dispatch.c 26 Jun 2004 10:34:24 -0000 1.1.1.2 +++ omapip/dispatch.c 28 Jun 2004 11:11:17 -0000 @@ -35,7 +35,7 @@ #include static omapi_io_object_t omapi_io_states; -u_int32_t cur_time; +TIME cur_time; OMAPI_OBJECT_ALLOC (omapi_io, omapi_io_object_t, omapi_type_io_object) Index: omapip/mrtrace.c =================================================================== RCS file: /home/ncvs/src/contrib/isc-dhcp/omapip/mrtrace.c,v retrieving revision 1.1.1.2 diff -u -r1.1.1.2 mrtrace.c --- omapip/mrtrace.c 26 Jun 2004 10:34:24 -0000 1.1.1.2 +++ omapip/mrtrace.c 28 Jun 2004 11:18:26 -0000 @@ -61,7 +61,7 @@ int trace_mr_select (int, fd_set *, fd_set *, fd_set *, struct timeval *); unsigned int trace_mr_res_randomid (unsigned int); -extern time_t cur_time; +extern TIME cur_time; #if defined (TRACING) void trace_mr_init () --=-=-=-- From owner-freebsd-sparc64@FreeBSD.ORG Tue Jun 29 15:28:26 2004 Return-Path: Delivered-To: freebsd-sparc64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9F41616A4CE; Tue, 29 Jun 2004 15:28:26 +0000 (GMT) Received: from smtp3.sentex.ca (smtp3.sentex.ca [64.7.153.18]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4449943D2D; Tue, 29 Jun 2004 15:28:26 +0000 (GMT) (envelope-from tinderbox@freebsd.org) Received: from smtp2.sentex.ca (smtp2c.sentex.ca [64.7.153.30]) by smtp3.sentex.ca (8.12.11/8.12.11) with ESMTP id i5TFSMOf081668; Tue, 29 Jun 2004 11:28:22 -0400 (EDT) (envelope-from tinderbox@freebsd.org) Received: from freebsd-current.sentex.ca (freebsd-current.sentex.ca [64.7.128.98]) by smtp2.sentex.ca (8.12.11/8.12.11) with ESMTP id i5TFSPXK042512; Tue, 29 Jun 2004 11:28:25 -0400 (EDT) (envelope-from tinderbox@freebsd.org) Received: by freebsd-current.sentex.ca (Postfix, from userid 666) id EEC397303F; Tue, 29 Jun 2004 11:28:24 -0400 (EDT) Sender: FreeBSD Tinderbox From: FreeBSD Tinderbox To: FreeBSD Tinderbox , , Precedence: bulk Message-Id: <20040629152824.EEC397303F@freebsd-current.sentex.ca> Date: Tue, 29 Jun 2004 11:28:24 -0400 (EDT) Subject: [current tinderbox] failure on sparc64/sparc64 X-BeenThere: freebsd-sparc64@freebsd.org X-Mailman-Version: 2.1.1 List-Id: Porting FreeBSD to the Sparc List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jun 2004 15:28:26 -0000 TB --- 2004-06-29 14:45:36 - tinderbox 2.3 running on freebsd-current.sentex.ca TB --- 2004-06-29 14:45:36 - starting CURRENT tinderbox run for sparc64/sparc64 TB --- 2004-06-29 14:45:36 - checking out the source tree TB --- 2004-06-29 14:45:36 - cd /home/tinderbox/sandbox/CURRENT/sparc64/sparc64 TB --- 2004-06-29 14:45:36 - /usr/bin/cvs -f -R -q -d/home/ncvs update -Pd -A src TB --- 2004-06-29 14:47:28 - building world (CFLAGS=-O2 -pipe) TB --- 2004-06-29 14:47:28 - cd /home/tinderbox/sandbox/CURRENT/sparc64/sparc64/src TB --- 2004-06-29 14:47:28 - /usr/bin/make -B buildworld >>> Rebuilding the temporary build tree >>> stage 1.1: legacy release compatibility shims >>> stage 1.2: bootstrap tools >>> stage 2.1: cleaning up the object tree >>> stage 2.2: rebuilding the object tree >>> stage 2.3: build tools >>> stage 3: cross tools >>> stage 4.1: building includes >>> stage 4.2: building libraries >>> stage 4.3: make dependencies >>> stage 4.4: building everything [...] cc -O2 -pipe -DHAVE_CONFIG_H -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/lib -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/src -c /tinderbox/CURRENT/sparc64/sparc64/src/contrib/tar/lib/exclude.c cc -O2 -pipe -DHAVE_CONFIG_H -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/lib -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/src -c /tinderbox/CURRENT/sparc64/sparc64/src/contrib/tar/lib/full-write.c cc -O2 -pipe -DHAVE_CONFIG_H -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/lib -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/src -c /tinderbox/CURRENT/sparc64/sparc64/src/contrib/tar/lib/getdate.c cc -O2 -pipe -DHAVE_CONFIG_H -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/lib -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/src -c /tinderbox/CURRENT/sparc64/sparc64/src/contrib/tar/lib/getline.c cc -O2 -pipe -DHAVE_CONFIG_H -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/lib -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/src -c /tinderbox/CURRENT/sparc64/sparc64/src/contrib/tar/lib/getstr.c cc -O2 -pipe -DHAVE_CONFIG_H -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/lib -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/src -c /tinderbox/CURRENT/sparc64/sparc64/src/contrib/tar/lib/hash.c {standard input}: Assembler messages: {standard input}:1283: Error: Illegal operands *** Error code 1 Stop in /tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar. *** Error code 1 Stop in /tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin. *** Error code 1 Stop in /tinderbox/CURRENT/sparc64/sparc64/src/gnu. *** Error code 1 Stop in /tinderbox/CURRENT/sparc64/sparc64/src. *** Error code 1 Stop in /tinderbox/CURRENT/sparc64/sparc64/src. *** Error code 1 Stop in /tinderbox/CURRENT/sparc64/sparc64/src. TB --- 2004-06-29 15:28:24 - WARNING: /usr/bin/make returned exit code 1 TB --- 2004-06-29 15:28:24 - ERROR: failed to build world TB --- 2004-06-29 15:28:24 - tinderbox aborted From owner-freebsd-sparc64@FreeBSD.ORG Wed Jun 30 14:56:50 2004 Return-Path: Delivered-To: freebsd-sparc64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E492A16A4CE; Wed, 30 Jun 2004 14:56:49 +0000 (GMT) Received: from smtp3.sentex.ca (smtp3.sentex.ca [64.7.153.18]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7363743D1F; Wed, 30 Jun 2004 14:56:49 +0000 (GMT) (envelope-from tinderbox@freebsd.org) Received: from smtp2.sentex.ca (smtp2c.sentex.ca [64.7.153.30]) by smtp3.sentex.ca (8.12.11/8.12.11) with ESMTP id i5UEu9Q1018245; Wed, 30 Jun 2004 10:56:09 -0400 (EDT) (envelope-from tinderbox@freebsd.org) Received: from freebsd-current.sentex.ca (freebsd-current.sentex.ca [64.7.128.98]) by smtp2.sentex.ca (8.12.11/8.12.11) with ESMTP id i5UEuB1d061245; Wed, 30 Jun 2004 10:56:11 -0400 (EDT) (envelope-from tinderbox@freebsd.org) Received: by freebsd-current.sentex.ca (Postfix, from userid 666) id 2387D7303F; Wed, 30 Jun 2004 10:56:11 -0400 (EDT) Sender: FreeBSD Tinderbox From: FreeBSD Tinderbox To: FreeBSD Tinderbox , , Precedence: bulk Message-Id: <20040630145611.2387D7303F@freebsd-current.sentex.ca> Date: Wed, 30 Jun 2004 10:56:11 -0400 (EDT) Subject: [current tinderbox] failure on sparc64/sparc64 X-BeenThere: freebsd-sparc64@freebsd.org X-Mailman-Version: 2.1.1 List-Id: Porting FreeBSD to the Sparc List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jun 2004 14:56:50 -0000 TB --- 2004-06-30 14:13:26 - tinderbox 2.3 running on freebsd-current.sentex.ca TB --- 2004-06-30 14:13:26 - starting CURRENT tinderbox run for sparc64/sparc64 TB --- 2004-06-30 14:13:26 - checking out the source tree TB --- 2004-06-30 14:13:26 - cd /home/tinderbox/sandbox/CURRENT/sparc64/sparc64 TB --- 2004-06-30 14:13:26 - /usr/bin/cvs -f -R -q -d/home/ncvs update -Pd -A src TB --- 2004-06-30 14:15:15 - building world (CFLAGS=-O2 -pipe) TB --- 2004-06-30 14:15:15 - cd /home/tinderbox/sandbox/CURRENT/sparc64/sparc64/src TB --- 2004-06-30 14:15:15 - /usr/bin/make -B buildworld >>> Rebuilding the temporary build tree >>> stage 1.1: legacy release compatibility shims >>> stage 1.2: bootstrap tools >>> stage 2.1: cleaning up the object tree >>> stage 2.2: rebuilding the object tree >>> stage 2.3: build tools >>> stage 3: cross tools >>> stage 4.1: building includes >>> stage 4.2: building libraries >>> stage 4.3: make dependencies >>> stage 4.4: building everything [...] cc -O2 -pipe -DHAVE_CONFIG_H -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/lib -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/src -c /tinderbox/CURRENT/sparc64/sparc64/src/contrib/tar/lib/exclude.c cc -O2 -pipe -DHAVE_CONFIG_H -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/lib -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/src -c /tinderbox/CURRENT/sparc64/sparc64/src/contrib/tar/lib/full-write.c cc -O2 -pipe -DHAVE_CONFIG_H -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/lib -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/src -c /tinderbox/CURRENT/sparc64/sparc64/src/contrib/tar/lib/getdate.c cc -O2 -pipe -DHAVE_CONFIG_H -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/lib -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/src -c /tinderbox/CURRENT/sparc64/sparc64/src/contrib/tar/lib/getline.c cc -O2 -pipe -DHAVE_CONFIG_H -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/lib -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/src -c /tinderbox/CURRENT/sparc64/sparc64/src/contrib/tar/lib/getstr.c cc -O2 -pipe -DHAVE_CONFIG_H -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/lib -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/src -c /tinderbox/CURRENT/sparc64/sparc64/src/contrib/tar/lib/hash.c {standard input}: Assembler messages: {standard input}:1283: Error: Illegal operands *** Error code 1 Stop in /tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar. *** Error code 1 Stop in /tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin. *** Error code 1 Stop in /tinderbox/CURRENT/sparc64/sparc64/src/gnu. *** Error code 1 Stop in /tinderbox/CURRENT/sparc64/sparc64/src. *** Error code 1 Stop in /tinderbox/CURRENT/sparc64/sparc64/src. *** Error code 1 Stop in /tinderbox/CURRENT/sparc64/sparc64/src. TB --- 2004-06-30 14:56:11 - WARNING: /usr/bin/make returned exit code 1 TB --- 2004-06-30 14:56:11 - ERROR: failed to build world TB --- 2004-06-30 14:56:11 - tinderbox aborted From owner-freebsd-sparc64@FreeBSD.ORG Wed Jun 30 18:42:57 2004 Return-Path: Delivered-To: freebsd-sparc64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EC59E16A4CE for ; Wed, 30 Jun 2004 18:42:57 +0000 (GMT) Received: from electra.cse.Buffalo.EDU (electra.cse.Buffalo.EDU [128.205.32.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8A4ED43D46 for ; Wed, 30 Jun 2004 18:42:57 +0000 (GMT) (envelope-from kensmith@cse.Buffalo.EDU) Received: from electra.cse.Buffalo.EDU (kensmith@localhost [127.0.0.1]) i5UIgb2n018612 for ; Wed, 30 Jun 2004 14:42:37 -0400 (EDT) Received: (from kensmith@localhost) by electra.cse.Buffalo.EDU (8.12.10/8.12.9/Submit) id i5UIgb0L018611 for freebsd-sparc64@freebsd.org; Wed, 30 Jun 2004 14:42:37 -0400 (EDT) Date: Wed, 30 Jun 2004 14:42:37 -0400 From: Ken Smith To: freebsd-sparc64@freebsd.org Message-ID: <20040630184237.GA18402@electra.cse.Buffalo.EDU> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.1i Subject: Snapshot - still working on it... X-BeenThere: freebsd-sparc64@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting FreeBSD to the Sparc List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jun 2004 18:42:58 -0000 Just so you know, I didn't forget about generating a new snapshot. I've just made two mistakes in a row that did enough dammage to require restarts. And if you think 'make buildworld' takes a while on sparc64 try 'make release' some time... :-) Third attempt is running now, hopefully third time is a charm. :-) Sorry for the delay. [ Garance, your suggestion about including cvsup was a good one, I'll include it along with perl in the ISO. ] -- Ken Smith - From there to here, from here to | kensmith@cse.buffalo.edu there, funny things are everywhere. | - Theodore Geisel | From owner-freebsd-sparc64@FreeBSD.ORG Thu Jul 1 03:49:32 2004 Return-Path: Delivered-To: freebsd-sparc64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B073C16A4CE for ; Thu, 1 Jul 2004 03:49:32 +0000 (GMT) Received: from ox.eicat.ca (ox.eicat.ca [66.96.30.35]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7498243D2F for ; Thu, 1 Jul 2004 03:49:32 +0000 (GMT) (envelope-from Mykel@mWare.ca) Received: from mWare.ca (H6.C18.B96.tor.eicat.ca [66.96.18.6]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ox.eicat.ca (Postfix) with ESMTP id 9A65DBD6A; Wed, 30 Jun 2004 23:49:28 -0400 (EDT) Message-ID: <40E389C6.3060001@mWare.ca> Date: Wed, 30 Jun 2004 23:49:26 -0400 From: Mykel User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040123 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Ken Smith References: <20040630184237.GA18402@electra.cse.Buffalo.EDU> In-Reply-To: <20040630184237.GA18402@electra.cse.Buffalo.EDU> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit cc: freebsd-sparc64@freebsd.org Subject: Re: Snapshot - still working on it... X-BeenThere: freebsd-sparc64@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting FreeBSD to the Sparc List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Jul 2004 03:49:32 -0000 I think there's a SCSI problem... Seagate/Exabyte Mammoth M2 (8900) UW with an SE terminator, I get: panic: trap: fast data access mmu miss cpuid = 0; Debugger("panic") Stopped at Debugger+0x1c: ta %xcc, 1 db> Ken Smith wrote: >Just so you know, I didn't forget about generating a new snapshot. >I've just made two mistakes in a row that did enough dammage to >require restarts. And if you think 'make buildworld' takes a while >on sparc64 try 'make release' some time... :-) > >Third attempt is running now, hopefully third time is a charm. :-) >Sorry for the delay. > >[ Garance, your suggestion about including cvsup was a good one, >I'll include it along with perl in the ISO. ] > > > From owner-freebsd-sparc64@FreeBSD.ORG Thu Jul 1 09:33:13 2004 Return-Path: Delivered-To: freebsd-sparc64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 67F2F16A4CE for ; Thu, 1 Jul 2004 09:33:13 +0000 (GMT) Received: from ns.kt-is.co.kr (ns.kt-is.co.kr [211.218.149.125]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6AECA43D54 for ; Thu, 1 Jul 2004 09:33:12 +0000 (GMT) (envelope-from yongari@kt-is.co.kr) Received: from michelle.kt-is.co.kr (ns2.kt-is.co.kr [220.76.118.193]) (authenticated bits=128) by ns.kt-is.co.kr (8.12.10/8.12.10) with ESMTP id i619USAh026845 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Thu, 1 Jul 2004 18:30:28 +0900 (KST) Received: from michelle.kt-is.co.kr (localhost.kt-is.co.kr [127.0.0.1]) by michelle.kt-is.co.kr (8.12.10/8.12.10) with ESMTP id i619WQ7S012913 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 1 Jul 2004 18:32:26 +0900 (KST) (envelope-from yongari@kt-is.co.kr) Received: (from yongari@localhost) by michelle.kt-is.co.kr (8.12.10/8.12.10/Submit) id i619WPD4012912 for sparc64@freebsd.org; Thu, 1 Jul 2004 18:32:25 +0900 (KST) (envelope-from yongari@kt-is.co.kr) Date: Thu, 1 Jul 2004 18:32:25 +0900 From: Pyun YongHyeon To: sparc64@freebsd.org Message-ID: <20040701093225.GA12517@kt-is.co.kr> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="/9DWx/yDrRhgMJTb" Content-Disposition: inline User-Agent: Mutt/1.4.1i X-Filter-Version: 1.11a (ns.kt-is.co.kr) Subject: pcm sound driver for SBus Ultra1/Ultra2 X-BeenThere: freebsd-sparc64@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: yongari@kt-is.co.kr List-Id: Porting FreeBSD to the Sparc List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Jul 2004 09:33:13 -0000 --/9DWx/yDrRhgMJTb Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hello All, I don't know how may users want to hear sound on Ultra1/Ultra2. But I wanted to hear some music while 'build world' is in progress. 1. The driver is based on OpenBSD's driver and ISA mss driver on FreeBSD. 2. Supports onboard CS4231A chip on SBus Ultra1/Ultra2. 3. Capture(recodring) was not tested at all. - I don't have microphone. 4. Due to lack of programming information for APC DMA, I used existing interfaces of OpenBSD driver. So it may have some bugs on FreeBSD. 5. Full-duplex mode doesn't work. 6. You may notice some noise when you work on ofw console. I don't know what is the reason, atm. 7. Due to lack of X supports, I could't test with xmms or GUI based audio tools. 8. If you have PCI/EBus based sparcs, they are not supported. Yes, they use the same chip but have different DMA interface. In addition, I don't have PCI/EBus based sparcs. Installation 1. get the driver patch file and fetch your system 2. build kernel and kernel modules 3. load snd_cs4231.ko and play Note, you may want to mute speaker output with mixer(8). The attached patch is for -CURRENT, and is also available at: http://www.kr.freebsd.org/~yongari/cs4231.freebsd.diff Corrections, suggestions welcome. Thanks. Regards, Pyun YongHyeon -- Pyun YongHyeon --/9DWx/yDrRhgMJTb Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="cs4231.freebsd.diff" --- sys/dev/sound/isa/sndbuf_dma.c.orig Mon Sep 8 01:28:02 2003 +++ sys/dev/sound/isa/sndbuf_dma.c Tue Jun 29 12:47:14 2004 @@ -30,6 +30,44 @@ SND_DECLARE_FILE("$FreeBSD: src/sys/dev/sound/isa/sndbuf_dma.c,v 1.2 2003/09/07 16:28:02 cg Exp $"); +#ifdef __sparc64__ +/* + * XXX + * Sparc64 don't have ISA bus. Temp. glue code to load pcm module. + * pcm(4) should be architecture independent. + */ +int +sndbuf_dmasetup(struct snd_dbuf *b, struct resource *drq) +{ + return (0); +} + +int +sndbuf_dmasetdir(struct snd_dbuf *b, int dir) +{ + return (0); +} + +void +sndbuf_dma(struct snd_dbuf *b, int go) +{ + return; +} + +int +sndbuf_dmaptr(struct snd_dbuf *b) +{ + return (0); +} + +void +sndbuf_dmabounce(struct snd_dbuf *b) +{ + return; +} + +#else + int sndbuf_dmasetup(struct snd_dbuf *b, struct resource *drq) { @@ -101,3 +139,4 @@ /* tell isa_dma to bounce data in/out */ } +#endif --- /dev/null Thu Jul 1 18:00:00 2004 +++ sys/dev/sound/sbus/apcdmareg.h Wed Jun 30 18:26:26 2004 @@ -0,0 +1,113 @@ +/* $OpenBSD: apcdmareg.h,v 1.2 2003/06/02 18:53:18 jason Exp $ */ + +/* + * Copyright (c) 2001 Jason L. Wright (jason@thought.net) + * All rights reserved. + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. + */ + +/* + * Definitions for Sun APC DMA controller. + */ + +/* APC DMA registers */ +#define APC_CSR 0x0010 /* control/status */ +#define APC_CVA 0x0020 /* capture virtual address */ +#define APC_CC 0x0024 /* capture count */ +#define APC_CNVA 0x0028 /* capture next virtual address */ +#define APC_CNC 0x002c /* capture next count */ +#define APC_PVA 0x0030 /* playback virtual address */ +#define APC_PC 0x0034 /* playback count */ +#define APC_PNVA 0x0038 /* playback next virtual address */ +#define APC_PNC 0x003c /* playback next count */ + +/* + * APC DMA Register definitions + */ +#define APC_CSR_RESET 0x00000001 /* reset */ +#define APC_CSR_CDMA_GO 0x00000004 /* capture dma go */ +#define APC_CSR_PDMA_GO 0x00000008 /* playback dma go */ +#define APC_CSR_CODEC_RESET 0x00000020 /* codec reset */ +#define APC_CSR_CPAUSE 0x00000040 /* capture dma pause */ +#define APC_CSR_PPAUSE 0x00000080 /* playback dma pause */ +#define APC_CSR_CMIE 0x00000100 /* capture pipe empty enb */ +#define APC_CSR_CMI 0x00000200 /* capture pipe empty intr */ +#define APC_CSR_CD 0x00000400 /* capture nva dirty */ +#define APC_CSR_CM 0x00000800 /* capture data lost */ +#define APC_CSR_PMIE 0x00001000 /* pb pipe empty intr enable */ +#define APC_CSR_PD 0x00002000 /* pb nva dirty */ +#define APC_CSR_PM 0x00004000 /* pb pipe empty */ +#define APC_CSR_PMI 0x00008000 /* pb pipe empty interrupt */ +#define APC_CSR_EIE 0x00010000 /* error interrupt enable */ +#define APC_CSR_CIE 0x00020000 /* capture intr enable */ +#define APC_CSR_PIE 0x00040000 /* playback intr enable */ +#define APC_CSR_GIE 0x00080000 /* general intr enable */ +#define APC_CSR_EI 0x00100000 /* error interrupt */ +#define APC_CSR_CI 0x00200000 /* capture interrupt */ +#define APC_CSR_PI 0x00400000 /* playback interrupt */ +#define APC_CSR_GI 0x00800000 /* general interrupt */ + +#define APC_CSR_PLAY ( \ + APC_CSR_EI | \ + APC_CSR_GIE | \ + APC_CSR_PIE | \ + APC_CSR_EIE | \ + APC_CSR_PDMA_GO | \ + APC_CSR_PMIE ) + +#define APC_CSR_CAPTURE ( \ + APC_CSR_EI | \ + APC_CSR_GIE | \ + APC_CSR_CIE | \ + APC_CSR_EIE | \ + APC_CSR_CDMA_GO ) + +#define APC_CSR_PLAY_PAUSE (~( \ + APC_CSR_PPAUSE | \ + APC_CSR_GI | \ + APC_CSR_PI | \ + APC_CSR_CI | \ + APC_CSR_EI | \ + APC_CSR_PMI | \ + APC_CSR_PMIE | \ + APC_CSR_CMI | \ + APC_CSR_CMIE ) ) + +#define APC_CSR_CAPTURE_PAUSE (~( \ + APC_CSR_PPAUSE | \ + APC_CSR_GI | \ + APC_CSR_PI | \ + APC_CSR_CI | \ + APC_CSR_EI | \ + APC_CSR_PMI | \ + APC_CSR_PMIE | \ + APC_CSR_CMI | \ + APC_CSR_CMIE ) ) + +#define APC_CSR_INTR_MASK ( \ + APC_CSR_GI | \ + APC_CSR_PI | \ + APC_CSR_CI | \ + APC_CSR_EI | \ + APC_CSR_PMI | \ + APC_CSR_CMI ) --- /dev/null Thu Jul 1 18:00:00 2004 +++ sys/dev/sound/sbus/cs4231.c Thu Jul 1 18:02:22 2004 @@ -0,0 +1,1030 @@ +/* + * Copyright (c) 1999 Jason L. Wright (jason@thought.net) + * Copyright (c) 2004 Pyun YongHyeon + * All rights reserved. + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. + * + * Effort sponsored in part by the Defense Advanced Research Projects + * Agency (DARPA) and Air Force Research Laboratory, Air Force + * Materiel Command, USAF, under agreement number F30602-01-2-0537. + * + * from: OpenBSD: cs4231.c,v 1.21 2003/07/03 20:36:07 jason Exp + */ + +/* + * Driver for CS4231 based audio found in some sun4m systems (cs4231) + * based on ideas from the S/Linux project and the NetBSD project. + */ +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include "mixer_if.h" + +/* + * This driver is for Sbus based sparcs(Ultra1 and Ultra2). If you have + * PCI/EBus based sparcs it is not supported by this driver. + * (We need another driver for those systems. Yes, they use the same chip + * cs4231A, but has different DMA engine and I don't have PCI/EBus based + * sparcs. + * Mixer routines were copied from ISA mss driver and modified. + * + * Though, cs4231 says it supports full-duplex mode, I doubt it due to + * lack of independent sampling frequency register. In addition, I can't + * find any documentation of Sun APC DMA programming information. I guessed + * the usage of APC DMA from existing OpenBSD's driver. + * + * Audio capture(recording) was not tested at all and may have bugs. + * Sorry, I don't have microphone. Don't try to use full-duplex mode. + * It wouldn't work. + */ +#define CS_TIMEOUT 90000 + +#define CS4231_MIN_BUF_SZ (8*1024) +#define CS4231_DEFAULT_BUF_SZ (32*1024) +#define CS4231_MAX_BUF_SZ (64*1024) +/* It seems that 4KB is the best value. */ +#define CS4231_MAX_DMA_SZ (4*1024) + + +#undef CS4231_DEBUG +#ifdef CS4231_DEBUG +#define DPRINTF(x) printf x +#else +#define DPRINTF(x) +#endif + +struct cs4231_softc; + +struct cs4231_channel { + struct cs4231_softc *parent; + struct pcm_channel *channel; + struct snd_dbuf *buffer; + int dir; + int locked; +}; + +struct cs4231_softc { + struct device *sc_dev; + int sc_rid; + struct resource *sc_res; + bus_space_handle_t sc_regh; + bus_space_tag_t sc_regt; + + int sc_irqrid; + struct resource *sc_irqres; + void *sc_ih; + bus_dma_tag_t sc_dmat; + u_int32_t sc_bufsz; + struct cs4231_channel sc_pch; + struct cs4231_channel sc_rch; + int sc_enabled; + struct mtx *sc_lock; +}; + +static int cs4231_sbus_probe(device_t); +static int cs4231_sbus_attach(device_t); +static int cs4231_sbus_detach(device_t); +static int cs4231_sbus_suspend(device_t); +static int cs4231_sbus_resume(device_t); +static void cs4231_free_resource(struct cs4231_softc *); +static void cs4231_power_reset(struct cs4231_softc *); +static int cs4231_enable(struct cs4231_softc *); +static void cs4231_disable(struct cs4231_softc *); +static void cs4231_write(struct cs4231_softc *, u_int8_t, u_int8_t); +static u_int8_t cs4231_read(struct cs4231_softc *, u_int8_t); +static void cs4231_intr(void *); +static int cs4231_mixer_init(struct snd_mixer *); +static void change_bits(mixer_tab *, u_int8_t *, u_int32_t, u_int32_t, + u_int32_t); +static int cs4231_mixer_set(struct snd_mixer *, u_int32_t, u_int32_t, + u_int32_t); +static int cs4231_mixer_setrecsrc(struct snd_mixer *, u_int32_t); +static void *cs4231_chan_init(kobj_t, void *, struct snd_dbuf *, + struct pcm_channel *, int); +static int cs4231_chan_setformat(kobj_t, void *, u_int32_t); +static int cs4231_chan_setspeed(kobj_t, void *, u_int32_t); +static void cs4231_chan_fs(struct cs4231_softc *, u_int8_t); +static int cs4231_chan_setblocksize(kobj_t, void *, u_int32_t); +static int cs4231_chan_trigger(kobj_t, void *, int); +static int cs4231_chan_getptr(kobj_t, void *); +static struct pcmchan_caps * + cs4231_chan_getcaps(kobj_t, void *); +static void cs4231_trigger(struct cs4231_channel *); +static void cs4231_halt(struct cs4231_channel *); + +#define CS4231_LOCK(sc) snd_mtxlock(sc->sc_lock) +#define CS4231_UNLOCK(sc) snd_mtxunlock(sc->sc_lock) +#define CS4231_LOCK_ASSERT(sc) snd_mtxassert(sc->sc_lock) + +#define CS_WRITE(sc,r,v) \ + bus_space_write_1((sc)->sc_regt, (sc)->sc_regh, (r) << 2, (v)) +#define CS_READ(sc,r) \ + bus_space_read_1((sc)->sc_regt, (sc)->sc_regh, (r) << 2) + +#define APC_WRITE(sc,r,v) \ + bus_space_write_4(sc->sc_regt, sc->sc_regh, r, v) +#define APC_READ(sc,r) \ + bus_space_read_4(sc->sc_regt, sc->sc_regh, r) + +static device_method_t cs4231_sbus_methods[] = { + DEVMETHOD(device_probe, cs4231_sbus_probe), + DEVMETHOD(device_attach, cs4231_sbus_attach), + DEVMETHOD(device_detach, cs4231_sbus_detach), + DEVMETHOD(device_suspend, cs4231_sbus_suspend), + DEVMETHOD(device_resume, cs4231_sbus_resume), + {0, 0} +}; + +static driver_t cs4231_sbus_driver = { + "pcm", + cs4231_sbus_methods, + PCM_SOFTC_SIZE +}; + +DRIVER_MODULE(snd_cs4231, sbus, cs4231_sbus_driver, pcm_devclass, 0, 0); +MODULE_DEPEND(snd_cs4231, snd_pcm, PCM_MINVER, PCM_PREFVER, PCM_MAXVER); +MODULE_VERSION(snd_cs4231, 1); + + +static u_int32_t cs4231_fmt[] = { + AFMT_U8, + AFMT_STEREO | AFMT_U8, + AFMT_S16_LE, + AFMT_STEREO | AFMT_S16_LE, + AFMT_MU_LAW, + AFMT_STEREO | AFMT_MU_LAW, + AFMT_A_LAW, + AFMT_STEREO | AFMT_A_LAW, + 0 +}; + +static struct pcmchan_caps cs4231_caps = {5510, 48000, cs4231_fmt, 0}; + +/* + * pcm(4) channel interface + */ +static kobj_method_t cs4231_chan_methods[] = { + KOBJMETHOD(channel_init, cs4231_chan_init), + KOBJMETHOD(channel_setformat, cs4231_chan_setformat), + KOBJMETHOD(channel_setspeed, cs4231_chan_setspeed), + KOBJMETHOD(channel_setblocksize, cs4231_chan_setblocksize), + KOBJMETHOD(channel_trigger, cs4231_chan_trigger), + KOBJMETHOD(channel_getptr, cs4231_chan_getptr), + KOBJMETHOD(channel_getcaps, cs4231_chan_getcaps), + { 0, 0 } +}; +CHANNEL_DECLARE(cs4231_chan); + +/* + * pcm(4) mixer interface + */ +static mixer_ent cs4231_mix_devices[32][2] = { + MIX_NONE(SOUND_MIXER_VOLUME), + MIX_NONE(SOUND_MIXER_BASS), + MIX_NONE(SOUND_MIXER_TREBLE), + /* AUX1 */ + MIX_ENT(SOUND_MIXER_SYNTH, 2, 1, 0, 5, 3, 1, 0, 5), + MIX_ENT(SOUND_MIXER_PCM, 6, 1, 0, 6, 7, 1, 0, 6), + MIX_ENT(SOUND_MIXER_SPEAKER, 26, 1, 0, 4, 0, 0, 0, 0), + MIX_ENT(SOUND_MIXER_LINE, 18, 1, 0, 5, 19, 1, 0, 5), + MIX_ENT(SOUND_MIXER_MIC, 0, 0, 5, 1, 1, 0, 5, 1), + /* + * XXX + * AUX2 : Ultra1/Ultra2 has no internal CD-ROM audio in + */ + MIX_ENT(SOUND_MIXER_CD, 4, 1, 0, 5, 5, 1, 0, 5), + MIX_ENT(SOUND_MIXER_IMIX, 13, 1, 2, 6, 0, 0, 0, 0), + MIX_NONE(SOUND_MIXER_ALTPCM), + MIX_NONE(SOUND_MIXER_RECLEV), + MIX_ENT(SOUND_MIXER_IGAIN, 0, 0, 0, 4, 1, 0, 0, 4), + MIX_NONE(SOUND_MIXER_OGAIN), + MIX_NONE(SOUND_MIXER_LINE1), + MIX_NONE(SOUND_MIXER_LINE2), + MIX_NONE(SOUND_MIXER_LINE3), +}; + +static kobj_method_t cs4231_mixer_methods[] = { + KOBJMETHOD(mixer_init, cs4231_mixer_init), + KOBJMETHOD(mixer_set, cs4231_mixer_set), + KOBJMETHOD(mixer_setrecsrc, cs4231_mixer_setrecsrc), + { 0, 0 } +}; +MIXER_DECLARE(cs4231_mixer); + +static int +cs4231_sbus_probe(device_t dev) +{ + char *name; + + name = sbus_get_name(dev); + if (strcmp("SUNW,CS4231", name) == 0) { + device_set_desc(dev, "Sun Audiocs CS4231A"); + return (0); + } + + return (ENXIO); +} + +static int +cs4231_sbus_attach(device_t dev) +{ + struct snddev_info *d; + struct cs4231_softc *sc; + char status[SND_STATUSLEN]; + + d = device_get_softc(dev); + sc = malloc(sizeof(struct cs4231_softc), M_DEVBUF, M_NOWAIT | M_ZERO); + if (sc == NULL) { + device_printf(dev, "cannot allocate softc\n"); + } + sc->sc_dev = dev; + sc->sc_lock = snd_mtxcreate(device_get_nameunit(sc->sc_dev), + "sound softc"); + + sc->sc_rid = 0; + if ((sc->sc_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, + &sc->sc_rid, RF_ACTIVE)) == NULL) { + device_printf(dev, "cannot map registers\n"); + return (ENXIO); + } + sc->sc_regt = rman_get_bustag(sc->sc_res); + sc->sc_regh = rman_get_bushandle(sc->sc_res); + sc->sc_irqrid = 0; + if ((sc->sc_irqres = bus_alloc_resource_any(sc->sc_dev, SYS_RES_IRQ, + &sc->sc_irqrid, RF_SHAREABLE | RF_ACTIVE)) == NULL) { + device_printf(sc->sc_dev, "cannot allocate interrupt\n"); + goto fail; + } + if (snd_setup_intr(sc->sc_dev, sc->sc_irqres, + INTR_MPSAFE, cs4231_intr, sc, &sc->sc_ih)) { + device_printf(sc->sc_dev, "cannot set up interrupt\n"); + goto fail; + } + + sc->sc_bufsz = pcm_getbuffersize(sc->sc_dev, CS4231_MIN_BUF_SZ, + CS4231_DEFAULT_BUF_SZ, CS4231_MAX_BUF_SZ); + if (bus_dma_tag_create( + NULL, /* parent */ + 64*1024, 0, /* alignment, boundary */ + BUS_SPACE_MAXADDR_32BIT,/* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filtfunc, filtfuncarg */ + sc->sc_bufsz, /* maxsize */ + 1, /* nsegments */ + sc->sc_bufsz, /* maxsegsz */ + BUS_DMA_ALLOCNOW, /* flags */ + NULL, /* lockfunc */ + NULL, /* lockfuncarg */ + &sc->sc_dmat)) { + device_printf(sc->sc_dev, "cannot allocate parent DMA tag\n"); + goto fail; + } + cs4231_enable(sc); + mixer_init(sc->sc_dev, &cs4231_mixer_class, sc); + if (pcm_register(sc->sc_dev, sc, 1, 1)) { + device_printf(sc->sc_dev, "cannot register to pcm\n"); + goto fail; + } + pcm_addchan(sc->sc_dev, PCMDIR_REC, &cs4231_chan_class, sc); + pcm_addchan(sc->sc_dev, PCMDIR_PLAY, &cs4231_chan_class, sc); + snprintf(status, SND_STATUSLEN, "at mem 0x%lx irq %ld bufsz %u", + rman_get_start(sc->sc_res), rman_get_start(sc->sc_irqres), + sc->sc_bufsz); + pcm_setstatus(sc->sc_dev, status); + + return (0); + +fail: + cs4231_free_resource(sc); + return (ENXIO); +} + +static int +cs4231_sbus_detach(device_t dev) +{ + struct cs4231_softc *sc; + int error; + + error = pcm_unregister(dev); + if (error) + return (error); + + sc = pcm_getdevinfo(dev); + cs4231_free_resource(sc); + + return (0); +} + +static int +cs4231_sbus_suspend(device_t dev) +{ + + return (ENXIO); +} + +static int +cs4231_sbus_resume(device_t dev) +{ + + return (ENXIO); +} + +static void +cs4231_power_reset(struct cs4231_softc *sc) +{ + + int i; + + APC_WRITE(sc, APC_CSR, APC_CSR_RESET); + DELAY(10); + APC_WRITE(sc, APC_CSR, 0); + DELAY(10); + APC_WRITE(sc, APC_CSR, APC_READ(sc, APC_CSR) | APC_CSR_CODEC_RESET); + DELAY(20); + APC_WRITE(sc, APC_CSR, APC_READ(sc, APC_CSR) & (~APC_CSR_CODEC_RESET)); + + for (i = CS_TIMEOUT; + i && CS_READ(sc, CS4231_IADDR) == CS_IN_INIT; i--) + DELAY(10); + if (i == 0) + device_printf(sc->sc_dev, "timeout waiting for reset\n"); + + /* Turn on cs4231 mode */ + cs4231_write(sc, CS_MISC_INFO, + cs4231_read(sc, CS_MISC_INFO) | CS_MODE2); + cs4231_write(sc, CS_PIN_CONTROL, + cs4231_read(sc, CS_PIN_CONTROL) | INTERRUPT_ENABLE); +} + +static int +cs4231_enable(struct cs4231_softc *sc) +{ + cs4231_power_reset(sc); + sc->sc_enabled = 1; + return (0); + +} + +static void +cs4231_disable(struct cs4231_softc *sc) +{ + u_int8_t v; + + if (sc->sc_enabled == 0) + return; + + cs4231_halt(&sc->sc_pch); + cs4231_halt(&sc->sc_rch); + v = cs4231_read(sc, CS_PIN_CONTROL) & ~INTERRUPT_ENABLE; + cs4231_write(sc, CS_PIN_CONTROL, v); + + /* reset APC */ + APC_WRITE(sc, APC_CSR, APC_CSR_RESET); + DELAY(10); + APC_WRITE(sc, APC_CSR, 0); + DELAY(10); + sc->sc_enabled = 0; +} + +static void +cs4231_free_resource(struct cs4231_softc *sc) +{ + cs4231_disable(sc); + if (sc->sc_irqres) { + if (sc->sc_ih) { + bus_teardown_intr(sc->sc_dev, sc->sc_irqres, + sc->sc_ih); + sc->sc_ih = NULL; + } + bus_release_resource(sc->sc_dev, SYS_RES_IRQ, sc->sc_irqrid, + sc->sc_irqres); + sc->sc_irqres = NULL; + } + if (sc->sc_dmat) + bus_dma_tag_destroy(sc->sc_dmat); + if (sc->sc_res) + bus_release_resource(sc->sc_dev, SYS_RES_MEMORY, sc->sc_rid, + sc->sc_res); + if (sc->sc_lock) + snd_mtxfree(sc->sc_lock); + free(sc, M_DEVBUF); +} + +static void +cs4231_write(struct cs4231_softc *sc, u_int8_t r, u_int8_t v) +{ + CS_WRITE(sc, CS4231_IADDR, r); + CS_WRITE(sc, CS4231_IDATA, v); +} + +static u_int8_t +cs4231_read(struct cs4231_softc *sc, u_int8_t r) +{ + CS_WRITE(sc, CS4231_IADDR, r); + return (CS_READ(sc, CS4231_IDATA)); +} + +static void +cs4231_intr(void *arg) +{ + struct cs4231_softc *sc; + struct cs4231_channel *ch; + u_int32_t csr; + u_int8_t reg, status; + + sc = arg; + CS4231_LOCK(sc); + + csr = APC_READ(sc, APC_CSR); + if ((csr & APC_CSR_GI) == 0) { + CS4231_UNLOCK(sc); + return; + } + APC_WRITE(sc, APC_CSR, csr); + + if ((csr & APC_CSR_EIE) && (csr & APC_CSR_EI)) { + status = cs4231_read(sc, CS_TEST_AND_INIT); + device_printf(sc->sc_dev, + "apc error interrupt : stat = 0x%x\n", status); + } + + if ((csr & APC_CSR_GIE) && (csr & APC_CSR_GI)) { + /* general interrupt */ + status = CS_READ(sc, CS4231_STATUS); + if (status & (INTERRUPT_STATUS | SAMPLE_ERROR)) { + reg = cs4231_read(sc, CS_IRQ_STATUS); + if (reg & CS_AFS_PI) { + cs4231_write(sc, CS_LOWER_BASE_COUNT, 0xff); + cs4231_write(sc, CS_UPPER_BASE_COUNT, 0xff); + } + if (reg & CS_AFS_CI) { + cs4231_write(sc, CS_LOWER_REC_CNT, 0xff); + cs4231_write(sc, CS_UPPER_REC_CNT, 0xff); + } + CS_WRITE(sc, CS4231_STATUS, 0); + } + } + + if ((csr & APC_CSR_PMIE) && (csr & APC_CSR_PMI)) { + u_long nextaddr, saddr; + u_int32_t togo; + + ch = &sc->sc_pch; + + CS4231_UNLOCK(sc); + chn_intr(ch->channel); + CS4231_LOCK(sc); + + togo = sndbuf_getblksz(ch->buffer); + saddr = sndbuf_getbufaddr(ch->buffer); + nextaddr = APC_READ(sc, APC_PNVA) + togo; + if (nextaddr >= saddr + sc->sc_bufsz) + nextaddr = saddr; + APC_WRITE(sc, APC_PNVA, nextaddr); + APC_WRITE(sc, APC_PNC, togo); + } + + if ((csr & APC_CSR_CIE) && (csr & APC_CSR_CI) && (csr & APC_CSR_CD)) { + u_long nextaddr, saddr; + u_int32_t togo; + + ch = &sc->sc_rch; + + CS4231_UNLOCK(sc); + chn_intr(ch->channel); + CS4231_LOCK(sc); + + togo = sndbuf_getblksz(ch->buffer); + saddr = sndbuf_getbufaddr(ch->buffer); + nextaddr = APC_READ(sc, APC_CNVA) + togo; + if (nextaddr >= saddr + sc->sc_bufsz) + nextaddr = saddr; + APC_WRITE(sc, APC_CNVA, nextaddr); + APC_WRITE(sc, APC_CNC, togo); + } + CS4231_UNLOCK(sc); +} + +static int +cs4231_mixer_init(struct snd_mixer *m) +{ + mix_setdevs(m, MODE2_MIXER_DEVICES); + mix_setrecdevs(m, MSS_REC_DEVICES); + + return (0); +} + +/* + * copied from sys/dev/sound/isa/mss.c + */ +static void +change_bits(mixer_tab *t, u_int8_t *regval, u_int32_t dev, u_int32_t chn, + u_int32_t newval) +{ + u_int8_t mask; + u_int32_t shift; + + if ((*t)[dev][chn].polarity == 1) /* reverse */ + newval = 100 - newval ; + + mask = (1 << (*t)[dev][chn].nbits) - 1; + newval = ((newval * mask) + 50) / 100; /* Scale it */ + shift = (*t)[dev][chn].bitoffs /*- (*t)[dev][LEFT_CHN].nbits + 1*/; + + *regval &= ~(mask << shift); /* Filter out the previous value */ + *regval |= (newval & mask) << shift; /* Set the new value */ +} + +/* + * copied from sys/dev/sound/isa/mss.c + */ +static int +cs4231_mixer_set(struct snd_mixer *m, u_int32_t dev, u_int32_t left, + u_int32_t right) +{ + struct cs4231_softc *sc; + mixer_tab *mix_d; + u_int8_t old, val, reg; + + sc = mix_getdevinfo(m); + CS4231_LOCK(sc); + mix_d = &cs4231_mix_devices; + if ((*mix_d)[dev][LEFT_CHN].nbits == 0) { + DEB(printf("nbits = 0 for dev %d\n", dev)); + return -1; + } + + if ((*mix_d)[dev][RIGHT_CHN].nbits == 0) + right = left; /* mono */ + + /* Set the left channel */ + reg = (*mix_d)[dev][LEFT_CHN].regno; + old = val = cs4231_read(sc, reg); + /* if volume is 0, mute chan. Otherwise, unmute. */ + if (reg != 0) { + if (reg == CS_MONO_IO_CONTROL) + val = (left == 0) ? old | MONO_OUTPUT_MUTE : old & 0xef; + else if (reg == CS_DIGITAL_MIX) + val = (left == 0) ? 0 : old & 0xfd; + else + val = (left == 0) ? old | 0x80 : old & 0x7f; + } + change_bits(mix_d, &val, dev, LEFT_CHN, left); + cs4231_write(sc, reg, val); + + if ((*mix_d)[dev][RIGHT_CHN].nbits != 0) { /* have stereo */ + /* Set the right channel */ + reg = (*mix_d)[dev][RIGHT_CHN].regno; + old = val = cs4231_read(sc, reg); + if (reg != 1) + val = (right == 0) ? old | 0x80 : old & 0x7f; + change_bits(mix_d, &val, dev, RIGHT_CHN, right); + cs4231_write(sc, reg, val); + } + CS4231_UNLOCK(sc); + + return (left | (right << 8)); +} + +static int +cs4231_mixer_setrecsrc(struct snd_mixer *m, u_int32_t src) +{ + struct cs4231_softc *sc; + u_int8_t v; + + sc = mix_getdevinfo(m); + switch(src) { + case SOUND_MASK_LINE: + case SOUND_MASK_LINE3: + v = CS_IN_LINE; + break; + + case SOUND_MASK_CD: + case SOUND_MASK_LINE1: + v = CS_IN_AUX1; + break; + + case SOUND_MASK_IMIX: + v = CS_IN_DAC; + break; + + case SOUND_MASK_MIC: + default: + v = CS_IN_MIC; + break; + } + CS4231_LOCK(sc); + cs4231_write(sc, CS_LEFT_INPUT_CONTROL, + (cs4231_read(sc, CS_LEFT_INPUT_CONTROL) & CS_IN_MASK) | v); + cs4231_write(sc, CS_RIGHT_INPUT_CONTROL, + (cs4231_read(sc, CS_RIGHT_INPUT_CONTROL) & CS_IN_MASK) | v); + CS4231_UNLOCK(sc); + + return (src); +} + +static void * +cs4231_chan_init(kobj_t obj, void *dev, struct snd_dbuf *b, + struct pcm_channel *c, int dir) +{ + struct cs4231_softc *sc; + struct cs4231_channel *ch; + + sc = dev; + ch = (dir == PCMDIR_PLAY) ? &sc->sc_pch : &sc->sc_rch; + ch->parent = sc; + ch->channel = c; + ch->dir = dir; + ch->buffer = b; + if (sndbuf_alloc(ch->buffer, sc->sc_dmat, sc->sc_bufsz) != 0) + return (NULL); + DPRINTF(("%s channel addr: %lx\n", dir == PCMDIR_PLAY ? "PLAY" : "REC", + sndbuf_getbufaddr(ch->buffer))); + return (ch); +} + +static int +cs4231_chan_setformat(kobj_t obj, void *data, u_int32_t format) +{ + struct cs4231_softc *sc; + struct cs4231_channel *ch; + u_int32_t encoding; + u_int8_t fs, v; + + ch = data; + sc = ch->parent; + + encoding = format & ~(AFMT_STEREO | AFMT_FULLDUPLEX); + fs = 0; + switch(encoding) { + case AFMT_U8: + fs = CS_AFMT_U8; + break; + case AFMT_MU_LAW: + fs = CS_AFMT_MU_LAW; + break; + case AFMT_S16_LE: + fs = CS_AFMT_S16_LE; + break; + case AFMT_A_LAW: + fs = CS_AFMT_A_LAW; + break; + case AFMT_IMA_ADPCM: + fs = CS_AFMT_IMA_ADPCM; + break; + case AFMT_U16_BE: + fs = CS_AFMT_U16_BE; + break; + default: + fs = CS_AFMT_U8; + break; + } + + if (format & AFMT_STEREO) + fs |= CS_AFMT_STEREO; + + DPRINTF(("FORMAT: %s : 0x%x\n", ch->dir == PCMDIR_PLAY ? "playback" : + "capture", format)); + CS4231_LOCK(sc); + v = cs4231_read(sc, CS_CLOCK_DATA_FORMAT); + v &= CS_CLOCK_DATA_FORMAT_MASK; + fs |= v; + cs4231_chan_fs(sc, fs); + CS4231_UNLOCK(sc); + return (0); +} + +static int +cs4231_chan_setspeed(kobj_t obj, void *data, u_int32_t speed) +{ + typedef struct { + u_int32_t speed; + u_int8_t bits; + } speed_struct; + + const static speed_struct speed_table[] = { + {5510, (0 << 1) | CLOCK_XTAL2}, + {5510, (0 << 1) | CLOCK_XTAL2}, + {6620, (7 << 1) | CLOCK_XTAL2}, + {8000, (0 << 1) | CLOCK_XTAL1}, + {9600, (7 << 1) | CLOCK_XTAL1}, + {11025, (1 << 1) | CLOCK_XTAL2}, + {16000, (1 << 1) | CLOCK_XTAL1}, + {18900, (2 << 1) | CLOCK_XTAL2}, + {22050, (3 << 1) | CLOCK_XTAL2}, + {27420, (2 << 1) | CLOCK_XTAL1}, + {32000, (3 << 1) | CLOCK_XTAL1}, + {33075, (6 << 1) | CLOCK_XTAL2}, + {33075, (4 << 1) | CLOCK_XTAL2}, + {44100, (5 << 1) | CLOCK_XTAL2}, + {48000, (6 << 1) | CLOCK_XTAL1}, + }; + + struct cs4231_softc *sc; + struct cs4231_channel *ch; + int i, n, sel; + u_int8_t fs; + + ch = data; + sc = ch->parent; + n = sizeof(speed_table) / sizeof(speed_struct); + + for (i = 1, sel =0; i < n - 1; i++) + if (abs(speed - speed_table[i].speed) < + abs(speed - speed_table[sel].speed)) + sel = i; + DPRINTF(("SPEED: %s : %dHz -> %dHz\n", ch->dir == PCMDIR_PLAY ? + "playback" : "capture", speed, speed_table[sel].speed)); + speed = speed_table[sel].speed; + + CS4231_LOCK(sc); + fs = cs4231_read(sc, CS_CLOCK_DATA_FORMAT); + fs &= ~CS_CLOCK_DATA_FORMAT_MASK; + fs |= speed_table[sel].bits; + cs4231_chan_fs(sc, fs); + CS4231_UNLOCK(sc); + return (speed); +} + +static void +cs4231_chan_fs(struct cs4231_softc *sc, u_int8_t fs) +{ + int i, doreset; + u_int8_t v; + + CS4231_LOCK_ASSERT(sc); + + /* set autocalibration */ + doreset = 0; + v = cs4231_read(sc, CS_INTERFACE_CONFIG) | AUTO_CAL_ENABLE; + CS_WRITE(sc, CS4231_IADDR, MODE_CHANGE_ENABLE); + CS_WRITE(sc, CS4231_IADDR, MODE_CHANGE_ENABLE | CS_INTERFACE_CONFIG); + CS_WRITE(sc, CS4231_IDATA, v); + + /* playback channel */ + CS_WRITE(sc, CS4231_IADDR, MODE_CHANGE_ENABLE | CS_CLOCK_DATA_FORMAT); + CS_WRITE(sc, CS4231_IDATA, fs); + CS_READ(sc, CS4231_IDATA); + CS_READ(sc, CS4231_IDATA); + for (i = CS_TIMEOUT; + i && CS_READ(sc, CS4231_IADDR) == CS_IN_INIT; i--) + DELAY(10); + if (i == 0) { + device_printf(sc->sc_dev, "timeout setting playback speed\n"); + doreset++; + } + + /* + * capture channel + * cs4231 doesn't allow sperate fs setup for playback/capture. + * I believe this will break full-duplex operation. + */ + CS_WRITE(sc, CS4231_IADDR, MODE_CHANGE_ENABLE | CS_REC_FORMAT); + CS_WRITE(sc, CS4231_IDATA, fs); + CS_READ(sc, CS4231_IDATA); + CS_READ(sc, CS4231_IDATA); + for (i = CS_TIMEOUT; + i && CS_READ(sc, CS4231_IADDR) == CS_IN_INIT; i--) + DELAY(10); + if (i == 0) { + device_printf(sc->sc_dev, "timeout setting capture format\n"); + doreset++; + } + + CS_WRITE(sc, CS4231_IADDR, 0); + for (i = CS_TIMEOUT; + i && CS_READ(sc, CS4231_IADDR) == CS_IN_INIT; i--) + DELAY(10); + if (i == 0) { + device_printf(sc->sc_dev, "timeout waiting for !MCE\n"); + doreset++; + } + CS_WRITE(sc, CS4231_IADDR, CS_TEST_AND_INIT); + + for (i = CS_TIMEOUT; + i && CS_READ(sc, CS4231_IDATA) & AUTO_CAL_IN_PROG; i--) + DELAY(10); + if (i == 0) { + device_printf(sc->sc_dev, + "timeout waiting for autocalibration\n"); + doreset++; + } + if (doreset) { + /* + * Maybe the last resort to avoid a dreadful message like + * "pcm0:play:0: play interrupt timeout, channel dead" would + * be hardware reset. + */ + device_printf(sc->sc_dev, "trying to hardware reset\n"); + cs4231_power_reset(sc); + CS4231_UNLOCK(sc); /* XXX */ + if (mixer_reinit(sc->sc_dev) == -1) + device_printf(sc->sc_dev, + "unable to reinitialize the mixer\n"); + CS4231_LOCK(sc); + } +} + +static int +cs4231_chan_setblocksize(kobj_t obj, void *data, u_int32_t blocksize) +{ + struct cs4231_softc *sc; + struct cs4231_channel *ch; + int nblks; + + ch = data; + sc = ch->parent; + + if (blocksize > CS4231_MAX_DMA_SZ) + blocksize = CS4231_MAX_DMA_SZ; + nblks = sc->sc_bufsz / blocksize; + sndbuf_resize(ch->buffer, nblks, blocksize); + + return blocksize; +} + +static int +cs4231_chan_trigger(kobj_t obj, void *data, int go) +{ + struct cs4231_channel *ch; + + ch = data; + switch(go) { + case PCMTRIG_EMLDMAWR: + case PCMTRIG_EMLDMARD: + break; + case PCMTRIG_START: + cs4231_trigger(ch); + break; + case PCMTRIG_ABORT: + case PCMTRIG_STOP: + cs4231_halt(ch); + break; + default: + break; + } + + return (0); +} + +static int +cs4231_chan_getptr(kobj_t obj, void *data) +{ + struct cs4231_softc *sc; + struct cs4231_channel *ch; + u_int32_t naddr; + int ptr, sz; + + ch = data; + sc = ch->parent; + + CS4231_LOCK(sc); + if (ch->dir == PCMDIR_PLAY) + naddr = APC_READ(sc, APC_PNVA); + else + naddr = APC_READ(sc, APC_CNVA); + sz = sndbuf_getsize(ch->buffer); + ptr = naddr + sndbuf_getblksz(ch->buffer) - + sndbuf_getbufaddr(ch->buffer); + CS4231_UNLOCK(sc); + + ptr %= sz; + return (ptr); +} + +static struct pcmchan_caps * +cs4231_chan_getcaps(kobj_t obj, void *data) +{ + return (&cs4231_caps); +} + +static void +cs4231_trigger(struct cs4231_channel *ch) +{ + struct cs4231_softc *sc; + u_int32_t csr, togo; + u_int32_t nextaddr, saddr; + + sc = ch->parent; + + CS4231_LOCK(sc); + if (ch->locked) { + device_printf(sc->sc_dev, "already triggered\n"); + CS4231_UNLOCK(sc); + return; + } + + nextaddr = sndbuf_getbufaddr(ch->buffer); + togo = sndbuf_getblksz(ch->buffer); + if (ch->dir == PCMDIR_PLAY) { + DPRINTF(("TRG: PNVA = %x, togo = %x\n", nextaddr, togo)); + + cs4231_read(sc, CS_TEST_AND_INIT); /* clear pending error */ + csr = APC_READ(sc, APC_CSR); + APC_WRITE(sc, APC_PNVA, nextaddr); + APC_WRITE(sc, APC_PNC, togo); + + if ((csr & APC_CSR_PDMA_GO) == 0 || + (csr & APC_CSR_PPAUSE) != 0) { + APC_WRITE(sc, APC_CSR, APC_READ(sc, APC_CSR) & + ~(APC_CSR_PIE | APC_CSR_PPAUSE)); + APC_WRITE(sc, APC_CSR, APC_READ(sc, APC_CSR) | + APC_CSR_GIE | APC_CSR_PIE | APC_CSR_EIE | + APC_CSR_EI | APC_CSR_PMIE | APC_CSR_PDMA_GO); + cs4231_write(sc, CS_LOWER_BASE_COUNT, 0xff); + cs4231_write(sc, CS_UPPER_BASE_COUNT, 0xff); + cs4231_write(sc, CS_INTERFACE_CONFIG, + cs4231_read(sc, CS_INTERFACE_CONFIG) | + PLAYBACK_ENABLE); + } + } else { + DPRINTF(("TRG: CNVA = %x, togo = %x\n", nextaddr, togo)); + + cs4231_read(sc, CS_TEST_AND_INIT); /* clear pending error */ + APC_WRITE(sc, APC_CNVA, nextaddr); + APC_WRITE(sc, APC_CNC, togo); + csr = APC_READ(sc, APC_CSR); + if ((csr & APC_CSR_CDMA_GO) == 0 || + (csr & APC_CSR_CPAUSE) != 0) { + csr &= APC_CSR_CPAUSE; + csr |= APC_CSR_GIE | APC_CSR_CMIE | APC_CSR_CIE | + APC_CSR_EI | APC_CSR_CDMA_GO; + APC_WRITE(sc, APC_CSR, csr); + cs4231_write(sc, CS_LOWER_REC_CNT, 0xff); + cs4231_write(sc, CS_UPPER_REC_CNT, 0xff); + cs4231_write(sc, CS_INTERFACE_CONFIG, + cs4231_read(sc, CS_INTERFACE_CONFIG) | + CAPTURE_ENABLE); + } + /* try to update next samples */ + if (APC_READ(sc, APC_CSR) & APC_CSR_CD) { + saddr = sndbuf_getbufaddr(ch->buffer); + nextaddr = APC_READ(sc, APC_CNVA) + togo; + if (nextaddr >= saddr + sc->sc_bufsz) + nextaddr = saddr; + APC_WRITE(sc, APC_CNVA, nextaddr); + APC_WRITE(sc, APC_CNC, togo); + } + } + ch->locked = 1; + CS4231_UNLOCK(sc); +} + +static void +cs4231_halt(struct cs4231_channel *ch) +{ + struct cs4231_softc *sc; + + sc = ch->parent; + CS4231_LOCK(sc); + + if (ch->dir == PCMDIR_PLAY ) { + /* XXX Kills some capture bits */ + APC_WRITE(sc, APC_CSR, APC_READ(sc, APC_CSR) & + ~(APC_CSR_EI | APC_CSR_GIE | APC_CSR_PIE | + APC_CSR_EIE | APC_CSR_PDMA_GO | APC_CSR_PMIE)); + cs4231_write(sc, CS_INTERFACE_CONFIG, + cs4231_read(sc, CS_INTERFACE_CONFIG) & (~PLAYBACK_ENABLE)); + } else { + /* XXX Kills some playback bits */ + APC_WRITE(sc, APC_CSR, APC_CSR_CAPTURE_PAUSE); + cs4231_write(sc, CS_INTERFACE_CONFIG, + cs4231_read(sc, CS_INTERFACE_CONFIG) & (~CAPTURE_ENABLE)); + } + ch->locked = 0; + CS4231_UNLOCK(sc); +} --- /dev/null Thu Jul 1 18:00:00 2004 +++ sys/dev/sound/sbus/cs4231.h Wed Jun 30 18:26:20 2004 @@ -0,0 +1,228 @@ +/*- + * Copyright (c) 1996 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Ken Hornstein and John Kohl. + * + * 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 REGENTS 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. + */ + +/* + * Register defs for Crystal Semiconductor CS4231 Audio Codec/mixer + * chip, used on Gravis UltraSound MAX cards. + * + * Block diagram: + * +----------------------------------------------------+ + * | | + * | +----------------------------------------------+ | + * | |mixed in +-+ | | + * | +------------>--| | | | + * | mic in | | | | + * Mic --+-->| --------- GAIN ->-| | | | + * | | AUX 1 in |M| | | + * GF1 --)-->| -------------+-->-|U| | | + * | | Line in | |X|---- GAIN ----------+ | | + * Line --)-->| ---------+---)-->-| | | | | + * | | | | | | | | | + * | | | | +-+ ADC | | + * | | | | | | | + * | | | | | | | + * | | | +--- L/M --\ | | | AMP--> + * | | | \ | | | | + * | | | \ | | | | + * | | +---- L/M -------O-->--+--------)-------+-|--+-> line + * | | mono in /| | | | + * +---|-->------------ L/M -----/ | | | | + * | AUX 2 in | | | | + * CD --------|-->------------ L/M -------+ L/M | | + * | | v | + * | | | | + * | DAC | | + * | | | | + * +----------------------------------------------------+ + * | | + * | | + * v v + * Pc BUS (DISK) ??? + * + * Documentation for this chip can be found at: + * http://www.cirrus.com/products/overviews/cs4231.html + */ + +/* + * This file was merged from two header files.(ad1848reg.h and cs4231reg.h) + * And the suffix AD1848 and SP was changed to CS4231 and CS respectively. + */ +/* CS4231 direct registers */ +#define CS4231_IADDR 0x00 +#define CS4231_IDATA 0x01 +#define CS4231_STATUS 0x02 +#define CS4231_PIO 0x03 + +/* Index address register */ +#define CS_IN_INIT 0x80 +#define MODE_CHANGE_ENABLE 0x40 +#define TRANSFER_DISABLE 0x20 +#define ADDRESS_MASK 0xe0 + +/* Status bits */ +#define INTERRUPT_STATUS 0x01 +#define PLAYBACK_READY 0x02 +#define PLAYBACK_LEFT 0x04 +/* pbright is not left */ +#define PLAYBACK_UPPER 0x08 +/* bplower is not upper */ +#define SAMPLE_ERROR 0x10 +#define CAPTURE_READY 0x20 +#define CAPTURE_LEFT 0x40 +/* cpright is not left */ +#define CAPTURE_UPPER 0x80 +/* cplower is not upper */ + +/* CS4231 indirect mapped registers */ +#define CS_LEFT_INPUT_CONTROL 0x00 +#define CS_RIGHT_INPUT_CONTROL 0x01 +#define CS_LEFT_AUX1_CONTROL 0x02 +#define CS_RIGHT_AUX1_CONTROL 0x03 +#define CS_LEFT_AUX2_CONTROL 0x04 +#define CS_RIGHT_AUX2_CONTROL 0x05 +#define CS_LEFT_OUTPUT_CONTROL 0x06 +#define CS_RIGHT_OUTPUT_CONTROL 0x07 +#define CS_CLOCK_DATA_FORMAT 0x08 +#define CS_INTERFACE_CONFIG 0x09 +#define CS_PIN_CONTROL 0x0a +#define CS_TEST_AND_INIT 0x0b +#define CS_MISC_INFO 0x0c +#define CS_DIGITAL_MIX 0x0d +#define CS_UPPER_BASE_COUNT 0x0e +#define CS_LOWER_BASE_COUNT 0x0f +/* CS4231/AD1845 mode2 registers; added to AD1848 registers */ +#define CS_ALT_FEATURE1 0x10 +#define CS_ALT_FEATURE2 0x11 +#define CS_LEFT_LINE_CONTROL 0x12 +#define CS_RIGHT_LINE_CONTROL 0x13 +#define CS_TIMER_LOW 0x14 +#define CS_TIMER_HIGH 0x15 +#define CS_UPPER_FREQUENCY_SEL 0x16 +#define CS_LOWER_FREQUENCY_SEL 0x17 +#define CS_IRQ_STATUS 0x18 +#define CS_VERSION_ID 0x19 +#define CS_MONO_IO_CONTROL 0x1a +#define CS_POWERDOWN_CONTROL 0x1b +#define CS_REC_FORMAT 0x1c +#define CS_XTAL_SELECT 0x1d +#define CS_UPPER_REC_CNT 0x1e +#define CS_LOWER_REC_CNT 0x1f + +#define CS_IN_MASK 0x2f +#define CS_IN_LINE 0x00 +#define CS_IN_AUX1 0x40 +#define CS_IN_MIC 0x80 +#define CS_IN_DAC 0xc0 +#define CS_MIC_GAIN_ENABLE 0x20 +#define CS_IN_GAIN_MASK 0xf0 + +/* Aux input control - registers I2 (channel 1,left); I3 (channel 1,right) + I4 (channel 2,left); I5 (channel 2,right) */ +#define AUX_INPUT_ATTEN_BITS 0x1f +#define AUX_INPUT_ATTEN_MASK 0xe0 +#define AUX_INPUT_MUTE 0x80 + +/* Output bits - registers I6,I7*/ +#define OUTPUT_MUTE 0x80 +#define OUTPUT_ATTEN_BITS 0x3f +#define OUTPUT_ATTEN_MASK (~OUTPUT_ATTEN_BITS & 0xff) + +/* Clock and Data format reg bits (some also Capture Data format) - reg I8 */ +#define CS_CLOCK_DATA_FORMAT_MASK 0x0f +#define CLOCK_XTAL1 0x00 +#define CLOCK_XTAL2 0x01 +#define CLOCK_FREQ_MASK 0xf1 +#define CS_AFMT_STEREO 0x10 +#define CS_AFMT_U8 0x00 +#define CS_AFMT_MU_LAW 0x20 +#define CS_AFMT_S16_LE 0x40 +#define CS_AFMT_A_LAW 0x60 +#define CS_AFMT_IMA_ADPCM 0xa0 +#define CS_AFMT_U16_BE 0xc0 + +/* Interface Configuration reg bits - register I9 */ +#define PLAYBACK_ENABLE 0x01 +#define CAPTURE_ENABLE 0x02 +#define DUAL_DMA 0x00 +#define SINGLE_DMA 0x04 +#define AUTO_CAL_ENABLE 0x08 +#define PLAYBACK_PIO_ENABLE 0x40 +#define CAPTURE_PIO_ENABLE 0x80 + +/* Pin control bits - register I10 */ +#define INTERRUPT_ENABLE 0x02 +#define XCTL0_ENABLE 0x40 +#define XCTL1_ENABLE 0x80 + +/* Test and init reg bits - register I11 (read-only) */ +#define OVERRANGE_LEFT_MASK 0xfc +#define OVERRANGE_RIGHT_MASK 0xf3 +#define DATA_REQUEST_STATUS 0x10 +#define AUTO_CAL_IN_PROG 0x20 +#define PLAYBACK_UNDERRUN 0x40 +#define CAPTURE_OVERRUN 0x80 + +/* Miscellaneous Control reg bits - register I12 */ +#define CS_ID_MASK 0x70 +#define CS_MODE2 0x40 + +/* Digital Mix Control reg bits - register I13 */ +#define DIGITAL_MIX1_ENABLE 0x01 +#define MIX_ATTEN_MASK 0x03 + +/* alternate feature status(I24) */ +#define CS_AFS_TI 0x40 /* timer interrupt */ +#define CS_AFS_CI 0x20 /* capture interrupt */ +#define CS_AFS_PI 0x10 /* playback interrupt */ +#define CS_AFS_CU 0x08 /* capture underrun */ +#define CS_AFS_CO 0x04 /* capture overrun */ +#define CS_AFS_PO 0x02 /* playback overrun */ +#define CS_AFS_PU 0x01 /* playback underrun */ + + +/* Miscellaneous Control reg bits */ +#define CS_MODE2 0x40 + +#define MONO_INPUT_ATTEN_BITS 0x0f +#define MONO_INPUT_ATTEN_MASK 0xf0 +#define MONO_OUTPUT_MUTE 0x40 +#define MONO_INPUT_MUTE 0x80 +#define MONO_INPUT_MUTE_MASK 0x7f + +#define LINE_INPUT_ATTEN_BITS 0x1f +#define LINE_INPUT_ATTEN_MASK 0xe0 +#define LINE_INPUT_MUTE 0x80 +#define LINE_INPUT_MUTE_MASK 0x7f --- sys/modules/Makefile.orig Mon Jun 28 18:03:48 2004 +++ sys/modules/Makefile Wed Jun 30 20:03:47 2004 @@ -417,6 +417,7 @@ .if ${MACHINE_ARCH} == "sparc64" _gem= gem _hme= hme +_sound= sound .endif .if defined(MODULES_OVERRIDE) && !defined(ALL_MODULES) --- sys/modules/sound/driver/Makefile.orig Sun Aug 18 01:23:44 2002 +++ sys/modules/sound/driver/Makefile Wed Jun 30 18:33:09 2004 @@ -1,6 +1,6 @@ # $FreeBSD: src/sys/modules/sound/driver/Makefile,v 1.15 2002/08/17 16:23:44 orion Exp $ -SUBDIR = als4000 ad1816 cmi cs4281 csa ds1 emu10k1 es137x ess +SUBDIR = als4000 ad1816 cmi cs4231 cs4281 csa ds1 emu10k1 es137x ess SUBDIR += fm801 ich maestro maestro3 mss neomagic sb16 sb8 sbc solo SUBDIR += t4dwave via8233 via82c686 vibes SUBDIR += driver uaudio --- /dev/null Thu Jul 1 18:00:00 2004 +++ sys/modules/sound/driver/cs4231/Makefile Wed Jun 30 18:32:25 2004 @@ -0,0 +1,9 @@ +# $FreeBSD$ + +.PATH: ${.CURDIR}/../../../../dev/sound/sbus + +KMOD= snd_cs4231 +SRCS= device_if.h bus_if.h +SRCS+= cs4231.c + +.include --/9DWx/yDrRhgMJTb-- From owner-freebsd-sparc64@FreeBSD.ORG Thu Jul 1 09:40:33 2004 Return-Path: Delivered-To: freebsd-sparc64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8144116A4CE for ; Thu, 1 Jul 2004 09:40:33 +0000 (GMT) Received: from ns.kt-is.co.kr (ns.kt-is.co.kr [211.218.149.125]) by mx1.FreeBSD.org (Postfix) with ESMTP id 76CE943D1F for ; Thu, 1 Jul 2004 09:40:32 +0000 (GMT) (envelope-from yongari@kt-is.co.kr) Received: from michelle.kt-is.co.kr (ns2.kt-is.co.kr [220.76.118.193]) (authenticated bits=128) by ns.kt-is.co.kr (8.12.10/8.12.10) with ESMTP id i619bdAh027117 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Thu, 1 Jul 2004 18:37:40 +0900 (KST) Received: from michelle.kt-is.co.kr (localhost.kt-is.co.kr [127.0.0.1]) i619db7S012948 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 1 Jul 2004 18:39:37 +0900 (KST) (envelope-from yongari@kt-is.co.kr) Received: (from yongari@localhost) by michelle.kt-is.co.kr (8.12.10/8.12.10/Submit) id i619dbMq012947 for freebsd-sparc64@freebsd.org; Thu, 1 Jul 2004 18:39:37 +0900 (KST) (envelope-from yongari@kt-is.co.kr) Date: Thu, 1 Jul 2004 18:39:37 +0900 From: Pyun YongHyeon To: freebsd-sparc64@freebsd.org Message-ID: <20040701093937.GA12933@kt-is.co.kr> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="W/nzBZO5zC0uMSeA" Content-Disposition: inline User-Agent: Mutt/1.4.1i X-Filter-Version: 1.11a (ns.kt-is.co.kr) Subject: pcm sound driver for SBus Ultra1/Ultra2 X-BeenThere: freebsd-sparc64@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: yongari@kt-is.co.kr List-Id: Porting FreeBSD to the Sparc List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Jul 2004 09:40:33 -0000 --W/nzBZO5zC0uMSeA Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hello All, I don't know how may users want to hear sound on Ultra1/Ultra2. But I wanted to hear some music while 'build world' is in progress. Driver summery 1. The driver is based on OpenBSD's driver and ISA mss driver on FreeBSD. 2. Supports onboard CS4231A chip on SBus Ultra1/Ultra2 3. Capture(recodring) was not tested at all. - I don't have microphone. 4. Due to lack of programming information for APC DMA, I used existing interfaces of OpenBSD driver. So it may have other bugs on FreeBSD. 5. Full-duplex mode doesn't work. 6. You may notice some noise when you work on ofw console. I don't know what is the reason, atm. 7. Due to lack of X supports, I could't test with xmms or GUI based audio tools. 8. If you have PCI/EBus based sparcs, they are not supported. Yes, they use the same chip but have different DMA interface. In addition, I don't have PCI/EBus based sparcs. Installation 1. get the driver patch file and fetch your system 2. build kernel and kernel modules 3. load snd_cs4231.ko and play Note, you may want to mute speaker output with mixer(8). The attached patch is for -CURRENT, and as usual is also available at: http://www.kr.freebsd.org/~yongari/cs4231.freebsd.diff Corrections, suggestions welcome. Thanks. Regards, Pyun YongHyeon -- Pyun YongHyeon --W/nzBZO5zC0uMSeA Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="cs4231.freebsd.diff" --- sys/dev/sound/isa/sndbuf_dma.c.orig Mon Sep 8 01:28:02 2003 +++ sys/dev/sound/isa/sndbuf_dma.c Tue Jun 29 12:47:14 2004 @@ -30,6 +30,44 @@ SND_DECLARE_FILE("$FreeBSD: src/sys/dev/sound/isa/sndbuf_dma.c,v 1.2 2003/09/07 16:28:02 cg Exp $"); +#ifdef __sparc64__ +/* + * XXX + * Sparc64 don't have ISA bus. Temp. glue code to load pcm module. + * pcm(4) should be architecture independent. + */ +int +sndbuf_dmasetup(struct snd_dbuf *b, struct resource *drq) +{ + return (0); +} + +int +sndbuf_dmasetdir(struct snd_dbuf *b, int dir) +{ + return (0); +} + +void +sndbuf_dma(struct snd_dbuf *b, int go) +{ + return; +} + +int +sndbuf_dmaptr(struct snd_dbuf *b) +{ + return (0); +} + +void +sndbuf_dmabounce(struct snd_dbuf *b) +{ + return; +} + +#else + int sndbuf_dmasetup(struct snd_dbuf *b, struct resource *drq) { @@ -101,3 +139,4 @@ /* tell isa_dma to bounce data in/out */ } +#endif --- /dev/null Thu Jul 1 18:00:00 2004 +++ sys/dev/sound/sbus/apcdmareg.h Wed Jun 30 18:26:26 2004 @@ -0,0 +1,113 @@ +/* $OpenBSD: apcdmareg.h,v 1.2 2003/06/02 18:53:18 jason Exp $ */ + +/* + * Copyright (c) 2001 Jason L. Wright (jason@thought.net) + * All rights reserved. + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. + */ + +/* + * Definitions for Sun APC DMA controller. + */ + +/* APC DMA registers */ +#define APC_CSR 0x0010 /* control/status */ +#define APC_CVA 0x0020 /* capture virtual address */ +#define APC_CC 0x0024 /* capture count */ +#define APC_CNVA 0x0028 /* capture next virtual address */ +#define APC_CNC 0x002c /* capture next count */ +#define APC_PVA 0x0030 /* playback virtual address */ +#define APC_PC 0x0034 /* playback count */ +#define APC_PNVA 0x0038 /* playback next virtual address */ +#define APC_PNC 0x003c /* playback next count */ + +/* + * APC DMA Register definitions + */ +#define APC_CSR_RESET 0x00000001 /* reset */ +#define APC_CSR_CDMA_GO 0x00000004 /* capture dma go */ +#define APC_CSR_PDMA_GO 0x00000008 /* playback dma go */ +#define APC_CSR_CODEC_RESET 0x00000020 /* codec reset */ +#define APC_CSR_CPAUSE 0x00000040 /* capture dma pause */ +#define APC_CSR_PPAUSE 0x00000080 /* playback dma pause */ +#define APC_CSR_CMIE 0x00000100 /* capture pipe empty enb */ +#define APC_CSR_CMI 0x00000200 /* capture pipe empty intr */ +#define APC_CSR_CD 0x00000400 /* capture nva dirty */ +#define APC_CSR_CM 0x00000800 /* capture data lost */ +#define APC_CSR_PMIE 0x00001000 /* pb pipe empty intr enable */ +#define APC_CSR_PD 0x00002000 /* pb nva dirty */ +#define APC_CSR_PM 0x00004000 /* pb pipe empty */ +#define APC_CSR_PMI 0x00008000 /* pb pipe empty interrupt */ +#define APC_CSR_EIE 0x00010000 /* error interrupt enable */ +#define APC_CSR_CIE 0x00020000 /* capture intr enable */ +#define APC_CSR_PIE 0x00040000 /* playback intr enable */ +#define APC_CSR_GIE 0x00080000 /* general intr enable */ +#define APC_CSR_EI 0x00100000 /* error interrupt */ +#define APC_CSR_CI 0x00200000 /* capture interrupt */ +#define APC_CSR_PI 0x00400000 /* playback interrupt */ +#define APC_CSR_GI 0x00800000 /* general interrupt */ + +#define APC_CSR_PLAY ( \ + APC_CSR_EI | \ + APC_CSR_GIE | \ + APC_CSR_PIE | \ + APC_CSR_EIE | \ + APC_CSR_PDMA_GO | \ + APC_CSR_PMIE ) + +#define APC_CSR_CAPTURE ( \ + APC_CSR_EI | \ + APC_CSR_GIE | \ + APC_CSR_CIE | \ + APC_CSR_EIE | \ + APC_CSR_CDMA_GO ) + +#define APC_CSR_PLAY_PAUSE (~( \ + APC_CSR_PPAUSE | \ + APC_CSR_GI | \ + APC_CSR_PI | \ + APC_CSR_CI | \ + APC_CSR_EI | \ + APC_CSR_PMI | \ + APC_CSR_PMIE | \ + APC_CSR_CMI | \ + APC_CSR_CMIE ) ) + +#define APC_CSR_CAPTURE_PAUSE (~( \ + APC_CSR_PPAUSE | \ + APC_CSR_GI | \ + APC_CSR_PI | \ + APC_CSR_CI | \ + APC_CSR_EI | \ + APC_CSR_PMI | \ + APC_CSR_PMIE | \ + APC_CSR_CMI | \ + APC_CSR_CMIE ) ) + +#define APC_CSR_INTR_MASK ( \ + APC_CSR_GI | \ + APC_CSR_PI | \ + APC_CSR_CI | \ + APC_CSR_EI | \ + APC_CSR_PMI | \ + APC_CSR_CMI ) --- /dev/null Thu Jul 1 18:00:00 2004 +++ sys/dev/sound/sbus/cs4231.c Thu Jul 1 18:02:22 2004 @@ -0,0 +1,1030 @@ +/* + * Copyright (c) 1999 Jason L. Wright (jason@thought.net) + * Copyright (c) 2004 Pyun YongHyeon + * All rights reserved. + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. + * + * Effort sponsored in part by the Defense Advanced Research Projects + * Agency (DARPA) and Air Force Research Laboratory, Air Force + * Materiel Command, USAF, under agreement number F30602-01-2-0537. + * + * from: OpenBSD: cs4231.c,v 1.21 2003/07/03 20:36:07 jason Exp + */ + +/* + * Driver for CS4231 based audio found in some sun4m systems (cs4231) + * based on ideas from the S/Linux project and the NetBSD project. + */ +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include "mixer_if.h" + +/* + * This driver is for Sbus based sparcs(Ultra1 and Ultra2). If you have + * PCI/EBus based sparcs it is not supported by this driver. + * (We need another driver for those systems. Yes, they use the same chip + * cs4231A, but has different DMA engine and I don't have PCI/EBus based + * sparcs. + * Mixer routines were copied from ISA mss driver and modified. + * + * Though, cs4231 says it supports full-duplex mode, I doubt it due to + * lack of independent sampling frequency register. In addition, I can't + * find any documentation of Sun APC DMA programming information. I guessed + * the usage of APC DMA from existing OpenBSD's driver. + * + * Audio capture(recording) was not tested at all and may have bugs. + * Sorry, I don't have microphone. Don't try to use full-duplex mode. + * It wouldn't work. + */ +#define CS_TIMEOUT 90000 + +#define CS4231_MIN_BUF_SZ (8*1024) +#define CS4231_DEFAULT_BUF_SZ (32*1024) +#define CS4231_MAX_BUF_SZ (64*1024) +/* It seems that 4KB is the best value. */ +#define CS4231_MAX_DMA_SZ (4*1024) + + +#undef CS4231_DEBUG +#ifdef CS4231_DEBUG +#define DPRINTF(x) printf x +#else +#define DPRINTF(x) +#endif + +struct cs4231_softc; + +struct cs4231_channel { + struct cs4231_softc *parent; + struct pcm_channel *channel; + struct snd_dbuf *buffer; + int dir; + int locked; +}; + +struct cs4231_softc { + struct device *sc_dev; + int sc_rid; + struct resource *sc_res; + bus_space_handle_t sc_regh; + bus_space_tag_t sc_regt; + + int sc_irqrid; + struct resource *sc_irqres; + void *sc_ih; + bus_dma_tag_t sc_dmat; + u_int32_t sc_bufsz; + struct cs4231_channel sc_pch; + struct cs4231_channel sc_rch; + int sc_enabled; + struct mtx *sc_lock; +}; + +static int cs4231_sbus_probe(device_t); +static int cs4231_sbus_attach(device_t); +static int cs4231_sbus_detach(device_t); +static int cs4231_sbus_suspend(device_t); +static int cs4231_sbus_resume(device_t); +static void cs4231_free_resource(struct cs4231_softc *); +static void cs4231_power_reset(struct cs4231_softc *); +static int cs4231_enable(struct cs4231_softc *); +static void cs4231_disable(struct cs4231_softc *); +static void cs4231_write(struct cs4231_softc *, u_int8_t, u_int8_t); +static u_int8_t cs4231_read(struct cs4231_softc *, u_int8_t); +static void cs4231_intr(void *); +static int cs4231_mixer_init(struct snd_mixer *); +static void change_bits(mixer_tab *, u_int8_t *, u_int32_t, u_int32_t, + u_int32_t); +static int cs4231_mixer_set(struct snd_mixer *, u_int32_t, u_int32_t, + u_int32_t); +static int cs4231_mixer_setrecsrc(struct snd_mixer *, u_int32_t); +static void *cs4231_chan_init(kobj_t, void *, struct snd_dbuf *, + struct pcm_channel *, int); +static int cs4231_chan_setformat(kobj_t, void *, u_int32_t); +static int cs4231_chan_setspeed(kobj_t, void *, u_int32_t); +static void cs4231_chan_fs(struct cs4231_softc *, u_int8_t); +static int cs4231_chan_setblocksize(kobj_t, void *, u_int32_t); +static int cs4231_chan_trigger(kobj_t, void *, int); +static int cs4231_chan_getptr(kobj_t, void *); +static struct pcmchan_caps * + cs4231_chan_getcaps(kobj_t, void *); +static void cs4231_trigger(struct cs4231_channel *); +static void cs4231_halt(struct cs4231_channel *); + +#define CS4231_LOCK(sc) snd_mtxlock(sc->sc_lock) +#define CS4231_UNLOCK(sc) snd_mtxunlock(sc->sc_lock) +#define CS4231_LOCK_ASSERT(sc) snd_mtxassert(sc->sc_lock) + +#define CS_WRITE(sc,r,v) \ + bus_space_write_1((sc)->sc_regt, (sc)->sc_regh, (r) << 2, (v)) +#define CS_READ(sc,r) \ + bus_space_read_1((sc)->sc_regt, (sc)->sc_regh, (r) << 2) + +#define APC_WRITE(sc,r,v) \ + bus_space_write_4(sc->sc_regt, sc->sc_regh, r, v) +#define APC_READ(sc,r) \ + bus_space_read_4(sc->sc_regt, sc->sc_regh, r) + +static device_method_t cs4231_sbus_methods[] = { + DEVMETHOD(device_probe, cs4231_sbus_probe), + DEVMETHOD(device_attach, cs4231_sbus_attach), + DEVMETHOD(device_detach, cs4231_sbus_detach), + DEVMETHOD(device_suspend, cs4231_sbus_suspend), + DEVMETHOD(device_resume, cs4231_sbus_resume), + {0, 0} +}; + +static driver_t cs4231_sbus_driver = { + "pcm", + cs4231_sbus_methods, + PCM_SOFTC_SIZE +}; + +DRIVER_MODULE(snd_cs4231, sbus, cs4231_sbus_driver, pcm_devclass, 0, 0); +MODULE_DEPEND(snd_cs4231, snd_pcm, PCM_MINVER, PCM_PREFVER, PCM_MAXVER); +MODULE_VERSION(snd_cs4231, 1); + + +static u_int32_t cs4231_fmt[] = { + AFMT_U8, + AFMT_STEREO | AFMT_U8, + AFMT_S16_LE, + AFMT_STEREO | AFMT_S16_LE, + AFMT_MU_LAW, + AFMT_STEREO | AFMT_MU_LAW, + AFMT_A_LAW, + AFMT_STEREO | AFMT_A_LAW, + 0 +}; + +static struct pcmchan_caps cs4231_caps = {5510, 48000, cs4231_fmt, 0}; + +/* + * pcm(4) channel interface + */ +static kobj_method_t cs4231_chan_methods[] = { + KOBJMETHOD(channel_init, cs4231_chan_init), + KOBJMETHOD(channel_setformat, cs4231_chan_setformat), + KOBJMETHOD(channel_setspeed, cs4231_chan_setspeed), + KOBJMETHOD(channel_setblocksize, cs4231_chan_setblocksize), + KOBJMETHOD(channel_trigger, cs4231_chan_trigger), + KOBJMETHOD(channel_getptr, cs4231_chan_getptr), + KOBJMETHOD(channel_getcaps, cs4231_chan_getcaps), + { 0, 0 } +}; +CHANNEL_DECLARE(cs4231_chan); + +/* + * pcm(4) mixer interface + */ +static mixer_ent cs4231_mix_devices[32][2] = { + MIX_NONE(SOUND_MIXER_VOLUME), + MIX_NONE(SOUND_MIXER_BASS), + MIX_NONE(SOUND_MIXER_TREBLE), + /* AUX1 */ + MIX_ENT(SOUND_MIXER_SYNTH, 2, 1, 0, 5, 3, 1, 0, 5), + MIX_ENT(SOUND_MIXER_PCM, 6, 1, 0, 6, 7, 1, 0, 6), + MIX_ENT(SOUND_MIXER_SPEAKER, 26, 1, 0, 4, 0, 0, 0, 0), + MIX_ENT(SOUND_MIXER_LINE, 18, 1, 0, 5, 19, 1, 0, 5), + MIX_ENT(SOUND_MIXER_MIC, 0, 0, 5, 1, 1, 0, 5, 1), + /* + * XXX + * AUX2 : Ultra1/Ultra2 has no internal CD-ROM audio in + */ + MIX_ENT(SOUND_MIXER_CD, 4, 1, 0, 5, 5, 1, 0, 5), + MIX_ENT(SOUND_MIXER_IMIX, 13, 1, 2, 6, 0, 0, 0, 0), + MIX_NONE(SOUND_MIXER_ALTPCM), + MIX_NONE(SOUND_MIXER_RECLEV), + MIX_ENT(SOUND_MIXER_IGAIN, 0, 0, 0, 4, 1, 0, 0, 4), + MIX_NONE(SOUND_MIXER_OGAIN), + MIX_NONE(SOUND_MIXER_LINE1), + MIX_NONE(SOUND_MIXER_LINE2), + MIX_NONE(SOUND_MIXER_LINE3), +}; + +static kobj_method_t cs4231_mixer_methods[] = { + KOBJMETHOD(mixer_init, cs4231_mixer_init), + KOBJMETHOD(mixer_set, cs4231_mixer_set), + KOBJMETHOD(mixer_setrecsrc, cs4231_mixer_setrecsrc), + { 0, 0 } +}; +MIXER_DECLARE(cs4231_mixer); + +static int +cs4231_sbus_probe(device_t dev) +{ + char *name; + + name = sbus_get_name(dev); + if (strcmp("SUNW,CS4231", name) == 0) { + device_set_desc(dev, "Sun Audiocs CS4231A"); + return (0); + } + + return (ENXIO); +} + +static int +cs4231_sbus_attach(device_t dev) +{ + struct snddev_info *d; + struct cs4231_softc *sc; + char status[SND_STATUSLEN]; + + d = device_get_softc(dev); + sc = malloc(sizeof(struct cs4231_softc), M_DEVBUF, M_NOWAIT | M_ZERO); + if (sc == NULL) { + device_printf(dev, "cannot allocate softc\n"); + } + sc->sc_dev = dev; + sc->sc_lock = snd_mtxcreate(device_get_nameunit(sc->sc_dev), + "sound softc"); + + sc->sc_rid = 0; + if ((sc->sc_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, + &sc->sc_rid, RF_ACTIVE)) == NULL) { + device_printf(dev, "cannot map registers\n"); + return (ENXIO); + } + sc->sc_regt = rman_get_bustag(sc->sc_res); + sc->sc_regh = rman_get_bushandle(sc->sc_res); + sc->sc_irqrid = 0; + if ((sc->sc_irqres = bus_alloc_resource_any(sc->sc_dev, SYS_RES_IRQ, + &sc->sc_irqrid, RF_SHAREABLE | RF_ACTIVE)) == NULL) { + device_printf(sc->sc_dev, "cannot allocate interrupt\n"); + goto fail; + } + if (snd_setup_intr(sc->sc_dev, sc->sc_irqres, + INTR_MPSAFE, cs4231_intr, sc, &sc->sc_ih)) { + device_printf(sc->sc_dev, "cannot set up interrupt\n"); + goto fail; + } + + sc->sc_bufsz = pcm_getbuffersize(sc->sc_dev, CS4231_MIN_BUF_SZ, + CS4231_DEFAULT_BUF_SZ, CS4231_MAX_BUF_SZ); + if (bus_dma_tag_create( + NULL, /* parent */ + 64*1024, 0, /* alignment, boundary */ + BUS_SPACE_MAXADDR_32BIT,/* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filtfunc, filtfuncarg */ + sc->sc_bufsz, /* maxsize */ + 1, /* nsegments */ + sc->sc_bufsz, /* maxsegsz */ + BUS_DMA_ALLOCNOW, /* flags */ + NULL, /* lockfunc */ + NULL, /* lockfuncarg */ + &sc->sc_dmat)) { + device_printf(sc->sc_dev, "cannot allocate parent DMA tag\n"); + goto fail; + } + cs4231_enable(sc); + mixer_init(sc->sc_dev, &cs4231_mixer_class, sc); + if (pcm_register(sc->sc_dev, sc, 1, 1)) { + device_printf(sc->sc_dev, "cannot register to pcm\n"); + goto fail; + } + pcm_addchan(sc->sc_dev, PCMDIR_REC, &cs4231_chan_class, sc); + pcm_addchan(sc->sc_dev, PCMDIR_PLAY, &cs4231_chan_class, sc); + snprintf(status, SND_STATUSLEN, "at mem 0x%lx irq %ld bufsz %u", + rman_get_start(sc->sc_res), rman_get_start(sc->sc_irqres), + sc->sc_bufsz); + pcm_setstatus(sc->sc_dev, status); + + return (0); + +fail: + cs4231_free_resource(sc); + return (ENXIO); +} + +static int +cs4231_sbus_detach(device_t dev) +{ + struct cs4231_softc *sc; + int error; + + error = pcm_unregister(dev); + if (error) + return (error); + + sc = pcm_getdevinfo(dev); + cs4231_free_resource(sc); + + return (0); +} + +static int +cs4231_sbus_suspend(device_t dev) +{ + + return (ENXIO); +} + +static int +cs4231_sbus_resume(device_t dev) +{ + + return (ENXIO); +} + +static void +cs4231_power_reset(struct cs4231_softc *sc) +{ + + int i; + + APC_WRITE(sc, APC_CSR, APC_CSR_RESET); + DELAY(10); + APC_WRITE(sc, APC_CSR, 0); + DELAY(10); + APC_WRITE(sc, APC_CSR, APC_READ(sc, APC_CSR) | APC_CSR_CODEC_RESET); + DELAY(20); + APC_WRITE(sc, APC_CSR, APC_READ(sc, APC_CSR) & (~APC_CSR_CODEC_RESET)); + + for (i = CS_TIMEOUT; + i && CS_READ(sc, CS4231_IADDR) == CS_IN_INIT; i--) + DELAY(10); + if (i == 0) + device_printf(sc->sc_dev, "timeout waiting for reset\n"); + + /* Turn on cs4231 mode */ + cs4231_write(sc, CS_MISC_INFO, + cs4231_read(sc, CS_MISC_INFO) | CS_MODE2); + cs4231_write(sc, CS_PIN_CONTROL, + cs4231_read(sc, CS_PIN_CONTROL) | INTERRUPT_ENABLE); +} + +static int +cs4231_enable(struct cs4231_softc *sc) +{ + cs4231_power_reset(sc); + sc->sc_enabled = 1; + return (0); + +} + +static void +cs4231_disable(struct cs4231_softc *sc) +{ + u_int8_t v; + + if (sc->sc_enabled == 0) + return; + + cs4231_halt(&sc->sc_pch); + cs4231_halt(&sc->sc_rch); + v = cs4231_read(sc, CS_PIN_CONTROL) & ~INTERRUPT_ENABLE; + cs4231_write(sc, CS_PIN_CONTROL, v); + + /* reset APC */ + APC_WRITE(sc, APC_CSR, APC_CSR_RESET); + DELAY(10); + APC_WRITE(sc, APC_CSR, 0); + DELAY(10); + sc->sc_enabled = 0; +} + +static void +cs4231_free_resource(struct cs4231_softc *sc) +{ + cs4231_disable(sc); + if (sc->sc_irqres) { + if (sc->sc_ih) { + bus_teardown_intr(sc->sc_dev, sc->sc_irqres, + sc->sc_ih); + sc->sc_ih = NULL; + } + bus_release_resource(sc->sc_dev, SYS_RES_IRQ, sc->sc_irqrid, + sc->sc_irqres); + sc->sc_irqres = NULL; + } + if (sc->sc_dmat) + bus_dma_tag_destroy(sc->sc_dmat); + if (sc->sc_res) + bus_release_resource(sc->sc_dev, SYS_RES_MEMORY, sc->sc_rid, + sc->sc_res); + if (sc->sc_lock) + snd_mtxfree(sc->sc_lock); + free(sc, M_DEVBUF); +} + +static void +cs4231_write(struct cs4231_softc *sc, u_int8_t r, u_int8_t v) +{ + CS_WRITE(sc, CS4231_IADDR, r); + CS_WRITE(sc, CS4231_IDATA, v); +} + +static u_int8_t +cs4231_read(struct cs4231_softc *sc, u_int8_t r) +{ + CS_WRITE(sc, CS4231_IADDR, r); + return (CS_READ(sc, CS4231_IDATA)); +} + +static void +cs4231_intr(void *arg) +{ + struct cs4231_softc *sc; + struct cs4231_channel *ch; + u_int32_t csr; + u_int8_t reg, status; + + sc = arg; + CS4231_LOCK(sc); + + csr = APC_READ(sc, APC_CSR); + if ((csr & APC_CSR_GI) == 0) { + CS4231_UNLOCK(sc); + return; + } + APC_WRITE(sc, APC_CSR, csr); + + if ((csr & APC_CSR_EIE) && (csr & APC_CSR_EI)) { + status = cs4231_read(sc, CS_TEST_AND_INIT); + device_printf(sc->sc_dev, + "apc error interrupt : stat = 0x%x\n", status); + } + + if ((csr & APC_CSR_GIE) && (csr & APC_CSR_GI)) { + /* general interrupt */ + status = CS_READ(sc, CS4231_STATUS); + if (status & (INTERRUPT_STATUS | SAMPLE_ERROR)) { + reg = cs4231_read(sc, CS_IRQ_STATUS); + if (reg & CS_AFS_PI) { + cs4231_write(sc, CS_LOWER_BASE_COUNT, 0xff); + cs4231_write(sc, CS_UPPER_BASE_COUNT, 0xff); + } + if (reg & CS_AFS_CI) { + cs4231_write(sc, CS_LOWER_REC_CNT, 0xff); + cs4231_write(sc, CS_UPPER_REC_CNT, 0xff); + } + CS_WRITE(sc, CS4231_STATUS, 0); + } + } + + if ((csr & APC_CSR_PMIE) && (csr & APC_CSR_PMI)) { + u_long nextaddr, saddr; + u_int32_t togo; + + ch = &sc->sc_pch; + + CS4231_UNLOCK(sc); + chn_intr(ch->channel); + CS4231_LOCK(sc); + + togo = sndbuf_getblksz(ch->buffer); + saddr = sndbuf_getbufaddr(ch->buffer); + nextaddr = APC_READ(sc, APC_PNVA) + togo; + if (nextaddr >= saddr + sc->sc_bufsz) + nextaddr = saddr; + APC_WRITE(sc, APC_PNVA, nextaddr); + APC_WRITE(sc, APC_PNC, togo); + } + + if ((csr & APC_CSR_CIE) && (csr & APC_CSR_CI) && (csr & APC_CSR_CD)) { + u_long nextaddr, saddr; + u_int32_t togo; + + ch = &sc->sc_rch; + + CS4231_UNLOCK(sc); + chn_intr(ch->channel); + CS4231_LOCK(sc); + + togo = sndbuf_getblksz(ch->buffer); + saddr = sndbuf_getbufaddr(ch->buffer); + nextaddr = APC_READ(sc, APC_CNVA) + togo; + if (nextaddr >= saddr + sc->sc_bufsz) + nextaddr = saddr; + APC_WRITE(sc, APC_CNVA, nextaddr); + APC_WRITE(sc, APC_CNC, togo); + } + CS4231_UNLOCK(sc); +} + +static int +cs4231_mixer_init(struct snd_mixer *m) +{ + mix_setdevs(m, MODE2_MIXER_DEVICES); + mix_setrecdevs(m, MSS_REC_DEVICES); + + return (0); +} + +/* + * copied from sys/dev/sound/isa/mss.c + */ +static void +change_bits(mixer_tab *t, u_int8_t *regval, u_int32_t dev, u_int32_t chn, + u_int32_t newval) +{ + u_int8_t mask; + u_int32_t shift; + + if ((*t)[dev][chn].polarity == 1) /* reverse */ + newval = 100 - newval ; + + mask = (1 << (*t)[dev][chn].nbits) - 1; + newval = ((newval * mask) + 50) / 100; /* Scale it */ + shift = (*t)[dev][chn].bitoffs /*- (*t)[dev][LEFT_CHN].nbits + 1*/; + + *regval &= ~(mask << shift); /* Filter out the previous value */ + *regval |= (newval & mask) << shift; /* Set the new value */ +} + +/* + * copied from sys/dev/sound/isa/mss.c + */ +static int +cs4231_mixer_set(struct snd_mixer *m, u_int32_t dev, u_int32_t left, + u_int32_t right) +{ + struct cs4231_softc *sc; + mixer_tab *mix_d; + u_int8_t old, val, reg; + + sc = mix_getdevinfo(m); + CS4231_LOCK(sc); + mix_d = &cs4231_mix_devices; + if ((*mix_d)[dev][LEFT_CHN].nbits == 0) { + DEB(printf("nbits = 0 for dev %d\n", dev)); + return -1; + } + + if ((*mix_d)[dev][RIGHT_CHN].nbits == 0) + right = left; /* mono */ + + /* Set the left channel */ + reg = (*mix_d)[dev][LEFT_CHN].regno; + old = val = cs4231_read(sc, reg); + /* if volume is 0, mute chan. Otherwise, unmute. */ + if (reg != 0) { + if (reg == CS_MONO_IO_CONTROL) + val = (left == 0) ? old | MONO_OUTPUT_MUTE : old & 0xef; + else if (reg == CS_DIGITAL_MIX) + val = (left == 0) ? 0 : old & 0xfd; + else + val = (left == 0) ? old | 0x80 : old & 0x7f; + } + change_bits(mix_d, &val, dev, LEFT_CHN, left); + cs4231_write(sc, reg, val); + + if ((*mix_d)[dev][RIGHT_CHN].nbits != 0) { /* have stereo */ + /* Set the right channel */ + reg = (*mix_d)[dev][RIGHT_CHN].regno; + old = val = cs4231_read(sc, reg); + if (reg != 1) + val = (right == 0) ? old | 0x80 : old & 0x7f; + change_bits(mix_d, &val, dev, RIGHT_CHN, right); + cs4231_write(sc, reg, val); + } + CS4231_UNLOCK(sc); + + return (left | (right << 8)); +} + +static int +cs4231_mixer_setrecsrc(struct snd_mixer *m, u_int32_t src) +{ + struct cs4231_softc *sc; + u_int8_t v; + + sc = mix_getdevinfo(m); + switch(src) { + case SOUND_MASK_LINE: + case SOUND_MASK_LINE3: + v = CS_IN_LINE; + break; + + case SOUND_MASK_CD: + case SOUND_MASK_LINE1: + v = CS_IN_AUX1; + break; + + case SOUND_MASK_IMIX: + v = CS_IN_DAC; + break; + + case SOUND_MASK_MIC: + default: + v = CS_IN_MIC; + break; + } + CS4231_LOCK(sc); + cs4231_write(sc, CS_LEFT_INPUT_CONTROL, + (cs4231_read(sc, CS_LEFT_INPUT_CONTROL) & CS_IN_MASK) | v); + cs4231_write(sc, CS_RIGHT_INPUT_CONTROL, + (cs4231_read(sc, CS_RIGHT_INPUT_CONTROL) & CS_IN_MASK) | v); + CS4231_UNLOCK(sc); + + return (src); +} + +static void * +cs4231_chan_init(kobj_t obj, void *dev, struct snd_dbuf *b, + struct pcm_channel *c, int dir) +{ + struct cs4231_softc *sc; + struct cs4231_channel *ch; + + sc = dev; + ch = (dir == PCMDIR_PLAY) ? &sc->sc_pch : &sc->sc_rch; + ch->parent = sc; + ch->channel = c; + ch->dir = dir; + ch->buffer = b; + if (sndbuf_alloc(ch->buffer, sc->sc_dmat, sc->sc_bufsz) != 0) + return (NULL); + DPRINTF(("%s channel addr: %lx\n", dir == PCMDIR_PLAY ? "PLAY" : "REC", + sndbuf_getbufaddr(ch->buffer))); + return (ch); +} + +static int +cs4231_chan_setformat(kobj_t obj, void *data, u_int32_t format) +{ + struct cs4231_softc *sc; + struct cs4231_channel *ch; + u_int32_t encoding; + u_int8_t fs, v; + + ch = data; + sc = ch->parent; + + encoding = format & ~(AFMT_STEREO | AFMT_FULLDUPLEX); + fs = 0; + switch(encoding) { + case AFMT_U8: + fs = CS_AFMT_U8; + break; + case AFMT_MU_LAW: + fs = CS_AFMT_MU_LAW; + break; + case AFMT_S16_LE: + fs = CS_AFMT_S16_LE; + break; + case AFMT_A_LAW: + fs = CS_AFMT_A_LAW; + break; + case AFMT_IMA_ADPCM: + fs = CS_AFMT_IMA_ADPCM; + break; + case AFMT_U16_BE: + fs = CS_AFMT_U16_BE; + break; + default: + fs = CS_AFMT_U8; + break; + } + + if (format & AFMT_STEREO) + fs |= CS_AFMT_STEREO; + + DPRINTF(("FORMAT: %s : 0x%x\n", ch->dir == PCMDIR_PLAY ? "playback" : + "capture", format)); + CS4231_LOCK(sc); + v = cs4231_read(sc, CS_CLOCK_DATA_FORMAT); + v &= CS_CLOCK_DATA_FORMAT_MASK; + fs |= v; + cs4231_chan_fs(sc, fs); + CS4231_UNLOCK(sc); + return (0); +} + +static int +cs4231_chan_setspeed(kobj_t obj, void *data, u_int32_t speed) +{ + typedef struct { + u_int32_t speed; + u_int8_t bits; + } speed_struct; + + const static speed_struct speed_table[] = { + {5510, (0 << 1) | CLOCK_XTAL2}, + {5510, (0 << 1) | CLOCK_XTAL2}, + {6620, (7 << 1) | CLOCK_XTAL2}, + {8000, (0 << 1) | CLOCK_XTAL1}, + {9600, (7 << 1) | CLOCK_XTAL1}, + {11025, (1 << 1) | CLOCK_XTAL2}, + {16000, (1 << 1) | CLOCK_XTAL1}, + {18900, (2 << 1) | CLOCK_XTAL2}, + {22050, (3 << 1) | CLOCK_XTAL2}, + {27420, (2 << 1) | CLOCK_XTAL1}, + {32000, (3 << 1) | CLOCK_XTAL1}, + {33075, (6 << 1) | CLOCK_XTAL2}, + {33075, (4 << 1) | CLOCK_XTAL2}, + {44100, (5 << 1) | CLOCK_XTAL2}, + {48000, (6 << 1) | CLOCK_XTAL1}, + }; + + struct cs4231_softc *sc; + struct cs4231_channel *ch; + int i, n, sel; + u_int8_t fs; + + ch = data; + sc = ch->parent; + n = sizeof(speed_table) / sizeof(speed_struct); + + for (i = 1, sel =0; i < n - 1; i++) + if (abs(speed - speed_table[i].speed) < + abs(speed - speed_table[sel].speed)) + sel = i; + DPRINTF(("SPEED: %s : %dHz -> %dHz\n", ch->dir == PCMDIR_PLAY ? + "playback" : "capture", speed, speed_table[sel].speed)); + speed = speed_table[sel].speed; + + CS4231_LOCK(sc); + fs = cs4231_read(sc, CS_CLOCK_DATA_FORMAT); + fs &= ~CS_CLOCK_DATA_FORMAT_MASK; + fs |= speed_table[sel].bits; + cs4231_chan_fs(sc, fs); + CS4231_UNLOCK(sc); + return (speed); +} + +static void +cs4231_chan_fs(struct cs4231_softc *sc, u_int8_t fs) +{ + int i, doreset; + u_int8_t v; + + CS4231_LOCK_ASSERT(sc); + + /* set autocalibration */ + doreset = 0; + v = cs4231_read(sc, CS_INTERFACE_CONFIG) | AUTO_CAL_ENABLE; + CS_WRITE(sc, CS4231_IADDR, MODE_CHANGE_ENABLE); + CS_WRITE(sc, CS4231_IADDR, MODE_CHANGE_ENABLE | CS_INTERFACE_CONFIG); + CS_WRITE(sc, CS4231_IDATA, v); + + /* playback channel */ + CS_WRITE(sc, CS4231_IADDR, MODE_CHANGE_ENABLE | CS_CLOCK_DATA_FORMAT); + CS_WRITE(sc, CS4231_IDATA, fs); + CS_READ(sc, CS4231_IDATA); + CS_READ(sc, CS4231_IDATA); + for (i = CS_TIMEOUT; + i && CS_READ(sc, CS4231_IADDR) == CS_IN_INIT; i--) + DELAY(10); + if (i == 0) { + device_printf(sc->sc_dev, "timeout setting playback speed\n"); + doreset++; + } + + /* + * capture channel + * cs4231 doesn't allow sperate fs setup for playback/capture. + * I believe this will break full-duplex operation. + */ + CS_WRITE(sc, CS4231_IADDR, MODE_CHANGE_ENABLE | CS_REC_FORMAT); + CS_WRITE(sc, CS4231_IDATA, fs); + CS_READ(sc, CS4231_IDATA); + CS_READ(sc, CS4231_IDATA); + for (i = CS_TIMEOUT; + i && CS_READ(sc, CS4231_IADDR) == CS_IN_INIT; i--) + DELAY(10); + if (i == 0) { + device_printf(sc->sc_dev, "timeout setting capture format\n"); + doreset++; + } + + CS_WRITE(sc, CS4231_IADDR, 0); + for (i = CS_TIMEOUT; + i && CS_READ(sc, CS4231_IADDR) == CS_IN_INIT; i--) + DELAY(10); + if (i == 0) { + device_printf(sc->sc_dev, "timeout waiting for !MCE\n"); + doreset++; + } + CS_WRITE(sc, CS4231_IADDR, CS_TEST_AND_INIT); + + for (i = CS_TIMEOUT; + i && CS_READ(sc, CS4231_IDATA) & AUTO_CAL_IN_PROG; i--) + DELAY(10); + if (i == 0) { + device_printf(sc->sc_dev, + "timeout waiting for autocalibration\n"); + doreset++; + } + if (doreset) { + /* + * Maybe the last resort to avoid a dreadful message like + * "pcm0:play:0: play interrupt timeout, channel dead" would + * be hardware reset. + */ + device_printf(sc->sc_dev, "trying to hardware reset\n"); + cs4231_power_reset(sc); + CS4231_UNLOCK(sc); /* XXX */ + if (mixer_reinit(sc->sc_dev) == -1) + device_printf(sc->sc_dev, + "unable to reinitialize the mixer\n"); + CS4231_LOCK(sc); + } +} + +static int +cs4231_chan_setblocksize(kobj_t obj, void *data, u_int32_t blocksize) +{ + struct cs4231_softc *sc; + struct cs4231_channel *ch; + int nblks; + + ch = data; + sc = ch->parent; + + if (blocksize > CS4231_MAX_DMA_SZ) + blocksize = CS4231_MAX_DMA_SZ; + nblks = sc->sc_bufsz / blocksize; + sndbuf_resize(ch->buffer, nblks, blocksize); + + return blocksize; +} + +static int +cs4231_chan_trigger(kobj_t obj, void *data, int go) +{ + struct cs4231_channel *ch; + + ch = data; + switch(go) { + case PCMTRIG_EMLDMAWR: + case PCMTRIG_EMLDMARD: + break; + case PCMTRIG_START: + cs4231_trigger(ch); + break; + case PCMTRIG_ABORT: + case PCMTRIG_STOP: + cs4231_halt(ch); + break; + default: + break; + } + + return (0); +} + +static int +cs4231_chan_getptr(kobj_t obj, void *data) +{ + struct cs4231_softc *sc; + struct cs4231_channel *ch; + u_int32_t naddr; + int ptr, sz; + + ch = data; + sc = ch->parent; + + CS4231_LOCK(sc); + if (ch->dir == PCMDIR_PLAY) + naddr = APC_READ(sc, APC_PNVA); + else + naddr = APC_READ(sc, APC_CNVA); + sz = sndbuf_getsize(ch->buffer); + ptr = naddr + sndbuf_getblksz(ch->buffer) - + sndbuf_getbufaddr(ch->buffer); + CS4231_UNLOCK(sc); + + ptr %= sz; + return (ptr); +} + +static struct pcmchan_caps * +cs4231_chan_getcaps(kobj_t obj, void *data) +{ + return (&cs4231_caps); +} + +static void +cs4231_trigger(struct cs4231_channel *ch) +{ + struct cs4231_softc *sc; + u_int32_t csr, togo; + u_int32_t nextaddr, saddr; + + sc = ch->parent; + + CS4231_LOCK(sc); + if (ch->locked) { + device_printf(sc->sc_dev, "already triggered\n"); + CS4231_UNLOCK(sc); + return; + } + + nextaddr = sndbuf_getbufaddr(ch->buffer); + togo = sndbuf_getblksz(ch->buffer); + if (ch->dir == PCMDIR_PLAY) { + DPRINTF(("TRG: PNVA = %x, togo = %x\n", nextaddr, togo)); + + cs4231_read(sc, CS_TEST_AND_INIT); /* clear pending error */ + csr = APC_READ(sc, APC_CSR); + APC_WRITE(sc, APC_PNVA, nextaddr); + APC_WRITE(sc, APC_PNC, togo); + + if ((csr & APC_CSR_PDMA_GO) == 0 || + (csr & APC_CSR_PPAUSE) != 0) { + APC_WRITE(sc, APC_CSR, APC_READ(sc, APC_CSR) & + ~(APC_CSR_PIE | APC_CSR_PPAUSE)); + APC_WRITE(sc, APC_CSR, APC_READ(sc, APC_CSR) | + APC_CSR_GIE | APC_CSR_PIE | APC_CSR_EIE | + APC_CSR_EI | APC_CSR_PMIE | APC_CSR_PDMA_GO); + cs4231_write(sc, CS_LOWER_BASE_COUNT, 0xff); + cs4231_write(sc, CS_UPPER_BASE_COUNT, 0xff); + cs4231_write(sc, CS_INTERFACE_CONFIG, + cs4231_read(sc, CS_INTERFACE_CONFIG) | + PLAYBACK_ENABLE); + } + } else { + DPRINTF(("TRG: CNVA = %x, togo = %x\n", nextaddr, togo)); + + cs4231_read(sc, CS_TEST_AND_INIT); /* clear pending error */ + APC_WRITE(sc, APC_CNVA, nextaddr); + APC_WRITE(sc, APC_CNC, togo); + csr = APC_READ(sc, APC_CSR); + if ((csr & APC_CSR_CDMA_GO) == 0 || + (csr & APC_CSR_CPAUSE) != 0) { + csr &= APC_CSR_CPAUSE; + csr |= APC_CSR_GIE | APC_CSR_CMIE | APC_CSR_CIE | + APC_CSR_EI | APC_CSR_CDMA_GO; + APC_WRITE(sc, APC_CSR, csr); + cs4231_write(sc, CS_LOWER_REC_CNT, 0xff); + cs4231_write(sc, CS_UPPER_REC_CNT, 0xff); + cs4231_write(sc, CS_INTERFACE_CONFIG, + cs4231_read(sc, CS_INTERFACE_CONFIG) | + CAPTURE_ENABLE); + } + /* try to update next samples */ + if (APC_READ(sc, APC_CSR) & APC_CSR_CD) { + saddr = sndbuf_getbufaddr(ch->buffer); + nextaddr = APC_READ(sc, APC_CNVA) + togo; + if (nextaddr >= saddr + sc->sc_bufsz) + nextaddr = saddr; + APC_WRITE(sc, APC_CNVA, nextaddr); + APC_WRITE(sc, APC_CNC, togo); + } + } + ch->locked = 1; + CS4231_UNLOCK(sc); +} + +static void +cs4231_halt(struct cs4231_channel *ch) +{ + struct cs4231_softc *sc; + + sc = ch->parent; + CS4231_LOCK(sc); + + if (ch->dir == PCMDIR_PLAY ) { + /* XXX Kills some capture bits */ + APC_WRITE(sc, APC_CSR, APC_READ(sc, APC_CSR) & + ~(APC_CSR_EI | APC_CSR_GIE | APC_CSR_PIE | + APC_CSR_EIE | APC_CSR_PDMA_GO | APC_CSR_PMIE)); + cs4231_write(sc, CS_INTERFACE_CONFIG, + cs4231_read(sc, CS_INTERFACE_CONFIG) & (~PLAYBACK_ENABLE)); + } else { + /* XXX Kills some playback bits */ + APC_WRITE(sc, APC_CSR, APC_CSR_CAPTURE_PAUSE); + cs4231_write(sc, CS_INTERFACE_CONFIG, + cs4231_read(sc, CS_INTERFACE_CONFIG) & (~CAPTURE_ENABLE)); + } + ch->locked = 0; + CS4231_UNLOCK(sc); +} --- /dev/null Thu Jul 1 18:00:00 2004 +++ sys/dev/sound/sbus/cs4231.h Wed Jun 30 18:26:20 2004 @@ -0,0 +1,228 @@ +/*- + * Copyright (c) 1996 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Ken Hornstein and John Kohl. + * + * 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 REGENTS 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. + */ + +/* + * Register defs for Crystal Semiconductor CS4231 Audio Codec/mixer + * chip, used on Gravis UltraSound MAX cards. + * + * Block diagram: + * +----------------------------------------------------+ + * | | + * | +----------------------------------------------+ | + * | |mixed in +-+ | | + * | +------------>--| | | | + * | mic in | | | | + * Mic --+-->| --------- GAIN ->-| | | | + * | | AUX 1 in |M| | | + * GF1 --)-->| -------------+-->-|U| | | + * | | Line in | |X|---- GAIN ----------+ | | + * Line --)-->| ---------+---)-->-| | | | | + * | | | | | | | | | + * | | | | +-+ ADC | | + * | | | | | | | + * | | | | | | | + * | | | +--- L/M --\ | | | AMP--> + * | | | \ | | | | + * | | | \ | | | | + * | | +---- L/M -------O-->--+--------)-------+-|--+-> line + * | | mono in /| | | | + * +---|-->------------ L/M -----/ | | | | + * | AUX 2 in | | | | + * CD --------|-->------------ L/M -------+ L/M | | + * | | v | + * | | | | + * | DAC | | + * | | | | + * +----------------------------------------------------+ + * | | + * | | + * v v + * Pc BUS (DISK) ??? + * + * Documentation for this chip can be found at: + * http://www.cirrus.com/products/overviews/cs4231.html + */ + +/* + * This file was merged from two header files.(ad1848reg.h and cs4231reg.h) + * And the suffix AD1848 and SP was changed to CS4231 and CS respectively. + */ +/* CS4231 direct registers */ +#define CS4231_IADDR 0x00 +#define CS4231_IDATA 0x01 +#define CS4231_STATUS 0x02 +#define CS4231_PIO 0x03 + +/* Index address register */ +#define CS_IN_INIT 0x80 +#define MODE_CHANGE_ENABLE 0x40 +#define TRANSFER_DISABLE 0x20 +#define ADDRESS_MASK 0xe0 + +/* Status bits */ +#define INTERRUPT_STATUS 0x01 +#define PLAYBACK_READY 0x02 +#define PLAYBACK_LEFT 0x04 +/* pbright is not left */ +#define PLAYBACK_UPPER 0x08 +/* bplower is not upper */ +#define SAMPLE_ERROR 0x10 +#define CAPTURE_READY 0x20 +#define CAPTURE_LEFT 0x40 +/* cpright is not left */ +#define CAPTURE_UPPER 0x80 +/* cplower is not upper */ + +/* CS4231 indirect mapped registers */ +#define CS_LEFT_INPUT_CONTROL 0x00 +#define CS_RIGHT_INPUT_CONTROL 0x01 +#define CS_LEFT_AUX1_CONTROL 0x02 +#define CS_RIGHT_AUX1_CONTROL 0x03 +#define CS_LEFT_AUX2_CONTROL 0x04 +#define CS_RIGHT_AUX2_CONTROL 0x05 +#define CS_LEFT_OUTPUT_CONTROL 0x06 +#define CS_RIGHT_OUTPUT_CONTROL 0x07 +#define CS_CLOCK_DATA_FORMAT 0x08 +#define CS_INTERFACE_CONFIG 0x09 +#define CS_PIN_CONTROL 0x0a +#define CS_TEST_AND_INIT 0x0b +#define CS_MISC_INFO 0x0c +#define CS_DIGITAL_MIX 0x0d +#define CS_UPPER_BASE_COUNT 0x0e +#define CS_LOWER_BASE_COUNT 0x0f +/* CS4231/AD1845 mode2 registers; added to AD1848 registers */ +#define CS_ALT_FEATURE1 0x10 +#define CS_ALT_FEATURE2 0x11 +#define CS_LEFT_LINE_CONTROL 0x12 +#define CS_RIGHT_LINE_CONTROL 0x13 +#define CS_TIMER_LOW 0x14 +#define CS_TIMER_HIGH 0x15 +#define CS_UPPER_FREQUENCY_SEL 0x16 +#define CS_LOWER_FREQUENCY_SEL 0x17 +#define CS_IRQ_STATUS 0x18 +#define CS_VERSION_ID 0x19 +#define CS_MONO_IO_CONTROL 0x1a +#define CS_POWERDOWN_CONTROL 0x1b +#define CS_REC_FORMAT 0x1c +#define CS_XTAL_SELECT 0x1d +#define CS_UPPER_REC_CNT 0x1e +#define CS_LOWER_REC_CNT 0x1f + +#define CS_IN_MASK 0x2f +#define CS_IN_LINE 0x00 +#define CS_IN_AUX1 0x40 +#define CS_IN_MIC 0x80 +#define CS_IN_DAC 0xc0 +#define CS_MIC_GAIN_ENABLE 0x20 +#define CS_IN_GAIN_MASK 0xf0 + +/* Aux input control - registers I2 (channel 1,left); I3 (channel 1,right) + I4 (channel 2,left); I5 (channel 2,right) */ +#define AUX_INPUT_ATTEN_BITS 0x1f +#define AUX_INPUT_ATTEN_MASK 0xe0 +#define AUX_INPUT_MUTE 0x80 + +/* Output bits - registers I6,I7*/ +#define OUTPUT_MUTE 0x80 +#define OUTPUT_ATTEN_BITS 0x3f +#define OUTPUT_ATTEN_MASK (~OUTPUT_ATTEN_BITS & 0xff) + +/* Clock and Data format reg bits (some also Capture Data format) - reg I8 */ +#define CS_CLOCK_DATA_FORMAT_MASK 0x0f +#define CLOCK_XTAL1 0x00 +#define CLOCK_XTAL2 0x01 +#define CLOCK_FREQ_MASK 0xf1 +#define CS_AFMT_STEREO 0x10 +#define CS_AFMT_U8 0x00 +#define CS_AFMT_MU_LAW 0x20 +#define CS_AFMT_S16_LE 0x40 +#define CS_AFMT_A_LAW 0x60 +#define CS_AFMT_IMA_ADPCM 0xa0 +#define CS_AFMT_U16_BE 0xc0 + +/* Interface Configuration reg bits - register I9 */ +#define PLAYBACK_ENABLE 0x01 +#define CAPTURE_ENABLE 0x02 +#define DUAL_DMA 0x00 +#define SINGLE_DMA 0x04 +#define AUTO_CAL_ENABLE 0x08 +#define PLAYBACK_PIO_ENABLE 0x40 +#define CAPTURE_PIO_ENABLE 0x80 + +/* Pin control bits - register I10 */ +#define INTERRUPT_ENABLE 0x02 +#define XCTL0_ENABLE 0x40 +#define XCTL1_ENABLE 0x80 + +/* Test and init reg bits - register I11 (read-only) */ +#define OVERRANGE_LEFT_MASK 0xfc +#define OVERRANGE_RIGHT_MASK 0xf3 +#define DATA_REQUEST_STATUS 0x10 +#define AUTO_CAL_IN_PROG 0x20 +#define PLAYBACK_UNDERRUN 0x40 +#define CAPTURE_OVERRUN 0x80 + +/* Miscellaneous Control reg bits - register I12 */ +#define CS_ID_MASK 0x70 +#define CS_MODE2 0x40 + +/* Digital Mix Control reg bits - register I13 */ +#define DIGITAL_MIX1_ENABLE 0x01 +#define MIX_ATTEN_MASK 0x03 + +/* alternate feature status(I24) */ +#define CS_AFS_TI 0x40 /* timer interrupt */ +#define CS_AFS_CI 0x20 /* capture interrupt */ +#define CS_AFS_PI 0x10 /* playback interrupt */ +#define CS_AFS_CU 0x08 /* capture underrun */ +#define CS_AFS_CO 0x04 /* capture overrun */ +#define CS_AFS_PO 0x02 /* playback overrun */ +#define CS_AFS_PU 0x01 /* playback underrun */ + + +/* Miscellaneous Control reg bits */ +#define CS_MODE2 0x40 + +#define MONO_INPUT_ATTEN_BITS 0x0f +#define MONO_INPUT_ATTEN_MASK 0xf0 +#define MONO_OUTPUT_MUTE 0x40 +#define MONO_INPUT_MUTE 0x80 +#define MONO_INPUT_MUTE_MASK 0x7f + +#define LINE_INPUT_ATTEN_BITS 0x1f +#define LINE_INPUT_ATTEN_MASK 0xe0 +#define LINE_INPUT_MUTE 0x80 +#define LINE_INPUT_MUTE_MASK 0x7f --- sys/modules/Makefile.orig Mon Jun 28 18:03:48 2004 +++ sys/modules/Makefile Wed Jun 30 20:03:47 2004 @@ -417,6 +417,7 @@ .if ${MACHINE_ARCH} == "sparc64" _gem= gem _hme= hme +_sound= sound .endif .if defined(MODULES_OVERRIDE) && !defined(ALL_MODULES) --- sys/modules/sound/driver/Makefile.orig Sun Aug 18 01:23:44 2002 +++ sys/modules/sound/driver/Makefile Wed Jun 30 18:33:09 2004 @@ -1,6 +1,6 @@ # $FreeBSD: src/sys/modules/sound/driver/Makefile,v 1.15 2002/08/17 16:23:44 orion Exp $ -SUBDIR = als4000 ad1816 cmi cs4281 csa ds1 emu10k1 es137x ess +SUBDIR = als4000 ad1816 cmi cs4231 cs4281 csa ds1 emu10k1 es137x ess SUBDIR += fm801 ich maestro maestro3 mss neomagic sb16 sb8 sbc solo SUBDIR += t4dwave via8233 via82c686 vibes SUBDIR += driver uaudio --- /dev/null Thu Jul 1 18:00:00 2004 +++ sys/modules/sound/driver/cs4231/Makefile Wed Jun 30 18:32:25 2004 @@ -0,0 +1,9 @@ +# $FreeBSD$ + +.PATH: ${.CURDIR}/../../../../dev/sound/sbus + +KMOD= snd_cs4231 +SRCS= device_if.h bus_if.h +SRCS+= cs4231.c + +.include --W/nzBZO5zC0uMSeA-- From owner-freebsd-sparc64@FreeBSD.ORG Thu Jul 1 10:29:18 2004 Return-Path: Delivered-To: freebsd-sparc64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 39F4716A4CE for ; Thu, 1 Jul 2004 10:29:18 +0000 (GMT) Received: from ns.kt-is.co.kr (ns.kt-is.co.kr [211.218.149.125]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9831943D5E for ; Thu, 1 Jul 2004 10:29:17 +0000 (GMT) (envelope-from yongari@kt-is.co.kr) Received: from michelle.kt-is.co.kr (ns2.kt-is.co.kr [220.76.118.193]) (authenticated bits=128) by ns.kt-is.co.kr (8.12.10/8.12.10) with ESMTP id i61AOkAh028730 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Thu, 1 Jul 2004 19:24:46 +0900 (KST) Received: from michelle.kt-is.co.kr (localhost.kt-is.co.kr [127.0.0.1]) i61AQi7S013066 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 1 Jul 2004 19:26:44 +0900 (KST) (envelope-from yongari@kt-is.co.kr) Received: (from yongari@localhost) by michelle.kt-is.co.kr (8.12.10/8.12.10/Submit) id i61AQiG5013065 for freebsd-sparc64@freebsd.org; Thu, 1 Jul 2004 19:26:44 +0900 (KST) (envelope-from yongari@kt-is.co.kr) Date: Thu, 1 Jul 2004 19:26:44 +0900 From: Pyun YongHyeon To: freebsd-sparc64@freebsd.org Message-ID: <20040701102644.GB12933@kt-is.co.kr> References: <20040701093937.GA12933@kt-is.co.kr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040701093937.GA12933@kt-is.co.kr> User-Agent: Mutt/1.4.1i X-Filter-Version: 1.11a (ns.kt-is.co.kr) Subject: Re: pcm sound driver for SBus Ultra1/Ultra2 X-BeenThere: freebsd-sparc64@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: yongari@kt-is.co.kr List-Id: Porting FreeBSD to the Sparc List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Jul 2004 10:29:18 -0000 On Thu, Jul 01, 2004 at 06:39:37PM +0900, To freebsd-sparc64@freebsd.org wrote: ... Sorry for the double post. -- Pyun YongHyeon From owner-freebsd-sparc64@FreeBSD.ORG Thu Jul 1 11:11:10 2004 Return-Path: Delivered-To: freebsd-sparc64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4179E16A4CE for ; Thu, 1 Jul 2004 11:11:10 +0000 (GMT) Received: from newtrinity.zeist.de (newtrinity.zeist.de [217.24.217.8]) by mx1.FreeBSD.org (Postfix) with ESMTP id B03E043D41 for ; Thu, 1 Jul 2004 11:11:09 +0000 (GMT) (envelope-from marius@newtrinity.zeist.de) Received: from newtrinity.zeist.de (localhost [127.0.0.1]) i61B9k1a012606; Thu, 1 Jul 2004 13:09:48 +0200 (CEST) (envelope-from marius@newtrinity.zeist.de) Received: (from marius@localhost) by newtrinity.zeist.de (8.12.10/8.12.10/Submit) id i61B9ePP012605; Thu, 1 Jul 2004 13:09:40 +0200 (CEST) (envelope-from marius) Date: Thu, 1 Jul 2004 13:09:40 +0200 From: Marius Strobl To: Pyun YongHyeon Message-ID: <20040701130940.A12214@newtrinity.zeist.de> References: <20040701093225.GA12517@kt-is.co.kr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <20040701093225.GA12517@kt-is.co.kr>; from yongari@kt-is.co.kr on Thu, Jul 01, 2004 at 06:32:25PM +0900 X-AntiVirus: checked by AntiVir Milter 1.1-beta; AVE 6.26.0.3; VDF 6.26.0.11 (host: newtrinity.zeist.de) cc: sparc64@freebsd.org Subject: Re: pcm sound driver for SBus Ultra1/Ultra2 X-BeenThere: freebsd-sparc64@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting FreeBSD to the Sparc List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Jul 2004 11:11:10 -0000 On Thu, Jul 01, 2004 at 06:32:25PM +0900, Pyun YongHyeon wrote: > Hello All, > > I don't know how may users want to hear sound on Ultra1/Ultra2. > But I wanted to hear some music while 'build world' is in progress. > > > 1. The driver is based on OpenBSD's driver and ISA mss driver > on FreeBSD. > 2. Supports onboard CS4231A chip on SBus Ultra1/Ultra2. > 3. Capture(recodring) was not tested at all. > - I don't have microphone. > 4. Due to lack of programming information for APC DMA, I > used existing interfaces of OpenBSD driver. So it may have > some bugs on FreeBSD. > 5. Full-duplex mode doesn't work. > 6. You may notice some noise when you work on ofw console. I don't > know what is the reason, atm. > 7. Due to lack of X supports, I could't test with xmms or GUI based > audio tools. > 8. If you have PCI/EBus based sparcs, they are not supported. Yes, they > use the same chip but have different DMA interface. In addition, I > don't have PCI/EBus based sparcs. > > Installation > 1. get the driver patch file and fetch your system > 2. build kernel and kernel modules > 3. load snd_cs4231.ko and play > Note, you may want to mute speaker output with mixer(8). > > The attached patch is for -CURRENT, and is also available at: > http://www.kr.freebsd.org/~yongari/cs4231.freebsd.diff > Interesting that adding a driver is sufficient for you. Last time I had a look at getting pcm(4) and SUNW,CS4231 working on FreeBSD/sparc64 I stumbled on pcm(4) not being endian-clean and not yet being fully converted to using busdma. At a quick glance that's still the case. Did you miss to add some changed files in your patch? From owner-freebsd-sparc64@FreeBSD.ORG Thu Jul 1 11:37:20 2004 Return-Path: Delivered-To: freebsd-sparc64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3C40216A4CE for ; Thu, 1 Jul 2004 11:37:20 +0000 (GMT) Received: from ns.kt-is.co.kr (ns.kt-is.co.kr [211.218.149.125]) by mx1.FreeBSD.org (Postfix) with ESMTP id C951C43D41 for ; Thu, 1 Jul 2004 11:37:19 +0000 (GMT) (envelope-from yongari@kt-is.co.kr) Received: from michelle.kt-is.co.kr (ns2.kt-is.co.kr [220.76.118.193]) (authenticated bits=128) by ns.kt-is.co.kr (8.12.10/8.12.10) with ESMTP id i61BYWAh030005 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Thu, 1 Jul 2004 20:34:32 +0900 (KST) Received: from michelle.kt-is.co.kr (localhost.kt-is.co.kr [127.0.0.1]) by michelle.kt-is.co.kr (8.12.10/8.12.10) with ESMTP id i61BaU7S013265 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 1 Jul 2004 20:36:30 +0900 (KST) (envelope-from yongari@kt-is.co.kr) Received: (from yongari@localhost) by michelle.kt-is.co.kr (8.12.10/8.12.10/Submit) id i61BaT6d013264; Thu, 1 Jul 2004 20:36:29 +0900 (KST) (envelope-from yongari@kt-is.co.kr) Date: Thu, 1 Jul 2004 20:36:29 +0900 From: Pyun YongHyeon To: Marius Strobl Message-ID: <20040701113629.GC12933@kt-is.co.kr> References: <20040701093225.GA12517@kt-is.co.kr> <20040701130940.A12214@newtrinity.zeist.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040701130940.A12214@newtrinity.zeist.de> User-Agent: Mutt/1.4.1i X-Filter-Version: 1.11a (ns.kt-is.co.kr) cc: sparc64@freebsd.org Subject: Re: pcm sound driver for SBus Ultra1/Ultra2 X-BeenThere: freebsd-sparc64@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: yongari@kt-is.co.kr List-Id: Porting FreeBSD to the Sparc List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Jul 2004 11:37:20 -0000 On Thu, Jul 01, 2004 at 01:09:40PM +0200, Marius Strobl wrote: > On Thu, Jul 01, 2004 at 06:32:25PM +0900, Pyun YongHyeon wrote: > > Hello All, > > > > I don't know how may users want to hear sound on Ultra1/Ultra2. > > But I wanted to hear some music while 'build world' is in progress. > > > > > > 1. The driver is based on OpenBSD's driver and ISA mss driver > > on FreeBSD. > > 2. Supports onboard CS4231A chip on SBus Ultra1/Ultra2. > > 3. Capture(recodring) was not tested at all. > > - I don't have microphone. > > 4. Due to lack of programming information for APC DMA, I > > used existing interfaces of OpenBSD driver. So it may have > > some bugs on FreeBSD. > > 5. Full-duplex mode doesn't work. > > 6. You may notice some noise when you work on ofw console. I don't > > know what is the reason, atm. > > 7. Due to lack of X supports, I could't test with xmms or GUI based > > audio tools. > > 8. If you have PCI/EBus based sparcs, they are not supported. Yes, they > > use the same chip but have different DMA interface. In addition, I > > don't have PCI/EBus based sparcs. > > > > Installation > > 1. get the driver patch file and fetch your system > > 2. build kernel and kernel modules > > 3. load snd_cs4231.ko and play > > Note, you may want to mute speaker output with mixer(8). > > > > The attached patch is for -CURRENT, and is also available at: > > http://www.kr.freebsd.org/~yongari/cs4231.freebsd.diff > > > > Interesting that adding a driver is sufficient for you. Last time I > had a look at getting pcm(4) and SUNW,CS4231 working on FreeBSD/sparc64 > I stumbled on pcm(4) not being endian-clean and not yet being fully > converted to using busdma. At a quick glance that's still the case. > Did you miss to add some changed files in your patch? > I'm afraid I didn't. The only real issue I encountered in pcm(4) was the reference for sndbuf_dmaxxx() in channel.c. So I added glue code (Nops) in sndbuf_dma.c. As you said, it seems that pcm(4) is not endian clean and I was surprised that I am the first big-endian consumer of pcm(4). But it works. :) Sample screen output follows. daemon# uname -a FreeBSD daemon.kt-is.co.kr 5.2-CURRENT FreeBSD 5.2-CURRENT #2: Wed Jun 30 20:01:02 KST 2004 root@daemon.kt-is.co.kr:/usr/src/sys/sparc64/compile/YONGARI_KERNEL sparc64 daemon# kldload snd_cs4231 daemon# sysctl hw.snd.verbose=2 hw.snd.verbose: 1 -> 2 daemon# cat /dev/sndstat FreeBSD Audio Driver (newpcm) Installed devices: pcm0: at mem 0xc000000 irq 2020 bufsz 32768 (1p/1r/0v channels duplex default) [pcm0:record:0]: spd 0, fmt 0x00000000/0x00000008, flags 0x00000000, 0x00000000 interrupts 0, overruns 0, hfree 32768, sfree 0 {hardware} -> feeder_root(0x00000000) -> {userland} [pcm0:play:0]: spd 0, fmt 0x00000000/0x00000008, flags 0x00000000, 0x00000000 interrupts 0, underruns 0, ready 0 {userland} -> feeder_root(0x00000000) -> {hardware} Regards, Pyun YongHyeon -- Pyun YongHyeon From owner-freebsd-sparc64@FreeBSD.ORG Thu Jul 1 14:22:48 2004 Return-Path: Delivered-To: freebsd-sparc64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BBF2616A4CE; Thu, 1 Jul 2004 14:22:48 +0000 (GMT) Received: from smtp3.sentex.ca (smtp3.sentex.ca [64.7.153.18]) by mx1.FreeBSD.org (Postfix) with ESMTP id 54F2843D31; Thu, 1 Jul 2004 14:22:48 +0000 (GMT) (envelope-from tinderbox@freebsd.org) Received: from smtp2.sentex.ca (smtp2c.sentex.ca [64.7.153.30]) by smtp3.sentex.ca (8.12.11/8.12.11) with ESMTP id i61EMGDR051007; Thu, 1 Jul 2004 10:22:16 -0400 (EDT) (envelope-from tinderbox@freebsd.org) Received: from freebsd-current.sentex.ca (freebsd-current.sentex.ca [64.7.128.98]) by smtp2.sentex.ca (8.12.11/8.12.11) with ESMTP id i61EMHM0058970; Thu, 1 Jul 2004 10:22:18 -0400 (EDT) (envelope-from tinderbox@freebsd.org) Received: by freebsd-current.sentex.ca (Postfix, from userid 666) id 8E9037303F; Thu, 1 Jul 2004 10:22:17 -0400 (EDT) Sender: FreeBSD Tinderbox From: FreeBSD Tinderbox To: FreeBSD Tinderbox , , Precedence: bulk Message-Id: <20040701142217.8E9037303F@freebsd-current.sentex.ca> Date: Thu, 1 Jul 2004 10:22:17 -0400 (EDT) Subject: [current tinderbox] failure on sparc64/sparc64 X-BeenThere: freebsd-sparc64@freebsd.org X-Mailman-Version: 2.1.1 List-Id: Porting FreeBSD to the Sparc List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Jul 2004 14:22:49 -0000 TB --- 2004-07-01 13:39:01 - tinderbox 2.3 running on freebsd-current.sentex.ca TB --- 2004-07-01 13:39:01 - starting CURRENT tinderbox run for sparc64/sparc64 TB --- 2004-07-01 13:39:01 - checking out the source tree TB --- 2004-07-01 13:39:01 - cd /home/tinderbox/sandbox/CURRENT/sparc64/sparc64 TB --- 2004-07-01 13:39:01 - /usr/bin/cvs -f -R -q -d/home/ncvs update -Pd -A src TB --- 2004-07-01 13:41:20 - building world (CFLAGS=-O2 -pipe) TB --- 2004-07-01 13:41:20 - cd /home/tinderbox/sandbox/CURRENT/sparc64/sparc64/src TB --- 2004-07-01 13:41:20 - /usr/bin/make -B buildworld >>> Rebuilding the temporary build tree >>> stage 1.1: legacy release compatibility shims >>> stage 1.2: bootstrap tools >>> stage 2.1: cleaning up the object tree >>> stage 2.2: rebuilding the object tree >>> stage 2.3: build tools >>> stage 3: cross tools >>> stage 4.1: building includes >>> stage 4.2: building libraries >>> stage 4.3: make dependencies >>> stage 4.4: building everything [...] cc -O2 -pipe -DHAVE_CONFIG_H -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/lib -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/src -c /tinderbox/CURRENT/sparc64/sparc64/src/contrib/tar/lib/exclude.c cc -O2 -pipe -DHAVE_CONFIG_H -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/lib -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/src -c /tinderbox/CURRENT/sparc64/sparc64/src/contrib/tar/lib/full-write.c cc -O2 -pipe -DHAVE_CONFIG_H -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/lib -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/src -c /tinderbox/CURRENT/sparc64/sparc64/src/contrib/tar/lib/getdate.c cc -O2 -pipe -DHAVE_CONFIG_H -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/lib -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/src -c /tinderbox/CURRENT/sparc64/sparc64/src/contrib/tar/lib/getline.c cc -O2 -pipe -DHAVE_CONFIG_H -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/lib -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/src -c /tinderbox/CURRENT/sparc64/sparc64/src/contrib/tar/lib/getstr.c cc -O2 -pipe -DHAVE_CONFIG_H -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/lib -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/src -c /tinderbox/CURRENT/sparc64/sparc64/src/contrib/tar/lib/hash.c {standard input}: Assembler messages: {standard input}:1283: Error: Illegal operands *** Error code 1 Stop in /tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar. *** Error code 1 Stop in /tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin. *** Error code 1 Stop in /tinderbox/CURRENT/sparc64/sparc64/src/gnu. *** Error code 1 Stop in /tinderbox/CURRENT/sparc64/sparc64/src. *** Error code 1 Stop in /tinderbox/CURRENT/sparc64/sparc64/src. *** Error code 1 Stop in /tinderbox/CURRENT/sparc64/sparc64/src. TB --- 2004-07-01 14:22:17 - WARNING: /usr/bin/make returned exit code 1 TB --- 2004-07-01 14:22:17 - ERROR: failed to build world TB --- 2004-07-01 14:22:17 - tinderbox aborted From owner-freebsd-sparc64@FreeBSD.ORG Thu Jul 1 15:36:14 2004 Return-Path: Delivered-To: freebsd-sparc64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E608C16A4CE for ; Thu, 1 Jul 2004 15:36:14 +0000 (GMT) Received: from omzesmtp01.mci.com (omzesmtp01.mci.com [199.249.17.7]) by mx1.FreeBSD.org (Postfix) with ESMTP id A7FBF43D2F for ; Thu, 1 Jul 2004 15:36:14 +0000 (GMT) (envelope-from james.gill@mci.com) Received: from cmr0.ash.ops.us.uu.net ([198.5.241.38]) by firewall.mci.com (Iplanet MTA 5.2) with ESMTP id <0I06003KDJ4QGQ@firewall.mci.com> for freebsd-sparc64@freebsd.org; Thu, 01 Jul 2004 15:31:38 +0000 (GMT) Received: from imr2.ash.ops.us.uu.net by cmr0.ash.ops.us.uu.net with ESMTP (peer crosschecked as: imr2.ash.ops.us.uu.net [153.39.43.15]) id QQqvlm24392; Thu, 01 Jul 2004 15:31:32 +0000 (GMT) Received: from haiti.corp.us.uu.net by imr2.ash.ops.us.uu.net with ESMTP (peer crosschecked as: haiti.corp.us.uu.net [153.39.146.95]) id QQqvlm22037; Thu, 01 Jul 2004 15:31:23 +0000 (GMT) Received: from localhost by haiti.corp.us.uu.net with ESMTP (peer crosschecked as: jamgill@localhost) id i61FVNq01958; Thu, 01 Jul 2004 11:31:23 -0400 (EDT) Date: Thu, 01 Jul 2004 11:31:23 -0400 (EDT) From: "Gill, James" In-reply-to: <20040630184237.GA18402@electra.cse.Buffalo.EDU> X-X-Sender: jamgill@haiti.corp.us.uu.net To: Ken Smith Message-id: MIME-version: 1.0 Content-type: TEXT/PLAIN; charset=US-ASCII References: <20040630184237.GA18402@electra.cse.Buffalo.EDU> cc: freebsd-sparc64@freebsd.org Subject: Re: Snapshot - still working on it... X-BeenThere: freebsd-sparc64@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: James.Gill@MCI.com List-Id: Porting FreeBSD to the Sparc List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Jul 2004 15:36:15 -0000 Hi Ken, If you like/need a fast mirror, send me a link and I'll put this up on mirrors.secsup.org a.k.a. ftp1.freebsd.org at any rate, i'll be holding my breath for my own copy ;) thank you for your efforts. --gill On Wed, 30 Jun 2004, Ken Smith wrote: > > Just so you know, I didn't forget about generating a new snapshot. > I've just made two mistakes in a row that did enough dammage to > require restarts. And if you think 'make buildworld' takes a while > on sparc64 try 'make release' some time... :-) > > Third attempt is running now, hopefully third time is a charm. :-) > Sorry for the delay. > > [ Garance, your suggestion about including cvsup was a good one, > I'll include it along with perl in the ISO. ] > > ----------------------------------------------------- MCI/UUNET Network Security & Abuse * 1-800-900-0241,4 ----------------------------------------------------- v-net: desk = 806-3834 ; group = 806-8805 From owner-freebsd-sparc64@FreeBSD.ORG Thu Jul 1 20:29:24 2004 Return-Path: Delivered-To: freebsd-sparc64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6282116A4CE for ; Thu, 1 Jul 2004 20:29:24 +0000 (GMT) Received: from electra.cse.Buffalo.EDU (electra.cse.Buffalo.EDU [128.205.32.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1841943D3F for ; Thu, 1 Jul 2004 20:29:24 +0000 (GMT) (envelope-from kensmith@cse.Buffalo.EDU) Received: from electra.cse.Buffalo.EDU (kensmith@localhost [127.0.0.1]) i61KSV2n025128 for ; Thu, 1 Jul 2004 16:28:31 -0400 (EDT) Received: (from kensmith@localhost) by electra.cse.Buffalo.EDU (8.12.10/8.12.9/Submit) id i61KSVrW025127 for freebsd-sparc64@freebsd.org; Thu, 1 Jul 2004 16:28:31 -0400 (EDT) Date: Thu, 1 Jul 2004 16:28:31 -0400 From: Ken Smith To: freebsd-sparc64@freebsd.org Message-ID: <20040701202831.GA24386@electra.cse.Buffalo.EDU> References: <20040630184237.GA18402@electra.cse.Buffalo.EDU> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040630184237.GA18402@electra.cse.Buffalo.EDU> User-Agent: Mutt/1.4.1i Subject: Re: Snapshot - still working on it... X-BeenThere: freebsd-sparc64@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting FreeBSD to the Sparc List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Jul 2004 20:29:24 -0000 On Wed, Jun 30, 2004 at 02:42:37PM -0400, Ken Smith wrote: > Third attempt is running now, hopefully third time is a charm. :-) Apparently not... It's a bit hard to dance fandango on the keyboard for sparc64 so we'll need to wait for the fix to a problem with the installation procedure. I'm a bit fuzzy on the whole thing but I know the person who should know about it does know about it. It's something along the lines of the random number generation stuff insisting on some input from the keyboard to unblock it when it can't find a suitable source of random stuff elsewhere on the system. At least on i386 with a console it tells you about this on a vty and you can switch to that vty and press some keys on your keyboard to unblock it. You can't do that on sparc64 through a serial console... I'll watch for the fix to be committed and will give it another try then. -- Ken Smith - From there to here, from here to | kensmith@cse.buffalo.edu there, funny things are everywhere. | - Theodore Geisel | From owner-freebsd-sparc64@FreeBSD.ORG Fri Jul 2 02:22:49 2004 Return-Path: Delivered-To: freebsd-sparc64@freebsd.org Received: from mx1.FreeBSD.org (unknown [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CAB4E16A4CF for ; Fri, 2 Jul 2004 02:22:49 +0000 (GMT) Received: from pooker.samsco.org (pooker.samsco.org [168.103.85.57]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6C17F43D41 for ; Fri, 2 Jul 2004 02:22:46 +0000 (GMT) (envelope-from scottl@samsco.org) Received: from samsco.org (p58.n-nypop02.stsn.com [199.106.89.58]) (authenticated bits=0) by pooker.samsco.org (8.12.11/8.12.10) with ESMTP id i622Ob83076913; Thu, 1 Jul 2004 20:24:38 -0600 (MDT) (envelope-from scottl@samsco.org) Message-ID: <40E4C659.3000005@samsco.org> Date: Thu, 01 Jul 2004 20:20:09 -0600 From: Scott Long User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.6) Gecko/20040304 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Marius Strobl References: <20040701093225.GA12517@kt-is.co.kr> <20040701130940.A12214@newtrinity.zeist.de> In-Reply-To: <20040701130940.A12214@newtrinity.zeist.de> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, hits=0.0 required=3.8 tests=none autolearn=no version=2.63 X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on pooker.samsco.org cc: sparc64@freebsd.org Subject: Re: pcm sound driver for SBus Ultra1/Ultra2 X-BeenThere: freebsd-sparc64@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting FreeBSD to the Sparc List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Jul 2004 02:22:49 -0000 Marius Strobl wrote: > On Thu, Jul 01, 2004 at 06:32:25PM +0900, Pyun YongHyeon wrote: > >>Hello All, >> >>I don't know how may users want to hear sound on Ultra1/Ultra2. >>But I wanted to hear some music while 'build world' is in progress. >> >> >> 1. The driver is based on OpenBSD's driver and ISA mss driver >> on FreeBSD. >> 2. Supports onboard CS4231A chip on SBus Ultra1/Ultra2. >> 3. Capture(recodring) was not tested at all. >> - I don't have microphone. >> 4. Due to lack of programming information for APC DMA, I >> used existing interfaces of OpenBSD driver. So it may have >> some bugs on FreeBSD. >> 5. Full-duplex mode doesn't work. >> 6. You may notice some noise when you work on ofw console. I don't >> know what is the reason, atm. >> 7. Due to lack of X supports, I could't test with xmms or GUI based >> audio tools. >> 8. If you have PCI/EBus based sparcs, they are not supported. Yes, they >> use the same chip but have different DMA interface. In addition, I >> don't have PCI/EBus based sparcs. >> >>Installation >> 1. get the driver patch file and fetch your system >> 2. build kernel and kernel modules >> 3. load snd_cs4231.ko and play >> Note, you may want to mute speaker output with mixer(8). >> >>The attached patch is for -CURRENT, and is also available at: >> http://www.kr.freebsd.org/~yongari/cs4231.freebsd.diff >> > > > Interesting that adding a driver is sufficient for you. Last time I > had a look at getting pcm(4) and SUNW,CS4231 working on FreeBSD/sparc64 > I stumbled on pcm(4) not being endian-clean and not yet being fully > converted to using busdma. At a quick glance that's still the case. > Did you miss to add some changed files in your patch? > When using the sbus attachment, does it really matter if register accesses are endian clean? The sbus registers are going to expect big-endian accesses from the cpu, yes? It would probably be better to explicitly wrap the register accesses with endian conversions, but it shouldn't be a barrier in this particular case. However, registers that are done via DMA transfers might need some special care. I don't think that there are many sound cards that operate this way, but it's something to think about. The lack of busdma in pcm is troubling and should be looked at. Scott From owner-freebsd-sparc64@FreeBSD.ORG Fri Jul 2 02:27:14 2004 Return-Path: Delivered-To: freebsd-sparc64@freebsd.org Received: from mx1.FreeBSD.org (unknown [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 308A916A4CE for ; Fri, 2 Jul 2004 02:27:14 +0000 (GMT) Received: from pooker.samsco.org (pooker.samsco.org [168.103.85.57]) by mx1.FreeBSD.org (Postfix) with ESMTP id 342EE43D1F for ; Fri, 2 Jul 2004 02:27:13 +0000 (GMT) (envelope-from scottl@samsco.org) Received: from samsco.org (p58.n-nypop02.stsn.com [199.106.89.58]) (authenticated bits=0) by pooker.samsco.org (8.12.11/8.12.10) with ESMTP id i622U7bc076949; Thu, 1 Jul 2004 20:30:08 -0600 (MDT) (envelope-from scottl@samsco.org) Message-ID: <40E4C7A4.4010707@samsco.org> Date: Thu, 01 Jul 2004 20:25:40 -0600 From: Scott Long User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.6) Gecko/20040304 X-Accept-Language: en-us, en MIME-Version: 1.0 To: yongari@kt-is.co.kr References: <20040701093225.GA12517@kt-is.co.kr> In-Reply-To: <20040701093225.GA12517@kt-is.co.kr> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, hits=0.0 required=3.8 tests=none autolearn=no version=2.63 X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on pooker.samsco.org cc: sparc64@freebsd.org Subject: Re: pcm sound driver for SBus Ultra1/Ultra2 X-BeenThere: freebsd-sparc64@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting FreeBSD to the Sparc List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Jul 2004 02:27:14 -0000 Pyun YongHyeon wrote: > Hello All, > > I don't know how may users want to hear sound on Ultra1/Ultra2. > But I wanted to hear some music while 'build world' is in progress. > > > 1. The driver is based on OpenBSD's driver and ISA mss driver > on FreeBSD. > 2. Supports onboard CS4231A chip on SBus Ultra1/Ultra2. > 3. Capture(recodring) was not tested at all. > - I don't have microphone. > 4. Due to lack of programming information for APC DMA, I > used existing interfaces of OpenBSD driver. So it may have > some bugs on FreeBSD. > 5. Full-duplex mode doesn't work. > 6. You may notice some noise when you work on ofw console. I don't > know what is the reason, atm. > 7. Due to lack of X supports, I could't test with xmms or GUI based > audio tools. > 8. If you have PCI/EBus based sparcs, they are not supported. Yes, they > use the same chip but have different DMA interface. In addition, I > don't have PCI/EBus based sparcs. > > Installation > 1. get the driver patch file and fetch your system > 2. build kernel and kernel modules > 3. load snd_cs4231.ko and play > Note, you may want to mute speaker output with mixer(8). > > The attached patch is for -CURRENT, and is also available at: > http://www.kr.freebsd.org/~yongari/cs4231.freebsd.diff > > Corrections, suggestions welcome. > Thanks. > > Regards, > Pyun YongHyeon > Once again, you've done another impressive job =-) The biggest question that I have is why you chose to base the work on the mss driver and not the cs428x driver. I looked at this briefly a few weeks ago and decided (after also looking at NetBSD) that it really only needed to be abstracted so it could take both a PCI and an SBUS front-end. The only thing that held me back was the lack of busdma support. Since this requires stubs into sndbuf_dma.c it might not be totally appropriate as it is, but I'd like to also review it further over the next few days and get back to you. Thanks! Scott From owner-freebsd-sparc64@FreeBSD.ORG Fri Jul 2 04:10:21 2004 Return-Path: Delivered-To: freebsd-sparc64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3A74D16A4CE for ; Fri, 2 Jul 2004 04:10:21 +0000 (GMT) Received: from ns.kt-is.co.kr (ns.kt-is.co.kr [211.218.149.125]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9BCCB43D49 for ; Fri, 2 Jul 2004 04:10:20 +0000 (GMT) (envelope-from yongari@kt-is.co.kr) Received: from michelle.kt-is.co.kr (ns2.kt-is.co.kr [220.76.118.193]) (authenticated bits=128) by ns.kt-is.co.kr (8.12.10/8.12.10) with ESMTP id i6246XAh050105 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Fri, 2 Jul 2004 13:06:33 +0900 (KST) Received: from michelle.kt-is.co.kr (localhost.kt-is.co.kr [127.0.0.1]) by michelle.kt-is.co.kr (8.12.10/8.12.10) with ESMTP id i6248a7S015738 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 2 Jul 2004 13:08:36 +0900 (KST) (envelope-from yongari@kt-is.co.kr) Received: (from yongari@localhost) by michelle.kt-is.co.kr (8.12.10/8.12.10/Submit) id i6248Rr6015737; Fri, 2 Jul 2004 13:08:27 +0900 (KST) (envelope-from yongari@kt-is.co.kr) Date: Fri, 2 Jul 2004 13:08:27 +0900 From: Pyun YongHyeon To: Scott Long Message-ID: <20040702040827.GA15458@kt-is.co.kr> References: <20040701093225.GA12517@kt-is.co.kr> <40E4C7A4.4010707@samsco.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <40E4C7A4.4010707@samsco.org> User-Agent: Mutt/1.4.1i X-Filter-Version: 1.11a (ns.kt-is.co.kr) cc: sparc64@freebsd.org Subject: Re: pcm sound driver for SBus Ultra1/Ultra2 X-BeenThere: freebsd-sparc64@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: yongari@kt-is.co.kr List-Id: Porting FreeBSD to the Sparc List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Jul 2004 04:10:21 -0000 On Thu, Jul 01, 2004 at 08:25:40PM -0600, Scott Long wrote: ... > > Once again, you've done another impressive job =-) The biggest question > that I have is why you chose to base the work on the mss driver and not > the cs428x driver. I looked at this briefly a few weeks ago and > decided (after also looking at NetBSD) that it really only needed to be > abstracted so it could take both a PCI and an SBUS front-end. The only > thing that held me back was the lack of busdma support. > Well, I didn't check cs4281 datasheet. After reading the source I thought it would be different enough to require new driver.(AC97, DMA, sampling frequency etc.) One of major problems for SBus cs4231 driver was lack of APC DMA doucumentation and no existing SBus pcm driver for reference. So I borrowed the APC DMA code from OpenBSD, and adopted mixer routine from mss with small modifications.(mss driver supports the same chip cs4231.) If mss driver was designed well with BUS DMA in mind it would be possible to take SBus frontend. But I still dout it due to dramatic differences between DMA interface and interrupt handling. In addition, existing driver may need modification which is beyond scope of my ability. > Since this requires stubs into sndbuf_dma.c it might not be totally > appropriate as it is, but I'd like to also review it further over the > next few days and get back to you. Thanks! > Yes, this was not good solution. I'm not sound guy at all, and have little knowledge of pcm(4) internals. The method I took was the fastest path to realize the driver. Thanks a lot. > Scott Regards, Pyun YongHyeon -- Pyun YongHyeon From owner-freebsd-sparc64@FreeBSD.ORG Fri Jul 2 16:22:45 2004 Return-Path: Delivered-To: freebsd-sparc64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 36C9716A4CE; Fri, 2 Jul 2004 16:22:45 +0000 (GMT) Received: from smtp3.sentex.ca (smtp3.sentex.ca [64.7.153.18]) by mx1.FreeBSD.org (Postfix) with ESMTP id C6A1F43D2F; Fri, 2 Jul 2004 16:22:44 +0000 (GMT) (envelope-from tinderbox@freebsd.org) Received: from smtp1.sentex.ca (smtp1.sentex.ca [199.212.134.4]) by smtp3.sentex.ca (8.12.11/8.12.11) with ESMTP id i62En2iB091899; Fri, 2 Jul 2004 10:49:02 -0400 (EDT) (envelope-from tinderbox@freebsd.org) Received: from freebsd-current.sentex.ca (freebsd-current.sentex.ca [64.7.128.98]) by smtp1.sentex.ca (8.12.11/8.12.11) with ESMTP id i62En4U1081919; Fri, 2 Jul 2004 10:49:04 -0400 (EDT) (envelope-from tinderbox@freebsd.org) Received: by freebsd-current.sentex.ca (Postfix, from userid 666) id F19537303F; Fri, 2 Jul 2004 10:49:03 -0400 (EDT) Sender: FreeBSD Tinderbox From: FreeBSD Tinderbox To: FreeBSD Tinderbox , , Precedence: bulk Message-Id: <20040702144903.F19537303F@freebsd-current.sentex.ca> Date: Fri, 2 Jul 2004 10:49:03 -0400 (EDT) Subject: [current tinderbox] failure on sparc64/sparc64 X-BeenThere: freebsd-sparc64@freebsd.org X-Mailman-Version: 2.1.1 List-Id: Porting FreeBSD to the Sparc List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Jul 2004 16:22:45 -0000 TB --- 2004-07-02 14:06:16 - tinderbox 2.3 running on freebsd-current.sentex.ca TB --- 2004-07-02 14:06:16 - starting CURRENT tinderbox run for sparc64/sparc64 TB --- 2004-07-02 14:06:16 - checking out the source tree TB --- 2004-07-02 14:06:16 - cd /home/tinderbox/sandbox/CURRENT/sparc64/sparc64 TB --- 2004-07-02 14:06:16 - /usr/bin/cvs -f -R -q -d/home/ncvs update -Pd -A src TB --- 2004-07-02 14:08:06 - building world (CFLAGS=-O2 -pipe) TB --- 2004-07-02 14:08:06 - cd /home/tinderbox/sandbox/CURRENT/sparc64/sparc64/src TB --- 2004-07-02 14:08:06 - /usr/bin/make -B buildworld >>> Rebuilding the temporary build tree >>> stage 1.1: legacy release compatibility shims >>> stage 1.2: bootstrap tools >>> stage 2.1: cleaning up the object tree >>> stage 2.2: rebuilding the object tree >>> stage 2.3: build tools >>> stage 3: cross tools >>> stage 4.1: building includes >>> stage 4.2: building libraries >>> stage 4.3: make dependencies >>> stage 4.4: building everything [...] cc -O2 -pipe -DHAVE_CONFIG_H -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/lib -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/src -c /tinderbox/CURRENT/sparc64/sparc64/src/contrib/tar/lib/exclude.c cc -O2 -pipe -DHAVE_CONFIG_H -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/lib -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/src -c /tinderbox/CURRENT/sparc64/sparc64/src/contrib/tar/lib/full-write.c cc -O2 -pipe -DHAVE_CONFIG_H -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/lib -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/src -c /tinderbox/CURRENT/sparc64/sparc64/src/contrib/tar/lib/getdate.c cc -O2 -pipe -DHAVE_CONFIG_H -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/lib -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/src -c /tinderbox/CURRENT/sparc64/sparc64/src/contrib/tar/lib/getline.c cc -O2 -pipe -DHAVE_CONFIG_H -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/lib -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/src -c /tinderbox/CURRENT/sparc64/sparc64/src/contrib/tar/lib/getstr.c cc -O2 -pipe -DHAVE_CONFIG_H -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/lib -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/src -c /tinderbox/CURRENT/sparc64/sparc64/src/contrib/tar/lib/hash.c {standard input}: Assembler messages: {standard input}:1283: Error: Illegal operands *** Error code 1 Stop in /tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar. *** Error code 1 Stop in /tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin. *** Error code 1 Stop in /tinderbox/CURRENT/sparc64/sparc64/src/gnu. *** Error code 1 Stop in /tinderbox/CURRENT/sparc64/sparc64/src. *** Error code 1 Stop in /tinderbox/CURRENT/sparc64/sparc64/src. *** Error code 1 Stop in /tinderbox/CURRENT/sparc64/sparc64/src. TB --- 2004-07-02 14:49:03 - WARNING: /usr/bin/make returned exit code 1 TB --- 2004-07-02 14:49:03 - ERROR: failed to build world TB --- 2004-07-02 14:49:03 - tinderbox aborted From owner-freebsd-sparc64@FreeBSD.ORG Sat Jul 3 14:01:33 2004 Return-Path: Delivered-To: freebsd-sparc64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B8BAA16A4CE; Sat, 3 Jul 2004 14:01:33 +0000 (GMT) Received: from smtp3.sentex.ca (smtp3.sentex.ca [64.7.153.18]) by mx1.FreeBSD.org (Postfix) with ESMTP id 51F0743D46; Sat, 3 Jul 2004 14:01:33 +0000 (GMT) (envelope-from tinderbox@freebsd.org) Received: from smtp1.sentex.ca (smtp1.sentex.ca [199.212.134.4]) by smtp3.sentex.ca (8.12.11/8.12.11) with ESMTP id i63E1UUU022720; Sat, 3 Jul 2004 10:01:30 -0400 (EDT) (envelope-from tinderbox@freebsd.org) Received: from freebsd-current.sentex.ca (freebsd-current.sentex.ca [64.7.128.98]) by smtp1.sentex.ca (8.12.11/8.12.11) with ESMTP id i63E1WT5025536; Sat, 3 Jul 2004 10:01:32 -0400 (EDT) (envelope-from tinderbox@freebsd.org) Received: by freebsd-current.sentex.ca (Postfix, from userid 666) id 59A137303F; Sat, 3 Jul 2004 10:01:32 -0400 (EDT) Sender: FreeBSD Tinderbox From: FreeBSD Tinderbox To: FreeBSD Tinderbox , , Precedence: bulk Message-Id: <20040703140132.59A137303F@freebsd-current.sentex.ca> Date: Sat, 3 Jul 2004 10:01:32 -0400 (EDT) Subject: [current tinderbox] failure on sparc64/sparc64 X-BeenThere: freebsd-sparc64@freebsd.org X-Mailman-Version: 2.1.1 List-Id: Porting FreeBSD to the Sparc List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Jul 2004 14:01:33 -0000 TB --- 2004-07-03 13:18:19 - tinderbox 2.3 running on freebsd-current.sentex.ca TB --- 2004-07-03 13:18:19 - starting CURRENT tinderbox run for sparc64/sparc64 TB --- 2004-07-03 13:18:19 - checking out the source tree TB --- 2004-07-03 13:18:19 - cd /home/tinderbox/sandbox/CURRENT/sparc64/sparc64 TB --- 2004-07-03 13:18:19 - /usr/bin/cvs -f -R -q -d/home/ncvs update -Pd -A src TB --- 2004-07-03 13:20:31 - building world (CFLAGS=-O2 -pipe) TB --- 2004-07-03 13:20:31 - cd /home/tinderbox/sandbox/CURRENT/sparc64/sparc64/src TB --- 2004-07-03 13:20:31 - /usr/bin/make -B buildworld >>> Rebuilding the temporary build tree >>> stage 1.1: legacy release compatibility shims >>> stage 1.2: bootstrap tools >>> stage 2.1: cleaning up the object tree >>> stage 2.2: rebuilding the object tree >>> stage 2.3: build tools >>> stage 3: cross tools >>> stage 4.1: building includes >>> stage 4.2: building libraries >>> stage 4.3: make dependencies >>> stage 4.4: building everything [...] cc -O2 -pipe -DHAVE_CONFIG_H -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/lib -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/src -c /tinderbox/CURRENT/sparc64/sparc64/src/contrib/tar/lib/exclude.c cc -O2 -pipe -DHAVE_CONFIG_H -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/lib -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/src -c /tinderbox/CURRENT/sparc64/sparc64/src/contrib/tar/lib/full-write.c cc -O2 -pipe -DHAVE_CONFIG_H -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/lib -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/src -c /tinderbox/CURRENT/sparc64/sparc64/src/contrib/tar/lib/getdate.c cc -O2 -pipe -DHAVE_CONFIG_H -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/lib -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/src -c /tinderbox/CURRENT/sparc64/sparc64/src/contrib/tar/lib/getline.c cc -O2 -pipe -DHAVE_CONFIG_H -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/lib -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/src -c /tinderbox/CURRENT/sparc64/sparc64/src/contrib/tar/lib/getstr.c cc -O2 -pipe -DHAVE_CONFIG_H -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/lib -I/tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar/../../../contrib/tar/src -c /tinderbox/CURRENT/sparc64/sparc64/src/contrib/tar/lib/hash.c {standard input}: Assembler messages: {standard input}:1283: Error: Illegal operands *** Error code 1 Stop in /tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin/tar. *** Error code 1 Stop in /tinderbox/CURRENT/sparc64/sparc64/src/gnu/usr.bin. *** Error code 1 Stop in /tinderbox/CURRENT/sparc64/sparc64/src/gnu. *** Error code 1 Stop in /tinderbox/CURRENT/sparc64/sparc64/src. *** Error code 1 Stop in /tinderbox/CURRENT/sparc64/sparc64/src. *** Error code 1 Stop in /tinderbox/CURRENT/sparc64/sparc64/src. TB --- 2004-07-03 14:01:32 - WARNING: /usr/bin/make returned exit code 1 TB --- 2004-07-03 14:01:32 - ERROR: failed to build world TB --- 2004-07-03 14:01:32 - tinderbox aborted