From owner-p4-projects@FreeBSD.ORG Thu Oct 7 00:53:32 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 9507416A4D0; Thu, 7 Oct 2004 00:53:31 +0000 (GMT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6B8E716A4CE for ; Thu, 7 Oct 2004 00:53:31 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 338B443D55 for ; Thu, 7 Oct 2004 00:53:31 +0000 (GMT) (envelope-from peter@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.11/8.12.11) with ESMTP id i970rVAp080869 for ; Thu, 7 Oct 2004 00:53:31 GMT (envelope-from peter@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.11/8.12.11/Submit) id i970rUOf080866 for perforce@freebsd.org; Thu, 7 Oct 2004 00:53:30 GMT (envelope-from peter@freebsd.org) Date: Thu, 7 Oct 2004 00:53:30 GMT Message-Id: <200410070053.i970rUOf080866@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to peter@freebsd.org using -f From: Peter Wemm To: Perforce Change Reviews Subject: PERFORCE change 62779 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Oct 2004 00:53:32 -0000 http://perforce.freebsd.org/chv.cgi?CH=62779 Change 62779 by peter@peter_overcee on 2004/10/07 00:53:06 IFC @62778 Affected files ... .. //depot/projects/hammer/etc/rc.d/gbde#5 integrate .. //depot/projects/hammer/lib/libkvm/kvm_proc.c#25 integrate .. //depot/projects/hammer/lib/libpthread/thread/thr_stack.c#5 integrate .. //depot/projects/hammer/lib/libthr/thread/thr_exit.c#11 integrate .. //depot/projects/hammer/libexec/getNAME/getNAME.1#2 integrate .. //depot/projects/hammer/sys/compat/freebsd32/freebsd32_proto.h#21 integrate .. //depot/projects/hammer/sys/compat/freebsd32/freebsd32_syscall.h#19 integrate .. //depot/projects/hammer/sys/compat/freebsd32/freebsd32_syscalls.c#19 integrate .. //depot/projects/hammer/sys/compat/freebsd32/freebsd32_sysent.c#19 integrate .. //depot/projects/hammer/sys/compat/freebsd32/syscalls.master#23 integrate .. //depot/projects/hammer/sys/conf/kern.pre.mk#31 integrate .. //depot/projects/hammer/sys/dev/acpica/acpi_pcib_acpi.c#13 integrate .. //depot/projects/hammer/sys/dev/ata/ata-all.c#38 integrate .. //depot/projects/hammer/sys/dev/ata/ata-all.h#22 integrate .. //depot/projects/hammer/sys/dev/ata/ata-card.c#16 integrate .. //depot/projects/hammer/sys/dev/ata/ata-cbus.c#8 integrate .. //depot/projects/hammer/sys/dev/ata/ata-chipset.c#46 integrate .. //depot/projects/hammer/sys/dev/ata/ata-isa.c#10 integrate .. //depot/projects/hammer/sys/dev/ata/ata-pci.c#26 integrate .. //depot/projects/hammer/sys/dev/ata/ata-pci.h#24 integrate .. //depot/projects/hammer/sys/dev/ata/ata-queue.c#18 integrate .. //depot/projects/hammer/sys/dev/digi/digi.c#18 integrate .. //depot/projects/hammer/sys/dev/digi/digi.h#6 integrate .. //depot/projects/hammer/sys/geom/geom_io.c#28 integrate .. //depot/projects/hammer/sys/geom/mirror/g_mirror.c#10 integrate .. //depot/projects/hammer/sys/i386/pci/pci_bus.c#17 integrate .. //depot/projects/hammer/sys/ia64/ia64/machdep.c#43 integrate .. //depot/projects/hammer/sys/kern/init_sysent.c#33 integrate .. //depot/projects/hammer/sys/kern/kern_exec.c#34 integrate .. //depot/projects/hammer/sys/kern/kern_fork.c#43 integrate .. //depot/projects/hammer/sys/kern/kern_kse.c#14 integrate .. //depot/projects/hammer/sys/kern/kern_thr.c#23 integrate .. //depot/projects/hammer/sys/kern/kern_thread.c#68 integrate .. //depot/projects/hammer/sys/kern/syscalls.c#32 integrate .. //depot/projects/hammer/sys/kern/vfs_subr.c#56 integrate .. //depot/projects/hammer/sys/net/bpf.c#23 integrate .. //depot/projects/hammer/sys/netinet6/in6_rmx.c#7 integrate .. //depot/projects/hammer/sys/sys/proc.h#68 integrate .. //depot/projects/hammer/sys/sys/syscall.h#32 integrate .. //depot/projects/hammer/sys/sys/syscall.mk#32 integrate .. //depot/projects/hammer/sys/sys/sysproto.h#32 integrate .. //depot/projects/hammer/sys/sys/thr.h#4 integrate .. //depot/projects/hammer/usr.bin/gprof/kernel.c#3 integrate .. //depot/projects/hammer/usr.sbin/newsyslog/newsyslog.c#19 integrate Differences ... ==== //depot/projects/hammer/etc/rc.d/gbde#5 (text+ko) ==== @@ -3,7 +3,7 @@ # This file, originally written by Garrett A. Wollman, is in the public # domain. # -# $FreeBSD: src/etc/rc.d/gbde,v 1.5 2004/07/18 18:01:47 simon Exp $ +# $FreeBSD: src/etc/rc.d/gbde,v 1.6 2004/10/06 14:42:35 pjd Exp $ # # PROVIDE: disks @@ -82,12 +82,16 @@ parentdev=${device%.bde} parent=${parentdev#/dev/} eval "lock=\${gbde_lock_${parent}-\"${gbde_lockdir}/${parent}.lock\"}" - if [ -e "${lock}" -a ! -e "${device}" ]; then + if [ ! -e "${device}" ]; then echo "Configuring Disk Encryption for ${device}." count=1 while [ ${count} -le ${gbde_attach_attempts} ]; do - gbde attach ${parentdev} -l ${lock} + if [ -e "${lock}" ]; then + gbde attach ${parentdev} -l ${lock} + else + gbde attach ${parentdev} + fi if [ -e ${device} ]; then break fi ==== //depot/projects/hammer/lib/libkvm/kvm_proc.c#25 (text+ko) ==== @@ -42,7 +42,7 @@ #endif #include -__FBSDID("$FreeBSD: src/lib/libkvm/kvm_proc.c,v 1.80 2004/09/05 02:09:54 julian Exp $"); +__FBSDID("$FreeBSD: src/lib/libkvm/kvm_proc.c,v 1.81 2004/10/06 17:10:56 jhb Exp $"); /* * Proc traversal interface for kvm. ps and w are (probably) the exclusive @@ -224,6 +224,12 @@ return (-1); } kp->ki_start = pstats.p_start; + + /* + * XXX: The times here are probably zero and need + * to be calculated from the raw data in p_rux and + * p_crux. + */ kp->ki_rusage = pstats.p_ru; kp->ki_childstime = pstats.p_cru.ru_stime; kp->ki_childutime = pstats.p_cru.ru_utime; @@ -348,7 +354,7 @@ kp->ki_lockname, LOCKNAMELEN); kp->ki_lockname[LOCKNAMELEN] = 0; } - bintime2timeval(&proc.p_runtime, &tv); + bintime2timeval(&proc.p_rux.rux_runtime, &tv); kp->ki_runtime = (u_int64_t)tv.tv_sec * 1000000 + tv.tv_usec; kp->ki_pid = proc.p_pid; kp->ki_siglist = proc.p_siglist; ==== //depot/projects/hammer/lib/libpthread/thread/thr_stack.c#5 (text+ko) ==== @@ -24,7 +24,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/lib/libpthread/thread/thr_stack.c,v 1.8 2003/09/14 22:39:44 davidxu Exp $ + * $FreeBSD: src/lib/libpthread/thread/thr_stack.c,v 1.9 2004/10/06 08:11:07 davidxu Exp $ */ #include #include @@ -61,7 +61,7 @@ * Base address of the last stack allocated (including its red zone, if * there is one). Stacks are allocated contiguously, starting beyond the * top of the main stack. When a new stack is created, a red zone is - * typically created (actually, the red zone is simply left unmapped) above + * typically created (actually, the red zone is mapped with PROT_NONE) above * the top of the stack, such that the stack will not be able to grow all * the way to the bottom of the next stack. This isn't fool-proof. It is * possible for a stack to grow by a large amount, such that it grows into @@ -134,6 +134,7 @@ kse_critical_t crit; size_t stacksize; size_t guardsize; + char *stackaddr; /* * Round up stack size to nearest multiple of _thr_page_size so @@ -194,7 +195,7 @@ _thr_guard_default; /* Allocate a new stack. */ - attr->stackaddr_attr = last_stack - stacksize; + stackaddr = last_stack - stacksize - guardsize; /* * Even if stack allocation fails, we don't want to try to @@ -209,11 +210,20 @@ KSE_LOCK_RELEASE(curkse, &_thread_list_lock); _kse_critical_leave(crit); - /* Map the stack, but not the guard page: */ - if ((attr->stackaddr_attr = mmap(attr->stackaddr_attr, - stacksize, PROT_READ | PROT_WRITE, MAP_STACK, - -1, 0)) == MAP_FAILED) - attr->stackaddr_attr = NULL; + /* Map the stack and guard page together, and split guard + page from allocated space: */ + if ((stackaddr = mmap(stackaddr, stacksize+guardsize, + PROT_READ | PROT_WRITE, MAP_STACK, + -1, 0)) != MAP_FAILED && + (guardsize == 0 || + mprotect(stackaddr, guardsize, PROT_NONE) == 0)) { + stackaddr += guardsize; + } else { + if (stackaddr != MAP_FAILED) + munmap(stackaddr, stacksize + guardsize); + stackaddr = NULL; + } + attr->stackaddr_attr = stackaddr; } if (attr->stackaddr_attr != NULL) return (0); ==== //depot/projects/hammer/lib/libthr/thread/thr_exit.c#11 (text+ko) ==== @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/lib/libthr/thread/thr_exit.c,v 1.13 2004/05/20 12:06:16 mtm Exp $ + * $FreeBSD: src/lib/libthr/thread/thr_exit.c,v 1.14 2004/10/06 14:20:57 mtm Exp $ */ #include #include @@ -43,7 +43,7 @@ __weak_reference(_pthread_exit, pthread_exit); /* thr_exit() */ -extern int _thr_exit(void); +extern int _thr_exit(long *state); static void deadlist_free_threads(); @@ -164,7 +164,6 @@ deadlist_free_threads(); TAILQ_INSERT_HEAD(&_dead_list, curthread, dle); TAILQ_REMOVE(&_thread_list, curthread, tle); - curthread->isdead = 1; /* If we're the last thread, call it quits */ if (TAILQ_EMPTY(&_thread_list)) @@ -181,7 +180,7 @@ * thread, which we can't be because we've already checked * for that. */ - _thr_exit(); + _thr_exit((long *)&curthread->isdead); /* This point should not be reached. */ PANIC("Dead thread has resumed"); ==== //depot/projects/hammer/libexec/getNAME/getNAME.1#2 (text+ko) ==== @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/libexec/getNAME/getNAME.1,v 1.12 2001/07/15 07:53:38 dd Exp $ +.\" $FreeBSD: src/libexec/getNAME/getNAME.1,v 1.13 2004/10/06 18:31:45 schweikh Exp $ .Dd July 8, 1996 .Dt GETNAME 1 .Os @@ -37,10 +37,10 @@ The .Nm utility -get name sections from manual pages. +extracts name sections from manual pages. Without options .Nm -building +is extracting sections suitable for building .Xr apropos 1 database entries. .Pp @@ -53,7 +53,9 @@ .It Fl w Print type of manual page (OLD, NEW, UNKNOWN). .El -.\" .Sh BUGS +.Sh BUGS +Many nonstandard manual pages from third parties +are not processed correctly. .Sh SEE ALSO .Xr apropos 1 , .Xr makewhatis 1 , ==== //depot/projects/hammer/sys/compat/freebsd32/freebsd32_proto.h#21 (text+ko) ==== @@ -2,8 +2,8 @@ * System call prototypes. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/compat/freebsd32/freebsd32_proto.h,v 1.28 2004/07/14 00:03:51 peter Exp $ - * created from FreeBSD: src/sys/compat/freebsd32/syscalls.master,v 1.40 2004/07/14 00:03:30 peter Exp + * $FreeBSD: src/sys/compat/freebsd32/freebsd32_proto.h,v 1.29 2004/10/06 14:23:00 mtm Exp $ + * created from FreeBSD: src/sys/compat/freebsd32/syscalls.master,v 1.41 2004/10/06 14:20:57 mtm Exp */ #ifndef _FREEBSD32_SYSPROTO_H_ ==== //depot/projects/hammer/sys/compat/freebsd32/freebsd32_syscall.h#19 (text+ko) ==== @@ -2,8 +2,8 @@ * System call numbers. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/compat/freebsd32/freebsd32_syscall.h,v 1.28 2004/07/14 00:03:51 peter Exp $ - * created from FreeBSD: src/sys/compat/freebsd32/syscalls.master,v 1.40 2004/07/14 00:03:30 peter Exp + * $FreeBSD: src/sys/compat/freebsd32/freebsd32_syscall.h,v 1.29 2004/10/06 14:23:00 mtm Exp $ + * created from FreeBSD: src/sys/compat/freebsd32/syscalls.master,v 1.41 2004/10/06 14:20:57 mtm Exp */ #define FREEBSD32_SYS_syscall 0 ==== //depot/projects/hammer/sys/compat/freebsd32/freebsd32_syscalls.c#19 (text+ko) ==== @@ -2,8 +2,8 @@ * System call names. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/compat/freebsd32/freebsd32_syscalls.c,v 1.19 2004/07/14 00:03:51 peter Exp $ - * created from FreeBSD: src/sys/compat/freebsd32/syscalls.master,v 1.40 2004/07/14 00:03:30 peter Exp + * $FreeBSD: src/sys/compat/freebsd32/freebsd32_syscalls.c,v 1.20 2004/10/06 14:23:00 mtm Exp $ + * created from FreeBSD: src/sys/compat/freebsd32/syscalls.master,v 1.41 2004/10/06 14:20:57 mtm Exp */ const char *freebsd32_syscallnames[] = { ==== //depot/projects/hammer/sys/compat/freebsd32/freebsd32_sysent.c#19 (text+ko) ==== @@ -2,8 +2,8 @@ * System call switch table. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/compat/freebsd32/freebsd32_sysent.c,v 1.29 2004/07/14 00:03:51 peter Exp $ - * created from FreeBSD: src/sys/compat/freebsd32/syscalls.master,v 1.40 2004/07/14 00:03:30 peter Exp + * $FreeBSD: src/sys/compat/freebsd32/freebsd32_sysent.c,v 1.30 2004/10/06 14:23:00 mtm Exp $ + * created from FreeBSD: src/sys/compat/freebsd32/syscalls.master,v 1.41 2004/10/06 14:20:57 mtm Exp */ #include "opt_compat.h" @@ -456,7 +456,7 @@ { 0, (sy_call_t *)nosys }, /* 428 = __acl_aclcheck_link */ { 0, (sy_call_t *)nosys }, /* 429 = sigwait */ { SYF_MPSAFE | AS(thr_create_args), (sy_call_t *)thr_create }, /* 430 = thr_create */ - { SYF_MPSAFE | 0, (sy_call_t *)thr_exit }, /* 431 = thr_exit */ + { SYF_MPSAFE | AS(thr_exit_args), (sy_call_t *)thr_exit }, /* 431 = thr_exit */ { SYF_MPSAFE | AS(thr_self_args), (sy_call_t *)thr_self }, /* 432 = thr_self */ { SYF_MPSAFE | AS(thr_kill_args), (sy_call_t *)thr_kill }, /* 433 = thr_kill */ { SYF_MPSAFE | AS(_umtx_lock_args), (sy_call_t *)_umtx_lock }, /* 434 = _umtx_lock */ ==== //depot/projects/hammer/sys/compat/freebsd32/syscalls.master#23 (text+ko) ==== @@ -1,4 +1,4 @@ - $FreeBSD: src/sys/compat/freebsd32/syscalls.master,v 1.40 2004/07/14 00:03:30 peter Exp $ + $FreeBSD: src/sys/compat/freebsd32/syscalls.master,v 1.41 2004/10/06 14:20:57 mtm Exp $ ; from: @(#)syscalls.master 8.2 (Berkeley) 1/13/94 ; from: src/sys/kern/syscalls.master 1.107 ; @@ -596,7 +596,7 @@ ; XXX implement 429 UNIMPL sigwait 430 MNOPROTO { int thr_create(ucontext_t *ctx, long *id, int flag s); } -431 MNOPROTO { void thr_exit(void); } +431 MNOPROTO { void thr_exit(long *state); } 432 MNOPROTO { int thr_self(long *id); } 433 MNOPROTO { int thr_kill(long id, int sig); } 434 MNOPROTO { int _umtx_lock(struct umtx *umtx); } ==== //depot/projects/hammer/sys/conf/kern.pre.mk#31 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/sys/conf/kern.pre.mk,v 1.57 2004/09/23 22:53:22 cognet Exp $ +# $FreeBSD: src/sys/conf/kern.pre.mk,v 1.58 2004/10/06 19:55:14 kensmith Exp $ # Part of a unified Makefile for building kernels. This part contains all # of the definitions that need to be before %BEFORE_DEPEND. @@ -24,7 +24,7 @@ . elif ${MACHINE_ARCH} == "ia64" COPTFLAGS?=-O2 -pipe . elif ${MACHINE_ARCH} == "sparc64" -COPTFLAGS?=-O2 -pipe +COPTFLAGS?=-O -pipe . elif ${MACHINE_ARCH} == "arm" COPTFLAGS?=-O2 -pipe . else ==== //depot/projects/hammer/sys/dev/acpica/acpi_pcib_acpi.c#13 (text+ko) ==== @@ -24,7 +24,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/acpica/acpi_pcib_acpi.c,v 1.40 2004/09/22 15:46:16 jhb Exp $ + * $FreeBSD: src/sys/dev/acpica/acpi_pcib_acpi.c,v 1.41 2004/10/06 07:26:52 imp Exp $ */ #include "opt_acpi.h" #include @@ -305,16 +305,16 @@ u_long start, u_long end, u_long count, u_int flags) { /* - * If no memory preference is given, use upper 2GB slot most + * If no memory preference is given, use upper 32MB slot most * bioses use for their memory window. Typically other bridges * before us get in the way to assert their preferences on memory. * Hardcoding like this sucks, so a more MD/MI way needs to be * found to do it. This is typically only used on older laptops - * that don't have pci busses behind pci bridge, so assuming < 2GB + * that don't have pci busses behind pci bridge, so assuming > 32MB * is liekly OK. */ if (type == SYS_RES_MEMORY && start == 0UL && end == ~0UL) - start = 0x80000000; + start = 0xfe000000; return (bus_generic_alloc_resource(dev, child, type, rid, start, end, count, flags)); } ==== //depot/projects/hammer/sys/dev/ata/ata-all.c#38 (text+ko) ==== @@ -27,7 +27,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/ata/ata-all.c,v 1.228 2004/09/26 11:48:43 sos Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/ata/ata-all.c,v 1.229 2004/10/06 19:46:07 sos Exp $"); #include "opt_ata.h" #include @@ -138,7 +138,8 @@ mtx_init(&ch->state_mtx, "ATA state lock", NULL, MTX_DEF); /* initialise device(s) on this channel */ - ch->locking(ch, ATA_LF_LOCK); + while (ch->locking(ch, ATA_LF_LOCK) != ch->unit) + tsleep(&error, PRIBIO, "ataatch", 1); ch->hw.reset(ch); ch->locking(ch, ATA_LF_UNLOCK); @@ -243,6 +244,10 @@ if (bootverbose) ata_printf(ch, -1, "reiniting channel ..\n"); + /* poll for locking of this channel */ + while (ch->locking(ch, ATA_LF_LOCK) != ch->unit) + tsleep(&devices, PRIBIO, "atarint", 1); + /* grap the channel lock no matter what */ mtx_lock(&ch->state_mtx); ch->state = ATA_ACTIVE; @@ -321,6 +326,7 @@ mtx_lock(&ch->state_mtx); ch->state = ATA_IDLE; mtx_unlock(&ch->state_mtx); + ch->locking(ch, ATA_LF_UNLOCK); ata_start(ch); return 0; @@ -335,8 +341,6 @@ if (!dev || !(ch = device_get_softc(dev))) return ENXIO; - ch->locking(ch, ATA_LF_LOCK); - while (!gotit) { mtx_lock(&ch->state_mtx); if (ch->state == ATA_IDLE) { @@ -346,6 +350,7 @@ tsleep(&gotit, PRIBIO, "atasusp", hz/10); mtx_unlock(&ch->state_mtx); } + ch->locking(ch, ATA_LF_UNLOCK); return 0; } @@ -358,9 +363,7 @@ if (!dev || !(ch = device_get_softc(dev))) return ENXIO; - ch->locking(ch, ATA_LF_LOCK); error = ata_reinit(ch); - ch->locking(ch, ATA_LF_UNLOCK); ata_start(ch); return error; } @@ -436,6 +439,7 @@ else ch->state = ATA_IDLE; mtx_unlock(&ch->state_mtx); + ch->locking(ch, ATA_LF_UNLOCK); ata_finish(request); } } ==== //depot/projects/hammer/sys/dev/ata/ata-all.h#22 (text+ko) ==== @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/ata/ata-all.h,v 1.84 2004/09/26 11:48:43 sos Exp $ + * $FreeBSD: src/sys/dev/ata/ata-all.h,v 1.85 2004/10/06 19:46:07 sos Exp $ */ /* ATA register defines */ @@ -366,10 +366,11 @@ #define ATA_INTERRUPT 0x0002 #define ATA_TIMEOUT 0x0004 - void (*reset)(struct ata_channel *); - void (*locking)(struct ata_channel *, int); + void (*reset)(struct ata_channel *); + int (*locking)(struct ata_channel *, int); #define ATA_LF_LOCK 0x0001 #define ATA_LF_UNLOCK 0x0002 +#define ATA_LF_WHICH 0x0004 struct mtx queue_mtx; /* queue lock */ TAILQ_HEAD(, ata_request) ata_queue; /* head of ATA queue */ ==== //depot/projects/hammer/sys/dev/ata/ata-card.c#16 (text+ko) ==== @@ -27,7 +27,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/ata/ata-card.c,v 1.25 2004/05/27 03:49:40 imp Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/ata/ata-card.c,v 1.26 2004/10/06 19:46:07 sos Exp $"); #include #include @@ -88,9 +88,10 @@ return(ENXIO); } -static void +static int ata_pccard_locknoop(struct ata_channel *ch, int type) { + return 1; } static void ==== //depot/projects/hammer/sys/dev/ata/ata-cbus.c#8 (text+ko) ==== @@ -27,7 +27,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/ata/ata-cbus.c,v 1.13 2004/06/03 06:09:58 phk Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/ata/ata-cbus.c,v 1.14 2004/10/06 19:46:07 sos Exp $"); #include "opt_ata.h" #include @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -54,8 +55,10 @@ struct resource *irq; void *ih; void (*setmode)(struct ata_device *, int); - void (*locking)(struct ata_channel *, int); + int (*locking)(struct ata_channel *, int); + struct mtx bank_mtx; int current_bank; + int restart_bank; struct { void (*function)(void *); void *argument; @@ -64,7 +67,7 @@ /* local prototypes */ static void ata_cbus_intr(void *); -static void ata_cbus_banking(struct ata_channel *, int); +static int ata_cbus_banking(struct ata_channel *, int); static void ata_cbus_setmode(struct ata_device *, int); static int @@ -158,8 +161,10 @@ return ENXIO; } + mtx_init(&ctlr->bank_mtx, "ATA cbus bank lock", NULL, MTX_DEF); + ctlr->current_bank = -1; + ctlr->restart_bank = -1; ctlr->locking = ata_cbus_banking; - ctlr->current_bank = -1; ctlr->setmode = ata_cbus_setmode;; if (!device_add_child(dev, "ata", 0)) @@ -220,35 +225,55 @@ ata_cbus_intr(void *data) { struct ata_cbus_controller *ctlr = data; + struct ata_channel *ch; + int unit; - if (ctlr->current_bank != -1 && - ctlr->interrupt[ctlr->current_bank].argument) - ctlr->interrupt[ctlr->current_bank]. - function(ctlr->interrupt[ctlr->current_bank].argument); + for (unit = 0; unit < 2; unit++) { + if (!(ch = ctlr->interrupt[unit].argument)) + continue; + if (ch->locking(ch, ATA_LF_WHICH) == unit) + ctlr->interrupt[unit].function(ch); + } } -static void +static int ata_cbus_banking(struct ata_channel *ch, int flags) { struct ata_cbus_controller *ctlr = device_get_softc(device_get_parent(ch->dev)); + int res; + mtx_lock(&ctlr->bank_mtx); switch (flags) { case ATA_LF_LOCK: + if (ctlr->current_bank == -1) + ctlr->current_bank = ch->unit; if (ctlr->current_bank == ch->unit) - break; - while (!atomic_cmpset_acq_int(&ctlr->current_bank, -1, ch->unit)) - tsleep((caddr_t)ch->locking, PRIBIO, "atabnk", 1); - ATA_OUTB(ctlr->bankio, 0, ch->unit); + ATA_OUTB(ctlr->bankio, 0, ch->unit); + else + ctlr->restart_bank = ch->unit; break; case ATA_LF_UNLOCK: - if (ctlr->current_bank == -1 || ctlr->current_bank != ch->unit) - break; - atomic_store_rel_int(&ctlr->current_bank, -1); + if (ctlr->current_bank == ch->unit) { + ctlr->current_bank = -1; + if (ctlr->restart_bank != -1) { + if (ctlr->interrupt[ctlr->restart_bank].argument) { + mtx_unlock(&ctlr->bank_mtx); + ata_start(ctlr->interrupt[ctlr->restart_bank].argument); + mtx_lock(&ctlr->bank_mtx); + } + ctlr->restart_bank = -1; + } + } + break; + + case ATA_LF_WHICH: break; } - return; + res = ctlr->current_bank; + mtx_unlock(&ctlr->bank_mtx); + return res; } static void ==== //depot/projects/hammer/sys/dev/ata/ata-chipset.c#46 (text+ko) ==== @@ -27,7 +27,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/ata/ata-chipset.c,v 1.90 2004/10/01 09:06:22 sos Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/ata/ata-chipset.c,v 1.91 2004/10/06 19:46:07 sos Exp $"); #include "opt_ata.h" #include @@ -120,7 +120,7 @@ static struct ata_chip_id *ata_find_chip(device_t, struct ata_chip_id *, int); static struct ata_chip_id *ata_match_chip(device_t, struct ata_chip_id *); static int ata_setup_interrupt(device_t); -static void ata_serialize(struct ata_channel *, int); +static int ata_serialize(struct ata_channel *, int); static int ata_mode2idx(int); /* generic or unknown ATA chipset init code */ @@ -261,9 +261,9 @@ /* implement this as a toggle instead to balance load XXX */ for (unit = 0; unit < 2; unit++) { - if (ctlr->chip->cfg1 == ATPOLD && ctlr->locked_ch != unit) + if (!(ch = ctlr->interrupt[unit].argument)) continue; - if (!(ch = ctlr->interrupt[unit].argument)) + if (ctlr->chip->cfg1 == ATPOLD && ch->locking(ch, ATA_LF_WHICH) != unit) continue; if (ch->dma && (ch->dma->flags & ATA_DMA_ACTIVE)) { int bmstat = ATA_IDX_INB(ch, ATA_BMSTAT_PORT) & ATA_BMSTAT_MASK; @@ -2797,28 +2797,62 @@ return 0; } -static void +struct ata_serialize { + struct mtx locked_mtx; + int locked_ch; + int restart_ch; +}; + +static int ata_serialize(struct ata_channel *ch, int flags) { - struct ata_pci_controller *scp = + struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(ch->dev)); + struct ata_serialize *serial; + static int inited = 0; + int res; + + if (!inited) { + ctlr->driver = malloc(sizeof(struct ata_serialize), + M_TEMP, M_NOWAIT | M_ZERO); + serial = ctlr->driver; + mtx_init(&serial->locked_mtx, "ATA serialize lock", NULL, MTX_DEF); + serial->locked_ch = -1; + serial->restart_ch = -1; + inited = 1; + } + else + serial = ctlr->driver; + mtx_lock(&serial->locked_mtx); switch (flags) { case ATA_LF_LOCK: - if (scp->locked_ch == ch->unit) - break; - while (!atomic_cmpset_acq_int(&scp->locked_ch, -1, ch->unit)) - tsleep(ch->locking, PRIBIO, "atasrl", 1); + if (serial->locked_ch == -1) + serial->locked_ch = ch->unit; + if (serial->locked_ch != ch->unit) + serial->restart_ch = ch->unit; break; case ATA_LF_UNLOCK: - if (scp->locked_ch == -1 || scp->locked_ch != ch->unit) - break; - atomic_store_rel_int(&scp->locked_ch, -1); - wakeup(ch->locking); + if (serial->locked_ch == ch->unit) { + serial->locked_ch = -1; + if (serial->restart_ch != -1) { + if (ctlr->interrupt[serial->restart_ch].argument) { + mtx_unlock(&serial->locked_mtx); + ata_start(ctlr->interrupt[serial->restart_ch].argument); + mtx_lock(&serial->locked_mtx); + } + serial->restart_ch = -1; + } + } + break; + + case ATA_LF_WHICH: break; } - return; + res = serial->locked_ch; + mtx_unlock(&serial->locked_mtx); + return res; } static int ==== //depot/projects/hammer/sys/dev/ata/ata-isa.c#10 (text+ko) ==== @@ -27,7 +27,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/ata/ata-isa.c,v 1.22 2004/04/30 16:21:34 sos Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/ata/ata-isa.c,v 1.23 2004/10/06 19:46:07 sos Exp $"); #include "opt_ata.h" #include @@ -58,9 +58,10 @@ {0} }; -static void +static int ata_isa_locknoop(struct ata_channel *ch, int type) { + return ch->unit; } static void ==== //depot/projects/hammer/sys/dev/ata/ata-pci.c#26 (text+ko) ==== @@ -27,7 +27,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/ata/ata-pci.c,v 1.89 2004/09/26 11:42:42 sos Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/ata/ata-pci.c,v 1.90 2004/10/06 19:46:08 sos Exp $"); #include "opt_ata.h" #include @@ -60,7 +60,7 @@ /* prototypes */ static int ata_pci_allocate(device_t, struct ata_channel *); static void ata_pci_dmainit(struct ata_channel *); -static void ata_pci_locknoop(struct ata_channel *, int); +static int ata_pci_locknoop(struct ata_channel *, int); int ata_legacy(device_t dev) @@ -467,9 +467,10 @@ } } -static void +static int ata_pci_locknoop(struct ata_channel *ch, int flags) { + return ch->unit; } static device_method_t ata_pci_methods[] = { ==== //depot/projects/hammer/sys/dev/ata/ata-pci.h#24 (text+ko) ==== @@ -25,43 +25,42 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/ata/ata-pci.h,v 1.33 2004/09/03 07:37:53 sos Exp $ + * $FreeBSD: src/sys/dev/ata/ata-pci.h,v 1.34 2004/10/06 19:46:08 sos Exp $ */ /* structure holding chipset config info */ struct ata_chip_id { - u_int32_t chipid; - u_int8_t chiprev; - int cfg1; - int cfg2; - u_int8_t max_dma; + u_int32_t chipid; + u_int8_t chiprev; + int cfg1; + int cfg2; + u_int8_t max_dma; char *text; }; /* structure describing a PCI ATA controller */ struct ata_pci_controller { - int r_type1; - int r_rid1; - struct resource *r_res1; - int r_type2; - int r_rid2; - struct resource *r_res2; - struct resource *r_irq; - void *handle; - struct ata_chip_id *chip; + int r_type1; + int r_rid1; + struct resource *r_res1; + int r_type2; + int r_rid2; + struct resource *r_res2; + struct resource *r_irq; + void *handle; + struct ata_chip_id *chip; + int channels; int (*chipinit)(device_t); int (*allocate)(device_t, struct ata_channel *); void (*reset)(struct ata_channel *); void (*dmainit)(struct ata_channel *); void (*setmode)(struct ata_device *, int); - void (*locking)(struct ata_channel *, int); - int locked_ch; - int channels; + int (*locking)(struct ata_channel *, int); struct { void (*function)(void *); - void *argument; + void *argument; } interrupt[8]; /* SOS max ch# for now XXX */ - void *driver; + void *driver; }; /* defines for known chipset PCI id's */ ==== //depot/projects/hammer/sys/dev/ata/ata-queue.c#18 (text+ko) ==== @@ -27,7 +27,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/ata/ata-queue.c,v 1.35 2004/09/26 11:48:43 sos Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/ata/ata-queue.c,v 1.36 2004/10/06 19:46:08 sos Exp $"); #include "opt_ata.h" #include @@ -176,13 +176,14 @@ /* if we have work todo, try to grap the ATA HW and start transaction */ if ((request = TAILQ_FIRST(&ch->ata_queue))) { - ch->locking(ch, ATA_LF_LOCK); - mtx_lock(&ch->state_mtx); - if (ch->state == ATA_IDLE) { - ch->state = ATA_ACTIVE; - gotit = 1; + if (ch->locking(ch, ATA_LF_LOCK) == ch->unit) { + mtx_lock(&ch->state_mtx); + if (ch->state == ATA_IDLE) { + ch->state = ATA_ACTIVE; + gotit = 1; + } + mtx_unlock(&ch->state_mtx); } - mtx_unlock(&ch->state_mtx); if (!gotit) { mtx_unlock(&ch->queue_mtx); return; @@ -203,8 +204,8 @@ mtx_lock(&ch->state_mtx); ch->state = ATA_IDLE; mtx_unlock(&ch->state_mtx); + ata_finish(request); ch->locking(ch, ATA_LF_UNLOCK); - ata_finish(request); } } else @@ -412,8 +413,6 @@ /* mark request as no longer running we'll shoot it down shortly */ ch->running = NULL; - /* debug on */ - request->flags |= ATA_R_DEBUG; ATA_DEBUG_RQ(request, "timeout"); /* if we saw an interrupt before the timeout, shout and re_arm timeout */ ==== //depot/projects/hammer/sys/dev/digi/digi.c#18 (text+ko) ==== @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/digi/digi.c,v 1.55 2004/07/28 21:06:13 phk Exp $ + * $FreeBSD: src/sys/dev/digi/digi.c,v 1.56 2004/10/06 20:01:49 phk Exp $ */ /*- @@ -59,24 +59,12 @@ #include #include - -#define CTRL_DEV 0x800000 -#define CALLOUT_MASK 0x400000 -#define CONTROL_INIT_STATE 0x100000 -#define CONTROL_LOCK_STATE 0x200000 -#define CONTROL_MASK (CTRL_DEV|CONTROL_INIT_STATE|CONTROL_LOCK_STATE) -#define UNIT_MASK 0x030000 -#define PORT_MASK 0x0000FF -#define DEV_TO_UNIT(dev) (MINOR_TO_UNIT(minor(dev))) -#define MINOR_MAGIC_MASK (CALLOUT_MASK | CONTROL_MASK) -#define MINOR_TO_UNIT(mynor) (((mynor) & UNIT_MASK)>>16) -#define MINOR_TO_PORT(mynor) ((mynor) & PORT_MASK) - -static d_open_t digiopen; -static d_close_t digiclose; -static d_read_t digiread; -static d_write_t digiwrite; -static d_ioctl_t digiioctl; +static t_open_t digiopen; +static d_open_t digicopen; +static d_close_t digicclose; +static t_ioctl_t digiioctl; +static d_ioctl_t digisioctl; +static d_ioctl_t digicioctl; static void digistop(struct tty *tp, int rw); static void digibreak(struct tty *tp, int brk); @@ -86,7 +74,7 @@ static void fepcmd(struct digi_p *port, int cmd, int op, int ncmds); static void digistart(struct tty *tp); static int digiparam(struct tty *tp, struct termios *t); -static void digihardclose(struct digi_p *port); +static void digiclose(struct tty *tp); static void digi_intr(void *); static int digi_init(struct digi_softc *_sc); static int digi_loadmoduledata(struct digi_softc *); @@ -143,13 +131,11 @@ 0x02, 0x80, 0x20, 0x10, 0x40, 0x01 }; -static struct cdevsw digi_sw = { +static struct cdevsw digi_csw = { .d_version = D_VERSION, - .d_open = digiopen, - .d_close = digiclose, - .d_read = digiread, - .d_write = digiwrite, - .d_ioctl = digiioctl, + .d_open = digicopen, + .d_close = digicclose, + .d_ioctl = digicioctl, .d_name = driver_name, .d_flags = D_TTY | D_NEEDGIANT, }; @@ -233,6 +219,7 @@ int lowwater; struct digi_p *port; volatile struct board_chan *bc; + struct tty *tp; ptr = NULL; @@ -529,25 +516,13 @@ return (0); } >>> TRUNCATED FOR MAIL (1000 lines) <<<