From trhodes at FreeBSD.org Wed Apr 1 00:13:23 2009 From: trhodes at FreeBSD.org (Tom Rhodes) Date: Wed Apr 1 00:13:30 2009 Subject: svn commit: r190608 - head/share/man/man3 Message-ID: <200904010713.n317DLPr022134@svn.freebsd.org> Author: trhodes Date: Wed Apr 1 07:13:21 2009 New Revision: 190608 URL: http://svn.freebsd.org/changeset/base/190608 Log: Remove KSE bits, cross reference libthr.3. PR: 132392 Submitted by: Niclas Zeising (original version) Modified: head/share/man/man3/pthread.3 Modified: head/share/man/man3/pthread.3 ============================================================================== --- head/share/man/man3/pthread.3 Wed Apr 1 06:18:51 2009 (r190607) +++ head/share/man/man3/pthread.3 Wed Apr 1 07:13:21 2009 (r190608) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 19, 2007 +.Dd April 1, 2009 .Dt PTHREAD 3 .Os .Sh NAME @@ -469,15 +469,15 @@ cancellation stack. .Sh IMPLEMENTATION NOTES The current .Fx -POSIX thread implementation is built in two libraries, +POSIX thread implementation is built into the .Lb libthr , -and -.Lb libkse . -They contain both thread-safe versions of +library. +It contains thread-safe versions of .Lb libc functions and the thread functions. -Threaded applications are linked with one of these libraries. +Threaded applications are linked with this library. .Sh SEE ALSO +.Xr libthr 3 , .Xr pthread_atfork 3 , .Xr pthread_cancel 3 , .Xr pthread_cleanup_pop 3 , From trhodes at FreeBSD.org Wed Apr 1 01:08:27 2009 From: trhodes at FreeBSD.org (Tom Rhodes) Date: Wed Apr 1 01:08:39 2009 Subject: svn commit: r190609 - head/share/man/man3 Message-ID: <200904010808.n3188PvJ023129@svn.freebsd.org> Author: trhodes Date: Wed Apr 1 08:08:25 2009 New Revision: 190609 URL: http://svn.freebsd.org/changeset/base/190609 Log: On second thought, remove the comma too. Modified: head/share/man/man3/pthread.3 Modified: head/share/man/man3/pthread.3 ============================================================================== --- head/share/man/man3/pthread.3 Wed Apr 1 07:13:21 2009 (r190608) +++ head/share/man/man3/pthread.3 Wed Apr 1 08:08:25 2009 (r190609) @@ -470,7 +470,7 @@ cancellation stack. The current .Fx POSIX thread implementation is built into the -.Lb libthr , +.Lb libthr library. It contains thread-safe versions of .Lb libc From trhodes at FreeBSD.org Wed Apr 1 01:33:55 2009 From: trhodes at FreeBSD.org (Tom Rhodes) Date: Wed Apr 1 01:34:06 2009 Subject: svn commit: r190610 - in head: usr.bin/cut usr.sbin/chown Message-ID: <200904010833.n318Xswe023813@svn.freebsd.org> Author: trhodes Date: Wed Apr 1 08:33:54 2009 New Revision: 190610 URL: http://svn.freebsd.org/changeset/base/190610 Log: Fix punctuation. PR: 132834 Submitted by: "Alan R. S. Bueno" Modified: head/usr.bin/cut/cut.1 head/usr.sbin/chown/chgrp.1 Modified: head/usr.bin/cut/cut.1 ============================================================================== --- head/usr.bin/cut/cut.1 Wed Apr 1 08:08:25 2009 (r190609) +++ head/usr.bin/cut/cut.1 Wed Apr 1 08:33:54 2009 (r190610) @@ -112,7 +112,7 @@ The specifies fields, separated in the input by the field delimiter character (see the .Fl d -option.) +option). Output fields are separated by a single occurrence of the field delimiter character. .It Fl n Modified: head/usr.sbin/chown/chgrp.1 ============================================================================== --- head/usr.sbin/chown/chgrp.1 Wed Apr 1 08:08:25 2009 (r190609) +++ head/usr.sbin/chown/chgrp.1 Wed Apr 1 08:33:54 2009 (r190610) @@ -61,7 +61,7 @@ The following options are available: If the .Fl R option is specified, symbolic links on the command line are followed. -(Symbolic links encountered in the tree traversal are not followed). +(Symbolic links encountered in the tree traversal are not followed.) .It Fl L If the .Fl R From trhodes at FreeBSD.org Wed Apr 1 02:22:26 2009 From: trhodes at FreeBSD.org (Tom Rhodes) Date: Wed Apr 1 02:22:37 2009 Subject: svn commit: r190611 - head/share/man/man4 Message-ID: <200904010922.n319MP0Z024822@svn.freebsd.org> Author: trhodes Date: Wed Apr 1 09:22:25 2009 New Revision: 190611 URL: http://svn.freebsd.org/changeset/base/190611 Log: Remove the fla.4 manual page, the driver was nuked over four years ago. Noticed by: rene Prodded by: brueffer Deleted: head/share/man/man4/fla.4 Modified: head/share/man/man4/Makefile Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Wed Apr 1 08:33:54 2009 (r190610) +++ head/share/man/man4/Makefile Wed Apr 1 09:22:25 2009 (r190611) @@ -95,7 +95,6 @@ MAN= aac.4 \ fd.4 \ fdc.4 \ firewire.4 \ - fla.4 \ fpa.4 \ fwe.4 \ fwip.4 \ From trhodes at FreeBSD.org Wed Apr 1 02:27:47 2009 From: trhodes at FreeBSD.org (Tom Rhodes) Date: Wed Apr 1 02:28:02 2009 Subject: svn commit: r190612 - head Message-ID: <200904010927.n319Rjpx024964@svn.freebsd.org> Author: trhodes Date: Wed Apr 1 09:27:45 2009 New Revision: 190612 URL: http://svn.freebsd.org/changeset/base/190612 Log: Add an entry for fla.4. Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Wed Apr 1 09:22:25 2009 (r190611) +++ head/ObsoleteFiles.inc Wed Apr 1 09:27:45 2009 (r190612) @@ -14,6 +14,8 @@ # The file is partitioned: OLD_FILES first, then OLD_LIBS and OLD_DIRS last. # +# 20090401: fla.4 was removed +OLD_FILES+=usr/share/man/man4/fla.4.gz # 20090319: uscanner(4) has been removed OLD_FILES+=usr/share/man/man4/uscanner.4.gz # 20090313: k8temp(4) renamed to amdtemp(4) From trhodes at FreeBSD.org Wed Apr 1 02:37:01 2009 From: trhodes at FreeBSD.org (Tom Rhodes) Date: Wed Apr 1 02:37:07 2009 Subject: svn commit: r190613 - head Message-ID: <200904010937.n319b0x7025178@svn.freebsd.org> Author: trhodes Date: Wed Apr 1 09:37:00 2009 New Revision: 190613 URL: http://svn.freebsd.org/changeset/base/190613 Log: Use the real removal date for fla(4), put the entry with other 2004* entries. Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Wed Apr 1 09:27:45 2009 (r190612) +++ head/ObsoleteFiles.inc Wed Apr 1 09:37:00 2009 (r190613) @@ -14,8 +14,6 @@ # The file is partitioned: OLD_FILES first, then OLD_LIBS and OLD_DIRS last. # -# 20090401: fla.4 was removed -OLD_FILES+=usr/share/man/man4/fla.4.gz # 20090319: uscanner(4) has been removed OLD_FILES+=usr/share/man/man4/uscanner.4.gz # 20090313: k8temp(4) renamed to amdtemp(4) @@ -1442,6 +1440,8 @@ OLD_FILES+=lib/geom/geom_concat.so.1 OLD_FILES+=lib/geom/geom_label.so.1 OLD_FILES+=lib/geom/geom_nop.so.1 OLD_FILES+=lib/geom/geom_stripe.so.1 +# 20040713: fla(4) removed. +OLD_FILES+=usr/share/man/man4/fla.4.gz # 200407XX OLD_FILES+=usr/sbin/kernbb OLD_FILES+=usr/sbin/ntp-genkeys From kib at FreeBSD.org Wed Apr 1 05:31:06 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Wed Apr 1 05:31:18 2009 Subject: svn commit: r190615 - head/sys/amd64/include Message-ID: <200904011231.n31CV42u031658@svn.freebsd.org> Author: kib Date: Wed Apr 1 12:31:04 2009 New Revision: 190615 URL: http://svn.freebsd.org/changeset/base/190615 Log: Provide convenient definition of the union descriptor, similar to the i386 one. Fully enumerate system segments and gate types. In collaboration with: pho Reviewed by: jhb Modified: head/sys/amd64/include/segments.h Modified: head/sys/amd64/include/segments.h ============================================================================== --- head/sys/amd64/include/segments.h Wed Apr 1 10:58:50 2009 (r190614) +++ head/sys/amd64/include/segments.h Wed Apr 1 12:31:04 2009 (r190615) @@ -108,12 +108,29 @@ struct gate_descriptor { u_int64_t sd_xx1:32; } __packed; +/* + * Generic descriptor + */ +union descriptor { + struct user_segment_descriptor sd; + struct gate_descriptor gd; +}; + /* system segments and gate types */ #define SDT_SYSNULL 0 /* system null */ +#define SDT_SYS286TSS 1 /* system 286 TSS available */ #define SDT_SYSLDT 2 /* system 64 bit local descriptor table */ +#define SDT_SYS286BSY 3 /* system 286 TSS busy */ +#define SDT_SYS286CGT 4 /* system 286 call gate */ +#define SDT_SYSTASKGT 5 /* system task gate */ +#define SDT_SYS286IGT 6 /* system 286 interrupt gate */ +#define SDT_SYS286TGT 7 /* system 286 trap gate */ +#define SDT_SYSNULL2 8 /* system null again */ #define SDT_SYSTSS 9 /* system available 64 bit TSS */ +#define SDT_SYSNULL3 10 /* system null again */ #define SDT_SYSBSY 11 /* system busy 64 bit TSS */ #define SDT_SYSCGT 12 /* system 64 bit call gate */ +#define SDT_SYSNULL4 13 /* system null again */ #define SDT_SYSIGT 14 /* system 64 bit interrupt gate */ #define SDT_SYSTGT 15 /* system 64 bit trap gate */ From kib at FreeBSD.org Wed Apr 1 05:44:18 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Wed Apr 1 05:44:25 2009 Subject: svn commit: r190616 - in head/sys: amd64/include compat/ia32 i386/include Message-ID: <200904011244.n31CiHub031947@svn.freebsd.org> Author: kib Date: Wed Apr 1 12:44:17 2009 New Revision: 190616 URL: http://svn.freebsd.org/changeset/base/190616 Log: Add all segment registers for the amd64 CPU to struct reg and mcontext. To keep these structures ABI-compatible, half the size of r_trapno, r_err, mc_trapno, mc_flags. Add fsbase and gsbase to mcontext on both amd64 and i386. Add flags to amd64 mcontext to indicate that it contains valid segments or bases. In collaboration with: pho Discussed with: peter Reviewed by: jhb Modified: head/sys/amd64/include/reg.h head/sys/amd64/include/ucontext.h head/sys/compat/ia32/ia32_signal.h head/sys/i386/include/ucontext.h Modified: head/sys/amd64/include/reg.h ============================================================================== --- head/sys/amd64/include/reg.h Wed Apr 1 12:31:04 2009 (r190615) +++ head/sys/amd64/include/reg.h Wed Apr 1 12:44:17 2009 (r190616) @@ -56,8 +56,12 @@ struct reg { register_t r_rdx; register_t r_rcx; register_t r_rax; - register_t r_trapno; - register_t r_err; + uint32_t r_trapno; + uint16_t r_fs; + uint16_t r_gs; + uint32_t r_err; + uint16_t r_es; + uint16_t r_ds; register_t r_rip; register_t r_cs; register_t r_rflags; Modified: head/sys/amd64/include/ucontext.h ============================================================================== --- head/sys/amd64/include/ucontext.h Wed Apr 1 12:31:04 2009 (r190615) +++ head/sys/amd64/include/ucontext.h Wed Apr 1 12:44:17 2009 (r190616) @@ -32,9 +32,16 @@ #ifndef _MACHINE_UCONTEXT_H_ #define _MACHINE_UCONTEXT_H_ +/* + * mc_trapno bits. Shall be in sync with TF_XXX. + */ +#define _MC_HASSEGS 0x1 +#define _MC_HASBASES 0x2 +#define _MC_FLAG_MASK (_MC_HASSEGS | _MC_HASBASES) + typedef struct __mcontext { /* - * The first 20 fields must match the definition of + * The first 24 fields must match the definition of * sigcontext. So that we can support sigcontext * and ucontext_t at the same time. */ @@ -54,9 +61,13 @@ typedef struct __mcontext { __register_t mc_r13; __register_t mc_r14; __register_t mc_r15; - __register_t mc_trapno; + __uint32_t mc_trapno; + __uint16_t mc_fs; + __uint16_t mc_gs; __register_t mc_addr; - __register_t mc_flags; + __uint32_t mc_flags; + __uint16_t mc_es; + __uint16_t mc_ds; __register_t mc_err; __register_t mc_rip; __register_t mc_cs; @@ -65,6 +76,7 @@ typedef struct __mcontext { __register_t mc_ss; long mc_len; /* sizeof(mcontext_t) */ + #define _MC_FPFMT_NODEV 0x10000 /* device not present or configured */ #define _MC_FPFMT_XMM 0x10002 long mc_fpformat; @@ -76,7 +88,11 @@ typedef struct __mcontext { * See for the internals of mc_fpstate[]. */ long mc_fpstate[64] __aligned(16); - long mc_spare[8]; + + __register_t mc_fsbase; + __register_t mc_gsbase; + + long mc_spare[6]; } mcontext_t; #endif /* !_MACHINE_UCONTEXT_H_ */ Modified: head/sys/compat/ia32/ia32_signal.h ============================================================================== --- head/sys/compat/ia32/ia32_signal.h Wed Apr 1 12:31:04 2009 (r190615) +++ head/sys/compat/ia32/ia32_signal.h Wed Apr 1 12:44:17 2009 (r190616) @@ -59,7 +59,9 @@ struct ia32_mcontext { * See for the internals of mc_fpstate[]. */ u_int32_t mc_fpstate[128] __aligned(16); - u_int32_t mc_spare2[8]; + u_int32_t mc_fsbase; + u_int32_t mc_gsbase; + u_int32_t mc_spare2[6]; }; struct ia32_ucontext { Modified: head/sys/i386/include/ucontext.h ============================================================================== --- head/sys/i386/include/ucontext.h Wed Apr 1 12:31:04 2009 (r190615) +++ head/sys/i386/include/ucontext.h Wed Apr 1 12:44:17 2009 (r190616) @@ -72,10 +72,15 @@ typedef struct __mcontext { * See for the internals of mc_fpstate[]. */ int mc_fpstate[128] __aligned(16); - int mc_spare2[8]; + + __register_t mc_fsbase; + __register_t mc_gsbase; + + int mc_spare2[6]; } mcontext_t; #if defined(_KERNEL) && defined(COMPAT_FREEBSD4) + struct mcontext4 { __register_t mc_onstack; /* XXX - sigcontext compat. */ __register_t mc_gs; /* machine state (struct trapframe) */ From kib at FreeBSD.org Wed Apr 1 05:46:06 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Wed Apr 1 05:46:17 2009 Subject: svn commit: r190617 - head/sys/i386/i386 Message-ID: <200904011246.n31Ck58x032028@svn.freebsd.org> Author: kib Date: Wed Apr 1 12:46:05 2009 New Revision: 190617 URL: http://svn.freebsd.org/changeset/base/190617 Log: Fill the fsbase and gsbase fields of the mcontext structure on i386. In collaboration with: pho Discussed with: peter Reviewed by: jhb Modified: head/sys/i386/i386/machdep.c Modified: head/sys/i386/i386/machdep.c ============================================================================== --- head/sys/i386/i386/machdep.c Wed Apr 1 12:44:17 2009 (r190616) +++ head/sys/i386/i386/machdep.c Wed Apr 1 12:46:05 2009 (r190617) @@ -589,6 +589,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, struct sigacts *psp; char *sp; struct trapframe *regs; + struct segment_descriptor *sdp; int sig; int oonstack; @@ -625,6 +626,15 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sf.sf_uc.uc_mcontext.mc_len = sizeof(sf.sf_uc.uc_mcontext); /* magic */ get_fpcontext(td, &sf.sf_uc.uc_mcontext); fpstate_drop(td); + /* + * Unconditionally fill the fsbase and gsbase into the mcontext. + */ + sdp = &td->td_pcb->pcb_gsd; + sf.sf_uc.uc_mcontext.mc_fsbase = sdp->sd_hibase << 24 | + sdp->sd_lobase; + sdp = &td->td_pcb->pcb_fsd; + sf.sf_uc.uc_mcontext.mc_gsbase = sdp->sd_hibase << 24 | + sdp->sd_lobase; /* Allocate space for the signal handler context. */ if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack && @@ -3078,6 +3088,7 @@ int get_mcontext(struct thread *td, mcontext_t *mcp, int flags) { struct trapframe *tp; + struct segment_descriptor *sdp; tp = td->td_frame; @@ -3109,6 +3120,11 @@ get_mcontext(struct thread *td, mcontext mcp->mc_ss = tp->tf_ss; mcp->mc_len = sizeof(*mcp); get_fpcontext(td, mcp); + sdp = &td->td_pcb->pcb_gsd; + mcp->mc_fsbase = sdp->sd_hibase << 24 | sdp->sd_lobase; + sdp = &td->td_pcb->pcb_fsd; + mcp->mc_gsbase = sdp->sd_hibase << 24 | sdp->sd_lobase; + return (0); } From kib at FreeBSD.org Wed Apr 1 05:48:19 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Wed Apr 1 05:48:26 2009 Subject: svn commit: r190618 - head/sys/amd64/include Message-ID: <200904011248.n31CmIHh032103@svn.freebsd.org> Author: kib Date: Wed Apr 1 12:48:17 2009 New Revision: 190618 URL: http://svn.freebsd.org/changeset/base/190618 Log: Fully enumerate all i386 sysarch commands an amd64 include file. Provides i386/freebsd API-compatible definitions for the argument structures of the above sysarch commands. struct i386_ioperm_args definition is ABI-compatible. In collaboration with: pho Reviewed by: jhb Modified: head/sys/amd64/include/sysarch.h Modified: head/sys/amd64/include/sysarch.h ============================================================================== --- head/sys/amd64/include/sysarch.h Wed Apr 1 12:46:05 2009 (r190617) +++ head/sys/amd64/include/sysarch.h Wed Apr 1 12:48:17 2009 (r190618) @@ -35,6 +35,15 @@ #ifndef _MACHINE_SYSARCH_H_ #define _MACHINE_SYSARCH_H_ +#define I386_GET_LDT 0 +#define I386_SET_LDT 1 +#define LDT_AUTO_ALLOC 0xffffffff + /* I386_IOPL */ +#define I386_GET_IOPERM 3 +#define I386_SET_IOPERM 4 + +/* XXX Not implementable #define I386_VM86 6 */ + #define I386_GET_FSBASE 7 #define I386_SET_FSBASE 8 #define I386_GET_GSBASE 9 @@ -46,6 +55,18 @@ #define AMD64_GET_GSBASE 130 #define AMD64_SET_GSBASE 131 +struct i386_ldt_args { + unsigned int start; + struct user_segment_descriptor *descs __packed; + unsigned int num; +}; + +struct i386_ioperm_args { + unsigned int start; + unsigned int length; + int enable; +}; + #ifndef _KERNEL #include From kib at FreeBSD.org Wed Apr 1 05:53:02 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Wed Apr 1 05:53:17 2009 Subject: svn commit: r190619 - in head/sys/amd64: amd64 include Message-ID: <200904011253.n31Cr1qL032221@svn.freebsd.org> Author: kib Date: Wed Apr 1 12:53:01 2009 New Revision: 190619 URL: http://svn.freebsd.org/changeset/base/190619 Log: Add separate gdt descriptors for %fs and %gs on amd64. Reorder amd64 gdt descriptors so that user-accessible selectors are the same as on i386. At least Wine hard-codes this into the binary. In collaboration with: pho Reviewed by: jhb Modified: head/sys/amd64/amd64/machdep.c head/sys/amd64/include/segments.h Modified: head/sys/amd64/amd64/machdep.c ============================================================================== --- head/sys/amd64/amd64/machdep.c Wed Apr 1 12:48:17 2009 (r190618) +++ head/sys/amd64/amd64/machdep.c Wed Apr 1 12:53:01 2009 (r190619) @@ -826,7 +826,12 @@ CTASSERT(sizeof(struct nmi_pcpu) == 16); struct amd64tss common_tss[MAXCPU]; -/* software prototypes -- in more palatable form */ +/* + * Software prototypes -- in more palatable form. + * + * Keep GUFS32, GUGS32, GUCODE32 and GUDATA at the same + * slots as corresponding segments for i386 kernel. + */ struct soft_segment_descriptor gdt_segs[] = { /* GNULL_SEL 0 Null Descriptor */ { .ssd_base = 0x0, @@ -837,7 +842,34 @@ struct soft_segment_descriptor gdt_segs[ .ssd_long = 0, .ssd_def32 = 0, .ssd_gran = 0 }, -/* GCODE_SEL 1 Code Descriptor for kernel */ +/* GNULL2_SEL 1 Null Descriptor */ +{ .ssd_base = 0x0, + .ssd_limit = 0x0, + .ssd_type = 0, + .ssd_dpl = 0, + .ssd_p = 0, + .ssd_long = 0, + .ssd_def32 = 0, + .ssd_gran = 0 }, +/* GUFS32_SEL 2 32 bit %gs Descriptor for user */ +{ .ssd_base = 0x0, + .ssd_limit = 0xfffff, + .ssd_type = SDT_MEMRWA, + .ssd_dpl = SEL_UPL, + .ssd_p = 1, + .ssd_long = 0, + .ssd_def32 = 1, + .ssd_gran = 1 }, +/* GUGS32_SEL 3 32 bit %fs Descriptor for user */ +{ .ssd_base = 0x0, + .ssd_limit = 0xfffff, + .ssd_type = SDT_MEMRWA, + .ssd_dpl = SEL_UPL, + .ssd_p = 1, + .ssd_long = 0, + .ssd_def32 = 1, + .ssd_gran = 1 }, +/* GCODE_SEL 4 Code Descriptor for kernel */ { .ssd_base = 0x0, .ssd_limit = 0xfffff, .ssd_type = SDT_MEMERA, @@ -846,7 +878,7 @@ struct soft_segment_descriptor gdt_segs[ .ssd_long = 1, .ssd_def32 = 0, .ssd_gran = 1 }, -/* GDATA_SEL 2 Data Descriptor for kernel */ +/* GDATA_SEL 5 Data Descriptor for kernel */ { .ssd_base = 0x0, .ssd_limit = 0xfffff, .ssd_type = SDT_MEMRWA, @@ -855,7 +887,7 @@ struct soft_segment_descriptor gdt_segs[ .ssd_long = 1, .ssd_def32 = 0, .ssd_gran = 1 }, -/* GUCODE32_SEL 3 32 bit Code Descriptor for user */ +/* GUCODE32_SEL 6 32 bit Code Descriptor for user */ { .ssd_base = 0x0, .ssd_limit = 0xfffff, .ssd_type = SDT_MEMERA, @@ -864,7 +896,7 @@ struct soft_segment_descriptor gdt_segs[ .ssd_long = 0, .ssd_def32 = 1, .ssd_gran = 1 }, -/* GUDATA_SEL 4 32/64 bit Data Descriptor for user */ +/* GUDATA_SEL 7 32/64 bit Data Descriptor for user */ { .ssd_base = 0x0, .ssd_limit = 0xfffff, .ssd_type = SDT_MEMRWA, @@ -873,7 +905,7 @@ struct soft_segment_descriptor gdt_segs[ .ssd_long = 0, .ssd_def32 = 1, .ssd_gran = 1 }, -/* GUCODE_SEL 5 64 bit Code Descriptor for user */ +/* GUCODE_SEL 8 64 bit Code Descriptor for user */ { .ssd_base = 0x0, .ssd_limit = 0xfffff, .ssd_type = SDT_MEMERA, @@ -882,9 +914,9 @@ struct soft_segment_descriptor gdt_segs[ .ssd_long = 1, .ssd_def32 = 0, .ssd_gran = 1 }, -/* GPROC0_SEL 6 Proc 0 Tss Descriptor */ +/* GPROC0_SEL 9 Proc 0 Tss Descriptor */ { .ssd_base = 0x0, - .ssd_limit = sizeof(struct amd64tss)-1, + .ssd_limit = sizeof(struct amd64tss) + IOPAGES * PAGE_SIZE - 1, .ssd_type = SDT_SYSTSS, .ssd_dpl = SEL_KPL, .ssd_p = 1, @@ -900,15 +932,24 @@ struct soft_segment_descriptor gdt_segs[ .ssd_long = 0, .ssd_def32 = 0, .ssd_gran = 0 }, -/* GUGS32_SEL 8 32 bit GS Descriptor for user */ +/* GUSERLDT_SEL 11 LDT Descriptor */ { .ssd_base = 0x0, - .ssd_limit = 0xfffff, - .ssd_type = SDT_MEMRWA, - .ssd_dpl = SEL_UPL, - .ssd_p = 1, + .ssd_limit = 0x0, + .ssd_type = 0, + .ssd_dpl = 0, + .ssd_p = 0, .ssd_long = 0, - .ssd_def32 = 1, - .ssd_gran = 1 }, + .ssd_def32 = 0, + .ssd_gran = 0 }, +/* GUSERLDT_SEL 12 LDT Descriptor, double size */ +{ .ssd_base = 0x0, + .ssd_limit = 0x0, + .ssd_type = 0, + .ssd_dpl = 0, + .ssd_p = 0, + .ssd_long = 0, + .ssd_def32 = 0, + .ssd_gran = 0 }, }; void Modified: head/sys/amd64/include/segments.h ============================================================================== --- head/sys/amd64/include/segments.h Wed Apr 1 12:48:17 2009 (r190618) +++ head/sys/amd64/include/segments.h Wed Apr 1 12:53:01 2009 (r190619) @@ -212,15 +212,19 @@ struct region_descriptor { * Entries in the Global Descriptor Table (GDT) */ #define GNULL_SEL 0 /* Null Descriptor */ -#define GCODE_SEL 1 /* Kernel Code Descriptor */ -#define GDATA_SEL 2 /* Kernel Data Descriptor */ -#define GUCODE32_SEL 3 /* User 32 bit code Descriptor */ -#define GUDATA_SEL 4 /* User 32/64 bit Data Descriptor */ -#define GUCODE_SEL 5 /* User 64 bit Code Descriptor */ -#define GPROC0_SEL 6 /* TSS for entering kernel etc */ -/* slot 7 is second half of GPROC0_SEL */ -#define GUGS32_SEL 8 /* User 32 bit GS Descriptor */ -#define NGDT 9 +#define GNULL2_SEL 1 /* Null Descriptor */ +#define GUFS32_SEL 2 /* User 32 bit %fs Descriptor */ +#define GUGS32_SEL 3 /* User 32 bit %gs Descriptor */ +#define GCODE_SEL 4 /* Kernel Code Descriptor */ +#define GDATA_SEL 5 /* Kernel Data Descriptor */ +#define GUCODE32_SEL 6 /* User 32 bit code Descriptor */ +#define GUDATA_SEL 7 /* User 32/64 bit Data Descriptor */ +#define GUCODE_SEL 8 /* User 64 bit Code Descriptor */ +#define GPROC0_SEL 9 /* TSS for entering kernel etc */ +/* slot 10 is second half of GPROC0_SEL */ +#define GUSERLDT_SEL 11 /* LDT */ +/* slot 11 is second half of GUSERLDT_SEL */ +#define NGDT 13 #ifdef _KERNEL extern struct user_segment_descriptor gdt[]; From kib at FreeBSD.org Wed Apr 1 06:09:27 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Wed Apr 1 06:09:35 2009 Subject: svn commit: r190620 - in head/sys: amd64/acpica amd64/amd64 amd64/ia32 amd64/include amd64/linux32 conf Message-ID: <200904011309.n31D9QqM032643@svn.freebsd.org> Author: kib Date: Wed Apr 1 13:09:26 2009 New Revision: 190620 URL: http://svn.freebsd.org/changeset/base/190620 Log: Save and restore segment registers on amd64 when entering and leaving the kernel on amd64. Fill and read segment registers for mcontext and signals. Handle traps caused by restoration of the invalidated selectors. Implement user-mode creation and manipulation of the process-specific LDT descriptors for amd64, see sysarch(2). Implement support for TSS i/o port access permission bitmap for amd64. Context-switch LDT and TSS. Do not save and restore segment registers on the context switch, that is handled by kernel enter/leave trampolines now. Remove segment restore code from the signal trampolines for freebsd/amd64, freebsd/ia32 and linux/i386 for the same reason. Implement amd64-specific compat shims for sysarch. Linuxolator (temporary ?) switched to use gsbase for thread_area pointer. TODO: Currently, gdb is not adapted to show segment registers from struct reg. Also, no machine-depended ptrace command is added to set segment registers for debugged process. In collaboration with: pho Discussed with: peter Reviewed by: jhb Linuxolator tested by: dchagin Added: head/sys/amd64/ia32/ia32_misc.c (contents, props changed) Modified: head/sys/amd64/acpica/acpi_switch.S head/sys/amd64/amd64/apic_vector.S head/sys/amd64/amd64/cpu_switch.S head/sys/amd64/amd64/db_interface.c head/sys/amd64/amd64/db_trace.c head/sys/amd64/amd64/exception.S head/sys/amd64/amd64/genassym.c head/sys/amd64/amd64/machdep.c head/sys/amd64/amd64/mp_machdep.c head/sys/amd64/amd64/sys_machdep.c head/sys/amd64/amd64/trap.c head/sys/amd64/amd64/vm_machdep.c head/sys/amd64/ia32/ia32_exception.S head/sys/amd64/ia32/ia32_reg.c head/sys/amd64/ia32/ia32_signal.c head/sys/amd64/ia32/ia32_sigtramp.S head/sys/amd64/include/asmacros.h head/sys/amd64/include/frame.h head/sys/amd64/include/md_var.h head/sys/amd64/include/pcb.h head/sys/amd64/include/pcpu.h head/sys/amd64/include/proc.h head/sys/amd64/include/segments.h head/sys/amd64/include/sysarch.h head/sys/amd64/linux32/linux32_locore.s head/sys/amd64/linux32/linux32_machdep.c head/sys/amd64/linux32/linux32_sysvec.c head/sys/conf/files.amd64 Modified: head/sys/amd64/acpica/acpi_switch.S ============================================================================== --- head/sys/amd64/acpica/acpi_switch.S Wed Apr 1 12:53:01 2009 (r190619) +++ head/sys/amd64/acpica/acpi_switch.S Wed Apr 1 13:09:26 2009 (r190620) @@ -64,12 +64,17 @@ ENTRY(acpi_restorecpu) /* Fetch PCB. */ movq WAKEUP_CTX(xpcb), %r11 - /* Restore segment registers. */ - mov WAKEUP_PCB(DS), %ds - mov WAKEUP_PCB(ES), %es - mov WAKEUP_XPCB(SS), %ss - mov WAKEUP_PCB(FS), %fs - mov WAKEUP_PCB(GS), %gs + /* Force kernel segment registers. */ + movl $KDSEL, %eax + movw %ax, %ds + movl $KDSEL, %eax + movw %ax, %es + movl $KDSEL, %eax + movw %ax, %ss + movl $KUF32SEL, %eax + movw %ax, %fs + movl $KUG32SEL, %eax + movw %ax, %gs movl $MSR_FSBASE, %ecx movl WAKEUP_PCB(FSBASE), %eax Modified: head/sys/amd64/amd64/apic_vector.S ============================================================================== --- head/sys/amd64/amd64/apic_vector.S Wed Apr 1 12:53:01 2009 (r190619) +++ head/sys/amd64/amd64/apic_vector.S Wed Apr 1 13:09:26 2009 (r190620) @@ -219,9 +219,7 @@ IDTVEC(cpustop) movl $0, LA_EOI(%rax) /* End Of Interrupt to APIC */ call cpustop_handler - - POP_FRAME - iretq + jmp doreti /* * Executed by a CPU when it receives an IPI_SUSPEND from another CPU. @@ -251,6 +249,5 @@ IDTVEC(rendezvous) call smp_rendezvous_action movq lapic, %rax movl $0, LA_EOI(%rax) /* End Of Interrupt to APIC */ - POP_FRAME /* Why not doreti? */ - iretq + jmp doreti #endif /* SMP */ Modified: head/sys/amd64/amd64/cpu_switch.S ============================================================================== --- head/sys/amd64/amd64/cpu_switch.S Wed Apr 1 12:53:01 2009 (r190619) +++ head/sys/amd64/amd64/cpu_switch.S Wed Apr 1 13:09:26 2009 (r190620) @@ -75,8 +75,6 @@ ENTRY(cpu_throw) 1: movq TD_PCB(%rdi),%r8 /* Old pcb */ movl PCPU(CPUID), %eax - movq PCB_FSBASE(%r8),%r9 - movq PCB_GSBASE(%r8),%r10 /* release bit from old pm_active */ movq TD_PROC(%rdi), %rdx /* oldtd->td_proc */ movq P_VMSPACE(%rdx), %rdx /* proc->p_vmspace */ @@ -110,28 +108,6 @@ ENTRY(cpu_switch) movq %rbx,PCB_RBX(%r8) movq %rax,PCB_RIP(%r8) - /* - * Reread fs and gs bases. Explicit fs segment register load - * by the usermode code may change actual fs base without - * updating pcb_{fs,gs}base. - * - * %rdx still contains the mtx, save %rdx around rdmsr. - */ - movq %rdx,%r11 - movl $MSR_FSBASE,%ecx - rdmsr - shlq $32,%rdx - leaq (%rax,%rdx),%r9 - movl $MSR_KGSBASE,%ecx - rdmsr - shlq $32,%rdx - leaq (%rax,%rdx),%r10 - movq %r11,%rdx - - testl $PCB_32BIT,PCB_FLAGS(%r8) - jnz store_seg -done_store_seg: - testl $PCB_DBREGS,PCB_FLAGS(%r8) jnz store_dr /* static predict not taken */ done_store_dr: @@ -192,36 +168,47 @@ sw1: testl $TDP_KTHREAD,TD_PFLAGS(%rsi) jnz do_kthread - testl $PCB_32BIT,PCB_FLAGS(%r8) - jnz load_seg -done_load_seg: - - cmpq PCB_FSBASE(%r8),%r9 - jz 1f - /* Restore userland %fs */ -restore_fsbase: - movl $MSR_FSBASE,%ecx + /* + * Load ldt register + */ + movq TD_PROC(%rsi),%rcx + cmpq $0, P_MD+MD_LDT(%rcx) + jne do_ldt + xorl %eax,%eax +ld_ldt: lldt %ax + + /* Restore fs base in GDT */ movl PCB_FSBASE(%r8),%eax - movl PCB_FSBASE+4(%r8),%edx - wrmsr -1: - cmpq PCB_GSBASE(%r8),%r10 - jz 2f - /* Restore userland %gs */ - movl $MSR_KGSBASE,%ecx + movq PCPU(FS32P),%rdx + movw %ax,2(%rdx) + shrl $16,%eax + movb %al,4(%rdx) + shrl $8,%eax + movb %al,7(%rdx) + + /* Restore gs base in GDT */ movl PCB_GSBASE(%r8),%eax - movl PCB_GSBASE+4(%r8),%edx - wrmsr -2: + movq PCPU(GS32P),%rdx + movw %ax,2(%rdx) + shrl $16,%eax + movb %al,4(%rdx) + shrl $8,%eax + movb %al,7(%rdx) -do_tss: +do_kthread: + /* Do we need to reload tss ? */ + movq PCPU(TSSP),%rax + movq PCB_TSSP(%r8),%rdx + testq %rdx,%rdx + cmovzq PCPU(COMMONTSSP),%rdx + cmpq %rax,%rdx + jne do_tss +done_tss: + movq %r8,PCPU(RSP0) + movq %r8,PCPU(CURPCB) /* Update the TSS_RSP0 pointer for the next interrupt */ - movq PCPU(TSSP), %rax - movq %r8, PCPU(RSP0) - movq %r8, PCPU(CURPCB) - addq $COMMON_TSS_RSP0, %rax - movq %rsi, PCPU(CURTHREAD) /* into next thread */ - movq %r8, (%rax) + movq %r8,COMMON_TSS_RSP0(%rdx) + movq %rsi,PCPU(CURTHREAD) /* into next thread */ /* Test if debug registers should be restored. */ testl $PCB_DBREGS,PCB_FLAGS(%r8) @@ -250,45 +237,6 @@ done_load_dr: * We use jumps rather than call in order to avoid the stack. */ -do_kthread: - /* - * Copy old fs/gsbase to new kthread pcb for future switches - * This maintains curpcb->pcb_[fg]sbase as caches of the MSR - */ - movq %r9,PCB_FSBASE(%r8) - movq %r10,PCB_GSBASE(%r8) - jmp do_tss - -store_seg: - mov %gs,PCB_GS(%r8) - testl $PCB_GS32BIT,PCB_FLAGS(%r8) - jnz 2f -1: mov %ds,PCB_DS(%r8) - mov %es,PCB_ES(%r8) - mov %fs,PCB_FS(%r8) - jmp done_store_seg -2: movq PCPU(GS32P),%rax - movq (%rax),%rax - movq %rax,PCB_GS32SD(%r8) - jmp 1b - -load_seg: - testl $PCB_GS32BIT,PCB_FLAGS(%r8) - jnz 2f -1: movl $MSR_GSBASE,%ecx - rdmsr - mov PCB_GS(%r8),%gs - wrmsr - mov PCB_DS(%r8),%ds - mov PCB_ES(%r8),%es - mov PCB_FS(%r8),%fs - jmp restore_fsbase - /* Restore userland %gs while preserving kernel gsbase */ -2: movq PCPU(GS32P),%rax - movq PCB_GS32SD(%r8),%rcx - movq %rcx,(%rax) - jmp 1b - store_dr: movq %dr7,%rax /* yes, do the save */ movq %dr0,%r15 @@ -325,6 +273,29 @@ load_dr: movq %r11,%dr6 movq %rax,%dr7 jmp done_load_dr + +do_tss: movq %rdx,PCPU(TSSP) + movq %rdx,%rcx + movq PCPU(TSS),%rax + movw %rcx,2(%rax) + shrq $16,%rcx + movb %cl,4(%rax) + shrq $8,%rcx + movb %cl,7(%rax) + shrq $8,%rcx + movl %ecx,8(%rax) + movb $0x89,5(%rax) /* unset busy */ + movl $TSSSEL,%eax + ltr %ax + jmp done_tss + +do_ldt: movq PCPU(LDT),%rax + movq P_MD+MD_LDT_SD(%rcx),%rdx + movq %rdx,(%rax) + movq P_MD+MD_LDT_SD+8(%rcx),%rdx + movq %rdx,8(%rax) + movl $LDTSEL,%eax + jmp ld_ldt END(cpu_switch) /* @@ -398,12 +369,6 @@ ENTRY(savectx2) movq (%rsp),%rax movq %rax,PCB_RIP(%r8) - mov %ds,PCB_DS(%r8) - mov %es,PCB_ES(%r8) - mov %ss,XPCB_SS(%r8) - mov %fs,PCB_FS(%r8) - mov %gs,PCB_GS(%r8) - movq %rbx,PCB_RBX(%r8) movq %rsp,PCB_RSP(%r8) movq %rbp,PCB_RBP(%r8) Modified: head/sys/amd64/amd64/db_interface.c ============================================================================== --- head/sys/amd64/amd64/db_interface.c Wed Apr 1 12:53:01 2009 (r190619) +++ head/sys/amd64/amd64/db_interface.c Wed Apr 1 13:09:26 2009 (r190620) @@ -139,7 +139,11 @@ void db_show_mdpcpu(struct pcpu *pc) { -#if 0 - db_printf("currentldt = 0x%x\n", pc->pc_currentldt); -#endif + db_printf("curpmap = %p\n", pc->pc_curpmap); + db_printf("tssp = %p\n", pc->pc_tssp); + db_printf("commontssp = %p\n", pc->pc_commontssp); + db_printf("rsp0 = 0x%lx\n", pc->pc_rsp0); + db_printf("gs32p = %p\n", pc->pc_gs32p); + db_printf("ldt = %p\n", pc->pc_ldt); + db_printf("tss = %p\n", pc->pc_tss); } Modified: head/sys/amd64/amd64/db_trace.c ============================================================================== --- head/sys/amd64/amd64/db_trace.c Wed Apr 1 12:53:01 2009 (r190619) +++ head/sys/amd64/amd64/db_trace.c Wed Apr 1 13:09:26 2009 (r190620) @@ -69,12 +69,10 @@ static db_varfcn_t db_ss; #define DB_OFFSET(x) (db_expr_t *)offsetof(struct trapframe, x) struct db_variable db_regs[] = { { "cs", DB_OFFSET(tf_cs), db_frame }, -#if 0 { "ds", DB_OFFSET(tf_ds), db_frame }, { "es", DB_OFFSET(tf_es), db_frame }, { "fs", DB_OFFSET(tf_fs), db_frame }, { "gs", DB_OFFSET(tf_gs), db_frame }, -#endif { "ss", NULL, db_ss }, { "rax", DB_OFFSET(tf_rax), db_frame }, { "rcx", DB_OFFSET(tf_rcx), db_frame }, @@ -94,7 +92,7 @@ struct db_variable db_regs[] = { { "r15", DB_OFFSET(tf_r15), db_frame }, { "rip", DB_OFFSET(tf_rip), db_frame }, { "rflags", DB_OFFSET(tf_rflags), db_frame }, -#define DB_N_SHOW_REGS 20 /* Don't show registers after here. */ +#define DB_N_SHOW_REGS 24 /* Don't show registers after here. */ { "dr0", NULL, db_dr0 }, { "dr1", NULL, db_dr1 }, { "dr2", NULL, db_dr2 }, @@ -357,7 +355,7 @@ db_nextframe(struct amd64_frame **fp, db rbp = tf->tf_rbp; switch (frame_type) { case TRAP: - db_printf("--- trap %#lr", tf->tf_trapno); + db_printf("--- trap %#r", tf->tf_trapno); break; case SYSCALL: db_printf("--- syscall"); Modified: head/sys/amd64/amd64/exception.S ============================================================================== --- head/sys/amd64/amd64/exception.S Wed Apr 1 12:53:01 2009 (r190619) +++ head/sys/amd64/amd64/exception.S Wed Apr 1 13:09:26 2009 (r190620) @@ -42,6 +42,7 @@ #include #include #include +#include #include "assym.s" @@ -99,7 +100,7 @@ MCOUNT_LABEL(btrap) /* Traps that we leave interrupts disabled for.. */ #define TRAP_NOEN(a) \ subq $TF_RIP,%rsp; \ - movq $(a),TF_TRAPNO(%rsp) ; \ + movl $(a),TF_TRAPNO(%rsp) ; \ movq $0,TF_ADDR(%rsp) ; \ movq $0,TF_ERR(%rsp) ; \ jmp alltraps_noen @@ -111,7 +112,7 @@ IDTVEC(bpt) /* Regular traps; The cpu does not supply tf_err for these. */ #define TRAP(a) \ subq $TF_RIP,%rsp; \ - movq $(a),TF_TRAPNO(%rsp) ; \ + movl $(a),TF_TRAPNO(%rsp) ; \ movq $0,TF_ADDR(%rsp) ; \ movq $0,TF_ERR(%rsp) ; \ jmp alltraps @@ -139,7 +140,7 @@ IDTVEC(xmm) /* This group of traps have tf_err already pushed by the cpu */ #define TRAP_ERR(a) \ subq $TF_ERR,%rsp; \ - movq $(a),TF_TRAPNO(%rsp) ; \ + movl $(a),TF_TRAPNO(%rsp) ; \ movq $0,TF_ADDR(%rsp) ; \ jmp alltraps IDTVEC(tss) @@ -164,6 +165,10 @@ alltraps: testb $SEL_RPL_MASK,TF_CS(%rsp) /* Did we come from kernel? */ jz alltraps_testi /* already running with kernel GS.base */ swapgs + movw %fs,TF_FS(%rsp) + movw %gs,TF_GS(%rsp) + movw %es,TF_ES(%rsp) + movw %ds,TF_DS(%rsp) alltraps_testi: testl $PSL_I,TF_RFLAGS(%rsp) jz alltraps_pushregs @@ -185,6 +190,7 @@ alltraps_pushregs_no_rdi: movq %r13,TF_R13(%rsp) movq %r14,TF_R14(%rsp) movq %r15,TF_R15(%rsp) + movl $TF_HASSEGS,TF_FLAGS(%rsp) FAKE_MCOUNT(TF_RIP(%rsp)) #ifdef KDTRACE_HOOKS /* @@ -193,7 +199,7 @@ alltraps_pushregs_no_rdi: * interrupt. For all other trap types, just handle them in * the usual way. */ - cmpq $T_BPTFLT,TF_TRAPNO(%rsp) + cmpl $T_BPTFLT,TF_TRAPNO(%rsp) jne calltrap /* Check if there is no DTrace hook registered. */ @@ -228,13 +234,17 @@ calltrap: .type alltraps_noen,@function alltraps_noen: testb $SEL_RPL_MASK,TF_CS(%rsp) /* Did we come from kernel? */ - jz alltraps_pushregs /* already running with kernel GS.base */ + jz 1f /* already running with kernel GS.base */ swapgs +1: movw %fs,TF_FS(%rsp) + movw %gs,TF_GS(%rsp) + movw %es,TF_ES(%rsp) + movw %ds,TF_DS(%rsp) jmp alltraps_pushregs IDTVEC(dblfault) subq $TF_ERR,%rsp - movq $T_DOUBLEFLT,TF_TRAPNO(%rsp) + movl $T_DOUBLEFLT,TF_TRAPNO(%rsp) movq $0,TF_ADDR(%rsp) movq $0,TF_ERR(%rsp) movq %rdi,TF_RDI(%rsp) @@ -252,6 +262,11 @@ IDTVEC(dblfault) movq %r13,TF_R13(%rsp) movq %r14,TF_R14(%rsp) movq %r15,TF_R15(%rsp) + movw %fs,TF_FS(%rsp) + movw %gs,TF_GS(%rsp) + movw %es,TF_ES(%rsp) + movw %ds,TF_DS(%rsp) + movl $TF_HASSEGS,TF_FLAGS(%rsp) testb $SEL_RPL_MASK,TF_CS(%rsp) /* Did we come from kernel? */ jz 1f /* already running with kernel GS.base */ swapgs @@ -262,7 +277,7 @@ IDTVEC(dblfault) IDTVEC(page) subq $TF_ERR,%rsp - movq $T_PAGEFLT,TF_TRAPNO(%rsp) + movl $T_PAGEFLT,TF_TRAPNO(%rsp) testb $SEL_RPL_MASK,TF_CS(%rsp) /* Did we come from kernel? */ jz 1f /* already running with kernel GS.base */ swapgs @@ -270,6 +285,10 @@ IDTVEC(page) movq %rdi,TF_RDI(%rsp) /* free up a GP register */ movq %cr2,%rdi /* preserve %cr2 before .. */ movq %rdi,TF_ADDR(%rsp) /* enabling interrupts. */ + movw %fs,TF_FS(%rsp) + movw %gs,TF_GS(%rsp) + movw %es,TF_ES(%rsp) + movw %ds,TF_DS(%rsp) testl $PSL_I,TF_RFLAGS(%rsp) jz alltraps_pushregs_no_rdi sti @@ -283,17 +302,19 @@ IDTVEC(page) */ IDTVEC(prot) subq $TF_ERR,%rsp - movq $T_PROTFLT,TF_TRAPNO(%rsp) + movl $T_PROTFLT,TF_TRAPNO(%rsp) movq $0,TF_ADDR(%rsp) movq %rdi,TF_RDI(%rsp) /* free up a GP register */ leaq doreti_iret(%rip),%rdi cmpq %rdi,TF_RIP(%rsp) - je 2f /* kernel but with user gsbase!! */ + je 1f /* kernel but with user gsbase!! */ testb $SEL_RPL_MASK,TF_CS(%rsp) /* Did we come from kernel? */ - jz 1f /* already running with kernel GS.base */ -2: - swapgs -1: + jz 2f /* already running with kernel GS.base */ +1: swapgs +2: movw %fs,TF_FS(%rsp) + movw %gs,TF_GS(%rsp) + movw %es,TF_ES(%rsp) + movw %ds,TF_DS(%rsp) testl $PSL_I,TF_RFLAGS(%rsp) jz alltraps_pushregs_no_rdi sti @@ -316,6 +337,10 @@ IDTVEC(fast_syscall) movq %rcx,TF_RIP(%rsp) /* %rcx original value is in %r10 */ movq PCPU(SCRATCH_RSP),%r11 /* %r11 already saved */ movq %r11,TF_RSP(%rsp) /* user stack pointer */ + movw %fs,TF_FS(%rsp) + movw %gs,TF_GS(%rsp) + movw %es,TF_ES(%rsp) + movw %ds,TF_DS(%rsp) sti movq $KUDSEL,TF_SS(%rsp) movq $KUCSEL,TF_CS(%rsp) @@ -333,40 +358,11 @@ IDTVEC(fast_syscall) movq %r13,TF_R13(%rsp) /* C preserved */ movq %r14,TF_R14(%rsp) /* C preserved */ movq %r15,TF_R15(%rsp) /* C preserved */ + movl $TF_HASSEGS,TF_FLAGS(%rsp) FAKE_MCOUNT(TF_RIP(%rsp)) movq %rsp, %rdi call syscall movq PCPU(CURPCB),%rax - testq $PCB_FULLCTX,PCB_FLAGS(%rax) - jne 3f -1: /* Check for and handle AST's on return to userland */ - cli - movq PCPU(CURTHREAD),%rax - testl $TDF_ASTPENDING | TDF_NEEDRESCHED,TD_FLAGS(%rax) - je 2f - sti - movq %rsp, %rdi - call ast - jmp 1b -2: /* restore preserved registers */ - MEXITCOUNT - movq TF_RDI(%rsp),%rdi /* bonus; preserve arg 1 */ - movq TF_RSI(%rsp),%rsi /* bonus: preserve arg 2 */ - movq TF_RDX(%rsp),%rdx /* return value 2 */ - movq TF_RAX(%rsp),%rax /* return value 1 */ - movq TF_RBX(%rsp),%rbx /* C preserved */ - movq TF_RBP(%rsp),%rbp /* C preserved */ - movq TF_R12(%rsp),%r12 /* C preserved */ - movq TF_R13(%rsp),%r13 /* C preserved */ - movq TF_R14(%rsp),%r14 /* C preserved */ - movq TF_R15(%rsp),%r15 /* C preserved */ - movq TF_RFLAGS(%rsp),%r11 /* original %rflags */ - movq TF_RIP(%rsp),%rcx /* original %rip */ - movq TF_RSP(%rsp),%r9 /* user stack pointer */ - movq %r9,%rsp /* original %rsp */ - swapgs - sysretq -3: /* Requested full context restore, use doreti for that */ andq $~PCB_FULLCTX,PCB_FLAGS(%rax) MEXITCOUNT jmp doreti @@ -405,7 +401,7 @@ IDTVEC(fast_syscall32) IDTVEC(nmi) subq $TF_RIP,%rsp - movq $(T_NMI),TF_TRAPNO(%rsp) + movl $(T_NMI),TF_TRAPNO(%rsp) movq $0,TF_ADDR(%rsp) movq $0,TF_ERR(%rsp) movq %rdi,TF_RDI(%rsp) @@ -423,6 +419,11 @@ IDTVEC(nmi) movq %r13,TF_R13(%rsp) movq %r14,TF_R14(%rsp) movq %r15,TF_R15(%rsp) + movw %fs,TF_FS(%rsp) + movw %gs,TF_GS(%rsp) + movw %es,TF_ES(%rsp) + movw %ds,TF_DS(%rsp) + movl $TF_HASSEGS,TF_FLAGS(%rsp) xorl %ebx,%ebx testb $SEL_RPL_MASK,TF_CS(%rsp) jnz nmi_fromuserspace @@ -515,9 +516,7 @@ outofnmi: nocallchain: #endif testl %ebx,%ebx - jz nmi_kernelexit - swapgs - jmp nmi_restoreregs + jnz doreti_exit nmi_kernelexit: /* * Put back the preserved MSR_GSBASE value. @@ -633,7 +632,55 @@ doreti_ast: */ doreti_exit: MEXITCOUNT - movq TF_RDI(%rsp),%rdi + movq PCPU(CURTHREAD),%r8 + movq TD_PCB(%r8),%r8 + + /* + * Do not reload segment registers for kernel. + * Since we do not reload segments registers with sane + * values on kernel entry, descriptors referenced by + * segments registers may be not valid. This is fatal + * for the usermode, but is innocent for the kernel. + */ + testb $SEL_RPL_MASK,TF_CS(%rsp) + jz ld_regs + + testl $TF_HASSEGS,TF_FLAGS(%rsp) + je set_segs + +do_segs: + /* Restore %fs and fsbase */ + movw TF_FS(%rsp),%ax + .globl ld_fs +ld_fs: movw %ax,%fs + cmpw $KUF32SEL,%ax + jne 1f + movl $MSR_FSBASE,%ecx + movl PCB_FSBASE(%r8),%eax + movl PCB_FSBASE+4(%r8),%edx + wrmsr +1: + /* Restore %gs and gsbase */ + movw TF_GS(%rsp),%si + pushfq + cli + movl $MSR_GSBASE,%ecx + rdmsr + .globl ld_gs +ld_gs: movw %si,%gs + wrmsr + popfq + cmpw $KUG32SEL,%si + jne 1f + movl $MSR_KGSBASE,%ecx + movl PCB_GSBASE(%r8),%eax + movl PCB_GSBASE+4(%r8),%edx + wrmsr +1: .globl ld_es +ld_es: movw TF_ES(%rsp),%es + .globl ld_ds +ld_ds: movw TF_DS(%rsp),%ds +ld_regs:movq TF_RDI(%rsp),%rdi movq TF_RSI(%rsp),%rsi movq TF_RDX(%rsp),%rdx movq TF_RCX(%rsp),%rcx @@ -657,6 +704,14 @@ doreti_exit: doreti_iret: iretq +set_segs: + movw $KUDSEL,%ax + movw %ax,TF_DS(%rsp) + movw %ax,TF_ES(%rsp) + movw $KUF32SEL,TF_FS(%rsp) + movw $KUG32SEL,TF_GS(%rsp) + jmp do_segs + /* * doreti_iret_fault. Alternative return code for * the case where we get a fault in the doreti_exit code @@ -671,7 +726,12 @@ doreti_iret_fault: testl $PSL_I,TF_RFLAGS(%rsp) jz 1f sti -1: movq %rdi,TF_RDI(%rsp) +1: movw %fs,TF_FS(%rsp) + movw %gs,TF_GS(%rsp) + movw %es,TF_ES(%rsp) + movw %ds,TF_DS(%rsp) + movl $TF_HASSEGS,TF_FLAGS(%rsp) + movq %rdi,TF_RDI(%rsp) movq %rsi,TF_RSI(%rsp) movq %rdx,TF_RDX(%rsp) movq %rcx,TF_RCX(%rsp) @@ -686,11 +746,48 @@ doreti_iret_fault: movq %r13,TF_R13(%rsp) movq %r14,TF_R14(%rsp) movq %r15,TF_R15(%rsp) - movq $T_PROTFLT,TF_TRAPNO(%rsp) + movl $T_PROTFLT,TF_TRAPNO(%rsp) movq $0,TF_ERR(%rsp) /* XXX should be the error code */ movq $0,TF_ADDR(%rsp) FAKE_MCOUNT(TF_RIP(%rsp)) jmp calltrap + + ALIGN_TEXT + .globl ds_load_fault +ds_load_fault: + movl $T_PROTFLT,TF_TRAPNO(%rsp) + movzwl TF_DS(%rsp),%edx + movl %edx,TF_ERR(%rsp) + movw $KUDSEL,TF_DS(%rsp) + jmp calltrap + + ALIGN_TEXT + .globl es_load_fault +es_load_fault: + movl $T_PROTFLT,TF_TRAPNO(%rsp) + movzwl TF_ES(%rsp),%edx + movl %edx,TF_ERR(%rsp) + movw $KUDSEL,TF_ES(%rsp) + jmp calltrap + + ALIGN_TEXT + .globl fs_load_fault +fs_load_fault: + movl $T_PROTFLT,TF_TRAPNO(%rsp) + movzwl TF_FS(%rsp),%edx + movl %edx,TF_ERR(%rsp) + movw $KUF32SEL,TF_FS(%rsp) + jmp calltrap + + ALIGN_TEXT + .globl gs_load_fault +gs_load_fault: + popfq + movl $T_PROTFLT,TF_TRAPNO(%rsp) + movzwl TF_GS(%rsp),%edx + movl %edx,TF_ERR(%rsp) + movw $KUG32SEL,TF_GS(%rsp) + jmp calltrap #ifdef HWPMC_HOOKS ENTRY(end_exceptions) #endif Modified: head/sys/amd64/amd64/genassym.c ============================================================================== --- head/sys/amd64/amd64/genassym.c Wed Apr 1 12:53:01 2009 (r190619) +++ head/sys/amd64/amd64/genassym.c Wed Apr 1 13:09:26 2009 (r190620) @@ -79,6 +79,10 @@ ASSYM(P_VMSPACE, offsetof(struct proc, p ASSYM(VM_PMAP, offsetof(struct vmspace, vm_pmap)); ASSYM(PM_ACTIVE, offsetof(struct pmap, pm_active)); +ASSYM(P_MD, offsetof(struct proc, p_md)); +ASSYM(MD_LDT, offsetof(struct mdproc, md_ldt)); +ASSYM(MD_LDT_SD, offsetof(struct mdproc, md_ldt_sd)); + ASSYM(TD_LOCK, offsetof(struct thread, td_lock)); ASSYM(TD_FLAGS, offsetof(struct thread, td_flags)); ASSYM(TD_PCB, offsetof(struct thread, td_pcb)); @@ -132,16 +136,13 @@ ASSYM(PCB_RBX, offsetof(struct pcb, pcb_ ASSYM(PCB_RIP, offsetof(struct pcb, pcb_rip)); ASSYM(PCB_FSBASE, offsetof(struct pcb, pcb_fsbase)); ASSYM(PCB_GSBASE, offsetof(struct pcb, pcb_gsbase)); -ASSYM(PCB_DS, offsetof(struct pcb, pcb_ds)); -ASSYM(PCB_ES, offsetof(struct pcb, pcb_es)); -ASSYM(PCB_FS, offsetof(struct pcb, pcb_fs)); -ASSYM(PCB_GS, offsetof(struct pcb, pcb_gs)); ASSYM(PCB_DR0, offsetof(struct pcb, pcb_dr0)); ASSYM(PCB_DR1, offsetof(struct pcb, pcb_dr1)); ASSYM(PCB_DR2, offsetof(struct pcb, pcb_dr2)); ASSYM(PCB_DR3, offsetof(struct pcb, pcb_dr3)); ASSYM(PCB_DR6, offsetof(struct pcb, pcb_dr6)); ASSYM(PCB_DR7, offsetof(struct pcb, pcb_dr7)); +ASSYM(PCB_TSSP, offsetof(struct pcb, pcb_tssp)); ASSYM(PCB_DBREGS, PCB_DBREGS); ASSYM(PCB_32BIT, PCB_32BIT); ASSYM(PCB_GS32BIT, PCB_GS32BIT); @@ -193,7 +194,13 @@ ASSYM(TF_CS, offsetof(struct trapframe, ASSYM(TF_RFLAGS, offsetof(struct trapframe, tf_rflags)); ASSYM(TF_RSP, offsetof(struct trapframe, tf_rsp)); ASSYM(TF_SS, offsetof(struct trapframe, tf_ss)); +ASSYM(TF_DS, offsetof(struct trapframe, tf_ds)); +ASSYM(TF_ES, offsetof(struct trapframe, tf_es)); +ASSYM(TF_FS, offsetof(struct trapframe, tf_fs)); +ASSYM(TF_GS, offsetof(struct trapframe, tf_gs)); +ASSYM(TF_FLAGS, offsetof(struct trapframe, tf_flags)); ASSYM(TF_SIZE, sizeof(struct trapframe)); +ASSYM(TF_HASSEGS, TF_HASSEGS); ASSYM(SIGF_HANDLER, offsetof(struct sigframe, sf_ahu.sf_handler)); ASSYM(SIGF_UC, offsetof(struct sigframe, sf_uc)); @@ -215,7 +222,11 @@ ASSYM(PC_SCRATCH_RSP, offsetof(struct pc ASSYM(PC_CURPMAP, offsetof(struct pcpu, pc_curpmap)); ASSYM(PC_TSSP, offsetof(struct pcpu, pc_tssp)); ASSYM(PC_RSP0, offsetof(struct pcpu, pc_rsp0)); +ASSYM(PC_FS32P, offsetof(struct pcpu, pc_fs32p)); ASSYM(PC_GS32P, offsetof(struct pcpu, pc_gs32p)); +ASSYM(PC_LDT, offsetof(struct pcpu, pc_ldt)); +ASSYM(PC_COMMONTSSP, offsetof(struct pcpu, pc_commontssp)); +ASSYM(PC_TSS, offsetof(struct pcpu, pc_tss)); ASSYM(LA_VER, offsetof(struct LAPIC, version)); ASSYM(LA_TPR, offsetof(struct LAPIC, tpr)); @@ -230,6 +241,10 @@ ASSYM(KDSEL, GSEL(GDATA_SEL, SEL_KPL)); ASSYM(KUCSEL, GSEL(GUCODE_SEL, SEL_UPL)); ASSYM(KUDSEL, GSEL(GUDATA_SEL, SEL_UPL)); ASSYM(KUC32SEL, GSEL(GUCODE32_SEL, SEL_UPL)); +ASSYM(KUF32SEL, GSEL(GUFS32_SEL, SEL_UPL)); +ASSYM(KUG32SEL, GSEL(GUGS32_SEL, SEL_UPL)); +ASSYM(TSSSEL, GSEL(GPROC0_SEL, SEL_KPL)); +ASSYM(LDTSEL, GSEL(GUSERLDT_SEL, SEL_KPL)); ASSYM(SEL_RPL_MASK, SEL_RPL_MASK); ASSYM(MSR_GSBASE, MSR_GSBASE); Modified: head/sys/amd64/amd64/machdep.c ============================================================================== --- head/sys/amd64/amd64/machdep.c Wed Apr 1 12:53:01 2009 (r190619) +++ head/sys/amd64/amd64/machdep.c Wed Apr 1 13:09:26 2009 (r190620) @@ -159,7 +159,7 @@ extern vm_offset_t ksym_start, ksym_end; #define ICH_PMBASE 0x400 #define ICH_SMI_EN ICH_PMBASE + 0x30 -int _udatasel, _ucodesel, _ucode32sel; +int _udatasel, _ucodesel, _ucode32sel, _ufssel, _ugssel; int cold = 1; @@ -192,6 +192,8 @@ struct mtx icu_lock; struct mem_range_softc mem_range_softc; +struct mtx dt_lock; /* lock for GDT and LDT */ + static void cpu_startup(dummy) void *dummy; @@ -278,7 +280,7 @@ cpu_startup(dummy) * Send an interrupt to process. * * Stack is set up to allow sigcode stored - * at top to call routine, followed by kcall + * at top to call routine, followed by call * to sigreturn routine below. After sigreturn * resets the signal mask, the stack, and the * frame pointer, it returns to the user @@ -316,6 +318,8 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sf.sf_uc.uc_mcontext.mc_len = sizeof(sf.sf_uc.uc_mcontext); /* magic */ get_fpcontext(td, &sf.sf_uc.uc_mcontext); fpstate_drop(td); + sf.sf_uc.uc_mcontext.mc_fsbase = td->td_pcb->pcb_fsbase; + sf.sf_uc.uc_mcontext.mc_gsbase = td->td_pcb->pcb_gsbase; /* Allocate space for the signal handler context. */ if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack && @@ -370,6 +374,11 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, regs->tf_rip = PS_STRINGS - *(p->p_sysent->sv_szsigcode); regs->tf_rflags &= ~(PSL_T | PSL_D); regs->tf_cs = _ucodesel; + regs->tf_ds = _udatasel; + regs->tf_es = _udatasel; + regs->tf_fs = _ufssel; + regs->tf_gs = _ugssel; + regs->tf_flags = TF_HASSEGS; PROC_LOCK(p); mtx_lock(&psp->ps_mtx); } @@ -401,9 +410,16 @@ sigreturn(td, uap) ksiginfo_t ksi; error = copyin(uap->sigcntxp, &uc, sizeof(uc)); - if (error != 0) + if (error != 0) { + printf("sigreturn (pid %d): copyin failed\n", p->p_pid); return (error); + } ucp = &uc; + if ((ucp->uc_mcontext.mc_flags & ~_MC_FLAG_MASK) != 0) { + printf("sigreturn (pid %d): mc_flags %x\n", p->p_pid, + ucp->uc_mcontext.mc_flags); + return (EINVAL); + } regs = td->td_frame; rflags = ucp->uc_mcontext.mc_rflags; /* @@ -420,7 +436,8 @@ sigreturn(td, uap) * one less debugger trap, so allowing it is fairly harmless. */ if (!EFL_SECURE(rflags & ~PSL_RF, regs->tf_rflags & ~PSL_RF)) { - printf("sigreturn: rflags = 0x%lx\n", rflags); + printf("sigreturn (pid %d): rflags = 0x%lx\n", p->p_pid, + rflags); return (EINVAL); } @@ -431,7 +448,7 @@ sigreturn(td, uap) */ cs = ucp->uc_mcontext.mc_cs; if (!CS_SECURE(cs)) { - printf("sigreturn: cs = 0x%x\n", cs); + printf("sigreturn (pid %d): cs = 0x%x\n", p->p_pid, cs); ksiginfo_init_trap(&ksi); ksi.ksi_signo = SIGBUS; ksi.ksi_code = BUS_OBJERR; @@ -442,9 +459,13 @@ sigreturn(td, uap) } ret = set_fpcontext(td, &ucp->uc_mcontext); - if (ret != 0) + if (ret != 0) { + printf("sigreturn (pid %d): set_fpcontext\n", p->p_pid); return (ret); + } bcopy(&ucp->uc_mcontext.mc_rdi, regs, sizeof(*regs)); + td->td_pcb->pcb_fsbase = ucp->uc_mcontext.mc_fsbase; + td->td_pcb->pcb_gsbase = ucp->uc_mcontext.mc_gsbase; PROC_LOCK(p); #if defined(COMPAT_43) @@ -738,22 +759,16 @@ exec_setregs(td, entry, stack, ps_string { struct trapframe *regs = td->td_frame; struct pcb *pcb = td->td_pcb; + + mtx_lock(&dt_lock); + if (td->td_proc->p_md.md_ldt != NULL) + user_ldt_free(td); + else + mtx_unlock(&dt_lock); - critical_enter(); - wrmsr(MSR_FSBASE, 0); - wrmsr(MSR_KGSBASE, 0); /* User value while we're in the kernel */ pcb->pcb_fsbase = 0; pcb->pcb_gsbase = 0; - critical_exit(); pcb->pcb_flags &= ~(PCB_32BIT | PCB_GS32BIT); - load_ds(_udatasel); - load_es(_udatasel); - load_fs(_udatasel); - load_gs(_udatasel); - pcb->pcb_ds = _udatasel; - pcb->pcb_es = _udatasel; - pcb->pcb_fs = _udatasel; - pcb->pcb_gs = _udatasel; pcb->pcb_initial_fpucw = __INITIAL_FPUCW__; bzero((char *)regs, sizeof(struct trapframe)); @@ -763,6 +778,11 @@ exec_setregs(td, entry, stack, ps_string regs->tf_rflags = PSL_USER | (regs->tf_rflags & PSL_T); regs->tf_ss = _udatasel; regs->tf_cs = _ucodesel; + regs->tf_ds = _udatasel; + regs->tf_es = _udatasel; + regs->tf_fs = _ufssel; + regs->tf_gs = _ugssel; + regs->tf_flags = TF_HASSEGS; /* * Reset the hardware debug registers if they were in use. @@ -1380,12 +1400,12 @@ hammer_time(u_int64_t modulep, u_int64_t /* * make gdt memory segments */ - gdt_segs[GPROC0_SEL].ssd_base = (uintptr_t)&common_tss[0]; - for (x = 0; x < NGDT; x++) { - if (x != GPROC0_SEL && x != (GPROC0_SEL + 1)) + if (x != GPROC0_SEL && x != (GPROC0_SEL + 1) && + x != GUSERLDT_SEL && x != (GUSERLDT_SEL) + 1) ssdtosd(&gdt_segs[x], &gdt[x]); } + gdt_segs[GPROC0_SEL].ssd_base = (uintptr_t)&common_tss[0]; ssdtosyssd(&gdt_segs[GPROC0_SEL], (struct system_segment_descriptor *)&gdt[GPROC0_SEL]); @@ -1403,6 +1423,10 @@ hammer_time(u_int64_t modulep, u_int64_t PCPU_SET(curthread, &thread0); PCPU_SET(curpcb, thread0.td_pcb); PCPU_SET(tssp, &common_tss[0]); + PCPU_SET(commontssp, &common_tss[0]); + PCPU_SET(tss, (struct system_segment_descriptor *)&gdt[GPROC0_SEL]); + PCPU_SET(ldt, (struct system_segment_descriptor *)&gdt[GUSERLDT_SEL]); + PCPU_SET(fs32p, &gdt[GUFS32_SEL]); PCPU_SET(gs32p, &gdt[GUGS32_SEL]); /* @@ -1415,6 +1439,7 @@ hammer_time(u_int64_t modulep, u_int64_t */ mutex_init(); mtx_init(&icu_lock, "icu", NULL, MTX_SPIN | MTX_NOWITNESS); + mtx_init(&dt_lock, "descriptor tables", NULL, MTX_DEF); /* exceptions */ for (x = 0; x < NIDT; x++) @@ -1503,7 +1528,8 @@ hammer_time(u_int64_t modulep, u_int64_t common_tss[0].tss_ist2 = (long) np; /* Set the IO permission bitmap (empty due to tss seg limit) */ - common_tss[0].tss_iobase = sizeof(struct amd64tss); + common_tss[0].tss_iobase = sizeof(struct amd64tss) + + IOPAGES * PAGE_SIZE; gsel_tss = GSEL(GPROC0_SEL, SEL_KPL); ltr(gsel_tss); @@ -1531,10 +1557,12 @@ hammer_time(u_int64_t modulep, u_int64_t _ucodesel = GSEL(GUCODE_SEL, SEL_UPL); _udatasel = GSEL(GUDATA_SEL, SEL_UPL); _ucode32sel = GSEL(GUCODE32_SEL, SEL_UPL); + _ufssel = GSEL(GUFS32_SEL, SEL_UPL); + _ugssel = GSEL(GUGS32_SEL, SEL_UPL); load_ds(_udatasel); load_es(_udatasel); - load_fs(_udatasel); + load_fs(_ufssel); /* setup proc 0's pcb */ thread0.td_pcb->pcb_flags = 0; @@ -1656,6 +1684,17 @@ fill_regs(struct thread *td, struct reg regs->r_rflags = tp->tf_rflags; regs->r_rsp = tp->tf_rsp; regs->r_ss = tp->tf_ss; + if (tp->tf_flags & TF_HASSEGS) { + regs->r_ds = tp->tf_ds; + regs->r_es = tp->tf_es; + regs->r_fs = tp->tf_fs; + regs->r_gs = tp->tf_gs; + } else { + regs->r_ds = 0; + regs->r_es = 0; + regs->r_fs = 0; + regs->r_gs = 0; + } return (0); } @@ -1689,6 +1728,13 @@ set_regs(struct thread *td, struct reg * tp->tf_rflags = rflags; tp->tf_rsp = regs->r_rsp; tp->tf_ss = regs->r_ss; + if (0) { /* XXXKIB */ + tp->tf_ds = regs->r_ds; + tp->tf_es = regs->r_es; + tp->tf_fs = regs->r_fs; + tp->tf_gs = regs->r_gs; + tp->tf_flags = TF_HASSEGS; + } td->td_pcb->pcb_flags |= PCB_FULLCTX; return (0); } @@ -1808,8 +1854,15 @@ get_mcontext(struct thread *td, mcontext mcp->mc_cs = tp->tf_cs; mcp->mc_rsp = tp->tf_rsp; mcp->mc_ss = tp->tf_ss; + mcp->mc_ds = tp->tf_ds; + mcp->mc_es = tp->tf_es; + mcp->mc_fs = tp->tf_fs; + mcp->mc_gs = tp->tf_gs; + mcp->mc_flags = tp->tf_flags; mcp->mc_len = sizeof(*mcp); get_fpcontext(td, mcp); + mcp->mc_fsbase = td->td_pcb->pcb_fsbase; + mcp->mc_gsbase = td->td_pcb->pcb_gsbase; return (0); } @@ -1827,7 +1880,8 @@ set_mcontext(struct thread *td, const mc int ret; tp = td->td_frame; - if (mcp->mc_len != sizeof(*mcp)) + if (mcp->mc_len != sizeof(*mcp) || + (mcp->mc_flags & ~_MC_FLAG_MASK) != 0) return (EINVAL); rflags = (mcp->mc_rflags & PSL_USERCHANGE) | (tp->tf_rflags & ~PSL_USERCHANGE); @@ -1853,6 +1907,17 @@ set_mcontext(struct thread *td, const mc tp->tf_rflags = rflags; tp->tf_rsp = mcp->mc_rsp; tp->tf_ss = mcp->mc_ss; + tp->tf_flags = mcp->mc_flags; + if (tp->tf_flags & TF_HASSEGS) { + tp->tf_ds = mcp->mc_ds; + tp->tf_es = mcp->mc_es; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From kib at FreeBSD.org Wed Apr 1 06:11:52 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Wed Apr 1 06:11:58 2009 Subject: svn commit: r190621 - head/sys/compat/freebsd32 Message-ID: <200904011311.n31DBpN9032763@svn.freebsd.org> Author: kib Date: Wed Apr 1 13:11:50 2009 New Revision: 190621 URL: http://svn.freebsd.org/changeset/base/190621 Log: Rename implementation function for freebsd32 sysarch(2) to allow for the arguments translations. Provide ABI-compatible definition of the struct i386_ldt_args for freebsd32 compat layer. In collaboration with: pho Reviewed by: jhb Modified: head/sys/compat/freebsd32/freebsd32.h head/sys/compat/freebsd32/syscalls.master Modified: head/sys/compat/freebsd32/freebsd32.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32.h Wed Apr 1 13:09:26 2009 (r190620) +++ head/sys/compat/freebsd32/freebsd32.h Wed Apr 1 13:11:50 2009 (r190621) @@ -191,4 +191,10 @@ struct thr_param32 { uint32_t spare[3]; }; +struct i386_ldt_args32 { + uint32_t start; + uint32_t descs; + uint32_t num; +}; + #endif /* !_COMPAT_FREEBSD32_FREEBSD32_H_ */ Modified: head/sys/compat/freebsd32/syscalls.master ============================================================================== --- head/sys/compat/freebsd32/syscalls.master Wed Apr 1 13:09:26 2009 (r190620) +++ head/sys/compat/freebsd32/syscalls.master Wed Apr 1 13:11:50 2009 (r190621) @@ -298,7 +298,7 @@ 162 AUE_NULL OBSOL getdomainname 163 AUE_NULL OBSOL setdomainname 164 AUE_NULL OBSOL uname -165 AUE_SYSARCH NOPROTO { int sysarch(int op, char *parms); } +165 AUE_SYSARCH STD { int freebsd32_sysarch(int op, char *parms); } 166 AUE_RTPRIO NOPROTO { int rtprio(int function, pid_t pid, \ struct rtprio *rtp); } 167 AUE_NULL UNIMPL nosys From kib at FreeBSD.org Wed Apr 1 06:12:44 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Wed Apr 1 06:12:50 2009 Subject: svn commit: r190622 - head/sys/compat/freebsd32 Message-ID: <200904011312.n31DCfid032820@svn.freebsd.org> Author: kib Date: Wed Apr 1 13:12:40 2009 New Revision: 190622 URL: http://svn.freebsd.org/changeset/base/190622 Log: Regen Modified: head/sys/compat/freebsd32/freebsd32_proto.h head/sys/compat/freebsd32/freebsd32_syscall.h head/sys/compat/freebsd32/freebsd32_syscalls.c head/sys/compat/freebsd32/freebsd32_sysent.c Modified: head/sys/compat/freebsd32/freebsd32_proto.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32_proto.h Wed Apr 1 13:11:50 2009 (r190621) +++ head/sys/compat/freebsd32/freebsd32_proto.h Wed Apr 1 13:12:40 2009 (r190622) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 185878 2008-12-10 20:56:19Z jhb + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 190621 2009-04-01 13:11:50Z kib */ #ifndef _FREEBSD32_SYSPROTO_H_ @@ -119,6 +119,10 @@ struct freebsd32_adjtime_args { char delta_l_[PADL_(struct timeval32 *)]; struct timeval32 * delta; char delta_r_[PADR_(struct timeval32 *)]; char olddelta_l_[PADL_(struct timeval32 *)]; struct timeval32 * olddelta; char olddelta_r_[PADR_(struct timeval32 *)]; }; +struct freebsd32_sysarch_args { + char op_l_[PADL_(int)]; int op; char op_r_[PADR_(int)]; + char parms_l_[PADL_(char *)]; char * parms; char parms_r_[PADR_(char *)]; +}; struct freebsd32_semsys_args { char which_l_[PADL_(int)]; int which; char which_r_[PADR_(int)]; char a2_l_[PADL_(int)]; int a2; char a2_r_[PADR_(int)]; @@ -456,6 +460,7 @@ int freebsd32_writev(struct thread *, st int freebsd32_settimeofday(struct thread *, struct freebsd32_settimeofday_args *); int freebsd32_utimes(struct thread *, struct freebsd32_utimes_args *); int freebsd32_adjtime(struct thread *, struct freebsd32_adjtime_args *); +int freebsd32_sysarch(struct thread *, struct freebsd32_sysarch_args *); int freebsd32_semsys(struct thread *, struct freebsd32_semsys_args *); int freebsd32_msgsys(struct thread *, struct freebsd32_msgsys_args *); int freebsd32_shmsys(struct thread *, struct freebsd32_shmsys_args *); @@ -682,6 +687,7 @@ int freebsd6_freebsd32_ftruncate(struct #define FREEBSD32_SYS_AUE_freebsd32_settimeofday AUE_SETTIMEOFDAY #define FREEBSD32_SYS_AUE_freebsd32_utimes AUE_UTIMES #define FREEBSD32_SYS_AUE_freebsd32_adjtime AUE_ADJTIME +#define FREEBSD32_SYS_AUE_freebsd32_sysarch AUE_SYSARCH #define FREEBSD32_SYS_AUE_freebsd32_semsys AUE_SEMSYS #define FREEBSD32_SYS_AUE_freebsd32_msgsys AUE_MSGSYS #define FREEBSD32_SYS_AUE_freebsd32_shmsys AUE_SHMSYS Modified: head/sys/compat/freebsd32/freebsd32_syscall.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32_syscall.h Wed Apr 1 13:11:50 2009 (r190621) +++ head/sys/compat/freebsd32/freebsd32_syscall.h Wed Apr 1 13:12:40 2009 (r190622) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 185878 2008-12-10 20:56:19Z jhb + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 190621 2009-04-01 13:11:50Z kib */ #define FREEBSD32_SYS_syscall 0 @@ -159,7 +159,7 @@ /* 162 is obsolete getdomainname */ /* 163 is obsolete setdomainname */ /* 164 is obsolete uname */ -#define FREEBSD32_SYS_sysarch 165 +#define FREEBSD32_SYS_freebsd32_sysarch 165 #define FREEBSD32_SYS_rtprio 166 #define FREEBSD32_SYS_freebsd32_semsys 169 #define FREEBSD32_SYS_freebsd32_msgsys 170 Modified: head/sys/compat/freebsd32/freebsd32_syscalls.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_syscalls.c Wed Apr 1 13:11:50 2009 (r190621) +++ head/sys/compat/freebsd32/freebsd32_syscalls.c Wed Apr 1 13:12:40 2009 (r190622) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 185878 2008-12-10 20:56:19Z jhb + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 190621 2009-04-01 13:11:50Z kib */ const char *freebsd32_syscallnames[] = { @@ -172,7 +172,7 @@ const char *freebsd32_syscallnames[] = { "obs_getdomainname", /* 162 = obsolete getdomainname */ "obs_setdomainname", /* 163 = obsolete setdomainname */ "obs_uname", /* 164 = obsolete uname */ - "sysarch", /* 165 = sysarch */ + "freebsd32_sysarch", /* 165 = freebsd32_sysarch */ "rtprio", /* 166 = rtprio */ "#167", /* 167 = nosys */ "#168", /* 168 = nosys */ Modified: head/sys/compat/freebsd32/freebsd32_sysent.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_sysent.c Wed Apr 1 13:11:50 2009 (r190621) +++ head/sys/compat/freebsd32/freebsd32_sysent.c Wed Apr 1 13:12:40 2009 (r190622) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 185878 2008-12-10 20:56:19Z jhb + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 190621 2009-04-01 13:11:50Z kib */ #include "opt_compat.h" @@ -203,7 +203,7 @@ struct sysent freebsd32_sysent[] = { { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 162 = obsolete getdomainname */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 163 = obsolete setdomainname */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 164 = obsolete uname */ - { AS(sysarch_args), (sy_call_t *)sysarch, AUE_SYSARCH, NULL, 0, 0 }, /* 165 = sysarch */ + { AS(freebsd32_sysarch_args), (sy_call_t *)freebsd32_sysarch, AUE_SYSARCH, NULL, 0, 0 }, /* 165 = freebsd32_sysarch */ { AS(rtprio_args), (sy_call_t *)rtprio, AUE_RTPRIO, NULL, 0, 0 }, /* 166 = rtprio */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 167 = nosys */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 168 = nosys */ From kib at FreeBSD.org Wed Apr 1 06:44:30 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Wed Apr 1 06:44:42 2009 Subject: svn commit: r190623 - in head/sys: amd64/include i386/include Message-ID: <200904011344.n31DiSiD033502@svn.freebsd.org> Author: kib Date: Wed Apr 1 13:44:28 2009 New Revision: 190623 URL: http://svn.freebsd.org/changeset/base/190623 Log: Sync definitions for struct sigcontext for i386 and amd64 architectures to struct mcontext. Modified: head/sys/amd64/include/signal.h head/sys/i386/include/signal.h Modified: head/sys/amd64/include/signal.h ============================================================================== --- head/sys/amd64/include/signal.h Wed Apr 1 13:12:40 2009 (r190622) +++ head/sys/amd64/include/signal.h Wed Apr 1 13:44:28 2009 (r190623) @@ -78,9 +78,13 @@ struct sigcontext { long sc_r13; long sc_r14; long sc_r15; - long sc_trapno; + int sc_trapno; + short sc_fs; + short sc_gs; long sc_addr; - long sc_flags; + int sc_flags; + short sc_es; + short sc_ds; long sc_err; long sc_rip; long sc_cs; @@ -95,7 +99,11 @@ struct sigcontext { long sc_fpformat; long sc_ownedfp; long sc_fpstate[64] __aligned(16); - long sc_spare[8]; + + long sc_fsbase; + long sc_gsbase; + + long sc_spare[6]; }; #endif /* __BSD_VISIBLE */ Modified: head/sys/i386/include/signal.h ============================================================================== --- head/sys/i386/include/signal.h Wed Apr 1 13:12:40 2009 (r190622) +++ head/sys/i386/include/signal.h Wed Apr 1 13:44:28 2009 (r190623) @@ -116,7 +116,11 @@ struct sigcontext { int sc_ownedfp; int sc_spare1[1]; int sc_fpstate[128] __aligned(16); - int sc_spare2[8]; + + int sc_fsbase; + int sc_gsbase; + + int sc_spare2[6]; }; #define sc_sp sc_esp From kib at FreeBSD.org Wed Apr 1 07:38:21 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Wed Apr 1 07:38:59 2009 Subject: svn commit: r190624 - in head: lib/libc/gen libexec/rtld-elf Message-ID: <200904011438.n31EcKIg034592@svn.freebsd.org> Author: kib Date: Wed Apr 1 14:38:20 2009 New Revision: 190624 URL: http://svn.freebsd.org/changeset/base/190624 Log: Document RTLD_NODELETE, -z nodelete and -z origin support. Modified: head/lib/libc/gen/dlopen.3 head/libexec/rtld-elf/rtld.1 Modified: head/lib/libc/gen/dlopen.3 ============================================================================== --- head/lib/libc/gen/dlopen.3 Wed Apr 1 13:44:28 2009 (r190623) +++ head/lib/libc/gen/dlopen.3 Wed Apr 1 14:38:20 2009 (r190624) @@ -32,7 +32,7 @@ .\" @(#) dlopen.3 1.6 90/01/31 SMI .\" $FreeBSD$ .\" -.Dd September 10, 2002 +.Dd April 1, 2009 .Os .Dt DLOPEN 3 .Sh NAME @@ -123,7 +123,7 @@ call to One of the following flags may be ORed into the .Fa mode argument: -.Bl -tag -width RTLD_GLOBALX +.Bl -tag -width RTLD_NODELETE .It Dv RTLD_GLOBAL Symbols from this shared object and its directed acyclic graph (DAG) of needed objects will be available for resolving undefined references @@ -141,6 +141,13 @@ the absolute pathnames of all objects, t With this flag .Fn dlopen will return to the caller only in the case of error. +.It Dv RTLD_NODELETE +Prevents unload of the loaded object on +.Fn dlclose . +The same behaviour may be requested by +.Fl "z nodelete" +option of the static linker +.Xr ld 1 . .El .Pp If Modified: head/libexec/rtld-elf/rtld.1 ============================================================================== --- head/libexec/rtld-elf/rtld.1 Wed Apr 1 13:44:28 2009 (r190623) +++ head/libexec/rtld-elf/rtld.1 Wed Apr 1 14:38:20 2009 (r190624) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 23, 2009 +.Dd April 1, 2009 .Dt RTLD 1 .Os .Sh NAME @@ -58,6 +58,25 @@ to be called on a per-object basis, givi to perform any extra set-up before execution of the program proper begins. This is useful for C++ libraries that contain static constructors. .Pp +When resolving dependencies for the loaded objects, +.Nm +may be allowed to translate dynamic token strings in rpath and soname +by setting +.Fl "z origin" +option of the static linker +.Xr ld 1 . +The following strings are recognized now: +.Bl -tag -width ".Pa $PLATFORM" +.It Pa $ORIGIN +Translated to the full path of the loaded object. +.It Pa $OSNAME +Translated to the name of the operating system implementation. +.It Pa $OSREL +Translated to the release level of the operating system. +.It Pa $PLATFORM +Translated to the machine hardware platform. +.El +.Pp The .Nm utility itself is loaded by the kernel together with any dynamically-linked From jkim at FreeBSD.org Wed Apr 1 09:24:25 2009 From: jkim at FreeBSD.org (Jung-uk Kim) Date: Wed Apr 1 09:24:36 2009 Subject: svn commit: r190626 - in head/sys/amd64: amd64 include Message-ID: <200904011624.n31GOOXJ036722@svn.freebsd.org> Author: jkim Date: Wed Apr 1 16:24:24 2009 New Revision: 190626 URL: http://svn.freebsd.org/changeset/base/190626 Log: Garbage collect unused stack segment since r190620. Modified: head/sys/amd64/amd64/genassym.c head/sys/amd64/include/pcb.h Modified: head/sys/amd64/amd64/genassym.c ============================================================================== --- head/sys/amd64/amd64/genassym.c Wed Apr 1 15:29:22 2009 (r190625) +++ head/sys/amd64/amd64/genassym.c Wed Apr 1 16:24:24 2009 (r190626) @@ -161,7 +161,6 @@ ASSYM(XPCB_CR0, offsetof(struct xpcb, xp ASSYM(XPCB_CR2, offsetof(struct xpcb, xpcb_cr2)); ASSYM(XPCB_CR4, offsetof(struct xpcb, xpcb_cr4)); ASSYM(XPCB_KGSBASE, offsetof(struct xpcb, xpcb_kgsbase)); -ASSYM(XPCB_SS, offsetof(struct xpcb, xpcb_ss)); ASSYM(XPCB_GDT, offsetof(struct xpcb, xpcb_gdt)); ASSYM(XPCB_IDT, offsetof(struct xpcb, xpcb_idt)); ASSYM(XPCB_LDT, offsetof(struct xpcb, xpcb_ldt)); Modified: head/sys/amd64/include/pcb.h ============================================================================== --- head/sys/amd64/include/pcb.h Wed Apr 1 15:29:22 2009 (r190625) +++ head/sys/amd64/include/pcb.h Wed Apr 1 16:24:24 2009 (r190626) @@ -86,7 +86,6 @@ struct xpcb { register_t xpcb_cr2; register_t xpcb_cr4; register_t xpcb_kgsbase; - uint32_t xpcb_ss; struct region_descriptor xpcb_gdt; struct region_descriptor xpcb_idt; struct region_descriptor xpcb_ldt; From dfr at FreeBSD.org Wed Apr 1 10:06:29 2009 From: dfr at FreeBSD.org (Doug Rabson) Date: Wed Apr 1 10:06:36 2009 Subject: svn commit: r190627 - in head/sys: dev/xen/balloon dev/xen/console i386/include/xen i386/xen xen xen/evtchn Message-ID: <200904011706.n31H6Sk1037626@svn.freebsd.org> Author: dfr Date: Wed Apr 1 17:06:28 2009 New Revision: 190627 URL: http://svn.freebsd.org/changeset/base/190627 Log: Fix the Xen build for i386 PV mode. Modified: head/sys/dev/xen/balloon/balloon.c head/sys/dev/xen/console/console.c head/sys/i386/include/xen/xenpmap.h head/sys/i386/include/xen/xenvar.h head/sys/i386/xen/pmap.c head/sys/i386/xen/xen_machdep.c head/sys/xen/evtchn/evtchn.c head/sys/xen/reboot.c (contents, props changed) Modified: head/sys/dev/xen/balloon/balloon.c ============================================================================== --- head/sys/dev/xen/balloon/balloon.c Wed Apr 1 16:24:24 2009 (r190626) +++ head/sys/dev/xen/balloon/balloon.c Wed Apr 1 17:06:28 2009 (r190627) @@ -167,6 +167,8 @@ minimum_target(void) { #ifdef XENHVM #define max_pfn physmem +#else +#define max_pfn HYPERVISOR_shared_info->arch.max_pfn #endif unsigned long min_pages, curr_pages = current_target(); @@ -256,6 +258,7 @@ increase_reservation(unsigned long nr_pa set_phys_to_machine(pfn, frame_list[i]); +#if 0 #ifndef XENHVM /* Link back into the page tables if not highmem. */ if (pfn < max_low_pfn) { @@ -268,6 +271,7 @@ increase_reservation(unsigned long nr_pa ("HYPERVISOR_update_va_mapping failed")); } #endif +#endif /* Relinquish the page back to the allocator. */ vm_page_unwire(page, 0); @@ -447,6 +451,9 @@ balloon_init(void *arg) { #ifndef XENHVM vm_page_t page; + unsigned long pfn; + +#define max_pfn HYPERVISOR_shared_info->arch.max_pfn #endif if (!is_running_on_xen()) @@ -477,6 +484,7 @@ balloon_init(void *arg) page = PHYS_TO_VM_PAGE(pfn << PAGE_SHIFT); balloon_append(page); } +#undef max_pfn #endif target_watch.callback = watch_target; Modified: head/sys/dev/xen/console/console.c ============================================================================== --- head/sys/dev/xen/console/console.c Wed Apr 1 16:24:24 2009 (r190626) +++ head/sys/dev/xen/console/console.c Wed Apr 1 17:06:28 2009 (r190627) @@ -225,7 +225,6 @@ static int xc_attach(device_t dev) { int error; - struct xc_softc *sc = (struct xc_softc *)device_get_softc(dev); if (xen_start_info->flags & SIF_INITDOMAIN) { xc_consdev.cn_putc = xccnputc_dom0; @@ -247,7 +246,7 @@ xc_attach(device_t dev) 0, "console", NULL, - xencons_priv_interrupt, + xencons_priv_interrupt, NULL, INTR_TYPE_TTY, NULL); KASSERT(error >= 0, ("can't register console interrupt")); Modified: head/sys/i386/include/xen/xenpmap.h ============================================================================== --- head/sys/i386/include/xen/xenpmap.h Wed Apr 1 16:24:24 2009 (r190626) +++ head/sys/i386/include/xen/xenpmap.h Wed Apr 1 17:06:28 2009 (r190627) @@ -45,6 +45,8 @@ void xen_pt_pin(vm_paddr_t); void xen_pt_unpin(vm_paddr_t); void xen_flush_queue(void); void pmap_ref(pt_entry_t *pte, vm_paddr_t ma); +void pmap_suspend(void); +void pmap_resume(void); void xen_check_queue(void); #ifdef INVARIANTS Modified: head/sys/i386/include/xen/xenvar.h ============================================================================== --- head/sys/i386/include/xen/xenvar.h Wed Apr 1 16:24:24 2009 (r190626) +++ head/sys/i386/include/xen/xenvar.h Wed Apr 1 17:06:28 2009 (r190627) @@ -40,6 +40,8 @@ extern int xendebug_flags; #include extern xen_pfn_t *xen_phys_machine; +extern xen_pfn_t *xen_pfn_to_mfn_frame_list[16]; +extern xen_pfn_t *xen_pfn_to_mfn_frame_list_list; #if 0 #define TRACE_ENTER XENPRINTF("(file=%s, line=%d) entered %s\n", __FILE__, __LINE__, __FUNCTION__) Modified: head/sys/i386/xen/pmap.c ============================================================================== --- head/sys/i386/xen/pmap.c Wed Apr 1 16:24:24 2009 (r190626) +++ head/sys/i386/xen/pmap.c Wed Apr 1 17:06:28 2009 (r190627) @@ -4100,6 +4100,72 @@ pmap_align_superpage(vm_object_t object, *addr = ((*addr + PDRMASK) & ~PDRMASK) + superpage_offset; } +#ifdef XEN + +void +pmap_suspend() +{ + pmap_t pmap; + int i, pdir, offset; + vm_paddr_t pdirma; + mmu_update_t mu[4]; + + /* + * We need to remove the recursive mapping structure from all + * our pmaps so that Xen doesn't get confused when it restores + * the page tables. The recursive map lives at page directory + * index PTDPTDI. We assume that the suspend code has stopped + * the other vcpus (if any). + */ + LIST_FOREACH(pmap, &allpmaps, pm_list) { + for (i = 0; i < 4; i++) { + /* + * Figure out which page directory (L2) page + * contains this bit of the recursive map and + * the offset within that page of the map + * entry + */ + pdir = (PTDPTDI + i) / NPDEPG; + offset = (PTDPTDI + i) % NPDEPG; + pdirma = pmap->pm_pdpt[pdir] & PG_FRAME; + mu[i].ptr = pdirma + offset * sizeof(pd_entry_t); + mu[i].val = 0; + } + HYPERVISOR_mmu_update(mu, 4, NULL, DOMID_SELF); + } +} + +void +pmap_resume() +{ + pmap_t pmap; + int i, pdir, offset; + vm_paddr_t pdirma; + mmu_update_t mu[4]; + + /* + * Restore the recursive map that we removed on suspend. + */ + LIST_FOREACH(pmap, &allpmaps, pm_list) { + for (i = 0; i < 4; i++) { + /* + * Figure out which page directory (L2) page + * contains this bit of the recursive map and + * the offset within that page of the map + * entry + */ + pdir = (PTDPTDI + i) / NPDEPG; + offset = (PTDPTDI + i) % NPDEPG; + pdirma = pmap->pm_pdpt[pdir] & PG_FRAME; + mu[i].ptr = pdirma + offset * sizeof(pd_entry_t); + mu[i].val = (pmap->pm_pdpt[i] & PG_FRAME) | PG_V; + } + HYPERVISOR_mmu_update(mu, 4, NULL, DOMID_SELF); + } +} + +#endif + #if defined(PMAP_DEBUG) pmap_pid_dump(int pid) { Modified: head/sys/i386/xen/xen_machdep.c ============================================================================== --- head/sys/i386/xen/xen_machdep.c Wed Apr 1 16:24:24 2009 (r190626) +++ head/sys/i386/xen/xen_machdep.c Wed Apr 1 17:06:28 2009 (r190627) @@ -89,6 +89,8 @@ start_info_t *xen_start_info; shared_info_t *HYPERVISOR_shared_info; xen_pfn_t *xen_machine_phys = machine_to_phys_mapping; xen_pfn_t *xen_phys_machine; +xen_pfn_t *xen_pfn_to_mfn_frame_list[16]; +xen_pfn_t *xen_pfn_to_mfn_frame_list_list; int preemptable, init_first; extern unsigned int avail_space; @@ -810,6 +812,39 @@ shift_phys_machine(unsigned long *phys_m } #endif /* ADD_ISA_HOLE */ +/* + * Build a directory of the pages that make up our Physical to Machine + * mapping table. The Xen suspend/restore code uses this to find our + * mapping table. + */ +static void +init_frame_list_list(void *arg) +{ + unsigned long nr_pages = xen_start_info->nr_pages; +#define FPP (PAGE_SIZE/sizeof(xen_pfn_t)) + int i, j, k; + + xen_pfn_to_mfn_frame_list_list = malloc(PAGE_SIZE, M_DEVBUF, M_WAITOK); + for (i = 0, j = 0, k = -1; i < nr_pages; + i += FPP, j++) { + if ((j & (FPP - 1)) == 0) { + k++; + xen_pfn_to_mfn_frame_list[k] = + malloc(PAGE_SIZE, M_DEVBUF, M_WAITOK); + xen_pfn_to_mfn_frame_list_list[k] = + VTOMFN(xen_pfn_to_mfn_frame_list[k]); + j = 0; + } + xen_pfn_to_mfn_frame_list[k][j] = + VTOMFN(&xen_phys_machine[i]); + } + + HYPERVISOR_shared_info->arch.max_pfn = nr_pages; + HYPERVISOR_shared_info->arch.pfn_to_mfn_frame_list_list + = VTOMFN(xen_pfn_to_mfn_frame_list_list); +} +SYSINIT(init_fll, SI_SUB_DEVFS, SI_ORDER_ANY, init_frame_list_list, NULL); + extern unsigned long physfree; int pdir, curoffset; @@ -1081,7 +1116,6 @@ initvalues(start_info_t *startinfo) PT_SET_MA(console_page, console_page_ma | PG_KERNEL); printk("#5\n"); - HYPERVISOR_shared_info->arch.pfn_to_mfn_frame_list_list = (unsigned long)xen_phys_machine; set_iopl.iopl = 1; PANIC_IF(HYPERVISOR_physdev_op(PHYSDEVOP_SET_IOPL, &set_iopl)); Modified: head/sys/xen/evtchn/evtchn.c ============================================================================== --- head/sys/xen/evtchn/evtchn.c Wed Apr 1 16:24:24 2009 (r190626) +++ head/sys/xen/evtchn/evtchn.c Wed Apr 1 17:06:28 2009 (r190627) @@ -512,7 +512,7 @@ bind_interdomain_evtchn_to_irqhandler(un int bind_virq_to_irqhandler(unsigned int virq, unsigned int cpu, const char *devname, driver_filter_t filter, driver_intr_t handler, - unsigned long irqflags, unsigned int *irqp) + void *arg, unsigned long irqflags, unsigned int *irqp) { unsigned int irq; int error; Modified: head/sys/xen/reboot.c ============================================================================== --- head/sys/xen/reboot.c Wed Apr 1 16:24:24 2009 (r190626) +++ head/sys/xen/reboot.c Wed Apr 1 17:06:28 2009 (r190627) @@ -176,9 +176,9 @@ xen_suspend() /* * Bind us to CPU 0 and stop any other VCPUs. */ - mtx_lock_spin(&sched_lock); + thread_lock(curthread); sched_bind(curthread, 0); - mtx_unlock_spin(&sched_lock); + thread_unlock(curthread); KASSERT(PCPU_GET(cpuid) == 0, ("xen_suspend: not running on cpu 0")); map = PCPU_GET(other_cpus) & ~stopped_cpus; @@ -188,8 +188,10 @@ xen_suspend() if (DEVICE_SUSPEND(root_bus) != 0) { printf("xen_suspend: device_suspend failed\n"); +#ifdef SMP if (map) restart_cpus(map); +#endif return; } @@ -253,7 +255,9 @@ xen_suspend() DEVICE_RESUME(root_bus); #ifdef SMP + thread_lock(curthread); sched_unbind(curthread); + thread_unlock(curthread); if (map) restart_cpus(map); #endif From bz at FreeBSD.org Wed Apr 1 10:12:15 2009 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Wed Apr 1 10:12:29 2009 Subject: svn commit: r190628 - head Message-ID: <200904011711.n31HBocn037782@svn.freebsd.org> Author: bz Date: Wed Apr 1 17:11:50 2009 New Revision: 190628 URL: http://svn.freebsd.org/changeset/base/190628 Log: Add a new world named 'mips' to our universe. Discussed with: imp Modified: head/Makefile Modified: head/Makefile ============================================================================== --- head/Makefile Wed Apr 1 17:06:28 2009 (r190627) +++ head/Makefile Wed Apr 1 17:11:50 2009 (r190628) @@ -279,7 +279,7 @@ tinderbox: # existing system is. # .if make(universe) || make(tinderbox) -TARGETS?=amd64 arm i386 ia64 pc98 powerpc sparc64 sun4v +TARGETS?=amd64 arm i386 ia64 mips pc98 powerpc sparc64 sun4v .if defined(DOING_TINDERBOX) FAILFILE=tinderbox.failed From jkim at FreeBSD.org Wed Apr 1 11:36:35 2009 From: jkim at FreeBSD.org (Jung-uk Kim) Date: Wed Apr 1 11:36:42 2009 Subject: svn commit: r190629 - head/sys/amd64/amd64 Message-ID: <200904011836.n31IaYSr039468@svn.freebsd.org> Author: jkim Date: Wed Apr 1 18:36:34 2009 New Revision: 190629 URL: http://svn.freebsd.org/changeset/base/190629 Log: Garbage collect unused MSR_GSBASE since r190620. The only consumer was exception.S and specialreg.h is directly included now. Note no md5 changes were observed for all assym.s consumers with this. Modified: head/sys/amd64/amd64/genassym.c Modified: head/sys/amd64/amd64/genassym.c ============================================================================== --- head/sys/amd64/amd64/genassym.c Wed Apr 1 17:11:50 2009 (r190628) +++ head/sys/amd64/amd64/genassym.c Wed Apr 1 18:36:34 2009 (r190629) @@ -72,7 +72,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include ASSYM(P_VMSPACE, offsetof(struct proc, p_vmspace)); @@ -246,8 +245,6 @@ ASSYM(TSSSEL, GSEL(GPROC0_SEL, SEL_KPL)) ASSYM(LDTSEL, GSEL(GUSERLDT_SEL, SEL_KPL)); ASSYM(SEL_RPL_MASK, SEL_RPL_MASK); -ASSYM(MSR_GSBASE, MSR_GSBASE); - #ifdef HWPMC_HOOKS ASSYM(PMC_FN_USER_CALLCHAIN, PMC_FN_USER_CALLCHAIN); #endif From jhb at freebsd.org Wed Apr 1 11:47:03 2009 From: jhb at freebsd.org (John Baldwin) Date: Wed Apr 1 11:47:09 2009 Subject: svn commit: r190520 - in stable/7/sys: . amd64/amd64 amd64/linux32 arm/arm compat/ia32 compat/svr4 contrib/pf dev/ath/ath_hal dev/cxgb i386/i386 i386/linux ia64/ia64 kern powerpc/powerpc sparc64/sp... In-Reply-To: <200903290807.n2T87b4D025770@svn.freebsd.org> References: <200903290807.n2T87b4D025770@svn.freebsd.org> Message-ID: <200904011446.51822.jhb@freebsd.org> On Sunday 29 March 2009 4:07:37 am Dmitry Chagin wrote: > Author: dchagin > Date: Sun Mar 29 08:07:36 2009 > New Revision: 190520 > URL: http://svn.freebsd.org/changeset/base/190520 > > Log: > Merge from head to stable/7: > > r189771: > Implement new way of branding ELF binaries by looking to a > ".note.ABI-tag" section. > > The search order of a brand is changed, now first of all the > ".note.ABI-tag" is looked through. > > Move code which fetch osreldate for ELF binary to check_note() handler. I think this breaks the ABI of older ELF ABI kernel modules (e.g. older linux.ko binaries) since it changes the layout of the 'ElfN(Brandinfo)' structure. I think you can fix this by making the following changes in 7.x only: 1) Move the new field (brand_note) to the end of the structure. 2) Add a new flag BI_BRAND_NOTE (or some such) that indicates that the brandnote pointer is valid. Only use the brandnote field if the new flag is set and set it in all the new places that now have notes. Old modules won't have the flag set, so the new field (which would really be garbage) would be ignored. -- John Baldwin From mav at FreeBSD.org Wed Apr 1 11:55:09 2009 From: mav at FreeBSD.org (Alexander Motin) Date: Wed Apr 1 11:55:20 2009 Subject: svn commit: r190630 - head/sys/dev/sound/pci/hda Message-ID: <200904011855.n31It8Dn039870@svn.freebsd.org> Author: mav Date: Wed Apr 1 18:55:08 2009 New Revision: 190630 URL: http://svn.freebsd.org/changeset/base/190630 Log: Add some more logic for AD1986A codec input tracing. Use mic preamplifier only for mic-type inputs. This gives better chances to use it. Change default configuration for some AD1986A codec based ASUS boards, use it also for ASUS P5PL2 board. This makes front mic preamplifier working. Tested by: Vadim Frolov Modified: head/sys/dev/sound/pci/hda/hdac.c Modified: head/sys/dev/sound/pci/hda/hdac.c ============================================================================== --- head/sys/dev/sound/pci/hda/hdac.c Wed Apr 1 18:36:34 2009 (r190629) +++ head/sys/dev/sound/pci/hda/hdac.c Wed Apr 1 18:55:08 2009 (r190630) @@ -83,7 +83,7 @@ #include "mixer_if.h" -#define HDA_DRV_TEST_REV "20090329_0131" +#define HDA_DRV_TEST_REV "20090401_0132" SND_DECLARE_FILE("$FreeBSD$"); @@ -261,6 +261,7 @@ SND_DECLARE_FILE("$FreeBSD$"); #define ASUS_A7T_SUBVENDOR HDA_MODEL_CONSTRUCT(ASUS, 0x13c2) #define ASUS_W2J_SUBVENDOR HDA_MODEL_CONSTRUCT(ASUS, 0x1971) #define ASUS_M5200_SUBVENDOR HDA_MODEL_CONSTRUCT(ASUS, 0x1993) +#define ASUS_P5PL2_SUBVENDOR HDA_MODEL_CONSTRUCT(ASUS, 0x817f) #define ASUS_P1AH2_SUBVENDOR HDA_MODEL_CONSTRUCT(ASUS, 0x81cb) #define ASUS_M2NPVMX_SUBVENDOR HDA_MODEL_CONSTRUCT(ASUS, 0x81cb) #define ASUS_M2V_SUBVENDOR HDA_MODEL_CONSTRUCT(ASUS, 0x81e7) @@ -2425,13 +2426,20 @@ hdac_widget_pin_getconfig(struct hdac_wi /* New patches */ if (id == HDA_CODEC_AD1986A && (sc->pci_subvendor == ASUS_M2NPVMX_SUBVENDOR || - sc->pci_subvendor == ASUS_A8NVMCSM_SUBVENDOR)) { + sc->pci_subvendor == ASUS_A8NVMCSM_SUBVENDOR || + sc->pci_subvendor == ASUS_P5PL2_SUBVENDOR)) { switch (nid) { - case 28: /* 5.1 out => 2.0 out + 2 inputs */ + case 26: /* Headphones with redirection */ + patch = "as=1 seq=15"; + break; + case 28: /* 5.1 out => 2.0 out + 1 input */ patch = "device=Line-in as=8 seq=1"; break; - case 29: - patch = "device=Mic as=8 seq=2"; + case 29: /* Can't use this as input, as the only available mic + * preamplifier is busy by front panel mic (nid 31). + * If you want to use this rear connector as mic input, + * you have to disable the front panel one. */ + patch = "as=0"; break; case 31: /* Lot of inputs configured with as=15 and unusable */ patch = "as=8 seq=3"; @@ -4731,6 +4739,35 @@ hdac_vendor_patch_parse(struct hdac_devi w = hdac_widget_get(devinfo, 15); if (w != NULL) w->connsenable[3] = 0; + /* There is only one mic preamplifier, use it effectively. */ + w = hdac_widget_get(devinfo, 31); + if (w != NULL) { + if ((w->wclass.pin.config & + HDA_CONFIG_DEFAULTCONF_DEVICE_MASK) == + HDA_CONFIG_DEFAULTCONF_DEVICE_MIC_IN) { + w = hdac_widget_get(devinfo, 16); + if (w != NULL) + w->connsenable[2] = 0; + } else { + w = hdac_widget_get(devinfo, 15); + if (w != NULL) + w->connsenable[0] = 0; + } + } + w = hdac_widget_get(devinfo, 32); + if (w != NULL) { + if ((w->wclass.pin.config & + HDA_CONFIG_DEFAULTCONF_DEVICE_MASK) == + HDA_CONFIG_DEFAULTCONF_DEVICE_MIC_IN) { + w = hdac_widget_get(devinfo, 16); + if (w != NULL) + w->connsenable[0] = 0; + } else { + w = hdac_widget_get(devinfo, 15); + if (w != NULL) + w->connsenable[1] = 0; + } + } if (subvendor == ASUS_A8X_SUBVENDOR) { /* From kib at FreeBSD.org Wed Apr 1 12:23:08 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Wed Apr 1 12:23:14 2009 Subject: svn commit: r190631 - in head/sys: conf ia64/ia32 Message-ID: <200904011923.n31JN7Pa040434@svn.freebsd.org> Author: kib Date: Wed Apr 1 19:23:07 2009 New Revision: 190631 URL: http://svn.freebsd.org/changeset/base/190631 Log: Add trivial implementation for the freebsd32_sysarch on ia64. Fix comapt32 and LINT build on ia64. Discussed with: jhb Added: head/sys/ia64/ia32/ia32_misc.c (contents, props changed) Modified: head/sys/conf/files.ia64 Modified: head/sys/conf/files.ia64 ============================================================================== --- head/sys/conf/files.ia64 Wed Apr 1 18:55:08 2009 (r190630) +++ head/sys/conf/files.ia64 Wed Apr 1 19:23:07 2009 (r190631) @@ -70,6 +70,7 @@ ia64/acpica/madt.c optional acpi ia64/disasm/disasm_decode.c standard ia64/disasm/disasm_extract.c standard ia64/disasm/disasm_format.c standard +ia64/ia32/ia32_misc.c optional compat_ia32 ia64/ia32/ia32_reg.c optional compat_ia32 ia64/ia32/ia32_signal.c optional compat_ia32 ia64/ia32/ia32_trap.c optional compat_ia32 Added: head/sys/ia64/ia32/ia32_misc.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/ia64/ia32/ia32_misc.c Wed Apr 1 19:23:07 2009 (r190631) @@ -0,0 +1,50 @@ +/*- + * Copyright (c) 2009 Konstantin Belousov + * 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 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 AUTHOR 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_compat.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +int +freebsd32_sysarch(struct thread *td, struct freebsd32_sysarch_args *uap) +{ + + return (EOPNOTSUPP); +} From kib at FreeBSD.org Wed Apr 1 12:23:48 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Wed Apr 1 12:23:55 2009 Subject: svn commit: r190632 - head/lib/libc/i386/sys Message-ID: <200904011923.n31JNlhh040482@svn.freebsd.org> Author: kib Date: Wed Apr 1 19:23:46 2009 New Revision: 190632 URL: http://svn.freebsd.org/changeset/base/190632 Log: Unconditionally build wrappers for i386_get_ioperm(), i386_set_ioperm(), i386_get_ldt() and i386_set_ldt(). In collaboration with: pho Reviewed by: jhb Modified: head/lib/libc/i386/sys/Makefile.inc Modified: head/lib/libc/i386/sys/Makefile.inc ============================================================================== --- head/lib/libc/i386/sys/Makefile.inc Wed Apr 1 19:23:07 2009 (r190631) +++ head/lib/libc/i386/sys/Makefile.inc Wed Apr 1 19:23:46 2009 (r190632) @@ -2,11 +2,10 @@ # $FreeBSD$ .if !defined(COMPAT_32BIT) -SRCS+= i386_clr_watch.c i386_get_ioperm.c \ - i386_set_ioperm.c i386_set_watch.c i386_vm86.c +SRCS+= i386_clr_watch.c i386_set_watch.c i386_vm86.c .endif -SRCS+= i386_get_fsbase.c i386_get_gsbase.c i386_get_ldt.c \ - i386_set_fsbase.c i386_set_gsbase.c i386_set_ldt.c +SRCS+= i386_get_fsbase.c i386_get_gsbase.c i386_get_ioperm.c i386_get_ldt.c \ + i386_set_fsbase.c i386_set_gsbase.c i386_set_ioperm.c i386_set_ldt.c MDASM= Ovfork.S brk.S cerror.S exect.S getcontext.S pipe.S ptrace.S \ reboot.S sbrk.S setlogin.S sigreturn.S syscall.S From xcllnt at mac.com Wed Apr 1 12:49:20 2009 From: xcllnt at mac.com (Marcel Moolenaar) Date: Wed Apr 1 12:49:26 2009 Subject: svn commit: r190631 - in head/sys: conf ia64/ia32 In-Reply-To: <200904011923.n31JN7Pa040434@svn.freebsd.org> References: <200904011923.n31JN7Pa040434@svn.freebsd.org> Message-ID: On Apr 1, 2009, at 12:23 PM, Konstantin Belousov wrote: > Author: kib > Date: Wed Apr 1 19:23:07 2009 > New Revision: 190631 > URL: http://svn.freebsd.org/changeset/base/190631 > > Log: > Add trivial implementation for the freebsd32_sysarch on ia64. > Fix comapt32 and LINT build on ia64. Thanks! Much appreciated. -- Marcel Moolenaar xcllnt@mac.com From piso at FreeBSD.org Wed Apr 1 13:23:48 2009 From: piso at FreeBSD.org (Paolo Pisati) Date: Wed Apr 1 13:23:55 2009 Subject: svn commit: r190633 - in head: sbin/ipfw sys sys/amd64/include/xen sys/arm/arm sys/contrib/pf sys/dev/ata sys/dev/cxgb sys/dev/sound/usb sys/dev/usb sys/dev/usb/bluetooth sys/dev/usb/controller sys... Message-ID: <200904012023.n31KNl71041878@svn.freebsd.org> Author: piso Date: Wed Apr 1 20:23:47 2009 New Revision: 190633 URL: http://svn.freebsd.org/changeset/base/190633 Log: Implement an ipfw action to reassemble ip packets: reass. Modified: head/sbin/ipfw/ (props changed) head/sbin/ipfw/ipfw.8 head/sbin/ipfw/ipfw2.c head/sbin/ipfw/ipfw2.h head/sbin/ipfw/main.c head/sys/ (props changed) head/sys/amd64/include/xen/ (props changed) head/sys/arm/arm/cpufunc_asm_sheeva.S (props changed) head/sys/contrib/pf/ (props changed) head/sys/dev/ata/ata-usb.c (props changed) head/sys/dev/cxgb/ (props changed) head/sys/dev/sound/usb/uaudio.c (props changed) head/sys/dev/sound/usb/uaudio.h (props changed) head/sys/dev/sound/usb/uaudio_pcm.c (props changed) head/sys/dev/sound/usb/uaudioreg.h (props changed) head/sys/dev/usb/README.TXT (props changed) head/sys/dev/usb/bluetooth/TODO.TXT (props changed) head/sys/dev/usb/bluetooth/ng_ubt.c (props changed) head/sys/dev/usb/bluetooth/ng_ubt_var.h (props changed) head/sys/dev/usb/bluetooth/ubtbcmfw.c (props changed) head/sys/dev/usb/controller/at91dci.c (props changed) head/sys/dev/usb/controller/at91dci.h (props changed) head/sys/dev/usb/controller/at91dci_atmelarm.c (props changed) head/sys/dev/usb/controller/atmegadci.c (props changed) head/sys/dev/usb/controller/atmegadci.h (props changed) head/sys/dev/usb/controller/atmegadci_atmelarm.c (props changed) head/sys/dev/usb/controller/ehci.c (props changed) head/sys/dev/usb/controller/ehci.h (props changed) head/sys/dev/usb/controller/ehci_ixp4xx.c (props changed) head/sys/dev/usb/controller/ehci_mbus.c (props changed) head/sys/dev/usb/controller/ehci_pci.c (props changed) head/sys/dev/usb/controller/musb_otg.c (props changed) head/sys/dev/usb/controller/musb_otg.h (props changed) head/sys/dev/usb/controller/musb_otg_atmelarm.c (props changed) head/sys/dev/usb/controller/ohci.c (props changed) head/sys/dev/usb/controller/ohci.h (props changed) head/sys/dev/usb/controller/ohci_atmelarm.c (props changed) head/sys/dev/usb/controller/ohci_pci.c (props changed) head/sys/dev/usb/controller/uhci.c (props changed) head/sys/dev/usb/controller/uhci.h (props changed) head/sys/dev/usb/controller/uhci_pci.c (props changed) head/sys/dev/usb/controller/usb_controller.c (props changed) head/sys/dev/usb/controller/uss820dci.c (props changed) head/sys/dev/usb/controller/uss820dci.h (props changed) head/sys/dev/usb/controller/uss820dci_atmelarm.c (props changed) head/sys/dev/usb/input/uhid.c (props changed) head/sys/dev/usb/input/ukbd.c (props changed) head/sys/dev/usb/input/ums.c (props changed) head/sys/dev/usb/input/usb_rdesc.h (props changed) head/sys/dev/usb/misc/udbp.c (props changed) head/sys/dev/usb/misc/udbp.h (props changed) head/sys/dev/usb/misc/ufm.c (props changed) head/sys/dev/usb/net/if_aue.c (props changed) head/sys/dev/usb/net/if_auereg.h (props changed) head/sys/dev/usb/net/if_axe.c (props changed) head/sys/dev/usb/net/if_axereg.h (props changed) head/sys/dev/usb/net/if_cdce.c (props changed) head/sys/dev/usb/net/if_cdcereg.h (props changed) head/sys/dev/usb/net/if_cue.c (props changed) head/sys/dev/usb/net/if_cuereg.h (props changed) head/sys/dev/usb/net/if_kue.c (props changed) head/sys/dev/usb/net/if_kuefw.h (props changed) head/sys/dev/usb/net/if_kuereg.h (props changed) head/sys/dev/usb/net/if_rue.c (props changed) head/sys/dev/usb/net/if_ruereg.h (props changed) head/sys/dev/usb/net/if_udav.c (props changed) head/sys/dev/usb/net/if_udavreg.h (props changed) head/sys/dev/usb/net/usb_ethernet.c (props changed) head/sys/dev/usb/net/usb_ethernet.h (props changed) head/sys/dev/usb/quirk/usb_quirk.c (props changed) head/sys/dev/usb/quirk/usb_quirk.h (props changed) head/sys/dev/usb/serial/u3g.c (props changed) head/sys/dev/usb/serial/uark.c (props changed) head/sys/dev/usb/serial/ubsa.c (props changed) head/sys/dev/usb/serial/ubser.c (props changed) head/sys/dev/usb/serial/uchcom.c (props changed) head/sys/dev/usb/serial/ucycom.c (props changed) head/sys/dev/usb/serial/ufoma.c (props changed) head/sys/dev/usb/serial/uftdi.c (props changed) head/sys/dev/usb/serial/uftdi_reg.h (props changed) head/sys/dev/usb/serial/ugensa.c (props changed) head/sys/dev/usb/serial/uipaq.c (props changed) head/sys/dev/usb/serial/ulpt.c (props changed) head/sys/dev/usb/serial/umct.c (props changed) head/sys/dev/usb/serial/umodem.c (props changed) head/sys/dev/usb/serial/umoscom.c (props changed) head/sys/dev/usb/serial/uplcom.c (props changed) head/sys/dev/usb/serial/usb_serial.c (props changed) head/sys/dev/usb/serial/usb_serial.h (props changed) head/sys/dev/usb/serial/uslcom.c (props changed) head/sys/dev/usb/serial/uvisor.c (props changed) head/sys/dev/usb/serial/uvscom.c (props changed) head/sys/dev/usb/storage/rio500_usb.h (props changed) head/sys/dev/usb/storage/umass.c (props changed) head/sys/dev/usb/storage/urio.c (props changed) head/sys/dev/usb/storage/ustorage_fs.c (props changed) head/sys/dev/usb/template/usb_template.c (props changed) head/sys/dev/usb/template/usb_template.h (props changed) head/sys/dev/usb/template/usb_template_cdce.c (props changed) head/sys/dev/usb/template/usb_template_msc.c (props changed) head/sys/dev/usb/template/usb_template_mtp.c (props changed) head/sys/dev/usb/ufm_ioctl.h (props changed) head/sys/dev/usb/usb.h (props changed) head/sys/dev/usb/usb_bus.h (props changed) head/sys/dev/usb/usb_busdma.c (props changed) head/sys/dev/usb/usb_busdma.h (props changed) head/sys/dev/usb/usb_cdc.h (props changed) head/sys/dev/usb/usb_compat_linux.c (props changed) head/sys/dev/usb/usb_compat_linux.h (props changed) head/sys/dev/usb/usb_controller.h (props changed) head/sys/dev/usb/usb_core.c (props changed) head/sys/dev/usb/usb_core.h (props changed) head/sys/dev/usb/usb_debug.c (props changed) head/sys/dev/usb/usb_debug.h (props changed) head/sys/dev/usb/usb_defs.h (props changed) head/sys/dev/usb/usb_dev.c (props changed) head/sys/dev/usb/usb_dev.h (props changed) head/sys/dev/usb/usb_device.c (props changed) head/sys/dev/usb/usb_device.h (props changed) head/sys/dev/usb/usb_dynamic.c (props changed) head/sys/dev/usb/usb_dynamic.h (props changed) head/sys/dev/usb/usb_endian.h (props changed) head/sys/dev/usb/usb_error.c (props changed) head/sys/dev/usb/usb_error.h (props changed) head/sys/dev/usb/usb_generic.c (props changed) head/sys/dev/usb/usb_generic.h (props changed) head/sys/dev/usb/usb_handle_request.c (props changed) head/sys/dev/usb/usb_handle_request.h (props changed) head/sys/dev/usb/usb_hid.c (props changed) head/sys/dev/usb/usb_hid.h (props changed) head/sys/dev/usb/usb_hub.c (props changed) head/sys/dev/usb/usb_hub.h (props changed) head/sys/dev/usb/usb_if.m (props changed) head/sys/dev/usb/usb_ioctl.h (props changed) head/sys/dev/usb/usb_lookup.c (props changed) head/sys/dev/usb/usb_lookup.h (props changed) head/sys/dev/usb/usb_mbuf.c (props changed) head/sys/dev/usb/usb_mbuf.h (props changed) head/sys/dev/usb/usb_mfunc.h (props changed) head/sys/dev/usb/usb_msctest.c (props changed) head/sys/dev/usb/usb_msctest.h (props changed) head/sys/dev/usb/usb_parse.c (props changed) head/sys/dev/usb/usb_parse.h (props changed) head/sys/dev/usb/usb_pci.h (props changed) head/sys/dev/usb/usb_process.c (props changed) head/sys/dev/usb/usb_process.h (props changed) head/sys/dev/usb/usb_request.c (props changed) head/sys/dev/usb/usb_request.h (props changed) head/sys/dev/usb/usb_revision.h (props changed) head/sys/dev/usb/usb_sw_transfer.c (props changed) head/sys/dev/usb/usb_sw_transfer.h (props changed) head/sys/dev/usb/usb_transfer.c (props changed) head/sys/dev/usb/usb_transfer.h (props changed) head/sys/dev/usb/usb_util.c (props changed) head/sys/dev/usb/usb_util.h (props changed) head/sys/dev/usb/usbdevs (props changed) head/sys/dev/usb/usbhid.h (props changed) head/sys/dev/usb/wlan/if_rum.c (props changed) head/sys/dev/usb/wlan/if_rumfw.h (props changed) head/sys/dev/usb/wlan/if_rumreg.h (props changed) head/sys/dev/usb/wlan/if_rumvar.h (props changed) head/sys/dev/usb/wlan/if_ural.c (props changed) head/sys/dev/usb/wlan/if_uralreg.h (props changed) head/sys/dev/usb/wlan/if_uralvar.h (props changed) head/sys/dev/usb/wlan/if_zyd.c (props changed) head/sys/dev/usb/wlan/if_zydfw.h (props changed) head/sys/dev/usb/wlan/if_zydreg.h (props changed) head/sys/dev/usb/wlan/usb_wlan.h (props changed) head/sys/dev/xen/netfront/ (props changed) head/sys/dev/xen/xenpci/ (props changed) head/sys/legacy/dev/ata/ata-usb.c (props changed) head/sys/legacy/dev/sound/usb/uaudio.c (props changed) head/sys/legacy/dev/sound/usb/uaudio.h (props changed) head/sys/legacy/dev/sound/usb/uaudio_pcm.c (props changed) head/sys/legacy/dev/sound/usb/uaudioreg.h (props changed) head/sys/legacy/dev/usb/ (props changed) head/sys/legacy/dev/usb/ehci_ixp4xx.c (props changed) head/sys/mips/mips/elf64_machdep.c (props changed) head/sys/netinet/ip_fw.h head/sys/netinet/ip_fw2.c head/sys/netinet/ip_fw_pfil.c head/sys/xen/evtchn.h (props changed) head/sys/xen/hypervisor.h (props changed) head/sys/xen/xen_intr.h (props changed) Modified: head/sbin/ipfw/ipfw.8 ============================================================================== --- head/sbin/ipfw/ipfw.8 Wed Apr 1 19:23:46 2009 (r190632) +++ head/sbin/ipfw/ipfw.8 Wed Apr 1 20:23:47 2009 (r190633) @@ -866,6 +866,13 @@ in any subsequent forwarding decisions. Initially this is limited to the values 0 through 15, see .Xr setfib 8 . Processing continues at the next rule. +.It Cm reass +Queue and reassemble ip fragments. +If the packet is not fragmented, counters are updated and processing continues with the next rule. +If the packet is the last logical fragment, the packet is reassembled and, if +.Va net.inet.ip.fw.one_pass +is set to 0, processing continues with the next rule, else packet is allowed to pass and search terminates. +If the packet is a fragment in the middle, it is consumed and processing stops immediately. .El .Ss RULE BODY The body of a rule contains zero or more patterns (such as Modified: head/sbin/ipfw/ipfw2.c ============================================================================== --- head/sbin/ipfw/ipfw2.c Wed Apr 1 19:23:46 2009 (r190632) +++ head/sbin/ipfw/ipfw2.c Wed Apr 1 20:23:47 2009 (r190633) @@ -211,6 +211,7 @@ static struct _s_x rule_actions[] = { { "check-state", TOK_CHECKSTATE }, { "//", TOK_COMMENT }, { "nat", TOK_NAT }, + { "reass", TOK_REASS }, { "setfib", TOK_SETFIB }, { NULL, 0 } /* terminator */ }; @@ -1089,6 +1090,10 @@ show_ipfw(struct ip_fw *rule, int pcwidt case O_SETFIB: PRINT_UINT_ARG("setfib ", cmd->arg1); break; + + case O_REASS: + printf("reass"); + break; default: printf("** unrecognized action %d len %d ", @@ -2781,6 +2786,10 @@ chkarg: ac--; av++; break; } + + case TOK_REASS: + action->opcode = O_REASS; + break; default: errx(EX_DATAERR, "invalid action %s\n", av[-1]); Modified: head/sbin/ipfw/ipfw2.h ============================================================================== --- head/sbin/ipfw/ipfw2.h Wed Apr 1 19:23:46 2009 (r190632) +++ head/sbin/ipfw/ipfw2.h Wed Apr 1 20:23:47 2009 (r190633) @@ -95,6 +95,7 @@ enum tokens { TOK_UNREACH, TOK_CHECKSTATE, TOK_NAT, + TOK_REASS, TOK_ALTQ, TOK_LOG, Modified: head/sbin/ipfw/main.c ============================================================================== --- head/sbin/ipfw/main.c Wed Apr 1 19:23:46 2009 (r190632) +++ head/sbin/ipfw/main.c Wed Apr 1 20:23:47 2009 (r190633) @@ -54,7 +54,7 @@ help(void) "RULE-BODY: check-state [PARAMS] | ACTION [PARAMS] ADDR [OPTION_LIST]\n" "ACTION: check-state | allow | count | deny | unreach{,6} CODE |\n" " skipto N | {divert|tee} PORT | forward ADDR |\n" -" pipe N | queue N | nat N | setfib FIB\n" +" pipe N | queue N | nat N | setfib FIB | reass\n" "PARAMS: [log [logamount LOGLIMIT]] [altq QUEUE_NAME]\n" "ADDR: [ MAC dst src ether_type ] \n" " [ ip from IPADDR [ PORT ] to IPADDR [ PORTLIST ] ]\n" Modified: head/sys/netinet/ip_fw.h ============================================================================== --- head/sys/netinet/ip_fw.h Wed Apr 1 19:23:46 2009 (r190632) +++ head/sys/netinet/ip_fw.h Wed Apr 1 20:23:47 2009 (r190633) @@ -139,7 +139,8 @@ enum ipfw_opcodes { /* arguments (4 byt O_FORWARD_IP, /* fwd sockaddr */ O_FORWARD_MAC, /* fwd mac */ O_NAT, /* nope */ - + O_REASS, /* none */ + /* * More opcodes. */ @@ -574,6 +575,7 @@ enum { IP_FW_NETGRAPH, IP_FW_NGTEE, IP_FW_NAT, + IP_FW_REASS, }; /* flags for divert mtag */ Modified: head/sys/netinet/ip_fw2.c ============================================================================== --- head/sys/netinet/ip_fw2.c Wed Apr 1 19:23:46 2009 (r190632) +++ head/sys/netinet/ip_fw2.c Wed Apr 1 20:23:47 2009 (r190633) @@ -898,6 +898,9 @@ ipfw_log(struct ip_fw *f, u_int hlen, st case O_NAT: action = "Nat"; break; + case O_REASS: + action = "Reass"; + break; default: action = "UNKNOWN"; break; @@ -3375,6 +3378,55 @@ check_body: goto done; } + case O_REASS: { + int ip_off; + + f->pcnt++; + f->bcnt += pktlen; + ip_off = (args->eh != NULL) ? ntohs(ip->ip_off) : ip->ip_off; + if (ip_off & (IP_MF | IP_OFFMASK)) { + /* + * ip_reass() expects len & off in host + * byte order: fix them in case we come + * from layer2. + */ + if (args->eh != NULL) { + ip->ip_len = ntohs(ip->ip_len); + ip->ip_off = ntohs(ip->ip_off); + } + + m = ip_reass(m); + args->m = m; + + /* + * IP header checksum fixup after + * reassembly and leave header + * in network byte order. + */ + if (m != NULL) { + int hlen; + + ip = mtod(m, struct ip *); + hlen = ip->ip_hl << 2; + /* revert len & off for layer2 pkts */ + if (args->eh != NULL) + ip->ip_len = htons(ip->ip_len); + ip->ip_sum = 0; + if (hlen == sizeof(struct ip)) + ip->ip_sum = in_cksum_hdr(ip); + else + ip->ip_sum = in_cksum(m, hlen); + retval = IP_FW_REASS; + args->rule = f; + goto done; + } else { + retval = IP_FW_DENY; + goto done; + } + } + goto next_rule; + } + default: panic("-- unknown opcode %d\n", cmd->opcode); } /* end of switch() on opcodes */ @@ -4024,6 +4076,7 @@ check_ipfw_struct(struct ip_fw *rule, in case O_UNREACH6: #endif case O_SKIPTO: + case O_REASS: check_size: if (cmdlen != F_INSN_SIZE(ipfw_insn)) goto bad_size; Modified: head/sys/netinet/ip_fw_pfil.c ============================================================================== --- head/sys/netinet/ip_fw_pfil.c Wed Apr 1 19:23:46 2009 (r190632) +++ head/sys/netinet/ip_fw_pfil.c Wed Apr 1 20:23:47 2009 (r190633) @@ -200,6 +200,9 @@ again: case IP_FW_NAT: goto again; /* continue with packet */ + case IP_FW_REASS: + goto again; + default: KASSERT(0, ("%s: unknown retval", __func__)); } @@ -329,6 +332,9 @@ again: case IP_FW_NAT: goto again; /* continue with packet */ + case IP_FW_REASS: + goto again; + default: KASSERT(0, ("%s: unknown retval", __func__)); } From jhb at FreeBSD.org Wed Apr 1 14:14:02 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Wed Apr 1 14:14:09 2009 Subject: svn commit: r190634 - in head/sys: arm/arm mips/mips Message-ID: <200904012114.n31LE24B042948@svn.freebsd.org> Author: jhb Date: Wed Apr 1 21:14:01 2009 New Revision: 190634 URL: http://svn.freebsd.org/changeset/base/190634 Log: Remove some pointless mergeinfo that is the result of doing a local 'svn cp' and having svn create empty mergeinfo for the file. Modified: head/sys/arm/arm/cpufunc_asm_sheeva.S (props changed) head/sys/mips/mips/elf64_machdep.c (props changed) From jkim at FreeBSD.org Wed Apr 1 17:23:57 2009 From: jkim at FreeBSD.org (Jung-uk Kim) Date: Wed Apr 1 17:24:03 2009 Subject: svn commit: r190635 - head/sys/amd64/acpica Message-ID: <200904020023.n320Nu0u046562@svn.freebsd.org> Author: jkim Date: Thu Apr 2 00:23:56 2009 New Revision: 190635 URL: http://svn.freebsd.org/changeset/base/190635 Log: Chase GDT layout changes and unbreak suspend/resume on amd64. Modified: head/sys/amd64/acpica/acpi_switch.S head/sys/amd64/acpica/acpi_wakecode.S head/sys/amd64/acpica/acpi_wakeup.c Modified: head/sys/amd64/acpica/acpi_switch.S ============================================================================== --- head/sys/amd64/acpica/acpi_switch.S Wed Apr 1 21:14:01 2009 (r190634) +++ head/sys/amd64/acpica/acpi_switch.S Thu Apr 2 00:23:56 2009 (r190635) @@ -128,9 +128,19 @@ ENTRY(acpi_restorecpu) /* Restore descriptor tables. */ lidt WAKEUP_XPCB(IDT) lldt WAKEUP_XPCB(LDT) + +#define SDT_SYSTSS 9 +#define SDT_SYSBSY 11 + + /* Reset task busy bit and reload TR. */ + movq PCPU(TSS), %rax + andb $(~SDT_SYSBSY | SDT_SYSTSS), 5(%rax) movw WAKEUP_XPCB(TR), %ax ltr %ax +#undef SDT_SYSTSS +#undef SDT_SYSBSY + /* Restore other callee saved registers. */ movq WAKEUP_PCB(R15), %r15 movq WAKEUP_PCB(R14), %r14 Modified: head/sys/amd64/acpica/acpi_wakecode.S ============================================================================== --- head/sys/amd64/acpica/acpi_wakecode.S Wed Apr 1 21:14:01 2009 (r190634) +++ head/sys/amd64/acpica/acpi_wakecode.S Thu Apr 2 00:23:56 2009 (r190635) @@ -223,6 +223,12 @@ reset_video: bootgdt: .long 0x00000000 .long 0x00000000 + .long 0x00000000 + .long 0x00000000 + .long 0x00000000 + .long 0x00000000 + .long 0x00000000 + .long 0x00000000 bootcode64: .long 0x0000ffff @@ -261,6 +267,8 @@ wakeup_xpcb: wakeup_gdt: .word 0 .quad 0 + + ALIGN_DATA wakeup_efer: .quad 0 wakeup_pat: Modified: head/sys/amd64/acpica/acpi_wakeup.c ============================================================================== --- head/sys/amd64/acpica/acpi_wakeup.c Wed Apr 1 21:14:01 2009 (r190634) +++ head/sys/amd64/acpica/acpi_wakeup.c Thu Apr 2 00:23:56 2009 (r190635) @@ -78,7 +78,6 @@ static struct xpcb *stopxpcbs; int acpi_restorecpu(struct xpcb *, vm_offset_t); int acpi_savecpu(struct xpcb *); -static void acpi_reset_tss(int cpu); static void acpi_alloc_wakeup_handler(void); static void acpi_stop_beep(void *); @@ -116,8 +115,6 @@ acpi_wakeup_ap(struct acpi_softc *sc, in stopxpcbs[cpu].xpcb_gdt.rd_base); WAKECODE_FIXUP(wakeup_cpu, int, cpu); - acpi_reset_tss(cpu); - /* do an INIT IPI: assert RESET */ lapic_ipi_raw(APIC_DEST_DESTFLD | APIC_TRIGMOD_EDGE | APIC_LEVEL_ASSERT | APIC_DESTMODE_PHY | APIC_DELMODE_INIT, apic_id); @@ -220,19 +217,6 @@ acpi_wakeup_cpus(struct acpi_softc *sc, } #endif -static void -acpi_reset_tss(int cpu) -{ - uint32_t *tss; - - /* - * We have to clear "task busy" bit in TSS to restore - * task register later. Otherwise, ltr causes GPF. - */ - tss = (uint32_t *)&gdt[NGDT * cpu + GPROC0_SEL] + 1; - *tss &= ~((SDT_SYSBSY ^ SDT_SYSTSS) << 8); -} - int acpi_sleep_machdep(struct acpi_softc *sc, int state) { @@ -289,8 +273,6 @@ acpi_sleep_machdep(struct acpi_softc *sc stopxpcbs[0].xpcb_gdt.rd_base); WAKECODE_FIXUP(wakeup_cpu, int, 0); - acpi_reset_tss(0); - /* Call ACPICA to enter the desired sleep state */ if (state == ACPI_STATE_S4 && sc->acpi_s4bios) status = AcpiEnterSleepStateS4bios(); From jkim at FreeBSD.org Wed Apr 1 18:46:59 2009 From: jkim at FreeBSD.org (Jung-uk Kim) Date: Wed Apr 1 18:47:06 2009 Subject: svn commit: r190636 - head/sys/amd64/acpica Message-ID: <200904020146.n321kvVA048417@svn.freebsd.org> Author: jkim Date: Thu Apr 2 01:46:57 2009 New Revision: 190636 URL: http://svn.freebsd.org/changeset/base/190636 Log: Reduce code duplcations from r190620. While I am here, tweak a comment. Modified: head/sys/amd64/acpica/acpi_switch.S Modified: head/sys/amd64/acpica/acpi_switch.S ============================================================================== --- head/sys/amd64/acpica/acpi_switch.S Thu Apr 2 00:23:56 2009 (r190635) +++ head/sys/amd64/acpica/acpi_switch.S Thu Apr 2 01:46:57 2009 (r190636) @@ -67,9 +67,7 @@ ENTRY(acpi_restorecpu) /* Force kernel segment registers. */ movl $KDSEL, %eax movw %ax, %ds - movl $KDSEL, %eax movw %ax, %es - movl $KDSEL, %eax movw %ax, %ss movl $KUF32SEL, %eax movw %ax, %fs @@ -132,7 +130,7 @@ ENTRY(acpi_restorecpu) #define SDT_SYSTSS 9 #define SDT_SYSBSY 11 - /* Reset task busy bit and reload TR. */ + /* Clear "task busy" bit and reload TR. */ movq PCPU(TSS), %rax andb $(~SDT_SYSBSY | SDT_SYSTSS), 5(%rax) movw WAKEUP_XPCB(TR), %ax From weongyo at FreeBSD.org Wed Apr 1 19:26:59 2009 From: weongyo at FreeBSD.org (Weongyo Jeong) Date: Wed Apr 1 19:27:10 2009 Subject: svn commit: r190637 - stable/7/share/man/man4 Message-ID: <200904020226.n322QwA7049220@svn.freebsd.org> Author: weongyo Date: Thu Apr 2 02:26:58 2009 New Revision: 190637 URL: http://svn.freebsd.org/changeset/base/190637 Log: MFC r190437: bump date. Pointed by: yongari Approved by: re (kib) Modified: stable/7/share/man/man4/ (props changed) stable/7/share/man/man4/igb.4 (props changed) stable/7/share/man/man4/malo.4 Modified: stable/7/share/man/man4/malo.4 ============================================================================== --- stable/7/share/man/man4/malo.4 Thu Apr 2 01:46:57 2009 (r190636) +++ stable/7/share/man/man4/malo.4 Thu Apr 2 02:26:58 2009 (r190637) @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\"/ -.Dd March 25, 2008 +.Dd March 26, 2009 .Dt MALO 4 .Os .Sh NAME From vehemens at verizon.net Thu Apr 2 00:21:19 2009 From: vehemens at verizon.net (vehemens) Date: Thu Apr 2 00:21:26 2009 Subject: svn commit: r190595 - head/sys/dev/drm Message-ID: <200904012324.48863.vehemens@verizon.net> >Author: rnoland >Date: Tue Mar 31 17:52:05 2009 >New Revision: 190595 >URL: http://svn.freebsd.org/changeset/base/190595 > >Log: > Simplify the radeon microcode loading. > > Submitted by: Christoph Mallon > MFC after: 3 days > >Modified: > head/sys/dev/drm/r600_cp.c > head/sys/dev/drm/radeon_cp.c I don't see the point of this change given that you are deveating from a code base which makes incorporating future code changes that much more diffcult. Could you back this one out? From rnoland at FreeBSD.org Thu Apr 2 00:26:34 2009 From: rnoland at FreeBSD.org (Robert Noland) Date: Thu Apr 2 00:26:40 2009 Subject: svn commit: r190595 - head/sys/dev/drm In-Reply-To: <200904012324.48863.vehemens@verizon.net> References: <200904012324.48863.vehemens@verizon.net> Message-ID: <1238657152.20670.13.camel@balrog.2hip.net> On Wed, 2009-04-01 at 23:24 -0700, vehemens wrote: > >Author: rnoland > >Date: Tue Mar 31 17:52:05 2009 > >New Revision: 190595 > >URL: http://svn.freebsd.org/changeset/base/190595 > > > >Log: > > Simplify the radeon microcode loading. > > > > Submitted by: Christoph Mallon > > MFC after: 3 days > > > >Modified: > > head/sys/dev/drm/r600_cp.c > > head/sys/dev/drm/radeon_cp.c > > I don't see the point of this change given that you are deveating from a code > base which makes incorporating future code changes that much more diffcult. There are no future code changes to be gotten from git... > Could you back this one out? Nope, I showed it to alex before I committed it and he is planning to send it up in linux as well. git is unfortunately a wasteland, even the nouveau guys are preparing to move out... It is still much easier for me to work with Alex and the nouveau folks than Intel though... robert. -- Robert Noland FreeBSD -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 196 bytes Desc: This is a digitally signed message part Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20090402/20dbcf8c/attachment.pgp From kostikbel at gmail.com Thu Apr 2 01:50:12 2009 From: kostikbel at gmail.com (Kostik Belousov) Date: Thu Apr 2 01:50:20 2009 Subject: svn commit: r190635 - head/sys/amd64/acpica In-Reply-To: <200904020023.n320Nu0u046562@svn.freebsd.org> References: <200904020023.n320Nu0u046562@svn.freebsd.org> Message-ID: <20090402085005.GA31897@deviant.kiev.zoral.com.ua> On Thu, Apr 02, 2009 at 12:23:56AM +0000, Jung-uk Kim wrote: > Author: jkim > Date: Thu Apr 2 00:23:56 2009 > New Revision: 190635 > URL: http://svn.freebsd.org/changeset/base/190635 > > Log: > Chase GDT layout changes and unbreak suspend/resume on amd64. > > Modified: > head/sys/amd64/acpica/acpi_switch.S > head/sys/amd64/acpica/acpi_wakecode.S > head/sys/amd64/acpica/acpi_wakeup.c Uff, thanks ! -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 195 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20090402/a2d6afe8/attachment.pgp From sobomax at FreeBSD.org Thu Apr 2 03:15:51 2009 From: sobomax at FreeBSD.org (Maxim Sobolev) Date: Thu Apr 2 03:15:58 2009 Subject: svn: head: sbin/ipfw sys sys/amd64/include/xen sys/arm/arm sys/contrib/pf sys/dev/ata sys/dev/cxgb sys/dev/sound/usb sys/dev/usb sys/dev/usb/bluetooth sys/dev/usb/controller sys... In-Reply-To: <200904012023.n31KNl71041878@svn.freebsd.org> References: <200904012023.n31KNl71041878@svn.freebsd.org> Message-ID: <49D4903C.7090904@FreeBSD.org> Paolo Pisati wrote: > Author: piso > Date: Wed Apr 1 20:23:47 2009 > New Revision: 190633 > URL: http://svn.freebsd.org/changeset/base/190633 > > Log: > Implement an ipfw action to reassemble ip packets: reass. Heh, nice name, isn't it? At first I thought it was an april fools joke as well. ;-) -Maxim From rpaulo at FreeBSD.org Thu Apr 2 06:02:12 2009 From: rpaulo at FreeBSD.org (Rui Paulo) Date: Thu Apr 2 06:02:24 2009 Subject: svn commit: r190639 - head/sys/net Message-ID: <200904021302.n32D2CXw065488@svn.freebsd.org> Author: rpaulo Date: Thu Apr 2 13:02:12 2009 New Revision: 190639 URL: http://svn.freebsd.org/changeset/base/190639 Log: Sync DLTs with latest libpcap version. Modified: head/sys/net/bpf.h Modified: head/sys/net/bpf.h ============================================================================== --- head/sys/net/bpf.h Thu Apr 2 07:11:54 2009 (r190638) +++ head/sys/net/bpf.h Thu Apr 2 13:02:12 2009 (r190639) @@ -726,6 +726,94 @@ struct bpf_zbuf_header { #define DLT_BLUETOOTH_HCI_H4_WITH_PHDR 201 /* + * AX.25 packet with a 1-byte KISS header; see + * + * http://www.ax25.net/kiss.htm + * + * as per Richard Stearn . + */ +#define DLT_AX25_KISS 202 + +/* + * LAPD packets from an ISDN channel, starting with the address field, + * with no pseudo-header. + * Requested by Varuna De Silva . + */ +#define DLT_LAPD 203 + +/* + * Variants of various link-layer headers, with a one-byte direction + * pseudo-header prepended - zero means "received by this host", + * non-zero (any non-zero value) means "sent by this host" - as per + * Will Barker . + */ +#define DLT_PPP_WITH_DIR 204 /* PPP - don't confuse with DLT_PPP_WITH_DIRECTION */ +#define DLT_C_HDLC_WITH_DIR 205 /* Cisco HDLC */ +#define DLT_FRELAY_WITH_DIR 206 /* Frame Relay */ +#define DLT_LAPB_WITH_DIR 207 /* LAPB */ + +/* + * 208 is reserved for an as-yet-unspecified proprietary link-layer + * type, as requested by Will Barker. + */ + +/* + * IPMB with a Linux-specific pseudo-header; as requested by Alexey Neyman + * . + */ +#define DLT_IPMB_LINUX 209 + +/* + * FlexRay automotive bus - http://www.flexray.com/ - as requested + * by Hannes Kaelber . + */ +#define DLT_FLEXRAY 210 + +/* + * Media Oriented Systems Transport (MOST) bus for multimedia + * transport - http://www.mostcooperation.com/ - as requested + * by Hannes Kaelber . + */ +#define DLT_MOST 211 + +/* + * Local Interconnect Network (LIN) bus for vehicle networks - + * http://www.lin-subbus.org/ - as requested by Hannes Kaelber + * . + */ +#define DLT_LIN 212 + +/* + * X2E-private data link type used for serial line capture, + * as requested by Hannes Kaelber . + */ +#define DLT_X2E_SERIAL 213 + +/* + * X2E-private data link type used for the Xoraya data logger + * family, as requested by Hannes Kaelber . + */ +#define DLT_X2E_XORAYA 214 + +/* + * IEEE 802.15.4, exactly as it appears in the spec (no padding, no + * nothing), but with the PHY-level data for non-ASK PHYs (4 octets + * of 0 as preamble, one octet of SFD, one octet of frame length+ + * reserved bit, and then the MAC-layer data, starting with the + * frame control field). + * + * Requested by Max Filippov . + */ +#define DLT_IEEE802_15_4_NONASK_PHY 215 + +/* + * DLT and savefile link type values are split into a class and + * a member of that class. A class value of 0 indicates a regular + * DLT_/LINKTYPE_ value. + */ +#define DLT_CLASS(x) ((x) & 0x03ff0000) + +/* * The instruction encodings. */ /* instruction classes */ From rpaulo at FreeBSD.org Thu Apr 2 06:04:18 2009 From: rpaulo at FreeBSD.org (Rui Paulo) Date: Thu Apr 2 06:04:29 2009 Subject: svn commit: r190640 - in head/contrib/libpcap: . pcap Message-ID: <200904021304.n32D4H8v065562@svn.freebsd.org> Author: rpaulo Date: Thu Apr 2 13:04:17 2009 New Revision: 190640 URL: http://svn.freebsd.org/changeset/base/190640 Log: Restore local change to include inside pcap.h. This fixes remaining ports build problems. Modified: head/contrib/libpcap/pcap.h head/contrib/libpcap/pcap/pcap.h Modified: head/contrib/libpcap/pcap.h ============================================================================== --- head/contrib/libpcap/pcap.h Thu Apr 2 13:02:12 2009 (r190639) +++ head/contrib/libpcap/pcap.h Thu Apr 2 13:04:17 2009 (r190640) @@ -47,9 +47,7 @@ #include #endif /* WIN32/MSDOS/UN*X */ -#ifndef PCAP_DONT_INCLUDE_PCAP_BPF_H -#include -#endif +#include #include Modified: head/contrib/libpcap/pcap/pcap.h ============================================================================== --- head/contrib/libpcap/pcap/pcap.h Thu Apr 2 13:02:12 2009 (r190639) +++ head/contrib/libpcap/pcap/pcap.h Thu Apr 2 13:04:17 2009 (r190640) @@ -47,9 +47,7 @@ #include #endif /* WIN32/MSDOS/UN*X */ -#ifndef PCAP_DONT_INCLUDE_PCAP_BPF_H -#include -#endif +#include #include From jkim at FreeBSD.org Thu Apr 2 08:48:54 2009 From: jkim at FreeBSD.org (Jung-uk Kim) Date: Thu Apr 2 08:49:06 2009 Subject: svn commit: r190640 - in head/contrib/libpcap: . pcap In-Reply-To: <200904021304.n32D4H8v065562@svn.freebsd.org> References: <200904021304.n32D4H8v065562@svn.freebsd.org> Message-ID: <200904021148.44528.jkim@FreeBSD.org> On Thursday 02 April 2009 09:04 am, Rui Paulo wrote: > Author: rpaulo > Date: Thu Apr 2 13:04:17 2009 > New Revision: 190640 > URL: http://svn.freebsd.org/changeset/base/190640 > > Log: > Restore local change to include inside pcap.h. This > fixes remaining ports build problems. > > Modified: > head/contrib/libpcap/pcap.h > head/contrib/libpcap/pcap/pcap.h Thanks! Jung-uk Kim From jhb at FreeBSD.org Thu Apr 2 08:53:30 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Thu Apr 2 08:53:42 2009 Subject: svn commit: r190641 - in head/lib/libc: gen sys Message-ID: <200904021553.n32FrUEC068918@svn.freebsd.org> Author: jhb Date: Thu Apr 2 15:53:29 2009 New Revision: 190641 URL: http://svn.freebsd.org/changeset/base/190641 Log: Properly update the shm_open/shm_unlink symbol versioning metadata after these functions were moved into the kernel: - Move the version entries from gen/ to sys/. Since the ABI of the actual routines did not change, I'm still exporting them as FBSD 1.0 on purpose. - Add FBSD-private versions for the _ and __sys_ variants. Modified: head/lib/libc/gen/Symbol.map head/lib/libc/sys/Symbol.map Modified: head/lib/libc/gen/Symbol.map ============================================================================== --- head/lib/libc/gen/Symbol.map Thu Apr 2 13:04:17 2009 (r190640) +++ head/lib/libc/gen/Symbol.map Thu Apr 2 15:53:29 2009 (r190641) @@ -223,8 +223,6 @@ FBSD_1.0 { posix_madvise; popen; pclose; - shm_open; - shm_unlink; pselect; psignal; raise; Modified: head/lib/libc/sys/Symbol.map ============================================================================== --- head/lib/libc/sys/Symbol.map Thu Apr 2 13:04:17 2009 (r190640) +++ head/lib/libc/sys/Symbol.map Thu Apr 2 15:53:29 2009 (r190641) @@ -265,6 +265,8 @@ FBSD_1.0 { setsockopt; settimeofday; setuid; + shm_open; + shm_unlink; shmat; shmctl; shmdt; @@ -876,6 +878,10 @@ FBSDprivate_1.0 { __sys_settimeofday; _setuid; __sys_setuid; + _shm_open; + __sys_shm_open; + _shm_unlink; + __sys_shm_unlink; _shmat; __sys_shmat; _shmctl; From imp at FreeBSD.org Thu Apr 2 09:58:46 2009 From: imp at FreeBSD.org (Warner Losh) Date: Thu Apr 2 09:58:52 2009 Subject: svn commit: r190643 - head/sys/dev/ed Message-ID: <200904021658.n32GwjQc070351@svn.freebsd.org> Author: imp Date: Thu Apr 2 16:58:45 2009 New Revision: 190643 URL: http://svn.freebsd.org/changeset/base/190643 Log: Force an autonegotiation at attach time for all the attached PHYs for ed cards. There's a number of minor nits in a lot of the PHYs on the PC Cards that use the Axis AX88190 or DLink DL10019 and DL10022 chips. Forcing the autonegotiation doesn't seem to cause problems on the cards that have sane PHYs, but makes several cards I have work without further workarounds. I'm not 100% sure that kicking the PHY and resetting them is the right thing to do on the media change callback. Other NICs seem to need this and do similar things. Modified: head/sys/dev/ed/if_ed_pccard.c Modified: head/sys/dev/ed/if_ed_pccard.c ============================================================================== --- head/sys/dev/ed/if_ed_pccard.c Thu Apr 2 16:51:41 2009 (r190642) +++ head/sys/dev/ed/if_ed_pccard.c Thu Apr 2 16:58:45 2009 (r190643) @@ -382,6 +382,26 @@ ed_pccard_add_modem(device_t dev) } static int +ed_pccard_kick_phy(struct ed_softc *sc) +{ + struct mii_softc *miisc; + struct mii_data *mii; + + /* + * Many of the PHYs that wind up on PC Cards are weird in + * this way. Generally, we don't need to worry so much about + * the Isolation protocol since there's only one PHY in + * these designs, so this workaround is reasonable. + */ + mii = device_get_softc(sc->miibus); + LIST_FOREACH(miisc, &mii->mii_phys, mii_list) { + miisc->mii_flags |= MIIF_FORCEANEG; + mii_phy_reset(miisc); + } + return (mii_mediachg(mii)); +} + +static int ed_pccard_media_ioctl(struct ed_softc *sc, struct ifreq *ifr, u_long command) { struct mii_data *mii; @@ -584,6 +604,7 @@ ed_pccard_attach(device_t dev) sc->sc_tick = ed_pccard_tick; sc->sc_mediachg = ed_pccard_mediachg; sc->sc_media_ioctl = ed_pccard_media_ioctl; + ed_pccard_kick_phy(sc); } if (sc->modem_rid != -1) ed_pccard_add_modem(dev); @@ -963,6 +984,7 @@ ed_pccard_ax88x90_mii_readbits(struct ed val++; ed_asic_outb(sc, ED_AX88X90_MIIBUS, mdio | ED_AX88X90_MII_CLK); } + printf("AX88x90 %#x+%#x Reading %d bits: %x\n", (unsigned int)sc->port_bsh, sc->asic_offset, nbits, val); return val; } @@ -1062,6 +1084,7 @@ ed_pccard_tc5299j_mii_readbits(struct ed u_int val = 0; uint8_t cr; + printf("Reading %d bits\n", nbits); cr = ed_nic_inb(sc, ED_P0_CR); ed_nic_outb(sc, ED_P0_CR, cr | ED_CR_PAGE_3); @@ -1124,6 +1147,7 @@ ed_miibus_readreg(device_t dev, int phy, failed = (*sc->mii_readbits)(sc, ED_MII_ACK_BITS); val = (*sc->mii_readbits)(sc, ED_MII_DATA_BITS); (*sc->mii_writebits)(sc, ED_MII_IDLE, ED_MII_IDLE_BITS); + printf("Reading phy %d reg %#x returning %#x (valid %d)\n", phy, reg, val, !failed); return (failed ? 0 : val); } @@ -1132,6 +1156,7 @@ ed_miibus_writereg(device_t dev, int phy { struct ed_softc *sc; + printf("Writing phy %d reg %#x data %#x\n", phy, reg, data); sc = device_get_softc(dev); /* See ed_miibus_readreg for details */ if (sc->chip_type == ED_CHIP_TYPE_AX88790) { @@ -1158,14 +1183,15 @@ static int ed_ifmedia_upd(struct ifnet *ifp) { struct ed_softc *sc; - struct mii_data *mii; + int error; sc = ifp->if_softc; if (sc->miibus == NULL) return (ENXIO); - - mii = device_get_softc(sc->miibus); - return mii_mediachg(mii); + ED_LOCK(sc); + error = ed_pccard_kick_phy(sc); + ED_UNLOCK(sc); + return (error); } static void From imp at FreeBSD.org Thu Apr 2 10:08:55 2009 From: imp at FreeBSD.org (Warner Losh) Date: Thu Apr 2 10:09:03 2009 Subject: svn commit: r190644 - head/sys/dev/ed Message-ID: <200904021708.n32H8tO8070595@svn.freebsd.org> Author: imp Date: Thu Apr 2 17:08:54 2009 New Revision: 190644 URL: http://svn.freebsd.org/changeset/base/190644 Log: The AX88190 has 64k of external SRAM, of which 62k can be used for packet data. However, the AX88190A moves this on-chip and reduces it to the more traditional 16k from 16k-32k. The AX88790 follows the '190A. Probe memory above 32k to see which flavor of the '190 we have and use the extra memory if we have it. Eliminate the kludgy read eeprom for the ID code. It really is just a memory read at location 0x400, so just use that instead. Makes the code easier to understand as well as eliminates some magic numbers. Modified: head/sys/dev/ed/if_ed_pccard.c Modified: head/sys/dev/ed/if_ed_pccard.c ============================================================================== --- head/sys/dev/ed/if_ed_pccard.c Thu Apr 2 16:58:45 2009 (r190643) +++ head/sys/dev/ed/if_ed_pccard.c Thu Apr 2 17:08:54 2009 (r190644) @@ -788,11 +788,9 @@ ed_probe_ax88x90_generic(device_t dev, i * bytes in word mode and verify we can read them back. If we can't * then we don't have an AX88x90 chip here. */ - ed_nic_outb(sc, ED_P0_RCR, ED_RCR_MON); sc->isa16bit = 1; + ed_nic_outb(sc, ED_P0_RCR, ED_RCR_MON); ed_nic_outb(sc, ED_P0_DCR, ED_DCR_WTS | ED_DCR_FT1 | ED_DCR_LS); - ed_nic_outb(sc, ED_P0_PSTART, 16384 / ED_PAGE_SIZE); - ed_nic_outb(sc, ED_P0_PSTOP, 32768 / ED_PAGE_SIZE); ed_pio_writemem(sc, test_pattern, 16384, sizeof(test_pattern)); ed_pio_readmem(sc, 16384, test_buffer, sizeof(test_pattern)); if (bcmp(test_pattern, test_buffer, sizeof(test_pattern)) != 0) @@ -800,25 +798,45 @@ ed_probe_ax88x90_generic(device_t dev, i /* * Hard code values based on the datasheet. We're NE-2000 compatible - * NIC with 16kb of packet memory starting at 16k offset. We assume - * that the writes to ED_P0_START and ED_P0_STOP reflect the values - * below. + * NIC with 16kb of packet memory starting at 16k offset. */ sc->type = ED_TYPE_NE2000; + memsize = sc->mem_size = 16*1024; + sc->mem_start = 16 * 1024; if (ed_asic_inb(sc, ED_AX88X90_TEST) != 0) sc->chip_type = ED_CHIP_TYPE_AX88790; - else + else { sc->chip_type = ED_CHIP_TYPE_AX88190; - memsize = 16 * 1024; - sc->mem_size = memsize; - sc->mem_start = 16 * 1024; + /* + * The AX88190 (not A) has external 64k SRAM. Probe for this + * here. Most of the cards I have either use the AX88190A + * part, or have only 32k SRAM for some reason, so I don't + * know if this works or not. + */ + ed_pio_writemem(sc, test_pattern, 32768, sizeof(test_pattern)); + ed_pio_readmem(sc, 32768, test_buffer, sizeof(test_pattern)); + if (bcmp(test_pattern, test_buffer, sizeof(test_pattern)) == 0) { + sc->mem_start = 2*1024; + memsize = sc->mem_size = 62 * 1024; + } + } sc->mem_end = sc->mem_start + memsize; sc->tx_page_start = memsize / ED_PAGE_SIZE; - sc->txb_cnt = 2; + if (sc->mem_size > 16 * 1024) + sc->txb_cnt = 3; + else + sc->txb_cnt = 2; sc->rec_page_start = sc->tx_page_start + sc->txb_cnt * ED_TXBUF_SIZE; sc->rec_page_stop = sc->tx_page_start + memsize / ED_PAGE_SIZE; sc->mem_ring = sc->mem_start + sc->txb_cnt * ED_PAGE_SIZE * ED_TXBUF_SIZE; + + ed_nic_outb(sc, ED_P0_PSTART, sc->mem_start / ED_PAGE_SIZE); + ed_nic_outb(sc, ED_P0_PSTOP, sc->mem_end / ED_PAGE_SIZE); + + /* Get the mac before we go -- It's just at 0x400 in "SRAM" */ + ed_pio_readmem(sc, 0x400, sc->enaddr, ETHER_ADDR_LEN); + /* clear any pending interrupts that might have occurred above */ ed_nic_outb(sc, ED_P0_ISR, 0xff); sc->sc_write_mbufs = ed_pio_write_mbufs; @@ -826,42 +844,6 @@ ed_probe_ax88x90_generic(device_t dev, i } static int -ed_pccard_ax88x90_enaddr(struct ed_softc *sc) -{ - int i, j; - struct { - unsigned char offset, value; - } pg_seq[] = { - /* Select Page0 */ - {ED_P0_CR, ED_CR_RD2 | ED_CR_STP | ED_CR_PAGE_0}, - {ED_P0_DCR, ED_DCR_WTS}, /* Word access to SRAM */ - {ED_P0_RBCR0, 0x00}, /* Clear the count regs. */ - {ED_P0_RBCR1, 0x00}, - {ED_P0_IMR, 0x00}, /* Mask completion irq. */ - {ED_P0_ISR, 0xff}, /* ACK them all */ - {ED_P0_RCR, ED_RCR_MON | ED_RCR_INTT}, /* Set To Monitor */ - {ED_P0_TCR, ED_TCR_LB0}, /* loopback mode. */ - {ED_P0_RBCR0, 0x20}, /* 32byte DMA */ - {ED_P0_RBCR1, 0x00}, - {ED_P0_RSAR0, 0x00}, /* Read address is 0x0400 */ - {ED_P0_RSAR1, 0x04}, /* for MAC ADDR */ - {ED_P0_CR, ED_CR_RD0 | ED_CR_STA | ED_CR_PAGE_0}, - }; - - /* Card Settings */ - for (i = 0; i < sizeof(pg_seq) / sizeof(pg_seq[0]); i++) - ed_nic_outb(sc, pg_seq[i].offset, pg_seq[i].value); - - /* Get MAC address */ - for (i = 0; i < ETHER_ADDR_LEN; i += 2) { - j = ed_asic_inw(sc, 0); - sc->enaddr[i] = j & 0xff; - sc->enaddr[i + 1] = (j >> 8) & 0xff; - } - return (0); -} - -static int ed_pccard_ax88x90_check_mii(device_t dev, struct ed_softc *sc) { int i, id; @@ -938,9 +920,6 @@ ed_pccard_ax88x90(device_t dev, const st error); goto fail; } - error = ed_pccard_ax88x90_enaddr(sc); - if (error) - goto fail; error = ed_pccard_ax88x90_check_mii(dev, sc); if (error) goto fail; From imp at FreeBSD.org Thu Apr 2 10:15:51 2009 From: imp at FreeBSD.org (Warner Losh) Date: Thu Apr 2 10:15:57 2009 Subject: svn commit: r190645 - head/sys/dev/ed Message-ID: <200904021715.n32HFoqw070812@svn.freebsd.org> Author: imp Date: Thu Apr 2 17:15:49 2009 New Revision: 190645 URL: http://svn.freebsd.org/changeset/base/190645 Log: Minor DLINK DL100xx support tweaks: The DIROUT bit difference between the 19 and 22 is annoying. We can set both bits on both parts without ill effect. Use this trick to simplify the code. The DELAYS in the MII bus bit-bang code for the DL100xx parts aren't needed. Eliminate them. Modified: head/sys/dev/ed/dl100xxreg.h head/sys/dev/ed/if_ed_pccard.c Modified: head/sys/dev/ed/dl100xxreg.h ============================================================================== --- head/sys/dev/ed/dl100xxreg.h Thu Apr 2 17:08:54 2009 (r190644) +++ head/sys/dev/ed/dl100xxreg.h Thu Apr 2 17:15:49 2009 (r190645) @@ -38,5 +38,6 @@ #define ED_DL100XX_MII_DATAIN 0x10 #define ED_DL100XX_MII_DIROUT_22 0x20 #define ED_DL100XX_MII_DIROUT_19 0x10 +#define ED_DL100XX_MII_DIROUT 0x30 #define ED_DL100XX_MII_DATAOUT 0x40 #define ED_DL100XX_MII_CLK 0x80 Modified: head/sys/dev/ed/if_ed_pccard.c ============================================================================== --- head/sys/dev/ed/if_ed_pccard.c Thu Apr 2 17:08:54 2009 (r190644) +++ head/sys/dev/ed/if_ed_pccard.c Thu Apr 2 17:15:49 2009 (r190645) @@ -701,21 +701,14 @@ ed_pccard_dl100xx_mii_writebits(struct e { int i; - if (sc->chip_type == ED_CHIP_TYPE_DL10022) - DL100XX_MIISET(sc, ED_DL100XX_MII_DIROUT_22); - else - DL100XX_MIISET(sc, ED_DL100XX_MII_DIROUT_19); - + DL100XX_MIISET(sc, ED_DL100XX_MII_DIROUT); for (i = nbits - 1; i >= 0; i--) { if ((val >> i) & 1) DL100XX_MIISET(sc, ED_DL100XX_MII_DATAOUT); else DL100XX_MIICLR(sc, ED_DL100XX_MII_DATAOUT); - DELAY(10); DL100XX_MIISET(sc, ED_DL100XX_MII_CLK); - DELAY(10); DL100XX_MIICLR(sc, ED_DL100XX_MII_CLK); - DELAY(10); } } @@ -725,19 +718,13 @@ ed_pccard_dl100xx_mii_readbits(struct ed int i; u_int val = 0; - if (sc->chip_type == ED_CHIP_TYPE_DL10022) - DL100XX_MIICLR(sc, ED_DL100XX_MII_DIROUT_22); - else - DL100XX_MIICLR(sc, ED_DL100XX_MII_DIROUT_19); - + DL100XX_MIICLR(sc, ED_DL100XX_MII_DIROUT); for (i = nbits - 1; i >= 0; i--) { DL100XX_MIISET(sc, ED_DL100XX_MII_CLK); - DELAY(10); val <<= 1; if (ed_asic_inb(sc, ED_DL100XX_MIIBUS) & ED_DL100XX_MII_DATAIN) val++; DL100XX_MIICLR(sc, ED_DL100XX_MII_CLK); - DELAY(10); } return val; } From delphij at FreeBSD.org Thu Apr 2 10:16:40 2009 From: delphij at FreeBSD.org (Xin LI) Date: Thu Apr 2 10:16:46 2009 Subject: svn commit: r190646 - head/lib/libufs Message-ID: <200904021716.n32HGdE0070869@svn.freebsd.org> Author: delphij Date: Thu Apr 2 17:16:39 2009 New Revision: 190646 URL: http://svn.freebsd.org/changeset/base/190646 Log: Bail out when memory allocation is failed, rather than referencing a NULL pointer. PR: kern/94480 Submitted by: Michiel Pelt Modified: head/lib/libufs/block.c Modified: head/lib/libufs/block.c ============================================================================== --- head/lib/libufs/block.c Thu Apr 2 17:15:49 2009 (r190645) +++ head/lib/libufs/block.c Thu Apr 2 17:16:39 2009 (r190646) @@ -64,8 +64,10 @@ bread(struct uufsd *disk, ufs2_daddr_t b */ if (((intptr_t)data) & 0x3f) { p2 = malloc(size); - if (p2 == NULL) + if (p2 == NULL) { ERROR(disk, "allocate bounce buffer"); + goto fail; + } } cnt = pread(disk->d_fd, p2, size, (off_t)(blockno * disk->d_bsize)); if (cnt == -1) { @@ -115,8 +117,10 @@ bwrite(struct uufsd *disk, ufs2_daddr_t */ if (((intptr_t)data) & 0x3f) { p2 = malloc(size); - if (p2 == NULL) + if (p2 == NULL) { ERROR(disk, "allocate bounce buffer"); + return (-1); + } memcpy(p2, data, size); data = p2; } From rnoland at FreeBSD.org Thu Apr 2 10:53:31 2009 From: rnoland at FreeBSD.org (Robert Noland) Date: Thu Apr 2 10:53:38 2009 Subject: svn commit: r190647 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb dev/drm Message-ID: <200904021753.n32HrUnl071746@svn.freebsd.org> Author: rnoland Date: Thu Apr 2 17:53:30 2009 New Revision: 190647 URL: http://svn.freebsd.org/changeset/base/190647 Log: Merge 190123,190282 Fix up the flags to bus_dmamem again. The man page incorrectly showed the BUS_DMA_NOCACHE flags as being a valid flag for load instead of alloc. Approved by: re (kib) Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/dev/drm/ati_pcigart.c stable/7/sys/dev/drm/drm_scatter.c Modified: stable/7/sys/dev/drm/ati_pcigart.c ============================================================================== --- stable/7/sys/dev/drm/ati_pcigart.c Thu Apr 2 17:16:39 2009 (r190646) +++ stable/7/sys/dev/drm/ati_pcigart.c Thu Apr 2 17:53:30 2009 (r190647) @@ -75,14 +75,14 @@ drm_ati_alloc_pcigart_table(struct drm_d NULL, NULL, /* filtfunc, filtfuncargs */ gart_info->table_size, 1, /* maxsize, nsegs */ gart_info->table_size, /* maxsegsize */ - BUS_DMA_ALLOCNOW, NULL, NULL, /* flags, lockfunc, lockfuncargs */ + 0, NULL, NULL, /* flags, lockfunc, lockfuncargs */ &dmah->tag); if (ret != 0) { free(dmah, DRM_MEM_DMA); return ENOMEM; } - flags = BUS_DMA_NOWAIT | BUS_DMA_ZERO; + flags = BUS_DMA_WAITOK | BUS_DMA_ZERO; if (gart_info->gart_reg_if == DRM_ATI_GART_IGP) flags |= BUS_DMA_NOCACHE; @@ -95,7 +95,8 @@ drm_ati_alloc_pcigart_table(struct drm_d DRM_LOCK(); ret = bus_dmamap_load(dmah->tag, dmah->map, dmah->vaddr, - gart_info->table_size, drm_ati_alloc_pcigart_table_cb, dmah, 0); + gart_info->table_size, drm_ati_alloc_pcigart_table_cb, dmah, + BUS_DMA_NOWAIT); if (ret != 0) { bus_dmamem_free(dmah->tag, dmah->vaddr, dmah->map); bus_dma_tag_destroy(dmah->tag); Modified: stable/7/sys/dev/drm/drm_scatter.c ============================================================================== --- stable/7/sys/dev/drm/drm_scatter.c Thu Apr 2 17:16:39 2009 (r190646) +++ stable/7/sys/dev/drm/drm_scatter.c Thu Apr 2 17:53:30 2009 (r190647) @@ -92,7 +92,7 @@ drm_sg_alloc(struct drm_device *dev, str } ret = bus_dmamem_alloc(dmah->tag, &dmah->vaddr, - BUS_DMA_WAITOK | BUS_DMA_ZERO, &dmah->map); + BUS_DMA_WAITOK | BUS_DMA_ZERO | BUS_DMA_NOCACHE, &dmah->map); if (ret != 0) { bus_dma_tag_destroy(dmah->tag); free(dmah, DRM_MEM_DMA); @@ -102,8 +102,7 @@ drm_sg_alloc(struct drm_device *dev, str } ret = bus_dmamap_load(dmah->tag, dmah->map, dmah->vaddr, - request->size, drm_sg_alloc_cb, entry, - BUS_DMA_NOWAIT | BUS_DMA_NOCACHE); + request->size, drm_sg_alloc_cb, entry, BUS_DMA_NOWAIT); if (ret != 0) { bus_dmamem_free(dmah->tag, dmah->vaddr, dmah->map); bus_dma_tag_destroy(dmah->tag); From rnoland at FreeBSD.org Thu Apr 2 10:57:05 2009 From: rnoland at FreeBSD.org (Robert Noland) Date: Thu Apr 2 10:57:16 2009 Subject: svn commit: r190648 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb dev/drm Message-ID: <200904021757.n32Hv4Wv071901@svn.freebsd.org> Author: rnoland Date: Thu Apr 2 17:57:04 2009 New Revision: 190648 URL: http://svn.freebsd.org/changeset/base/190648 Log: Merge 190124 Add a couple of radeon pci ids. Approved by: re (kib) Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/dev/drm/drm_pciids.h Modified: stable/7/sys/dev/drm/drm_pciids.h ============================================================================== --- stable/7/sys/dev/drm/drm_pciids.h Thu Apr 2 17:53:30 2009 (r190647) +++ stable/7/sys/dev/drm/drm_pciids.h Thu Apr 2 17:57:04 2009 (r190648) @@ -320,6 +320,8 @@ {0x1002, 0x9612, CHIP_RS780|RADEON_NEW_MEMMAP|RADEON_IS_IGP, "ATI Radeon HD 3200 Graphics"}, \ {0x1002, 0x9613, CHIP_RS780|RADEON_NEW_MEMMAP|RADEON_IS_IGP, "ATI Radeon 3100 Graphics"}, \ {0x1002, 0x9614, CHIP_RS780|RADEON_NEW_MEMMAP|RADEON_IS_IGP, "ATI Radeon 3300 Graphics"}, \ + {0x1002, 0x9615, CHIP_RS780|RADEON_NEW_MEMMAP|RADEON_IS_IGP, "ATI Radeon 3200 Graphics"}, \ + {0x1002, 0x9616, CHIP_RS780|RADEON_NEW_MEMMAP|RADEON_IS_IGP, "ATI Radeon 3000 Graphics"}, \ {0x1002, 0x9440, CHIP_RV770|RADEON_NEW_MEMMAP, "ATI Radeon 4800 Series"}, \ {0x1002, 0x9441, CHIP_RV770|RADEON_NEW_MEMMAP, "ATI Radeon 4870 X2"}, \ {0x1002, 0x9442, CHIP_RV770|RADEON_NEW_MEMMAP, "ATI Radeon 4800 Series"}, \ From rnoland at FreeBSD.org Thu Apr 2 10:58:22 2009 From: rnoland at FreeBSD.org (Robert Noland) Date: Thu Apr 2 10:58:33 2009 Subject: svn commit: r190649 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb dev/drm Message-ID: <200904021758.n32HwKJw071985@svn.freebsd.org> Author: rnoland Date: Thu Apr 2 17:58:20 2009 New Revision: 190649 URL: http://svn.freebsd.org/changeset/base/190649 Log: Merge 190399 The GART allocations are a propery of the gart, not of scatter-gather memory. Track them in the appropriate structure. Approved by: re (kib) Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/dev/drm/ati_pcigart.c stable/7/sys/dev/drm/drmP.h stable/7/sys/dev/drm/drm_scatter.c Modified: stable/7/sys/dev/drm/ati_pcigart.c ============================================================================== --- stable/7/sys/dev/drm/ati_pcigart.c Thu Apr 2 17:57:04 2009 (r190648) +++ stable/7/sys/dev/drm/ati_pcigart.c Thu Apr 2 17:58:20 2009 (r190649) @@ -104,7 +104,7 @@ drm_ati_alloc_pcigart_table(struct drm_d return ENOMEM; } - dev->sg->dmah = dmah; + gart_info->dmah = dmah; return 0; } @@ -113,12 +113,12 @@ static void drm_ati_free_pcigart_table(struct drm_device *dev, struct drm_ati_pcigart_info *gart_info) { - struct drm_dma_handle *dmah = dev->sg->dmah; + struct drm_dma_handle *dmah = gart_info->dmah; bus_dmamem_free(dmah->tag, dmah->vaddr, dmah->map); bus_dma_tag_destroy(dmah->tag); free(dmah, DRM_MEM_DMA); - dev->sg->dmah = NULL; + gart_info->dmah = NULL; } int @@ -134,7 +134,7 @@ drm_ati_pcigart_cleanup(struct drm_devic if (gart_info->bus_addr) { if (gart_info->gart_table_location == DRM_ATI_GART_MAIN) { gart_info->bus_addr = 0; - if (dev->sg->dmah) + if (gart_info->dmah) drm_ati_free_pcigart_table(dev, gart_info); } } @@ -169,8 +169,8 @@ drm_ati_pcigart_init(struct drm_device * goto done; } - address = (void *)dev->sg->dmah->vaddr; - bus_address = dev->sg->dmah->busaddr; + address = (void *)gart_info->dmah->vaddr; + bus_address = gart_info->dmah->busaddr; } else { address = gart_info->addr; bus_address = gart_info->bus_addr; Modified: stable/7/sys/dev/drm/drmP.h ============================================================================== --- stable/7/sys/dev/drm/drmP.h Thu Apr 2 17:57:04 2009 (r190648) +++ stable/7/sys/dev/drm/drmP.h Thu Apr 2 17:58:20 2009 (r190649) @@ -480,9 +480,7 @@ typedef struct drm_sg_mem { void *virtual; int pages; dma_addr_t *busaddr; - struct drm_dma_handle *sg_dmah; /* Handle for sg_pages */ struct drm_dma_handle *dmah; /* Handle to PCI memory */ - /* for ATI PCIGART table */ } drm_sg_mem_t; typedef TAILQ_HEAD(drm_map_list, drm_local_map) drm_map_list_t; @@ -543,6 +541,7 @@ struct drm_ati_pcigart_info { struct drm_dma_handle *table_handle; drm_local_map_t mapping; int table_size; + struct drm_dma_handle *dmah; /* handle for ATI PCIGART table */ }; #ifndef DMA_BIT_MASK Modified: stable/7/sys/dev/drm/drm_scatter.c ============================================================================== --- stable/7/sys/dev/drm/drm_scatter.c Thu Apr 2 17:57:04 2009 (r190648) +++ stable/7/sys/dev/drm/drm_scatter.c Thu Apr 2 17:58:20 2009 (r190649) @@ -112,7 +112,7 @@ drm_sg_alloc(struct drm_device *dev, str return ENOMEM; } - entry->sg_dmah = dmah; + entry->dmah = dmah; entry->handle = (unsigned long)dmah->vaddr; DRM_DEBUG("sg alloc handle = %08lx\n", entry->handle); @@ -160,7 +160,7 @@ drm_sg_alloc_ioctl(struct drm_device *de void drm_sg_cleanup(struct drm_sg_mem *entry) { - struct drm_dma_handle *dmah = entry->sg_dmah; + struct drm_dma_handle *dmah = entry->dmah; bus_dmamap_unload(dmah->tag, dmah->map); bus_dmamem_free(dmah->tag, dmah->vaddr, dmah->map); From imp at FreeBSD.org Thu Apr 2 11:02:03 2009 From: imp at FreeBSD.org (Warner Losh) Date: Thu Apr 2 11:02:10 2009 Subject: svn commit: r190650 - head/sys/dev/ed Message-ID: <200904021802.n32I20vo072205@svn.freebsd.org> Author: imp Date: Thu Apr 2 18:02:00 2009 New Revision: 190650 URL: http://svn.freebsd.org/changeset/base/190650 Log: Minor tweaks in the names to match the chips more closely. Modified: head/sys/dev/ed/dl100xxreg.h head/sys/dev/ed/if_ed_pccard.c Modified: head/sys/dev/ed/dl100xxreg.h ============================================================================== --- head/sys/dev/ed/dl100xxreg.h Thu Apr 2 17:58:20 2009 (r190649) +++ head/sys/dev/ed/dl100xxreg.h Thu Apr 2 18:02:00 2009 (r190650) @@ -29,15 +29,15 @@ /* Dlink chipset used on some Netgear and Dlink PCMCIA cards */ #define ED_DL100XX_MIIBUS 0x0c /* MII bus register on ASIC */ -#define ED_DL100XX_DIAG 0x0d -#define ED_DL100XX_COLLISON_DIS 4 /* Disable collision detection */ +#define ED_DL10022_DIAG 0x0d +#define ED_DL10022_COLLISON_DIS 4 /* Disable collision detection */ -#define ED_DL100XX_MII_RESET1 0x04 -#define ED_DL100XX_MII_RESET2 0x08 +#define ED_DL10022_MII_RESET1 0x04 +#define ED_DL10022_MII_RESET2 0x08 #define ED_DL100XX_MII_DATAIN 0x10 -#define ED_DL100XX_MII_DIROUT_22 0x20 -#define ED_DL100XX_MII_DIROUT_19 0x10 -#define ED_DL100XX_MII_DIROUT 0x30 +#define ED_DL10022_MII_DIROUT 0x20 +#define ED_DL10019_MII_DIROUT 0x10 +#define ED_DL100XX_MII_DIROUT (ED_DL10022_MII_DIROUT | ED_DL10019_MII_DIROUT) #define ED_DL100XX_MII_DATAOUT 0x40 #define ED_DL100XX_MII_CLK 0x80 Modified: head/sys/dev/ed/if_ed_pccard.c ============================================================================== --- head/sys/dev/ed/if_ed_pccard.c Thu Apr 2 17:58:20 2009 (r190649) +++ head/sys/dev/ed/if_ed_pccard.c Thu Apr 2 18:02:00 2009 (r190650) @@ -439,9 +439,9 @@ ed_pccard_tick(void *arg) if (mii->mii_media_status & IFM_ACTIVE && media != mii->mii_media_status && 0 && sc->chip_type == ED_CHIP_TYPE_DL10022) { - ed_asic_outb(sc, ED_DL100XX_DIAG, + ed_asic_outb(sc, ED_DL10022_DIAG, (mii->mii_media_active & IFM_FDX) ? - ED_DL100XX_COLLISON_DIS : 0); + ED_DL10022_COLLISON_DIS : 0); } } @@ -683,15 +683,15 @@ ed_pccard_dl100xx_mii_reset(struct ed_so if (sc->chip_type != ED_CHIP_TYPE_DL10022) return; - ed_asic_outb(sc, ED_DL100XX_MIIBUS, ED_DL100XX_MII_RESET2); + ed_asic_outb(sc, ED_DL100XX_MIIBUS, ED_DL10022_MII_RESET2); DELAY(10); ed_asic_outb(sc, ED_DL100XX_MIIBUS, - ED_DL100XX_MII_RESET2 | ED_DL100XX_MII_RESET1); + ED_DL10022_MII_RESET2 | ED_DL10022_MII_RESET1); DELAY(10); - ed_asic_outb(sc, ED_DL100XX_MIIBUS, ED_DL100XX_MII_RESET2); + ed_asic_outb(sc, ED_DL100XX_MIIBUS, ED_DL10022_MII_RESET2); DELAY(10); ed_asic_outb(sc, ED_DL100XX_MIIBUS, - ED_DL100XX_MII_RESET2 | ED_DL100XX_MII_RESET1); + ED_DL10022_MII_RESET2 | ED_DL10022_MII_RESET1); DELAY(10); ed_asic_outb(sc, ED_DL100XX_MIIBUS, 0); } From imp at FreeBSD.org Thu Apr 2 11:11:23 2009 From: imp at FreeBSD.org (Warner Losh) Date: Thu Apr 2 11:12:02 2009 Subject: svn commit: r190651 - head/sys/dev/ed Message-ID: <200904021811.n32IBLZ6072450@svn.freebsd.org> Author: imp Date: Thu Apr 2 18:11:21 2009 New Revision: 190651 URL: http://svn.freebsd.org/changeset/base/190651 Log: Kill debug that crept in. Modified: head/sys/dev/ed/if_ed_pccard.c Modified: head/sys/dev/ed/if_ed_pccard.c ============================================================================== --- head/sys/dev/ed/if_ed_pccard.c Thu Apr 2 18:02:00 2009 (r190650) +++ head/sys/dev/ed/if_ed_pccard.c Thu Apr 2 18:11:21 2009 (r190651) @@ -1113,7 +1113,7 @@ ed_miibus_readreg(device_t dev, int phy, failed = (*sc->mii_readbits)(sc, ED_MII_ACK_BITS); val = (*sc->mii_readbits)(sc, ED_MII_DATA_BITS); (*sc->mii_writebits)(sc, ED_MII_IDLE, ED_MII_IDLE_BITS); - printf("Reading phy %d reg %#x returning %#x (valid %d)\n", phy, reg, val, !failed); +/* printf("Reading phy %d reg %#x returning %#x (valid %d)\n", phy, reg, val, !failed); */ return (failed ? 0 : val); } @@ -1122,7 +1122,7 @@ ed_miibus_writereg(device_t dev, int phy { struct ed_softc *sc; - printf("Writing phy %d reg %#x data %#x\n", phy, reg, data); +/* printf("Writing phy %d reg %#x data %#x\n", phy, reg, data); */ sc = device_get_softc(dev); /* See ed_miibus_readreg for details */ if (sc->chip_type == ED_CHIP_TYPE_AX88790) { From rnoland at FreeBSD.org Thu Apr 2 11:20:48 2009 From: rnoland at FreeBSD.org (Robert Noland) Date: Thu Apr 2 11:20:59 2009 Subject: svn commit: r190652 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb dev/drm Message-ID: <200904021820.n32IKlSd072683@svn.freebsd.org> Author: rnoland Date: Thu Apr 2 18:20:46 2009 New Revision: 190652 URL: http://svn.freebsd.org/changeset/base/190652 Log: Merge 190563 Load the right microcode for RS780 Approved by: re (kib) Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/dev/drm/r600_cp.c Modified: stable/7/sys/dev/drm/r600_cp.c ============================================================================== --- stable/7/sys/dev/drm/r600_cp.c Thu Apr 2 18:11:21 2009 (r190651) +++ stable/7/sys/dev/drm/r600_cp.c Thu Apr 2 18:20:46 2009 (r190652) @@ -392,17 +392,17 @@ static void r600_cp_load_microcode(drm_r DRM_INFO("Loading RS780 CP Microcode\n"); for (i = 0; i < PM4_UCODE_SIZE; i++) { RADEON_WRITE(R600_CP_ME_RAM_DATA, - RV670_cp_microcode[i][0]); + RS780_cp_microcode[i][0]); RADEON_WRITE(R600_CP_ME_RAM_DATA, - RV670_cp_microcode[i][1]); + RS780_cp_microcode[i][1]); RADEON_WRITE(R600_CP_ME_RAM_DATA, - RV670_cp_microcode[i][2]); + RS780_cp_microcode[i][2]); } RADEON_WRITE(R600_CP_PFP_UCODE_ADDR, 0); DRM_INFO("Loading RS780 PFP Microcode\n"); for (i = 0; i < PFP_UCODE_SIZE; i++) - RADEON_WRITE(R600_CP_PFP_UCODE_DATA, RV670_pfp_microcode[i]); + RADEON_WRITE(R600_CP_PFP_UCODE_DATA, RS780_pfp_microcode[i]); } RADEON_WRITE(R600_CP_PFP_UCODE_ADDR, 0); RADEON_WRITE(R600_CP_ME_RAM_WADDR, 0); From rnoland at FreeBSD.org Thu Apr 2 11:21:43 2009 From: rnoland at FreeBSD.org (Robert Noland) Date: Thu Apr 2 11:22:01 2009 Subject: svn commit: r190653 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb dev/drm Message-ID: <200904021821.n32ILfIL072752@svn.freebsd.org> Author: rnoland Date: Thu Apr 2 18:21:41 2009 New Revision: 190653 URL: http://svn.freebsd.org/changeset/base/190653 Log: Merge 190565 We don't know what these pages are going to be used for, they should be un-cached. This got lost somewhere with all the bus_dma fixups. Approved by: re (kib) Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/dev/drm/drm_pci.c Modified: stable/7/sys/dev/drm/drm_pci.c ============================================================================== --- stable/7/sys/dev/drm/drm_pci.c Thu Apr 2 18:20:46 2009 (r190652) +++ stable/7/sys/dev/drm/drm_pci.c Thu Apr 2 18:21:41 2009 (r190653) @@ -91,7 +91,7 @@ drm_pci_alloc(struct drm_device *dev, si } ret = bus_dmamem_alloc(dmah->tag, &dmah->vaddr, - BUS_DMA_WAITOK | BUS_DMA_ZERO, &dmah->map); + BUS_DMA_WAITOK | BUS_DMA_ZERO | BUS_DMA_NOCACHE, &dmah->map); if (ret != 0) { bus_dma_tag_destroy(dmah->tag); free(dmah, DRM_MEM_DMA); From imp at FreeBSD.org Thu Apr 2 12:27:57 2009 From: imp at FreeBSD.org (Warner Losh) Date: Thu Apr 2 12:28:08 2009 Subject: svn commit: r190654 - head/sys/dev/ed Message-ID: <200904021927.n32JRuR5073996@svn.freebsd.org> Author: imp Date: Thu Apr 2 19:27:56 2009 New Revision: 190654 URL: http://svn.freebsd.org/changeset/base/190654 Log: Retire two flags that haven't been used since OLDCARD was retired (well, since before OLDCARD was retired, since I removed their use somewhat before that). Modified: head/sys/dev/ed/if_edvar.h Modified: head/sys/dev/ed/if_edvar.h ============================================================================== --- head/sys/dev/ed/if_edvar.h Thu Apr 2 18:21:41 2009 (r190653) +++ head/sys/dev/ed/if_edvar.h Thu Apr 2 19:27:56 2009 (r190654) @@ -276,8 +276,6 @@ extern devclass_t ed_devclass; */ #define ED_FLAGS_TOSH_ETHER 0x10000 #define ED_FLAGS_GWETHER 0x20000 -#define ED_FLAGS_AX88190 0x30000 -#define ED_FLAGS_LINKSYS 0x80000 #define ED_FLAGS_GETTYPE(flg) ((flg) & 0xff0000) From peter at FreeBSD.org Thu Apr 2 14:16:21 2009 From: peter at FreeBSD.org (Peter Wemm) Date: Thu Apr 2 14:16:33 2009 Subject: svn commit: r190655 - head/sys/kern Message-ID: <200904022116.n32LGK81076210@svn.freebsd.org> Author: peter Date: Thu Apr 2 21:16:20 2009 New Revision: 190655 URL: http://svn.freebsd.org/changeset/base/190655 Log: vn_vptocnp() unlocks the name cache and forgets to re-lock it before returning in one error case, and mistakenly unlocks it for the umount -f case. Modified: head/sys/kern/vfs_cache.c Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Thu Apr 2 19:27:56 2009 (r190654) +++ head/sys/kern/vfs_cache.c Thu Apr 2 21:16:20 2009 (r190655) @@ -971,6 +971,7 @@ vn_vptocnp(struct vnode **vp, char **bp, vdrop(*vp); VFS_UNLOCK_GIANT(vfslocked); if (error) { + CACHE_RLOCK(); numfullpathfail2++; return (error); } @@ -979,7 +980,6 @@ vn_vptocnp(struct vnode **vp, char **bp, CACHE_RLOCK(); if ((*vp)->v_iflag & VI_DOOMED) { /* forced unmount */ - CACHE_RUNLOCK(); vdrop(*vp); return (ENOENT); } From delphij at FreeBSD.org Thu Apr 2 14:23:05 2009 From: delphij at FreeBSD.org (Xin LI) Date: Thu Apr 2 14:23:28 2009 Subject: svn commit: r190656 - head/usr.bin/locate/locate Message-ID: <200904022123.n32LN4hp076380@svn.freebsd.org> Author: delphij Date: Thu Apr 2 21:23:04 2009 New Revision: 190656 URL: http://svn.freebsd.org/changeset/base/190656 Log: Don't crash when we have an invalid count number. PR: bin/32686 Submitted by: Jaakko Heinonen MFC after: 1 week Modified: head/usr.bin/locate/locate/fastfind.c Modified: head/usr.bin/locate/locate/fastfind.c ============================================================================== --- head/usr.bin/locate/locate/fastfind.c Thu Apr 2 21:16:20 2009 (r190655) +++ head/usr.bin/locate/locate/fastfind.c Thu Apr 2 21:23:04 2009 (r190656) @@ -216,6 +216,8 @@ fastfind count += c - OFFSET; } + if (count < 0 || count > MAXPATHLEN) + errx(1, "corrupted database: %s", database); /* overlay old path */ p = path + count; foundchar = p - 1; From delphij at FreeBSD.org Thu Apr 2 14:44:56 2009 From: delphij at FreeBSD.org (Xin LI) Date: Thu Apr 2 14:45:08 2009 Subject: svn commit: r190657 - head/usr.bin/locate/locate Message-ID: <200904022144.n32LitaM076840@svn.freebsd.org> Author: delphij Date: Thu Apr 2 21:44:55 2009 New Revision: 190657 URL: http://svn.freebsd.org/changeset/base/190657 Log: Signed/unsigned fixes, should be WARNS=2 clean now. Modified: head/usr.bin/locate/locate/util.c Modified: head/usr.bin/locate/locate/util.c ============================================================================== --- head/usr.bin/locate/locate/util.c Thu Apr 2 21:23:04 2009 (r190656) +++ head/usr.bin/locate/locate/util.c Thu Apr 2 21:44:55 2009 (r190657) @@ -237,7 +237,7 @@ getwm(p) } u; register int i; - for (i = 0; i < INTSIZE; i++) + for (i = 0; i < (int)INTSIZE; i++) u.buf[i] = *p++; i = u.i; @@ -245,7 +245,7 @@ getwm(p) if (i > MAXPATHLEN || i < -(MAXPATHLEN)) { i = ntohl(i); if (i > MAXPATHLEN || i < -(MAXPATHLEN)) - errx(1, "integer out of +-MAXPATHLEN (%d): %d", + errx(1, "integer out of +-MAXPATHLEN (%d): %u", MAXPATHLEN, abs(i) < abs(htonl(i)) ? i : htonl(i)); } return(i); @@ -270,7 +270,7 @@ getwf(fp) if (word > MAXPATHLEN || word < -(MAXPATHLEN)) { word = ntohl(word); if (word > MAXPATHLEN || word < -(MAXPATHLEN)) - errx(1, "integer out of +-MAXPATHLEN (%d): %d", + errx(1, "integer out of +-MAXPATHLEN (%d): %u", MAXPATHLEN, abs(word) < abs(htonl(word)) ? word : htonl(word)); } From delphij at FreeBSD.org Thu Apr 2 14:51:55 2009 From: delphij at FreeBSD.org (Xin LI) Date: Thu Apr 2 14:52:01 2009 Subject: svn commit: r190658 - head/lib/libc/rpc Message-ID: <200904022151.n32LpsIC077034@svn.freebsd.org> Author: delphij Date: Thu Apr 2 21:51:54 2009 New Revision: 190658 URL: http://svn.freebsd.org/changeset/base/190658 Log: Remove a warning which is supposed to have been removed on 20030301. Modified: head/lib/libc/rpc/getnetconfig.c Modified: head/lib/libc/rpc/getnetconfig.c ============================================================================== --- head/lib/libc/rpc/getnetconfig.c Thu Apr 2 21:44:55 2009 (r190657) +++ head/lib/libc/rpc/getnetconfig.c Thu Apr 2 21:51:54 2009 (r190658) @@ -418,18 +418,6 @@ getnetconfigent(netid) return (NULL); } - if (strcmp(netid, "unix") == 0) { - fprintf(stderr, "The local transport is called \"unix\" "); - fprintf(stderr, "in /etc/netconfig.\n"); - fprintf(stderr, "Please change this to \"local\" manually "); - fprintf(stderr, "or run mergemaster(8).\n"); - fprintf(stderr, "See UPDATING entry 20021216 for details.\n"); - fprintf(stderr, "Continuing in 10 seconds\n\n"); - fprintf(stderr, "This warning will be removed 20030301\n"); - sleep(10); - - } - /* * Look up table if the entries have already been read and parsed in * getnetconfig(), then copy this entry into a buffer and return it. From delphij at FreeBSD.org Thu Apr 2 14:58:38 2009 From: delphij at FreeBSD.org (Xin LI) Date: Thu Apr 2 14:58:56 2009 Subject: svn commit: r190659 - in stable/6/lib/libc: . gen inet rpc sys Message-ID: <200904022158.n32LwYx5077242@svn.freebsd.org> Author: delphij Date: Thu Apr 2 21:58:34 2009 New Revision: 190659 URL: http://svn.freebsd.org/changeset/base/190659 Log: MFC revisions 162191, 166134, and 172259: Avoid memory leaks, properly handle malloc/realloc failures, and remove duplicate includes. Modified: stable/6/lib/libc/ (props changed) stable/6/lib/libc/gen/siglist.c stable/6/lib/libc/inet/inet_net_pton.c (props changed) stable/6/lib/libc/rpc/auth_time.c stable/6/lib/libc/rpc/getnetconfig.c stable/6/lib/libc/rpc/getnetpath.c stable/6/lib/libc/rpc/rpc_generic.c stable/6/lib/libc/rpc/rpcb_clnt.c stable/6/lib/libc/sys/ (props changed) Modified: stable/6/lib/libc/gen/siglist.c ============================================================================== --- stable/6/lib/libc/gen/siglist.c Thu Apr 2 21:51:54 2009 (r190658) +++ stable/6/lib/libc/gen/siglist.c Thu Apr 2 21:58:34 2009 (r190659) @@ -37,7 +37,6 @@ static char sccsid[] = "@(#)siglist.c 8. #include __FBSDID("$FreeBSD$"); -#include #include const char *const sys_signame[NSIG] = { Modified: stable/6/lib/libc/rpc/auth_time.c ============================================================================== --- stable/6/lib/libc/rpc/auth_time.c Thu Apr 2 21:51:54 2009 (r190658) +++ stable/6/lib/libc/rpc/auth_time.c Thu Apr 2 21:58:34 2009 (r190659) @@ -156,6 +156,7 @@ get_server(sin, host, srv, eps, maxep) struct hostent *he; struct hostent dummy; char *ptr[2]; + endpoint *ep; if (host == NULL && sin == NULL) return (NULL); @@ -175,26 +176,34 @@ get_server(sin, host, srv, eps, maxep) * This is lame. We go around once for TCP, then again * for UDP. */ - for (i = 0; (he->h_addr_list[i] != NULL) && (num_ep < maxep); - i++, num_ep++) { + for (i = 0, ep = eps; (he->h_addr_list[i] != NULL) && (num_ep < maxep); + i++, ep++, num_ep++) { struct in_addr *a; a = (struct in_addr *)he->h_addr_list[i]; snprintf(hname, sizeof(hname), "%s.0.111", inet_ntoa(*a)); - eps[num_ep].uaddr = strdup(hname); - eps[num_ep].family = strdup("inet"); - eps[num_ep].proto = strdup("tcp"); + ep->uaddr = strdup(hname); + ep->family = strdup("inet"); + ep->proto = strdup("tcp"); + if (ep->uaddr == NULL || ep->family == NULL || ep->proto == NULL) { + free_eps(eps, num_ep + 1); + return (NULL); + } } for (i = 0; (he->h_addr_list[i] != NULL) && (num_ep < maxep); - i++, num_ep++) { + i++, ep++, num_ep++) { struct in_addr *a; a = (struct in_addr *)he->h_addr_list[i]; snprintf(hname, sizeof(hname), "%s.0.111", inet_ntoa(*a)); - eps[num_ep].uaddr = strdup(hname); - eps[num_ep].family = strdup("inet"); - eps[num_ep].proto = strdup("udp"); + ep->uaddr = strdup(hname); + ep->family = strdup("inet"); + ep->proto = strdup("udp"); + if (ep->uaddr == NULL || ep->family == NULL || ep->proto == NULL) { + free_eps(eps, num_ep + 1); + return (NULL); + } } srv->name = (nis_name) host; Modified: stable/6/lib/libc/rpc/getnetconfig.c ============================================================================== --- stable/6/lib/libc/rpc/getnetconfig.c Thu Apr 2 21:51:54 2009 (r190658) +++ stable/6/lib/libc/rpc/getnetconfig.c Thu Apr 2 21:58:34 2009 (r190659) @@ -42,7 +42,6 @@ __FBSDID("$FreeBSD$"); #include "namespace.h" #include "reentrant.h" -#include #include #include #include @@ -535,6 +534,7 @@ struct netconfig *ncp; /* where to put r { char *tokenp; /* for processing tokens */ char *lasts; + char **nc_lookups; nc_error = NC_BADFILE; /* nearly anything that breaks is for this reason */ stringp[strlen(stringp)-1] = '\0'; /* get rid of newline */ @@ -600,14 +600,18 @@ struct netconfig *ncp; /* where to put r if (ncp->nc_lookups != NULL) /* from last visit */ free(ncp->nc_lookups); - /* preallocate one string pointer */ - ncp->nc_lookups = (char **)malloc(sizeof (char *)); + ncp->nc_lookups = NULL; ncp->nc_nlookups = 0; while ((cp = tokenp) != NULL) { + if ((nc_lookups = realloc(ncp->nc_lookups, + (ncp->nc_nlookups + 1) * sizeof *ncp->nc_lookups)) == NULL) { + free(ncp->nc_lookups); + ncp->nc_lookups = NULL; + return (-1); + } tokenp = _get_next_token(cp, ','); - ncp->nc_lookups[(size_t)ncp->nc_nlookups++] = cp; - ncp->nc_lookups = (char **)realloc(ncp->nc_lookups, - (size_t)(ncp->nc_nlookups+1) *sizeof(char *)); /* for next loop */ + ncp->nc_lookups = nc_lookups; + ncp->nc_lookups[ncp->nc_nlookups++] = cp; } } return (0); @@ -692,6 +696,7 @@ struct netconfig *ncp; p->nc_lookups = (char **)malloc((size_t)(p->nc_nlookups+1) * sizeof(char *)); if (p->nc_lookups == NULL) { free(p->nc_netid); + free(p); return(NULL); } for (i=0; i < p->nc_nlookups; i++) { Modified: stable/6/lib/libc/rpc/getnetpath.c ============================================================================== --- stable/6/lib/libc/rpc/getnetpath.c Thu Apr 2 21:51:54 2009 (r190658) +++ stable/6/lib/libc/rpc/getnetpath.c Thu Apr 2 21:58:34 2009 (r190659) @@ -41,7 +41,6 @@ __FBSDID("$FreeBSD$"); */ #include "namespace.h" -#include #include #include #include @@ -101,7 +100,7 @@ setnetpath() } if ((np_sessionp->nc_handlep = setnetconfig()) == NULL) { syslog (LOG_ERR, "rpc: failed to open " NETCONFIG); - return (NULL); + goto failed; } np_sessionp->valid = NP_VALID; np_sessionp->ncp_list = NULL; @@ -110,15 +109,18 @@ setnetpath() } else { (void) endnetconfig(np_sessionp->nc_handlep);/* won't need nc session*/ np_sessionp->nc_handlep = NULL; - if ((np_sessionp->netpath = malloc(strlen(npp)+1)) == NULL) { - free(np_sessionp); - return (NULL); - } else { + if ((np_sessionp->netpath = malloc(strlen(npp)+1)) == NULL) + goto failed; + else { (void) strcpy(np_sessionp->netpath, npp); } } np_sessionp->netpath_start = np_sessionp->netpath; return ((void *)np_sessionp); + +failed: + free(np_sessionp); + return (NULL); } /* Modified: stable/6/lib/libc/rpc/rpc_generic.c ============================================================================== --- stable/6/lib/libc/rpc/rpc_generic.c Thu Apr 2 21:51:54 2009 (r190658) +++ stable/6/lib/libc/rpc/rpc_generic.c Thu Apr 2 21:58:34 2009 (r190659) @@ -319,10 +319,8 @@ __rpc_setconf(nettype) case _RPC_NETPATH: case _RPC_CIRCUIT_N: case _RPC_DATAGRAM_N: - if (!(handle->nhandle = setnetpath())) { - free(handle); - return (NULL); - } + if (!(handle->nhandle = setnetpath())) + goto failed; handle->nflag = TRUE; break; case _RPC_VISIBLE: @@ -332,16 +330,19 @@ __rpc_setconf(nettype) case _RPC_UDP: if (!(handle->nhandle = setnetconfig())) { syslog (LOG_ERR, "rpc: failed to open " NETCONFIG); - free(handle); - return (NULL); + goto failed; } handle->nflag = FALSE; break; default: - return (NULL); + goto failed; } return (handle); + +failed: + free(handle); + return (NULL); } /* Modified: stable/6/lib/libc/rpc/rpcb_clnt.c ============================================================================== --- stable/6/lib/libc/rpc/rpcb_clnt.c Thu Apr 2 21:51:54 2009 (r190658) +++ stable/6/lib/libc/rpc/rpcb_clnt.c Thu Apr 2 21:58:34 2009 (r190659) @@ -374,10 +374,15 @@ getclnthandle(host, nconf, targaddr) return (NULL); } else { struct sockaddr_un sun; - - *targaddr = malloc(sizeof(sun.sun_path)); - strncpy(*targaddr, _PATH_RPCBINDSOCK, - sizeof(sun.sun_path)); + if (targaddr) { + *targaddr = malloc(sizeof(sun.sun_path)); + if (*targaddr == NULL) { + CLNT_DESTROY(client); + return (NULL); + } + strncpy(*targaddr, _PATH_RPCBINDSOCK, + sizeof(sun.sun_path)); + } return (client); } } else { From trhodes at FreeBSD.org Thu Apr 2 15:04:46 2009 From: trhodes at FreeBSD.org (Tom Rhodes) Date: Thu Apr 2 15:04:58 2009 Subject: svn commit: r190660 - stable/7/usr.sbin/arp Message-ID: <200904022204.n32M4jiL077584@svn.freebsd.org> Author: trhodes Date: Thu Apr 2 22:04:44 2009 New Revision: 190660 URL: http://svn.freebsd.org/changeset/base/190660 Log: nt a warning when blackhole and reject are used together. Update arp.8 manual page syntax. PR: 125896 Submitted by: Marc Olzheim Approved by: re (kib), sam Modified: stable/7/usr.sbin/arp/ (props changed) stable/7/usr.sbin/arp/arp.8 stable/7/usr.sbin/arp/arp.c Modified: stable/7/usr.sbin/arp/arp.8 ============================================================================== --- stable/7/usr.sbin/arp/arp.8 Thu Apr 2 21:58:34 2009 (r190659) +++ stable/7/usr.sbin/arp/arp.8 Thu Apr 2 22:04:44 2009 (r190660) @@ -28,7 +28,7 @@ .\" @(#)arp.8 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd March 18, 2008 +.Dd December 25, 2008 .Dt ARP 8 .Os .Sh NAME @@ -53,14 +53,12 @@ .Nm .Fl s Ar hostname ether_addr .Op Cm temp -.Op Cm reject -.Op Cm blackhole +.Op Cm blackhole No \&| Cm reject .Op Cm pub Op Cm only .Nm .Fl S Ar hostname ether_addr .Op Cm temp -.Op Cm reject -.Op Cm blackhole +.Op Cm blackhole No \&| Cm reject .Op Cm pub Op Cm only .Nm .Fl f Ar filename @@ -182,7 +180,8 @@ in the file should be of the form .Bd -ragged -offset indent -compact .Ar hostname ether_addr .Op Cm temp -.Op Cm pub +.Op Cm blackhole No \&| Cm reject +.Op Cm pub Op Cm only .Ed .Pp with argument meanings as given above. Modified: stable/7/usr.sbin/arp/arp.c ============================================================================== --- stable/7/usr.sbin/arp/arp.c Thu Apr 2 21:58:34 2009 (r190659) +++ stable/7/usr.sbin/arp/arp.c Thu Apr 2 22:04:44 2009 (r190660) @@ -330,8 +330,14 @@ set(int argc, char **argv) argc--; argv++; } } else if (strncmp(argv[0], "blackhole", 9) == 0) { + if (flags & RTF_REJECT) { + printf("Choose one of blackhole or reject, not both.\n"); + } flags |= RTF_BLACKHOLE; } else if (strncmp(argv[0], "reject", 6) == 0) { + if (flags & RTF_BLACKHOLE) { + printf("Choose one of blackhole or reject, not both.\n"); + } flags |= RTF_REJECT; } else if (strncmp(argv[0], "trail", 5) == 0) { /* XXX deprecated and undocumented feature */ @@ -630,8 +636,8 @@ usage(void) " arp [-n] [-i interface] -a", " arp -d hostname [pub]", " arp -d [-i interface] -a", - " arp -s hostname ether_addr [temp] [reject] [blackhole] [pub [only]]", - " arp -S hostname ether_addr [temp] [reject] [blackhole] [pub [only]]", + " arp -s hostname ether_addr [temp] [reject | blackhole] [pub [only]]", + " arp -S hostname ether_addr [temp] [reject | blackhole] [pub [only]]", " arp -f filename"); exit(1); } From delphij at FreeBSD.org Thu Apr 2 15:17:05 2009 From: delphij at FreeBSD.org (Xin LI) Date: Thu Apr 2 15:17:16 2009 Subject: svn commit: r190661 - head/lib/libc/gen Message-ID: <200904022217.n32MH2ji078617@svn.freebsd.org> Author: delphij Date: Thu Apr 2 22:17:02 2009 New Revision: 190661 URL: http://svn.freebsd.org/changeset/base/190661 Log: Properly handle malloc() failures. PR: bin/83338 Modified: head/lib/libc/gen/getcap.c Modified: head/lib/libc/gen/getcap.c ============================================================================== --- head/lib/libc/gen/getcap.c Thu Apr 2 22:04:44 2009 (r190660) +++ head/lib/libc/gen/getcap.c Thu Apr 2 22:17:02 2009 (r190661) @@ -189,7 +189,7 @@ getent(char **cap, u_int *len, char **db { DB *capdbp; char *r_end, *rp, **db_p; - int myfd, eof, foundit, retval, clen; + int myfd, eof, foundit, retval; char *record, *cbuf; int tc_not_resolved; char pbuf[_POSIX_PATH_MAX]; @@ -251,14 +251,16 @@ getent(char **cap, u_int *len, char **db return (retval); } /* save the data; close frees it */ - clen = strlen(record); - cbuf = malloc(clen + 1); - memcpy(cbuf, record, clen + 1); + cbuf = strdup(record); if (capdbp->close(capdbp) < 0) { free(cbuf); return (-2); } - *len = clen; + if (cbuf == NULL) { + errno = ENOMEM; + return (-2); + } + *len = strlen(record); *cap = cbuf; return (retval); } else { From yongari at FreeBSD.org Thu Apr 2 17:12:15 2009 From: yongari at FreeBSD.org (Pyun YongHyeon) Date: Thu Apr 2 17:12:33 2009 Subject: svn commit: r190663 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb dev/re Message-ID: <200904030012.n330CEqP083995@svn.freebsd.org> Author: yongari Date: Fri Apr 3 00:12:14 2009 New Revision: 190663 URL: http://svn.freebsd.org/changeset/base/190663 Log: MFC r190587: It seems that RTL8168D and RTL8102EL requires additional settle time to complete RL_PHYAR register write. Accessing RL_PHYAR register right after the write causes errors for subsequent PHY register accesses. Tested by: george at luckytele dot com, Steve Wills < STEVE at stevenwills dot com > Approved by: re (Kostik Belousov) Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/dev/re/if_re.c Modified: stable/7/sys/dev/re/if_re.c ============================================================================== --- stable/7/sys/dev/re/if_re.c Fri Apr 3 00:10:19 2009 (r190662) +++ stable/7/sys/dev/re/if_re.c Fri Apr 3 00:12:14 2009 (r190663) @@ -420,6 +420,7 @@ re_gmii_readreg(device_t dev, int phy, i } CSR_WRITE_4(sc, RL_PHYAR, reg << 16); + DELAY(1000); for (i = 0; i < RL_PHY_TIMEOUT; i++) { rval = CSR_READ_4(sc, RL_PHYAR); @@ -447,6 +448,7 @@ re_gmii_writereg(device_t dev, int phy, CSR_WRITE_4(sc, RL_PHYAR, (reg << 16) | (data & RL_PHYAR_PHYDATA) | RL_PHYAR_BUSY); + DELAY(1000); for (i = 0; i < RL_PHY_TIMEOUT; i++) { rval = CSR_READ_4(sc, RL_PHYAR); From imp at FreeBSD.org Thu Apr 2 19:28:12 2009 From: imp at FreeBSD.org (Warner Losh) Date: Thu Apr 2 19:28:19 2009 Subject: svn commit: r190664 - head/sys/dev/ed Message-ID: <200904030228.n332SB1X093671@svn.freebsd.org> Author: imp Date: Fri Apr 3 02:28:11 2009 New Revision: 190664 URL: http://svn.freebsd.org/changeset/base/190664 Log: Remove more debug... Modified: head/sys/dev/ed/if_ed_pccard.c Modified: head/sys/dev/ed/if_ed_pccard.c ============================================================================== --- head/sys/dev/ed/if_ed_pccard.c Fri Apr 3 00:12:14 2009 (r190663) +++ head/sys/dev/ed/if_ed_pccard.c Fri Apr 3 02:28:11 2009 (r190664) @@ -950,7 +950,6 @@ ed_pccard_ax88x90_mii_readbits(struct ed val++; ed_asic_outb(sc, ED_AX88X90_MIIBUS, mdio | ED_AX88X90_MII_CLK); } - printf("AX88x90 %#x+%#x Reading %d bits: %x\n", (unsigned int)sc->port_bsh, sc->asic_offset, nbits, val); return val; } @@ -1050,7 +1049,6 @@ ed_pccard_tc5299j_mii_readbits(struct ed u_int val = 0; uint8_t cr; - printf("Reading %d bits\n", nbits); cr = ed_nic_inb(sc, ED_P0_CR); ed_nic_outb(sc, ED_P0_CR, cr | ED_CR_PAGE_3); From imp at FreeBSD.org Thu Apr 2 20:04:27 2009 From: imp at FreeBSD.org (Warner Losh) Date: Thu Apr 2 20:04:38 2009 Subject: svn commit: r190665 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb dev/ed Message-ID: <200904030304.n3334QT1096478@svn.freebsd.org> Author: imp Date: Fri Apr 3 03:04:26 2009 New Revision: 190665 URL: http://svn.freebsd.org/changeset/base/190665 Log: Merge 190488 from head: Fix shared memory packet movement. Approved by: re@ (kostik) Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/dev/ed/if_ed.c Modified: stable/7/sys/dev/ed/if_ed.c ============================================================================== --- stable/7/sys/dev/ed/if_ed.c Fri Apr 3 02:28:11 2009 (r190664) +++ stable/7/sys/dev/ed/if_ed.c Fri Apr 3 03:04:26 2009 (r190665) @@ -1307,7 +1307,7 @@ ed_shmem_readmem16(struct ed_softc *sc, uint16_t amount) { bus_space_read_region_2(sc->mem_bst, sc->mem_bsh, src, (uint16_t *)dst, - amount + 1 / 2); + (amount + 1) / 2); } /* From weongyo at FreeBSD.org Thu Apr 2 20:25:02 2009 From: weongyo at FreeBSD.org (Weongyo Jeong) Date: Thu Apr 2 20:25:14 2009 Subject: svn commit: r190666 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb dev/malo Message-ID: <200904030325.n333P12f097991@svn.freebsd.org> Author: weongyo Date: Fri Apr 3 03:25:00 2009 New Revision: 190666 URL: http://svn.freebsd.org/changeset/base/190666 Log: MFC r190541: fix a bug of uses after free. Pointed by: dchagin MFC r190544: handles more exceptional cases when the driver failed to attach. MFC r190550: corrects a error message. MFC r190590: fix a bug that it passed a incorrect flag BUS_DMA_ALLOCNOW to create a device specific DMA tag. On amd64 it could exhaust all of bounce pages when bus_dma_tag_create(9) is called at malo_pci_attach() then as result in next turn it returns ENOMEM. This fix a attach fail on amd64. Pointed by: yongari Tested by: dchagin Approved by: re (kib) Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/dev/malo/if_malo_pci.c stable/7/sys/dev/malo/if_malohal.c Modified: stable/7/sys/dev/malo/if_malo_pci.c ============================================================================== --- stable/7/sys/dev/malo/if_malo_pci.c Fri Apr 3 03:04:26 2009 (r190665) +++ stable/7/sys/dev/malo/if_malo_pci.c Fri Apr 3 03:25:00 2009 (r190666) @@ -245,7 +245,7 @@ malo_pci_attach(device_t dev) BUS_SPACE_MAXADDR, /* maxsize */ 0, /* nsegments */ BUS_SPACE_MAXADDR, /* maxsegsize */ - BUS_DMA_ALLOCNOW, /* flags */ + 0, /* flags */ NULL, /* lockfunc */ NULL, /* lockarg */ &sc->malo_dmat)) { @@ -260,12 +260,13 @@ malo_pci_attach(device_t dev) error = malo_attach(pci_get_device(dev), sc); - if (error != 0) { - malo_pci_detach(dev); - return (error); - } + if (error != 0) + goto bad2; return (error); + +bad2: + bus_dma_tag_destroy(sc->malo_dmat); bad1: if (psc->malo_msi == 0) bus_teardown_intr(dev, psc->malo_res_irq[0], @@ -275,10 +276,11 @@ bad1: bus_teardown_intr(dev, psc->malo_res_irq[i], psc->malo_intrhand[i]); } - + bus_release_resources(dev, psc->malo_irq_spec, psc->malo_res_irq); bad: if (psc->malo_msi != 0) pci_release_msi(dev); + bus_release_resources(dev, psc->malo_mem_spec, psc->malo_res_mem); return (error); } Modified: stable/7/sys/dev/malo/if_malohal.c ============================================================================== --- stable/7/sys/dev/malo/if_malohal.c Fri Apr 3 03:04:26 2009 (r190665) +++ stable/7/sys/dev/malo/if_malohal.c Fri Apr 3 03:25:00 2009 (r190666) @@ -128,7 +128,7 @@ malo_hal_attach(device_t dev, uint16_t d NULL, /* lockarg */ &mh->mh_dmat); if (error != 0) { - device_printf(dev, "unable to allocate memory for cmd buffer, " + device_printf(dev, "unable to allocate memory for cmd tag, " "error %u\n", error); goto fail; } @@ -163,8 +163,6 @@ malo_hal_attach(device_t dev, uint16_t d return (mh); fail: - free(mh, M_DEVBUF); - if (mh->mh_dmamap != NULL) { bus_dmamap_unload(mh->mh_dmat, mh->mh_dmamap); if (mh->mh_cmdbuf != NULL) @@ -174,6 +172,7 @@ fail: } if (mh->mh_dmat) bus_dma_tag_destroy(mh->mh_dmat); + free(mh, M_DEVBUF); return (NULL); } From vehemens at verizon.net Thu Apr 2 22:49:41 2009 From: vehemens at verizon.net (vehemens) Date: Thu Apr 2 22:49:48 2009 Subject: svn commit: r190595 - head/sys/dev/drm In-Reply-To: <1238657152.20670.13.camel@balrog.2hip.net> References: <200904012324.48863.vehemens@verizon.net> <1238657152.20670.13.camel@balrog.2hip.net> Message-ID: <200904022253.10234.vehemens@verizon.net> On Thursday 02 April 2009 12:25:52 am Robert Noland wrote: > On Wed, 2009-04-01 at 23:24 -0700, vehemens wrote: > > >Author: rnoland > > >Date: Tue Mar 31 17:52:05 2009 > > >New Revision: 190595 > > >URL: http://svn.freebsd.org/changeset/base/190595 > > > > > >Log: > > > Simplify the radeon microcode loading. > > > > > > Submitted by: Christoph Mallon > > > MFC after: 3 days > > > > > >Modified: > > > head/sys/dev/drm/r600_cp.c > > > head/sys/dev/drm/radeon_cp.c > > > > I don't see the point of this change given that you are deveating from a > > code base which makes incorporating future code changes that much more > > diffcult. > > There are no future code changes to be gotten from git... What are your plans to incoporate DRI2 and KMS into FreeBSD then? > > Could you back this one out? > > Nope, I showed it to alex before I committed it and he is planning to > send it up in linux as well. git is unfortunately a wasteland, even the > nouveau guys are preparing to move out... It is still much easier for > me to work with Alex and the nouveau folks than Intel though... If you mean then I would agree, but the why appears to me to be a result of Linux developers interfering with those that would contribute to BSD. From marcel at FreeBSD.org Thu Apr 2 22:54:50 2009 From: marcel at FreeBSD.org (Marcel Moolenaar) Date: Thu Apr 2 22:55:02 2009 Subject: svn commit: r190667 - head/sys/geom/part Message-ID: <200904030554.n335so8a007599@svn.freebsd.org> Author: marcel Date: Fri Apr 3 05:54:49 2009 New Revision: 190667 URL: http://svn.freebsd.org/changeset/base/190667 Log: The 9 bytes immediately prior to the partition table can contain signatures or disk serial numbers. Don't assume those to be zero in all cases. This fixes a false negative. Tested by: avatar@mmlab.cse.yzu.edu.tw Modified: head/sys/geom/part/g_part_ebr.c Modified: head/sys/geom/part/g_part_ebr.c ============================================================================== --- head/sys/geom/part/g_part_ebr.c Fri Apr 3 03:25:00 2009 (r190666) +++ head/sys/geom/part/g_part_ebr.c Fri Apr 3 05:54:49 2009 (r190667) @@ -403,9 +403,14 @@ g_part_ebr_probe(struct g_part_table *ta if (magic != DOSMAGIC) goto out; - /* The sector is all zeroes, except for the partition entries. */ + /* + * The sector is all zeroes, except for the partition entries + * and some signatures or disk serial number. Those can be + * found in the 9 bytes immediately in front of the partition + * table. + */ sum = 0; - for (index = 0; index < DOSPARTOFF; index++) + for (index = 0; index < DOSPARTOFF - 9; index++) sum += buf[index]; if (sum != 0) goto out; From dchagin at freebsd.org Thu Apr 2 23:06:01 2009 From: dchagin at freebsd.org (Chagin Dmitry) Date: Thu Apr 2 23:06:13 2009 Subject: svn commit: r190655 - head/sys/kern In-Reply-To: <200904022116.n32LGK81076210@svn.freebsd.org> References: <200904022116.n32LGK81076210@svn.freebsd.org> Message-ID: <20090403060553.GA20624@dchagin.static.corbina.ru> On Thu, Apr 02, 2009 at 09:16:20PM +0000, Peter Wemm wrote: > Author: peter > Date: Thu Apr 2 21:16:20 2009 > New Revision: 190655 > URL: http://svn.freebsd.org/changeset/base/190655 > > Log: > vn_vptocnp() unlocks the name cache and forgets to re-lock it before > returning in one error case, and mistakenly unlocks it for the > umount -f case. > vn_vptocnp() consumers expects what in case of error returns w/o CACHE_RLOCK held. so you need something like: diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index ea19e13..b06a6c6 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -971,18 +971,17 @@ vn_vptocnp(struct vnode **vp, char **bp, char *buf, u_int *buflen) vdrop(*vp); VFS_UNLOCK_GIANT(vfslocked); if (error) { - CACHE_RLOCK(); numfullpathfail2++; return (error); } *bp = buf + *buflen; *vp = dvp; - CACHE_RLOCK(); if ((*vp)->v_iflag & VI_DOOMED) { /* forced unmount */ vdrop(*vp); return (ENOENT); } + CACHE_RLOCK(); vdrop(*vp); return (0); -- Have fun! chd -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 196 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20090403/69c4a042/attachment.pgp From rnoland at FreeBSD.org Thu Apr 2 23:15:00 2009 From: rnoland at FreeBSD.org (Robert Noland) Date: Thu Apr 2 23:15:08 2009 Subject: svn commit: r190595 - head/sys/dev/drm In-Reply-To: <200904022253.10234.vehemens@verizon.net> References: <200904012324.48863.vehemens@verizon.net> <1238657152.20670.13.camel@balrog.2hip.net> <200904022253.10234.vehemens@verizon.net> Message-ID: <1238739254.65025.17.camel@balrog.2hip.net> On Thu, 2009-04-02 at 22:53 -0700, vehemens wrote: > On Thursday 02 April 2009 12:25:52 am Robert Noland wrote: > > On Wed, 2009-04-01 at 23:24 -0700, vehemens wrote: > > > >Author: rnoland > > > >Date: Tue Mar 31 17:52:05 2009 > > > >New Revision: 190595 > > > >URL: http://svn.freebsd.org/changeset/base/190595 > > > > > > > >Log: > > > > Simplify the radeon microcode loading. > > > > > > > > Submitted by: Christoph Mallon > > > > MFC after: 3 days > > > > > > > >Modified: > > > > head/sys/dev/drm/r600_cp.c > > > > head/sys/dev/drm/radeon_cp.c > > > > > > I don't see the point of this change given that you are deveating from a > > > code base which makes incorporating future code changes that much more > > > diffcult. > > > > There are no future code changes to be gotten from git... > > What are your plans to incoporate DRI2 and KMS into FreeBSD then? KMS is a little tricky, but I've been starting to look at it. If by DRI2, you mean gem and/or newttm. They are on my list of stuff to deal with. No matter what, I will have to pull code from a linux tree somewhere as the basis to start. > > > Could you back this one out? > > > > Nope, I showed it to alex before I committed it and he is planning to > > send it up in linux as well. git is unfortunately a wasteland, even the > > nouveau guys are preparing to move out... It is still much easier for > > me to work with Alex and the nouveau folks than Intel though... > > If you mean then I would agree, but > the why appears to me to be a result of Linux developers interfering with > those that would contribute to BSD. It frustrates me, but their goal isn't to make things more difficult for us (me in particular). They (primarily Intel) is trying to simplify their process for upstreaming to linux. As changes to infrastructure occur, someone has to back port those changes to git. I don't have the time to try and do it, nor do the folks from ATI/AMD or the Nouveau crew. Intel has by far the most people working full time on drm and X, so they tend to get away with what they want to. Given that git doesn't match what is in Linux, it means that in order for anyone else to ship code to Linux they have to rework it before sending it up, it is just much easier on everyone if they do so. Right now, Alex(AMD) and I are doing a fairly decent job of staying in sync. I think the same will work for Nouveau. Intel is just too chaotic, so I just try to sync up with what they are shipping periodically. robert. -- Robert Noland FreeBSD -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 196 bytes Desc: This is a digitally signed message part Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20090403/9b39faa7/attachment-0001.pgp From kostikbel at gmail.com Fri Apr 3 02:44:50 2009 From: kostikbel at gmail.com (Kostik Belousov) Date: Fri Apr 3 02:45:02 2009 Subject: svn commit: r190655 - head/sys/kern In-Reply-To: <20090403060553.GA20624@dchagin.static.corbina.ru> References: <200904022116.n32LGK81076210@svn.freebsd.org> <20090403060553.GA20624@dchagin.static.corbina.ru> Message-ID: <20090403094432.GQ31897@deviant.kiev.zoral.com.ua> On Fri, Apr 03, 2009 at 10:05:53AM +0400, Chagin Dmitry wrote: > On Thu, Apr 02, 2009 at 09:16:20PM +0000, Peter Wemm wrote: > > Author: peter > > Date: Thu Apr 2 21:16:20 2009 > > New Revision: 190655 > > URL: http://svn.freebsd.org/changeset/base/190655 > > > > Log: > > vn_vptocnp() unlocks the name cache and forgets to re-lock it before > > returning in one error case, and mistakenly unlocks it for the > > umount -f case. > > > > vn_vptocnp() consumers expects what in case of error returns > w/o CACHE_RLOCK held. so you need something like: Yeah, I do not quite understand this commit. > > diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c > index ea19e13..b06a6c6 100644 > --- a/sys/kern/vfs_cache.c > +++ b/sys/kern/vfs_cache.c > @@ -971,18 +971,17 @@ vn_vptocnp(struct vnode **vp, char **bp, char *buf, u_int *buflen) > vdrop(*vp); > VFS_UNLOCK_GIANT(vfslocked); > if (error) { > - CACHE_RLOCK(); > numfullpathfail2++; > return (error); > } Yes, this is reversal of the part of the r190655. > *bp = buf + *buflen; > *vp = dvp; > - CACHE_RLOCK(); > if ((*vp)->v_iflag & VI_DOOMED) { > /* forced unmount */ > vdrop(*vp); > return (ENOENT); > } > + CACHE_RLOCK(); > vdrop(*vp); > > return (0); There, r190655 should be reversed too, instead of doing what you do. VI_DOOMED should be checked while cache is locked. > > > -- > Have fun! > chd -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 195 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20090403/f4e8a167/attachment.pgp From stas at FreeBSD.org Fri Apr 3 03:15:01 2009 From: stas at FreeBSD.org (Stanislav Sedov) Date: Fri Apr 3 03:16:51 2009 Subject: svn commit: r190668 - head/sys/dev/pci Message-ID: <200904031015.n33AF0Ws015940@svn.freebsd.org> Author: stas Date: Fri Apr 3 10:15:00 2009 New Revision: 190668 URL: http://svn.freebsd.org/changeset/base/190668 Log: - Correct the comment. MFC after: 3 days Modified: head/sys/dev/pci/pci.c Modified: head/sys/dev/pci/pci.c ============================================================================== --- head/sys/dev/pci/pci.c Fri Apr 3 05:54:49 2009 (r190667) +++ head/sys/dev/pci/pci.c Fri Apr 3 10:15:00 2009 (r190668) @@ -1030,9 +1030,10 @@ pci_get_vpd_readonly_method(device_t dev } /* - * Return the offset in configuration space of the requested extended - * capability entry or 0 if the specified capability was not found. - */ + * Find the requested extended capability and return the offset in + * configuration space via the pointer provided. The function returns + * 0 on success and error code otherwise. +*/ int pci_find_extcap_method(device_t dev, device_t child, int capability, int *capreg) From mav at FreeBSD.org Fri Apr 3 03:38:26 2009 From: mav at FreeBSD.org (Alexander Motin) Date: Fri Apr 3 03:38:37 2009 Subject: svn commit: r190669 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb kern Message-ID: <200904031038.n33AcOZp016515@svn.freebsd.org> Author: mav Date: Fri Apr 3 10:38:24 2009 New Revision: 190669 URL: http://svn.freebsd.org/changeset/base/190669 Log: MFC rev. 188464. Check for device_set_devclass() errors and skip driver probe/attach if any. Attach called without devclass set crashes the system. On attach/resume some ATA drivers sometimes trying to create duplicate adX device. It is surely their own problem, but it is not a reason to crash here. Approved by: re (kib) Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/kern/subr_bus.c Modified: stable/7/sys/kern/subr_bus.c ============================================================================== --- stable/7/sys/kern/subr_bus.c Fri Apr 3 10:15:00 2009 (r190668) +++ stable/7/sys/kern/subr_bus.c Fri Apr 3 10:38:24 2009 (r190669) @@ -1735,8 +1735,13 @@ device_probe_child(device_t dev, device_ dl = next_matching_driver(dc, child, dl)) { PDEBUG(("Trying %s", DRIVERNAME(dl->driver))); device_set_driver(child, dl->driver); - if (!hasclass) - device_set_devclass(child, dl->driver->name); + if (!hasclass) { + if (device_set_devclass(child, dl->driver->name)) { + PDEBUG(("Unable to set device class")); + device_set_driver(child, NULL); + continue; + } + } /* Fetch any flags for the device before probing. */ resource_int_value(dl->driver->name, child->unit, @@ -1814,8 +1819,11 @@ device_probe_child(device_t dev, device_ return (result); /* Set the winning driver, devclass, and flags. */ - if (!child->devclass) - device_set_devclass(child, best->driver->name); + if (!child->devclass) { + result = device_set_devclass(child, best->driver->name); + if (result != 0) + return (result); + } device_set_driver(child, best->driver); resource_int_value(best->driver->name, child->unit, "flags", &child->devflags); From dchagin at freebsd.org Fri Apr 3 05:35:29 2009 From: dchagin at freebsd.org (Chagin Dmitry) Date: Fri Apr 3 05:35:41 2009 Subject: svn commit: r190655 - head/sys/kern In-Reply-To: <20090403094432.GQ31897@deviant.kiev.zoral.com.ua> References: <200904022116.n32LGK81076210@svn.freebsd.org> <20090403060553.GA20624@dchagin.static.corbina.ru> <20090403094432.GQ31897@deviant.kiev.zoral.com.ua> Message-ID: <20090403123521.GA58369@dchagin.static.corbina.ru> On Fri, Apr 03, 2009 at 12:44:32PM +0300, Kostik Belousov wrote: > On Fri, Apr 03, 2009 at 10:05:53AM +0400, Chagin Dmitry wrote: > > On Thu, Apr 02, 2009 at 09:16:20PM +0000, Peter Wemm wrote: > > > Author: peter > > > Date: Thu Apr 2 21:16:20 2009 > > > New Revision: 190655 > > > URL: http://svn.freebsd.org/changeset/base/190655 > > > > > > Log: > > > vn_vptocnp() unlocks the name cache and forgets to re-lock it before > > > returning in one error case, and mistakenly unlocks it for the > > > umount -f case. > > > > > > > vn_vptocnp() consumers expects what in case of error returns > > w/o CACHE_RLOCK held. so you need something like: > Yeah, I do not quite understand this commit. > > > > > diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c > > index ea19e13..b06a6c6 100644 > > --- a/sys/kern/vfs_cache.c > > +++ b/sys/kern/vfs_cache.c > > @@ -971,18 +971,17 @@ vn_vptocnp(struct vnode **vp, char **bp, char *buf, u_int *buflen) > > vdrop(*vp); > > VFS_UNLOCK_GIANT(vfslocked); > > if (error) { > > - CACHE_RLOCK(); > > numfullpathfail2++; > > return (error); > > } > Yes, this is reversal of the part of the r190655. > > > *bp = buf + *buflen; > > *vp = dvp; > > - CACHE_RLOCK(); > > if ((*vp)->v_iflag & VI_DOOMED) { > > /* forced unmount */ > > vdrop(*vp); > > return (ENOENT); > > } > > + CACHE_RLOCK(); > > vdrop(*vp); > > > > return (0); > There, r190655 should be reversed too, instead of doing what you do. > VI_DOOMED should be checked while cache is locked. > whoops, it was fast hacking, therefore make universe panicked after rebase to r190655 thnx :) -- Have fun! chd -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 196 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20090403/a436233a/attachment.pgp From stas at FreeBSD.org Fri Apr 3 06:35:55 2009 From: stas at FreeBSD.org (Stanislav Sedov) Date: Fri Apr 3 06:36:07 2009 Subject: svn commit: r190670 - head/sys/dev/pci Message-ID: <200904031335.n33DZsrl023865@svn.freebsd.org> Author: stas Date: Fri Apr 3 13:35:54 2009 New Revision: 190670 URL: http://svn.freebsd.org/changeset/base/190670 Log: - Fix spacing in the comment. Reported by: jhb Modified: head/sys/dev/pci/pci.c Modified: head/sys/dev/pci/pci.c ============================================================================== --- head/sys/dev/pci/pci.c Fri Apr 3 10:38:24 2009 (r190669) +++ head/sys/dev/pci/pci.c Fri Apr 3 13:35:54 2009 (r190670) @@ -1033,7 +1033,7 @@ pci_get_vpd_readonly_method(device_t dev * Find the requested extended capability and return the offset in * configuration space via the pointer provided. The function returns * 0 on success and error code otherwise. -*/ + */ int pci_find_extcap_method(device_t dev, device_t child, int capability, int *capreg) From lulf at FreeBSD.org Fri Apr 3 09:02:15 2009 From: lulf at FreeBSD.org (Ulf Lilleengen) Date: Fri Apr 3 09:02:22 2009 Subject: svn commit: r190671 - stable/7/contrib/csup Message-ID: <200904031602.n33G2DrQ026612@svn.freebsd.org> Author: lulf Date: Fri Apr 3 16:02:13 2009 New Revision: 190671 URL: http://svn.freebsd.org/changeset/base/190671 Log: MFC r190422: - Add proper error checking and printing to the CVSMode code when reading and writing from/to streams, as leaving them out stops csup from cleaning up on SIGINT and friends properly. Approved by: re (kib) Modified: stable/7/contrib/csup/ (props changed) stable/7/contrib/csup/rcsfile.c stable/7/contrib/csup/rcsfile.h stable/7/contrib/csup/rcsparse.c stable/7/contrib/csup/updater.c Modified: stable/7/contrib/csup/rcsfile.c ============================================================================== --- stable/7/contrib/csup/rcsfile.c Fri Apr 3 13:35:54 2009 (r190670) +++ stable/7/contrib/csup/rcsfile.c Fri Apr 3 16:02:13 2009 (r190671) @@ -140,7 +140,7 @@ static void rcsfile_insertsorteddelta( struct delta *); static struct stream *rcsfile_getdeltatext(struct rcsfile *, struct delta *, struct buf **); -static void rcsdelta_writestring(char *, size_t, struct stream *); +static int rcsdelta_writestring(char *, size_t, struct stream *); static void rcsdelta_insertbranch(struct delta *, struct branch *); /* Space formatting of RCS file. */ @@ -308,14 +308,19 @@ rcsfile_write(struct rcsfile *rf, struct /* First write head. */ d = LIST_FIRST(&rf->trunk->deltalist); - stream_printf(dest, "head%s%s;\n", head_space, d->revnum); + if (stream_printf(dest, "head%s%s;\n", head_space, d->revnum) < 0) + return (-1); /* Write branch, if we have. */ - if (rf->branch != NULL) - stream_printf(dest, "branch%s%s;\n", branch_space, rf->branch); + if (rf->branch != NULL) { + if (stream_printf(dest, "branch%s%s;\n", branch_space, + rf->branch) < 0) + return (-1); + } /* Write access. */ - stream_printf(dest, "access"); + if (stream_printf(dest, "access") < 0) + return (-1); #if 0 if (!STAILQ_EMPTY(&rf->accesslist)) { /* @@ -324,32 +329,44 @@ rcsfile_write(struct rcsfile *rf, struct */ } #endif - stream_printf(dest, ";\n"); + if (stream_printf(dest, ";\n") < 0) + return (-1); /* Write out taglist. */ - stream_printf(dest, "symbols"); + if (stream_printf(dest, "symbols") < 0) + return (-1); if (!STAILQ_EMPTY(&rf->taglist)) { STAILQ_FOREACH(t, &rf->taglist, tag_next) { - stream_printf(dest, "\n%s%s:%s", tag_space, t->tag, - t->revnum); + if (stream_printf(dest, "\n%s%s:%s", tag_space, t->tag, + t->revnum) < 0) + return (-1); } } - stream_printf(dest, ";\n"); /* Write out locks and strict. */ - stream_printf(dest, "locks;"); - if (rf->strictlock) - stream_printf(dest, " strict;"); - stream_printf(dest, "\n"); + if (stream_printf(dest, ";\nlocks;") < 0) + return (-1); + if (rf->strictlock) { + if (stream_printf(dest, " strict;") < 0) + return (-1); + } + if (stream_printf(dest, "\n") < 0) + return (-1); /* Write out the comment. */ - if (rf->comment != NULL) - stream_printf(dest, "comment%s%s;\n", comment_space, rf->comment); - if (rf->expand != EXPAND_DEFAULT) - stream_printf(dest, "expand%s@%s@;\n", expand_space, - keyword_encode_expand(rf->expand)); + if (rf->comment != NULL) { + if (stream_printf(dest, "comment%s%s;\n", comment_space, + rf->comment) < 0) + return (-1); + } + if (rf->expand != EXPAND_DEFAULT) { + if (stream_printf(dest, "expand%s@%s@;\n", expand_space, + keyword_encode_expand(rf->expand)) < 0) + return (-1); + } - stream_printf(dest, "\n\n"); + if (stream_printf(dest, "\n\n") < 0) + return (-1); /* * Write out deltas. We use a stack where we push the appropriate deltas @@ -364,14 +381,18 @@ rcsfile_write(struct rcsfile *rf, struct /* Do not write out placeholders just to be safe. */ if (d->placeholder) continue; - stream_printf(dest, "%s\n", d->revnum); - stream_printf(dest, "date%s%s;%sauthor %s;%sstate", + if (stream_printf(dest, "%s\n", d->revnum) < 0) + return (-1); + if (stream_printf(dest, "date%s%s;%sauthor %s;%sstate", date_space, d->revdate, auth_space, d->author, - state_space); - if (d->state != NULL) - stream_printf(dest, " %s", d->state); - stream_printf(dest, ";\n"); - stream_printf(dest, "branches"); + state_space) < 0) + return (-1); + if (d->state != NULL) { + if (stream_printf(dest, " %s", d->state) < 0) + return (-1); + } + if (stream_printf(dest, ";\nbranches") < 0) + return (-1); /* * Write out our branches. Add them to a reversed list for use * later when we write out the text. @@ -385,30 +406,36 @@ rcsfile_write(struct rcsfile *rf, struct /* Push branch heads on stack. */ STAILQ_FOREACH(d_tmp, &deltalist_inverted, delta_prev) { - if (d_tmp == NULL) - err(1, "empty branch!"); - stream_printf(dest, "\n%s%s", branches_space, - d_tmp->revnum); + if (d_tmp == NULL) { + lprintf(2, "Empty branch!\n"); + return (-1); + } + if (stream_printf(dest, "\n%s%s", branches_space, + d_tmp->revnum) < 0) + return (-1); } - stream_printf(dest, ";\n"); - stream_printf(dest, "next%s", next_space); + if (stream_printf(dest, ";\nnext%s", next_space) < 0) + return (-1); /* Push next delta on stack. */ d_next = LIST_NEXT(d, delta_next); if (d_next != NULL) { - stream_printf(dest, "%s", d_next->revnum); + if (stream_printf(dest, "%s", d_next->revnum) < 0) + return (-1); STAILQ_INSERT_HEAD(&deltastack, d_next, stack_next); } - stream_printf(dest, ";\n\n"); + if (stream_printf(dest, ";\n\n") < 0) + return (-1); } - stream_printf(dest, "\n"); /* Write out desc. */ - stream_printf(dest, "desc\n@@"); + if (stream_printf(dest, "\ndesc\n@@") < 0) + return (-1); d = LIST_FIRST(&rf->trunk->deltalist); /* Write out deltatexts. */ error = rcsfile_write_deltatext(rf, dest); - stream_printf(dest, "\n"); + if (stream_printf(dest, "\n") < 0) + return (-1); return (error); } @@ -438,21 +465,25 @@ rcsfile_write_deltatext(struct rcsfile * /* Do not write out placeholders just to be safe. */ if (d->placeholder) return (0); - stream_printf(dest, "\n\n\n%s\n", d->revnum); - stream_printf(dest, "log\n@"); + if (stream_printf(dest, "\n\n\n%s\n", d->revnum) < 0) + return (-1); + if (stream_printf(dest, "log\n@") < 0) + return (-1); in = stream_open_buf(d->log); line = stream_getln(in, &size); while (line != NULL) { - stream_write(dest, line, size); + if (stream_write(dest, line, size) == -1) + return (-1); line = stream_getln(in, &size); } stream_close(in); - stream_printf(dest, "@\n"); - stream_printf(dest, "text\n@"); + if (stream_printf(dest, "@\ntext\n@") < 0) + return (-1); error = rcsfile_puttext(rf, dest, d, d->prev); if (error) return (error); - stream_printf(dest, "@"); + if (stream_printf(dest, "@") < 0) + return (-1); LIST_INIT(&branchlist_datesorted); d_next = LIST_NEXT(d, delta_next); @@ -535,7 +566,10 @@ rcsfile_puttext(struct rcsfile *rf, stru in = stream_open_buf(d->text); line = stream_getln(in, &size); while (line != NULL) { - stream_write(dest, line, size); + if (stream_write(dest, line, size) == -1) { + error = -1; + goto cleanup; + } line = stream_getln(in, &size); } stream_close(in); @@ -549,7 +583,10 @@ rcsfile_puttext(struct rcsfile *rf, stru } line = stream_getln(orig, &size); while (line != NULL) { - stream_write(dest, line, size); + if (stream_write(dest, line, size) == -1) { + error = -1; + goto cleanup; + } line = stream_getln(orig, &size); } stream_close(orig); @@ -1261,6 +1298,7 @@ int rcsdelta_addlog(struct delta *d, char *log, int len) { struct stream *dest; + int nbytes; assert(d != NULL); /* Strip away '@' at beginning and end. */ @@ -1268,9 +1306,9 @@ rcsdelta_addlog(struct delta *d, char *l len--; log[len - 1] = '\0'; dest = stream_open_buf(d->log); - stream_write(dest, log, len - 1); + nbytes = stream_write(dest, log, len - 1); stream_close(dest); - return (0); + return ((nbytes == -1) ? -1 : 0); } /* Add deltatext to a delta. Assume the delta already exists. */ @@ -1278,6 +1316,7 @@ int rcsdelta_addtext(struct delta *d, char *text, int len) { struct stream *dest; + int nbytes; assert(d != NULL); /* Strip away '@' at beginning and end. */ @@ -1286,36 +1325,40 @@ rcsdelta_addtext(struct delta *d, char * text[len - 1] = '\0'; dest = stream_open_buf(d->text); - stream_write(dest, text, len - 1); + nbytes = stream_write(dest, text, len - 1); stream_close(dest); - return (0); + return ((nbytes == -1) ? -1 : 0); } /* Add a deltatext logline to a delta. */ -void +int rcsdelta_appendlog(struct delta *d, char *logline, size_t size) { struct stream *dest; + int error; assert(d != NULL); dest = stream_open_buf(d->log); - rcsdelta_writestring(logline, size, dest); + error = rcsdelta_writestring(logline, size, dest); stream_close(dest); + return (error); } /* Add a deltatext textline to a delta. */ -void +int rcsdelta_appendtext(struct delta *d, char *textline, size_t size) { struct stream *dest; + int error; assert(d != NULL); dest = stream_open_buf(d->text); - rcsdelta_writestring(textline, size, dest); + error = rcsdelta_writestring(textline, size, dest); stream_close(dest); + return (error); } -static void +static int rcsdelta_writestring(char *textline, size_t size, struct stream *dest) { char buf[3]; @@ -1332,8 +1375,10 @@ rcsdelta_writestring(char *textline, siz buf[2] = '\0'; count = 2; } - stream_write(dest, buf, count); + if (stream_write(dest, buf, count) == -1) + return (-1); } + return (0); } /* Set delta state. */ Modified: stable/7/contrib/csup/rcsfile.h ============================================================================== --- stable/7/contrib/csup/rcsfile.h Fri Apr 3 13:35:54 2009 (r190670) +++ stable/7/contrib/csup/rcsfile.h Fri Apr 3 16:02:13 2009 (r190671) @@ -65,8 +65,8 @@ void rcsfile_importdelta(struct rcsfil int rcsdelta_addlog(struct delta *, char *, int); int rcsdelta_addtext(struct delta *, char *, int); -void rcsdelta_appendlog(struct delta *, char *, size_t); -void rcsdelta_appendtext(struct delta *, char *, size_t); +int rcsdelta_appendlog(struct delta *, char *, size_t); +int rcsdelta_appendtext(struct delta *, char *, size_t); void rcsdelta_setstate(struct delta *, char *); void rcsdelta_truncatetext(struct delta *, off_t); void rcsdelta_truncatelog(struct delta *, off_t); Modified: stable/7/contrib/csup/rcsparse.c ============================================================================== --- stable/7/contrib/csup/rcsparse.c Fri Apr 3 13:35:54 2009 (r190670) +++ stable/7/contrib/csup/rcsparse.c Fri Apr 3 16:02:13 2009 (r190671) @@ -309,7 +309,7 @@ parse_deltatexts(struct rcsfile *rf, yys error = 0; /* In case we don't have deltatexts. */ if (token != NUM) - return (token); + return (-1); do { /* num */ assert(token == NUM); Modified: stable/7/contrib/csup/updater.c ============================================================================== --- stable/7/contrib/csup/updater.c Fri Apr 3 13:35:54 2009 (r190670) +++ stable/7/contrib/csup/updater.c Fri Apr 3 16:02:13 2009 (r190671) @@ -1385,8 +1385,11 @@ updater_addfile(struct updater *up, stru do { nread = stream_read(up->rd, buf, (BUFSIZE > remains ? remains : BUFSIZE)); + if (nread == -1) + return (UPDATER_ERR_PROTO); remains -= nread; - stream_write(to, buf, nread); + if (stream_write(to, buf, nread) == -1) + goto bad; } while (remains > 0); stream_close(to); line = stream_getln(up->rd, NULL); @@ -1411,9 +1414,11 @@ updater_addfile(struct updater *up, stru FA_MODTIME | FA_MASK); error = updater_updatefile(up, fup, md5, isfixup); fup->wantmd5 = NULL; /* So that it doesn't get freed. */ - if (error) - return (error); - return (0); + return (error); +bad: + xasprintf(&up->errmsg, "%s: Cannot write: %s", fup->temppath, + strerror(errno)); + return (UPDATER_ERR_MSG); } static int @@ -1469,7 +1474,9 @@ updater_checkout(struct updater *up, str if (nbytes == -1) goto bad; } - stream_write(to, line, size); + nbytes = stream_write(to, line, size); + if (nbytes == -1) + goto bad; line = stream_getln(up->rd, &size); first = 0; } @@ -1682,8 +1689,11 @@ updater_rcsedit(struct updater *up, stru error = rcsfile_write(rf, dest); stream_close(dest); rcsfile_free(rf); - if (error) - lprintf(-1, "Error writing %s\n", name); + if (error) { + xasprintf(&up->errmsg, "%s: Cannot write: %s", fup->temppath, + strerror(errno)); + return (UPDATER_ERR_MSG); + } finish: sr->sr_clientattr = fattr_frompath(path, FATTR_NOFOLLOW); @@ -1768,7 +1778,9 @@ updater_addelta(struct rcsfile *rf, stru size--; logline++; } - rcsdelta_appendlog(d, logline, size); + if (rcsdelta_appendlog(d, logline, size) + < 0) + return (-1); logline = stream_getln(rd, &size); } break; @@ -1799,7 +1811,9 @@ updater_addelta(struct rcsfile *rf, stru size--; textline++; } - rcsdelta_appendtext(d, textline, size); + if (rcsdelta_appendtext(d, textline, + size) < 0) + return (-1); textline = stream_getln(rd, &size); } break; @@ -1839,8 +1853,15 @@ updater_append_file(struct updater *up, stream_filter_start(to, STREAM_FILTER_MD5, md5); /* First write the existing content. */ - while ((nread = read(fd, buf, BUFSIZE)) > 0) - stream_write(to, buf, nread); + while ((nread = read(fd, buf, BUFSIZE)) > 0) { + if (stream_write(to, buf, nread) == -1) + goto bad; + } + if (nread == -1) { + xasprintf(&up->errmsg, "%s: Error reading: %s", + strerror(errno)); + return (UPDATER_ERR_MSG); + } close(fd); bytes = fattr_filesize(fa) - pos; @@ -1848,8 +1869,11 @@ updater_append_file(struct updater *up, do { nread = stream_read(up->rd, buf, (BUFSIZE > bytes) ? bytes : BUFSIZE); + if (nread == -1) + return (UPDATER_ERR_PROTO); bytes -= nread; - stream_write(to, buf, nread); + if (stream_write(to, buf, nread) == -1) + goto bad; } while (bytes > 0); stream_close(to); @@ -1875,9 +1899,11 @@ updater_append_file(struct updater *up, FA_MODTIME | FA_MASK); error = updater_updatefile(up, fup, md5, 0); fup->wantmd5 = NULL; /* So that it doesn't get freed. */ - if (error) - return (error); - return (0); + return (error); +bad: + xasprintf(&up->errmsg, "%s: Cannot write: %s", fup->temppath, + strerror(errno)); + return (UPDATER_ERR_MSG); } /* From sam at FreeBSD.org Fri Apr 3 11:00:20 2009 From: sam at FreeBSD.org (Sam Leffler) Date: Fri Apr 3 11:00:27 2009 Subject: svn commit: r190672 - head/sys/net80211 Message-ID: <200904031800.n33I0JlC029063@svn.freebsd.org> Author: sam Date: Fri Apr 3 18:00:19 2009 New Revision: 190672 URL: http://svn.freebsd.org/changeset/base/190672 Log: o update dwds mcast handling after hoisting ieee80211_encap: frames need to be encapsulated before dispatching to the driver o eliminate M_WDS now that we call ieee80211_encap directly and can supply the wds vap to indicate a 4-address frame should be created Modified: head/sys/net80211/ieee80211_freebsd.h head/sys/net80211/ieee80211_output.c head/sys/net80211/ieee80211_wds.c Modified: head/sys/net80211/ieee80211_freebsd.h ============================================================================== --- head/sys/net80211/ieee80211_freebsd.h Fri Apr 3 16:02:13 2009 (r190671) +++ head/sys/net80211/ieee80211_freebsd.h Fri Apr 3 18:00:19 2009 (r190672) @@ -211,7 +211,6 @@ struct mbuf *ieee80211_getmgtframe(uint8 /* tx path usage */ #define M_ENCAP M_PROTO1 /* 802.11 encap done */ -#define M_WDS M_PROTO2 /* WDS frame */ #define M_EAPOL M_PROTO3 /* PAE/EAPOL frame */ #define M_PWR_SAV M_PROTO4 /* bypass PS handling */ #define M_MORE_DATA M_PROTO5 /* more data frames to follow */ @@ -219,7 +218,7 @@ struct mbuf *ieee80211_getmgtframe(uint8 #define M_TXCB M_PROTO7 /* do tx complete callback */ #define M_AMPDU_MPDU M_PROTO8 /* ok for A-MPDU aggregation */ #define M_80211_TX \ - (M_FRAG|M_FIRSTFRAG|M_LASTFRAG|M_ENCAP|M_WDS|M_EAPOL|M_PWR_SAV|\ + (M_FRAG|M_FIRSTFRAG|M_LASTFRAG|M_ENCAP|M_EAPOL|M_PWR_SAV|\ M_MORE_DATA|M_FF|M_TXCB|M_AMPDU_MPDU) /* rx path usage */ Modified: head/sys/net80211/ieee80211_output.c ============================================================================== --- head/sys/net80211/ieee80211_output.c Fri Apr 3 16:02:13 2009 (r190671) +++ head/sys/net80211/ieee80211_output.c Fri Apr 3 18:00:19 2009 (r190672) @@ -919,12 +919,11 @@ ieee80211_encap(struct ieee80211vap *vap hdrsize = sizeof(struct ieee80211_frame); /* * 4-address frames need to be generated for: - * o packets sent through a WDS vap (M_WDS || IEEE80211_M_WDS) + * o packets sent through a WDS vap (IEEE80211_M_WDS) * o packets relayed by a station operating with dynamic WDS * (IEEE80211_M_STA+IEEE80211_F_DWDS and src address) */ - is4addr = (m->m_flags & M_WDS) || - vap->iv_opmode == IEEE80211_M_WDS || /* XXX redundant? */ + is4addr = vap->iv_opmode == IEEE80211_M_WDS || (vap->iv_opmode == IEEE80211_M_STA && (vap->iv_flags & IEEE80211_F_DWDS) && !IEEE80211_ADDR_EQ(eh.ether_shost, vap->iv_myaddr)); Modified: head/sys/net80211/ieee80211_wds.c ============================================================================== --- head/sys/net80211/ieee80211_wds.c Fri Apr 3 16:02:13 2009 (r190671) +++ head/sys/net80211/ieee80211_wds.c Fri Apr 3 18:00:19 2009 (r190672) @@ -250,9 +250,7 @@ ieee80211_dwds_mcast(struct ieee80211vap if (ifp == m->m_pkthdr.rcvif) continue; /* - * Duplicate the frame and send it. We don't need - * to classify or lookup the tx node; this was already - * done by the caller so we can just re-use the info. + * Duplicate the frame and send it. */ mcopy = m_copypacket(m, M_DONTWAIT); if (mcopy == NULL) { @@ -267,6 +265,7 @@ ieee80211_dwds_mcast(struct ieee80211vap m_freem(mcopy); continue; } + /* calculate priority so drivers can find the tx queue */ if (ieee80211_classify(ni, mcopy)) { IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_OUTPUT | IEEE80211_MSG_WDS, @@ -278,7 +277,16 @@ ieee80211_dwds_mcast(struct ieee80211vap ieee80211_free_node(ni); continue; } - mcopy->m_flags |= M_MCAST | M_WDS; + /* + * Encapsulate the packet in prep for transmission. + */ + mcopy = ieee80211_encap(vap, ni, mcopy); + if (m == NULL) { + /* NB: stat+msg handled in ieee80211_encap */ + ieee80211_free_node(ni); + continue; + } + mcopy->m_flags |= M_MCAST; mcopy->m_pkthdr.rcvif = (void *) ni; err = parent->if_transmit(parent, mcopy); From kib at FreeBSD.org Fri Apr 3 12:17:25 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Fri Apr 3 12:17:37 2009 Subject: svn commit: r190673 - in head: lib/libc/gen libexec/rtld-elf Message-ID: <200904031917.n33JHOMr030710@svn.freebsd.org> Author: kib Date: Fri Apr 3 19:17:23 2009 New Revision: 190673 URL: http://svn.freebsd.org/changeset/base/190673 Log: Allow the NULL, RTLD_SELF and RTLD_NEXT handles to work with dlfunc(3). dlfunc() called dlsym() to do the work, and dlsym() determines the dso that originating the call by the return address. Due to this, dlfunc() operated as if the caller is always the libc. To fix this, move the dlfunc() to rtld, where it can call the internal implementation of dlsym, and still correctly fetch return address. Provide usual weak stub for the symbol from libc for static binaries. dlfunc is put to FBSD_1.0 symver namespace in the ld.so export to override dlfunc@FBSD_1.0 weak symbol, exported by libc. Reported, analyzed and tested by: Tijl Coosemans PR: standards/133339 Reviewed by: kan Deleted: head/lib/libc/gen/dlfunc.c Modified: head/lib/libc/gen/Makefile.inc head/lib/libc/gen/dlfcn.c head/libexec/rtld-elf/Symbol.map head/libexec/rtld-elf/rtld.c Modified: head/lib/libc/gen/Makefile.inc ============================================================================== --- head/lib/libc/gen/Makefile.inc Fri Apr 3 18:00:19 2009 (r190672) +++ head/lib/libc/gen/Makefile.inc Fri Apr 3 19:17:23 2009 (r190673) @@ -9,7 +9,7 @@ SRCS+= __getosreldate.c __xuname.c \ alarm.c arc4random.c assert.c basename.c check_utility_compat.c \ clock.c closedir.c confstr.c \ crypt.c ctermid.c daemon.c devname.c dirname.c disklabel.c \ - dlfcn.c dlfunc.c drand48.c erand48.c err.c errlst.c errno.c \ + dlfcn.c drand48.c erand48.c err.c errlst.c errno.c \ exec.c fdevname.c feature_present.c fmtcheck.c fmtmsg.c fnmatch.c \ fpclassify.c frexp.c fstab.c ftok.c fts.c fts-compat.c ftw.c \ getbootfile.c getbsize.c \ Modified: head/lib/libc/gen/dlfcn.c ============================================================================== --- head/lib/libc/gen/dlfcn.c Fri Apr 3 18:00:19 2009 (r190672) +++ head/lib/libc/gen/dlfcn.c Fri Apr 3 19:17:23 2009 (r190673) @@ -105,6 +105,14 @@ dlsym(void * __restrict handle, const ch return NULL; } +#pragma weak dlfunc +dlfunc_t +dlfunc(void * __restrict handle, const char * __restrict name) +{ + _rtld_error(sorry); + return NULL; +} + #pragma weak dlvsym void * dlvsym(void * __restrict handle, const char * __restrict name, Modified: head/libexec/rtld-elf/Symbol.map ============================================================================== --- head/libexec/rtld-elf/Symbol.map Fri Apr 3 18:00:19 2009 (r190672) +++ head/libexec/rtld-elf/Symbol.map Fri Apr 3 19:17:23 2009 (r190673) @@ -8,6 +8,7 @@ FBSD_1.0 { dlerror; dlopen; dlsym; + dlfunc; dlvsym; dladdr; dllockinit; Modified: head/libexec/rtld-elf/rtld.c ============================================================================== --- head/libexec/rtld-elf/rtld.c Fri Apr 3 18:00:19 2009 (r190672) +++ head/libexec/rtld-elf/rtld.c Fri Apr 3 19:17:23 2009 (r190673) @@ -200,6 +200,7 @@ static func_ptr_type exports[] = { (func_ptr_type) &dlerror, (func_ptr_type) &dlopen, (func_ptr_type) &dlsym, + (func_ptr_type) &dlfunc, (func_ptr_type) &dlvsym, (func_ptr_type) &dladdr, (func_ptr_type) &dllockinit, @@ -2170,6 +2171,19 @@ dlsym(void *handle, const char *name) SYMLOOK_DLSYM); } +dlfunc_t +dlfunc(void *handle, const char *name) +{ + union { + void *d; + dlfunc_t f; + } rv; + + rv.d = do_dlsym(handle, name, __builtin_return_address(0), NULL, + SYMLOOK_DLSYM); + return (rv.f); +} + void * dlvsym(void *handle, const char *name, const char *version) { From rnoland at FreeBSD.org Fri Apr 3 12:21:43 2009 From: rnoland at FreeBSD.org (Robert Noland) Date: Fri Apr 3 12:21:54 2009 Subject: svn commit: r190674 - head/sys/dev/drm Message-ID: <200904031921.n33JLdtJ030829@svn.freebsd.org> Author: rnoland Date: Fri Apr 3 19:21:39 2009 New Revision: 190674 URL: http://svn.freebsd.org/changeset/base/190674 Log: A little more cleanup from AMD, if we don't have the right microcode there is no reason to mess with the chip. MFC after: 3 days Modified: head/sys/dev/drm/r600_cp.c head/sys/dev/drm/radeon_cp.c Modified: head/sys/dev/drm/r600_cp.c ============================================================================== --- head/sys/dev/drm/r600_cp.c Fri Apr 3 19:17:23 2009 (r190673) +++ head/sys/dev/drm/r600_cp.c Fri Apr 3 19:21:39 2009 (r190674) @@ -286,20 +286,6 @@ static void r600_cp_load_microcode(drm_r const u32 *pfp; int i; - r600_do_cp_stop(dev_priv); - - RADEON_WRITE(R600_CP_RB_CNTL, - R600_RB_NO_UPDATE | - R600_RB_BLKSZ(15) | - R600_RB_BUFSZ(3)); - - RADEON_WRITE(R600_GRBM_SOFT_RESET, R600_SOFT_RESET_CP); - RADEON_READ(R600_GRBM_SOFT_RESET); - DRM_UDELAY(15000); - RADEON_WRITE(R600_GRBM_SOFT_RESET, 0); - - RADEON_WRITE(R600_CP_ME_RAM_WADDR, 0); - switch (dev_priv->flags & RADEON_FAMILY_MASK) { case CHIP_R600: DRM_INFO("Loading R600 Microcode\n"); @@ -337,19 +323,32 @@ static void r600_cp_load_microcode(drm_r pfp = RS780_pfp_microcode; break; default: - goto no_microcode; + return; } - for (i = 0; i != PM4_UCODE_SIZE; i++) { + r600_do_cp_stop(dev_priv); + + RADEON_WRITE(R600_CP_RB_CNTL, + R600_RB_NO_UPDATE | + R600_RB_BLKSZ(15) | + R600_RB_BUFSZ(3)); + + RADEON_WRITE(R600_GRBM_SOFT_RESET, R600_SOFT_RESET_CP); + RADEON_READ(R600_GRBM_SOFT_RESET); + DRM_UDELAY(15000); + RADEON_WRITE(R600_GRBM_SOFT_RESET, 0); + + RADEON_WRITE(R600_CP_ME_RAM_WADDR, 0); + + for (i = 0; i < PM4_UCODE_SIZE; i++) { RADEON_WRITE(R600_CP_ME_RAM_DATA, cp[i][0]); RADEON_WRITE(R600_CP_ME_RAM_DATA, cp[i][1]); RADEON_WRITE(R600_CP_ME_RAM_DATA, cp[i][2]); } RADEON_WRITE(R600_CP_PFP_UCODE_ADDR, 0); - for (i = 0; i != PFP_UCODE_SIZE; i++) + for (i = 0; i < PFP_UCODE_SIZE; i++) RADEON_WRITE(R600_CP_PFP_UCODE_DATA, pfp[i]); -no_microcode:; RADEON_WRITE(R600_CP_PFP_UCODE_ADDR, 0); RADEON_WRITE(R600_CP_ME_RAM_WADDR, 0); @@ -415,21 +414,9 @@ static void r700_cp_load_microcode(drm_r const u32 *cp; int i; - r600_do_cp_stop(dev_priv); - - RADEON_WRITE(R600_CP_RB_CNTL, - R600_RB_NO_UPDATE | - (15 << 8) | - (3 << 0)); - - RADEON_WRITE(R600_GRBM_SOFT_RESET, R600_SOFT_RESET_CP); - RADEON_READ(R600_GRBM_SOFT_RESET); - DRM_UDELAY(15000); - RADEON_WRITE(R600_GRBM_SOFT_RESET, 0); - switch (dev_priv->flags & RADEON_FAMILY_MASK) { case CHIP_RV770: - DRM_INFO("Loading RV770 Microcode\n"); + DRM_INFO("Loading RV770/RV790 Microcode\n"); pfp = RV770_pfp_microcode; cp = RV770_cp_microcode; break; @@ -444,19 +431,30 @@ static void r700_cp_load_microcode(drm_r cp = RV710_cp_microcode; break; default: - goto no_microcode; + return; } + r600_do_cp_stop(dev_priv); + + RADEON_WRITE(R600_CP_RB_CNTL, + R600_RB_NO_UPDATE | + (15 << 8) | + (3 << 0)); + + RADEON_WRITE(R600_GRBM_SOFT_RESET, R600_SOFT_RESET_CP); + RADEON_READ(R600_GRBM_SOFT_RESET); + DRM_UDELAY(15000); + RADEON_WRITE(R600_GRBM_SOFT_RESET, 0); + RADEON_WRITE(R600_CP_PFP_UCODE_ADDR, 0); - for (i = 0; i != R700_PFP_UCODE_SIZE; i++) + for (i = 0; i < R700_PFP_UCODE_SIZE; i++) RADEON_WRITE(R600_CP_PFP_UCODE_DATA, pfp[i]); RADEON_WRITE(R600_CP_PFP_UCODE_ADDR, 0); RADEON_WRITE(R600_CP_ME_RAM_WADDR, 0); - for (i = 0; i != R700_PM4_UCODE_SIZE; i++) + for (i = 0; i < R700_PM4_UCODE_SIZE; i++) RADEON_WRITE(R600_CP_ME_RAM_DATA, cp[i]); RADEON_WRITE(R600_CP_ME_RAM_WADDR, 0); -no_microcode:; RADEON_WRITE(R600_CP_PFP_UCODE_ADDR, 0); RADEON_WRITE(R600_CP_ME_RAM_WADDR, 0); Modified: head/sys/dev/drm/radeon_cp.c ============================================================================== --- head/sys/dev/drm/radeon_cp.c Fri Apr 3 19:17:23 2009 (r190673) +++ head/sys/dev/drm/radeon_cp.c Fri Apr 3 19:21:39 2009 (r190674) @@ -460,9 +460,6 @@ static void radeon_cp_load_microcode(drm DRM_DEBUG("\n"); - radeon_do_wait_for_idle(dev_priv); - - RADEON_WRITE(RADEON_CP_ME_RAM_ADDR, 0); switch (dev_priv->flags & RADEON_FAMILY_MASK) { case CHIP_R100: case CHIP_RV100: @@ -516,6 +513,10 @@ static void radeon_cp_load_microcode(drm return; } + radeon_do_wait_for_idle(dev_priv); + + RADEON_WRITE(RADEON_CP_ME_RAM_ADDR, 0); + for (i = 0; i != 256; i++) { RADEON_WRITE(RADEON_CP_ME_RAM_DATAH, cp[i][1]); RADEON_WRITE(RADEON_CP_ME_RAM_DATAL, cp[i][0]); From rnoland at FreeBSD.org Fri Apr 3 12:23:14 2009 From: rnoland at FreeBSD.org (Robert Noland) Date: Fri Apr 3 12:23:25 2009 Subject: svn commit: r190675 - head/sys/dev/drm Message-ID: <200904031923.n33JNEq7030910@svn.freebsd.org> Author: rnoland Date: Fri Apr 3 19:23:14 2009 New Revision: 190675 URL: http://svn.freebsd.org/changeset/base/190675 Log: Add support for RV790 (HD 4890) asics MFC after: 3 days Modified: head/sys/dev/drm/drm_pciids.h Modified: head/sys/dev/drm/drm_pciids.h ============================================================================== --- head/sys/dev/drm/drm_pciids.h Fri Apr 3 19:21:39 2009 (r190674) +++ head/sys/dev/drm/drm_pciids.h Fri Apr 3 19:23:14 2009 (r190675) @@ -336,6 +336,8 @@ {0x1002, 0x944B, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon HD 4850 X2"}, \ {0x1002, 0x945A, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon HD 4870"}, \ {0x1002, 0x945B, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon M98"}, \ + {0x1002, 0x9460, CHIP_RV770|RADEON_NEW_MEMMAP, "ATI Radeon 4800 Series"}, \ + {0x1002, 0x9462, CHIP_RV770|RADEON_NEW_MEMMAP, "ATI Radeon 4800 Series"}, \ {0x1002, 0x946A, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI FirePro M7750"}, \ {0x1002, 0x946B, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI M98"}, \ {0x1002, 0x947A, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI M98"}, \ From thompsa at FreeBSD.org Fri Apr 3 12:46:13 2009 From: thompsa at FreeBSD.org (Andrew Thompson) Date: Fri Apr 3 12:46:20 2009 Subject: svn commit: r190676 - in head/sys: cddl/contrib/opensolaris/uts/common/fs/zfs dev/pccbb dev/usb/controller geom/journal geom/mirror geom/part geom/raid3 kern sys Message-ID: <200904031946.n33JkCU7031404@svn.freebsd.org> Author: thompsa Date: Fri Apr 3 19:46:12 2009 New Revision: 190676 URL: http://svn.freebsd.org/changeset/base/190676 Log: Add a how argument to root_mount_hold() so it can be passed NOWAIT and be called in situations where sleeping isnt allowed. Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c head/sys/dev/pccbb/pccbb_pci.c head/sys/dev/usb/controller/usb_controller.c head/sys/geom/journal/g_journal.c head/sys/geom/mirror/g_mirror.c head/sys/geom/part/g_part.c head/sys/geom/raid3/g_raid3.c head/sys/kern/vfs_mount.c head/sys/sys/systm.h Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Fri Apr 3 19:23:14 2009 (r190675) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Fri Apr 3 19:46:12 2009 (r190676) @@ -3087,7 +3087,7 @@ zfs_modevent(module_t mod, int type, voi error = EOPNOTSUPP; switch (type) { case MOD_LOAD: - zfs_root_token = root_mount_hold("ZFS"); + zfs_root_token = root_mount_hold("ZFS", M_WAITOK); printf("WARNING: ZFS is considered to be an experimental " "feature in FreeBSD.\n"); TASK_INIT(&zfs_start_task, 0, zfs_start, NULL); Modified: head/sys/dev/pccbb/pccbb_pci.c ============================================================================== --- head/sys/dev/pccbb/pccbb_pci.c Fri Apr 3 19:23:14 2009 (r190675) +++ head/sys/dev/pccbb/pccbb_pci.c Fri Apr 3 19:46:12 2009 (r190676) @@ -439,7 +439,7 @@ cbb_pci_attach(device_t brdev) device_printf(brdev, "unable to create event thread.\n"); panic("cbb_create_event_thread"); } - sc->sc_root_token = root_mount_hold(device_get_nameunit(sc->dev)); + sc->sc_root_token = root_mount_hold(device_get_nameunit(sc->dev), M_WAITOK); return (0); err: if (sc->irq_res) Modified: head/sys/dev/usb/controller/usb_controller.c ============================================================================== --- head/sys/dev/usb/controller/usb_controller.c Fri Apr 3 19:23:14 2009 (r190675) +++ head/sys/dev/usb/controller/usb_controller.c Fri Apr 3 19:46:12 2009 (r190676) @@ -115,7 +115,7 @@ usb2_attach(device_t dev) } /* delay vfs_mountroot until the bus is explored */ - bus->bus_roothold = root_mount_hold(device_get_nameunit(dev)); + bus->bus_roothold = root_mount_hold(device_get_nameunit(dev), M_WAITOK); if (usb2_post_init_called) { mtx_lock(&Giant); Modified: head/sys/geom/journal/g_journal.c ============================================================================== --- head/sys/geom/journal/g_journal.c Fri Apr 3 19:23:14 2009 (r190675) +++ head/sys/geom/journal/g_journal.c Fri Apr 3 19:46:12 2009 (r190676) @@ -2310,7 +2310,7 @@ g_journal_create(struct g_class *mp, str sc->sc_inactive.jj_queue = NULL; sc->sc_active.jj_queue = NULL; - sc->sc_rootmount = root_mount_hold("GJOURNAL"); + sc->sc_rootmount = root_mount_hold("GJOURNAL", M_WAITOK); GJ_DEBUG(1, "root_mount_hold %p", sc->sc_rootmount); callout_init(&sc->sc_callout, CALLOUT_MPSAFE); Modified: head/sys/geom/mirror/g_mirror.c ============================================================================== --- head/sys/geom/mirror/g_mirror.c Fri Apr 3 19:23:14 2009 (r190675) +++ head/sys/geom/mirror/g_mirror.c Fri Apr 3 19:46:12 2009 (r190676) @@ -2907,7 +2907,7 @@ g_mirror_create(struct g_class *mp, cons G_MIRROR_DEBUG(1, "Device %s created (%u components, id=%u).", sc->sc_name, sc->sc_ndisks, sc->sc_id); - sc->sc_rootmount = root_mount_hold("GMIRROR"); + sc->sc_rootmount = root_mount_hold("GMIRROR", M_WAITOK); G_MIRROR_DEBUG(1, "root_mount_hold %p", sc->sc_rootmount); /* * Run timeout. Modified: head/sys/geom/part/g_part.c ============================================================================== --- head/sys/geom/part/g_part.c Fri Apr 3 19:23:14 2009 (r190675) +++ head/sys/geom/part/g_part.c Fri Apr 3 19:46:12 2009 (r190676) @@ -1474,7 +1474,7 @@ g_part_taste(struct g_class *mp, struct return (NULL); } - rht = root_mount_hold(mp->name); + rht = root_mount_hold(mp->name, M_WAITOK); g_topology_unlock(); /* Modified: head/sys/geom/raid3/g_raid3.c ============================================================================== --- head/sys/geom/raid3/g_raid3.c Fri Apr 3 19:23:14 2009 (r190675) +++ head/sys/geom/raid3/g_raid3.c Fri Apr 3 19:46:12 2009 (r190676) @@ -3193,7 +3193,7 @@ g_raid3_create(struct g_class *mp, const G_RAID3_DEBUG(1, "Device %s created (%u components, id=%u).", sc->sc_name, sc->sc_ndisks, sc->sc_id); - sc->sc_rootmount = root_mount_hold("GRAID3"); + sc->sc_rootmount = root_mount_hold("GRAID3", M_WAITOK); G_RAID3_DEBUG(1, "root_mount_hold %p", sc->sc_rootmount); /* Modified: head/sys/kern/vfs_mount.c ============================================================================== --- head/sys/kern/vfs_mount.c Fri Apr 3 19:23:14 2009 (r190675) +++ head/sys/kern/vfs_mount.c Fri Apr 3 19:46:12 2009 (r190676) @@ -1353,14 +1353,18 @@ static int root_mount_complete; * Hold root mount. */ struct root_hold_token * -root_mount_hold(const char *identifier) +root_mount_hold(const char *identifier, int how) { struct root_hold_token *h; if (root_mounted()) return (NULL); - h = malloc(sizeof *h, M_DEVBUF, M_ZERO | M_WAITOK); + h = malloc(sizeof *h, M_DEVBUF, M_ZERO | how); + if (h == NULL) { + printf("Unable to alloc root hold token for %s\n", identifier); + return (NULL); + } h->who = identifier; mtx_lock(&mountlist_mtx); LIST_INSERT_HEAD(&root_holds, h, list); Modified: head/sys/sys/systm.h ============================================================================== --- head/sys/sys/systm.h Fri Apr 3 19:23:14 2009 (r190675) +++ head/sys/sys/systm.h Fri Apr 3 19:46:12 2009 (r190676) @@ -325,7 +325,7 @@ void DELAY(int usec); /* Root mount holdback API */ struct root_hold_token; -struct root_hold_token *root_mount_hold(const char *identifier); +struct root_hold_token *root_mount_hold(const char *identifier, int how); void root_mount_rel(struct root_hold_token *h); void root_mount_wait(void); int root_mounted(void); From thompsa at FreeBSD.org Fri Apr 3 12:49:34 2009 From: thompsa at FreeBSD.org (Andrew Thompson) Date: Fri Apr 3 12:49:51 2009 Subject: svn commit: r190677 - in head/sys: cam geom Message-ID: <200904031949.n33JnXfP031500@svn.freebsd.org> Author: thompsa Date: Fri Apr 3 19:49:33 2009 New Revision: 190677 URL: http://svn.freebsd.org/changeset/base/190677 Log: Add interleaving root hold tokens from the CAM probe to disk_create and geom provider tasting. This is needed for disk attachments that happen after threads are running in the boot process. Tested by: rnoland Modified: head/sys/cam/cam_xpt.c head/sys/geom/geom.h head/sys/geom/geom_disk.c head/sys/geom/geom_disk.h head/sys/geom/geom_subr.c Modified: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Fri Apr 3 19:46:12 2009 (r190676) +++ head/sys/cam/cam_xpt.c Fri Apr 3 19:49:33 2009 (r190677) @@ -5139,6 +5139,7 @@ xpt_find_device(struct cam_et *target, l typedef struct { union ccb *request_ccb; struct ccb_pathinq *cpi; + struct root_hold_token *roothold; int counter; } xpt_scan_bus_info; @@ -5201,6 +5202,7 @@ xpt_scan_bus(struct cam_periph *periph, } scan_info->request_ccb = request_ccb; scan_info->cpi = &work_ccb->cpi; + scan_info->roothold = root_mount_hold("CAM", M_NOWAIT); /* Cache on our stack so we can work asynchronously */ max_target = scan_info->cpi->max_target; @@ -5232,6 +5234,7 @@ xpt_scan_bus(struct cam_periph *periph, printf("xpt_scan_bus: xpt_create_path failed" " with status %#x, bus scan halted\n", status); + root_mount_rel(scan_info->roothold); free(scan_info, M_CAMXPT); request_ccb->ccb_h.status = status; xpt_free_ccb(work_ccb); @@ -5240,6 +5243,7 @@ xpt_scan_bus(struct cam_periph *periph, } work_ccb = xpt_alloc_ccb_nowait(); if (work_ccb == NULL) { + root_mount_rel(scan_info->roothold); free(scan_info, M_CAMXPT); xpt_free_path(path); request_ccb->ccb_h.status = CAM_RESRC_UNAVAIL; @@ -5353,6 +5357,7 @@ xpt_scan_bus(struct cam_periph *periph, xpt_free_ccb(request_ccb); xpt_free_ccb((union ccb *)scan_info->cpi); request_ccb = scan_info->request_ccb; + root_mount_rel(scan_info->roothold); free(scan_info, M_CAMXPT); request_ccb->ccb_h.status = CAM_REQ_CMP; xpt_done(request_ccb); @@ -5372,6 +5377,7 @@ xpt_scan_bus(struct cam_periph *periph, xpt_free_ccb(request_ccb); xpt_free_ccb((union ccb *)scan_info->cpi); request_ccb = scan_info->request_ccb; + root_mount_rel(scan_info->roothold); free(scan_info, M_CAMXPT); request_ccb->ccb_h.status = status; xpt_done(request_ccb); Modified: head/sys/geom/geom.h ============================================================================== --- head/sys/geom/geom.h Fri Apr 3 19:46:12 2009 (r190676) +++ head/sys/geom/geom.h Fri Apr 3 19:49:33 2009 (r190677) @@ -193,6 +193,8 @@ struct g_provider { /* Two fields for the implementing class to use */ void *private; u_int index; + + struct root_hold_token *roothold; }; /* geom_dev.c */ Modified: head/sys/geom/geom_disk.c ============================================================================== --- head/sys/geom/geom_disk.c Fri Apr 3 19:46:12 2009 (r190676) +++ head/sys/geom/geom_disk.c Fri Apr 3 19:49:33 2009 (r190677) @@ -381,6 +381,7 @@ g_disk_create(void *arg, int flag) printf("GEOM: new disk %s\n", gp->name); dp->d_geom = gp; g_error_provider(pp, 0); + root_mount_rel(dp->d_roothold); } static void @@ -467,6 +468,7 @@ disk_create(struct disk *dp, int version dp->d_sectorsize, DEVSTAT_ALL_SUPPORTED, DEVSTAT_TYPE_DIRECT, DEVSTAT_PRIORITY_MAX); dp->d_geom = NULL; + dp->d_roothold = root_mount_hold(dp->d_name, M_WAITOK); g_disk_ident_adjust(dp->d_ident, sizeof(dp->d_ident)); g_post_event(g_disk_create, dp, M_WAITOK, dp, NULL); } Modified: head/sys/geom/geom_disk.h ============================================================================== --- head/sys/geom/geom_disk.h Fri Apr 3 19:46:12 2009 (r190676) +++ head/sys/geom/geom_disk.h Fri Apr 3 19:49:33 2009 (r190677) @@ -88,6 +88,8 @@ struct disk { /* Fields private to the driver */ void *d_drv1; + + struct root_hold_token *d_roothold; }; #define DISKFLAG_NEEDSGIANT 0x1 Modified: head/sys/geom/geom_subr.c ============================================================================== --- head/sys/geom/geom_subr.c Fri Apr 3 19:46:12 2009 (r190676) +++ head/sys/geom/geom_subr.c Fri Apr 3 19:49:33 2009 (r190677) @@ -545,6 +545,10 @@ g_new_provider_event(void *arg, int flag mp->taste(mp, pp, 0); g_topology_assert(); } + if (pp->roothold != NULL) { + root_mount_rel(pp->roothold); + pp->roothold = NULL; + } } @@ -581,6 +585,7 @@ g_new_providerf(struct g_geom *gp, const pp->stat = devstat_new_entry(pp, -1, 0, DEVSTAT_ALL_SUPPORTED, DEVSTAT_TYPE_DIRECT, DEVSTAT_PRIORITY_MAX); LIST_INSERT_HEAD(&gp->provider, pp, provider); + pp->roothold = root_mount_hold(pp->name, M_WAITOK); g_post_event(g_new_provider_event, pp, M_WAITOK, pp, gp, NULL); return (pp); } From sam at FreeBSD.org Fri Apr 3 13:46:33 2009 From: sam at FreeBSD.org (Sam Leffler) Date: Fri Apr 3 13:46:39 2009 Subject: svn commit: r190678 - head/sys/net80211 Message-ID: <200904032046.n33KkWgl032674@svn.freebsd.org> Author: sam Date: Fri Apr 3 20:46:32 2009 New Revision: 190678 URL: http://svn.freebsd.org/changeset/base/190678 Log: fix whitespace Modified: head/sys/net80211/ieee80211_output.c Modified: head/sys/net80211/ieee80211_output.c ============================================================================== --- head/sys/net80211/ieee80211_output.c Fri Apr 3 19:49:33 2009 (r190677) +++ head/sys/net80211/ieee80211_output.c Fri Apr 3 20:46:32 2009 (r190678) @@ -1009,7 +1009,7 @@ ieee80211_encap(struct ieee80211vap *vap case IEEE80211_M_WDS: /* NB: is4addr should always be true */ goto bad; } - if (m->m_flags & M_MORE_DATA) + if (m->m_flags & M_MORE_DATA) wh->i_fc[1] |= IEEE80211_FC1_MORE_DATA; if (addqos) { uint8_t *qos; From cperciva at FreeBSD.org Fri Apr 3 14:13:19 2009 From: cperciva at FreeBSD.org (Colin Percival) Date: Fri Apr 3 14:13:25 2009 Subject: svn commit: r190679 - head/usr.sbin/portsnap/phttpget Message-ID: <200904032113.n33LDITC033195@svn.freebsd.org> Author: cperciva Date: Fri Apr 3 21:13:18 2009 New Revision: 190679 URL: http://svn.freebsd.org/changeset/base/190679 Log: Set SO_NOSIGPIPE on sockets used by phttpget. Without this, if (1) phttpget is attempting to download enough files that it can't send all the requests at once, and (2) the remote server forcibly closes the connection, resulting in RST packets being sent, phttpget will receive a SIGPIPE and terminate without downloading all of the files. This is probably responsible for a number of hard-to-reproduce errors with portsnap and freebsd-update. MFC after: 3 days Modified: head/usr.sbin/portsnap/phttpget/phttpget.c Modified: head/usr.sbin/portsnap/phttpget/phttpget.c ============================================================================== --- head/usr.sbin/portsnap/phttpget/phttpget.c Fri Apr 3 20:46:32 2009 (r190678) +++ head/usr.sbin/portsnap/phttpget/phttpget.c Fri Apr 3 21:13:18 2009 (r190679) @@ -317,6 +317,7 @@ main(int argc, char *argv[]) int chunked; /* != if transfer-encoding is chunked */ off_t clen; /* Chunk length */ int firstreq = 0; /* # of first request for this connection */ + int val; /* Value used for setsockopt call */ /* Check that the arguments are sensible */ if (argc < 2) @@ -370,6 +371,11 @@ main(int argc, char *argv[]) setsockopt(sd, SOL_SOCKET, SO_RCVTIMEO, (void *)&timo, (socklen_t)sizeof(timo)); + /* ... disable SIGPIPE generation ... */ + val = 1; + setsockopt(sd, SOL_SOCKET, SO_NOSIGPIPE, + (void *)&val, sizeof(int)); + /* ... and connect to the server. */ if(connect(sd, res->ai_addr, res->ai_addrlen)) { close(sd); From keramida at ceid.upatras.gr Fri Apr 3 15:26:19 2009 From: keramida at ceid.upatras.gr (Giorgos Keramidas) Date: Fri Apr 3 15:26:26 2009 Subject: svn commit: r190655 - head/sys/kern In-Reply-To: <200904022116.n32LGK81076210@svn.freebsd.org> (Peter Wemm's message of "Thu, 2 Apr 2009 21:16:20 +0000 (UTC)") References: <200904022116.n32LGK81076210@svn.freebsd.org> Message-ID: <87y6uhqsqh.fsf@kobe.laptop> On Thu, 2 Apr 2009 21:16:20 +0000 (UTC), Peter Wemm wrote: > Author: peter > Date: Thu Apr 2 21:16:20 2009 > New Revision: 190655 > URL: http://svn.freebsd.org/changeset/base/190655 > > Log: > vn_vptocnp() unlocks the name cache and forgets to re-lock it before > returning in one error case, and mistakenly unlocks it for the > umount -f case. > > Modified: > head/sys/kern/vfs_cache.c > > Modified: head/sys/kern/vfs_cache.c > ============================================================================== > --- head/sys/kern/vfs_cache.c Thu Apr 2 19:27:56 2009 (r190654) > +++ head/sys/kern/vfs_cache.c Thu Apr 2 21:16:20 2009 (r190655) > @@ -971,6 +971,7 @@ vn_vptocnp(struct vnode **vp, char **bp, > vdrop(*vp); > VFS_UNLOCK_GIANT(vfslocked); > if (error) { > + CACHE_RLOCK(); > numfullpathfail2++; > return (error); > } > @@ -979,7 +980,6 @@ vn_vptocnp(struct vnode **vp, char **bp, > CACHE_RLOCK(); > if ((*vp)->v_iflag & VI_DOOMED) { > /* forced unmount */ > - CACHE_RUNLOCK(); > vdrop(*vp); > return (ENOENT); > } This seems to trigger panics for nullfs mounts: System call __getcwd returning with the following locks held: shared rw Name Cache (Name Cache) r = 0 (0xc0ba245c) locked @ /usr/src/sys/kern/vfs_cache.c:980 panic: witness_warn From trhodes at FreeBSD.org Fri Apr 3 16:52:48 2009 From: trhodes at FreeBSD.org (Tom Rhodes) Date: Fri Apr 3 16:53:00 2009 Subject: svn commit: r190680 - head/share/man/man9 Message-ID: <200904032352.n33NqlCd037300@svn.freebsd.org> Author: trhodes Date: Fri Apr 3 23:52:47 2009 New Revision: 190680 URL: http://svn.freebsd.org/changeset/base/190680 Log: Catch up with recent locking changes. PR: 132546 Submitted by: pluknet Reviewed by: alc Modified: head/share/man/man9/vm_map_lock.9 Modified: head/share/man/man9/vm_map_lock.9 ============================================================================== --- head/share/man/man9/vm_map_lock.9 Fri Apr 3 21:13:18 2009 (r190679) +++ head/share/man/man9/vm_map_lock.9 Fri Apr 3 23:52:47 2009 (r190680) @@ -73,7 +73,6 @@ The .Fn vm_map_lock_read macro obtains a read-lock on .Fa map . -Currently this is implemented as an exclusive lock. .Pp The .Fn vm_map_unlock_read @@ -93,23 +92,18 @@ macro attempts to obtain a read-lock on .Fa map . It returns FALSE if the lock cannot be immediately acquired; otherwise return TRUE with the lock acquired. -Currently this is implemented as an exclusive lock. .Pp The .Fn vm_map_lock_upgrade macro attempts to atomically upgrade a read-lock on .Fa map to an exclusive lock. -As read-locks are currently implemented as exclusive locks, -this macro is a no-op. .Pp The .Fn vm_map_lock_downgrade macro attempts to downgrade an exclusive lock on .Fa map to a read-lock. -As read-locks are currently implemented as exclusive locks, -this macro is a no-op. .Sh IMPLEMENTATION NOTES Currently, all of the locking macros implement their locks as sleep locks. .Sh SEE ALSO From nwhitehorn at FreeBSD.org Fri Apr 3 17:22:45 2009 From: nwhitehorn at FreeBSD.org (Nathan Whitehorn) Date: Fri Apr 3 17:22:53 2009 Subject: svn commit: r190681 - in head: share/mk sys/conf sys/dev/powermac_nvram sys/dev/uart sys/powerpc/aim sys/powerpc/booke sys/powerpc/include sys/powerpc/ofw sys/powerpc/powermac sys/powerpc/powerpc Message-ID: <200904040022.n340Mifi039247@svn.freebsd.org> Author: nwhitehorn Date: Sat Apr 4 00:22:44 2009 New Revision: 190681 URL: http://svn.freebsd.org/changeset/base/190681 Log: Add support for 64-bit PowerPC CPUs operating in the 64-bit bridge mode provided, for example, on the PowerPC 970 (G5), as well as on related CPUs like the POWER3 and POWER4. This also adds support for various built-in hardware found on Apple G5 hardware (e.g. the IBM CPC925 northbridge). Reviewed by: grehan Added: head/sys/powerpc/aim/mmu_oea64.c (contents, props changed) head/sys/powerpc/powermac/cpcht.c (contents, props changed) head/sys/powerpc/powermac/cpchtvar.h (contents, props changed) head/sys/powerpc/powerpc/uio_machdep.c - copied unchanged from r190402, head/sys/powerpc/booke/uio_machdep.c Deleted: head/sys/powerpc/aim/uio_machdep.c head/sys/powerpc/booke/uio_machdep.c Modified: head/share/mk/bsd.cpu.mk head/sys/conf/files.powerpc head/sys/dev/powermac_nvram/powermac_nvram.c head/sys/dev/uart/uart_cpu_powerpc.c head/sys/powerpc/aim/machdep.c head/sys/powerpc/aim/mmu_oea.c head/sys/powerpc/aim/mp_cpudep.c head/sys/powerpc/aim/ofw_machdep.c head/sys/powerpc/aim/trap_subr.S head/sys/powerpc/aim/uma_machdep.c head/sys/powerpc/aim/vm_machdep.c head/sys/powerpc/booke/machdep.c head/sys/powerpc/include/hid.h head/sys/powerpc/include/md_var.h head/sys/powerpc/include/sf_buf.h head/sys/powerpc/include/spr.h head/sys/powerpc/include/vmparam.h head/sys/powerpc/ofw/ofw_syscons.c head/sys/powerpc/powerpc/bus_machdep.c head/sys/powerpc/powerpc/cpu.c head/sys/powerpc/powerpc/mem.c head/sys/powerpc/powerpc/mmu_if.m head/sys/powerpc/powerpc/pmap_dispatch.c Modified: head/share/mk/bsd.cpu.mk ============================================================================== --- head/share/mk/bsd.cpu.mk Fri Apr 3 23:52:47 2009 (r190680) +++ head/share/mk/bsd.cpu.mk Sat Apr 4 00:22:44 2009 (r190681) @@ -119,7 +119,7 @@ _CPUCFLAGS = -mcpu=${CPUTYPE} MACHINE_CPU = booke _CPUCFLAGS = -Wa,-me500 -msoft-float . else -_CPUCFLAGS = -mcpu=${CPUTYPE} +_CPUCFLAGS = -mcpu=${CPUTYPE} -mno-powerpc64 . endif . elif ${MACHINE_ARCH} == "mips" . if ${CPUTYPE} == "mips32" Modified: head/sys/conf/files.powerpc ============================================================================== --- head/sys/conf/files.powerpc Fri Apr 3 23:52:47 2009 (r190680) +++ head/sys/conf/files.powerpc Sat Apr 4 00:22:44 2009 (r190681) @@ -76,13 +76,13 @@ powerpc/aim/interrupt.c optional aim powerpc/aim/locore.S optional aim no-obj powerpc/aim/machdep.c optional aim powerpc/aim/mmu_oea.c optional aim +powerpc/aim/mmu_oea64.c optional aim powerpc/aim/mp_cpudep.c optional aim smp powerpc/aim/nexus.c optional aim powerpc/aim/ofw_machdep.c optional aim powerpc/aim/ofwmagic.S optional aim powerpc/aim/swtch.S optional aim powerpc/aim/trap.c optional aim -powerpc/aim/uio_machdep.c optional aim powerpc/aim/uma_machdep.c optional aim powerpc/aim/vm_machdep.c optional aim powerpc/booke/clock.c optional e500 @@ -93,7 +93,6 @@ powerpc/booke/machdep.c optional e500 powerpc/booke/pmap.c optional e500 powerpc/booke/swtch.S optional e500 powerpc/booke/trap.c optional e500 -powerpc/booke/uio_machdep.c optional e500 powerpc/booke/vm_machdep.c optional e500 powerpc/fpu/fpu_add.c optional fpu_emu powerpc/fpu/fpu_compare.c optional fpu_emu @@ -127,6 +126,7 @@ powerpc/powermac/uninorth.c optional pow powerpc/powermac/cuda.c optional powermac cuda powerpc/powermac/pmu.c optional powermac pmu powerpc/powermac/macgpio.c optional powermac pci +powerpc/powermac/cpcht.c optional powermac pci powerpc/powerpc/altivec.c optional aim powerpc/powerpc/atomic.S standard powerpc/powerpc/autoconf.c standard @@ -158,6 +158,7 @@ powerpc/powerpc/stack_machdep.c optional powerpc/powerpc/suswintr.c standard powerpc/powerpc/syncicache.c standard powerpc/powerpc/sys_machdep.c standard +powerpc/powerpc/uio_machdep.c standard powerpc/psim/iobus.c optional psim powerpc/psim/ata_iobus.c optional ata psim powerpc/psim/openpic_iobus.c optional psim Modified: head/sys/dev/powermac_nvram/powermac_nvram.c ============================================================================== --- head/sys/dev/powermac_nvram/powermac_nvram.c Fri Apr 3 23:52:47 2009 (r190680) +++ head/sys/dev/powermac_nvram/powermac_nvram.c Sat Apr 4 00:22:44 2009 (r190681) @@ -131,19 +131,25 @@ powermac_nvram_attach(device_t dev) { struct powermac_nvram_softc *sc; phandle_t node; - u_int32_t reg[2]; - int gen0, gen1; + u_int32_t reg[3]; + int gen0, gen1, i; node = ofw_bus_get_node(dev); sc = device_get_softc(dev); - if (OF_getprop(node, "reg", reg, sizeof(reg)) < 8) + if ((i = OF_getprop(node, "reg", reg, sizeof(reg))) < 8) return ENXIO; sc->sc_dev = dev; sc->sc_node = node; - sc->sc_bank0 = (vm_offset_t)pmap_mapdev(reg[0], NVRAM_SIZE * 2); + /* + * Find which byte of reg corresponds to the 32-bit physical address. + * We should probably read #address-cells from /chosen instead. + */ + i = (i/4) - 2; + + sc->sc_bank0 = (vm_offset_t)pmap_mapdev(reg[i], NVRAM_SIZE * 2); sc->sc_bank1 = sc->sc_bank0 + NVRAM_SIZE; gen0 = powermac_nvram_check((void *)sc->sc_bank0); Modified: head/sys/dev/uart/uart_cpu_powerpc.c ============================================================================== --- head/sys/dev/uart/uart_cpu_powerpc.c Fri Apr 3 23:52:47 2009 (r190680) +++ head/sys/dev/uart/uart_cpu_powerpc.c Sat Apr 4 00:22:44 2009 (r190681) @@ -31,6 +31,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include #include @@ -53,8 +55,7 @@ bus_space_tag_t uart_bus_space_mem = &bs int uart_cpu_eqres(struct uart_bas *b1, struct uart_bas *b2) { - - return ((b1->bsh == b2->bsh) ? 1 : 0); + return ((pmap_kextract(b1->bsh) == pmap_kextract(b2->bsh)) ? 1 : 0); } #ifdef MPC85XX @@ -116,7 +117,16 @@ uart_cpu_getdev(int devtype, struct uart return (ENXIO); if (OF_getprop(input, "name", buf, sizeof(buf)) == -1) return (ENXIO); - if (strcmp(buf, "ch-a")) + + if (strcmp(buf, "ch-a") == 0) { + class = &uart_z8530_class; + di->bas.regshft = 4; + di->bas.chan = 1; + } else if (strcmp(buf,"serial") == 0) { + class = &uart_ns8250_class; + di->bas.regshft = 0; + di->bas.chan = 0; + } else return (ENXIO); error = OF_decode_addr(input, 0, &di->bas.bst, &di->bas.bsh); @@ -125,11 +135,13 @@ uart_cpu_getdev(int devtype, struct uart di->ops = uart_getops(class); - di->bas.rclk = 230400; - di->bas.chan = 1; - di->bas.regshft = 4; + if (OF_getprop(input, "clock-frequency", &di->bas.rclk, + sizeof(di->bas.rclk)) == -1) + di->bas.rclk = 230400; + if (OF_getprop(input, "current-speed", &di->baudrate, + sizeof(di->baudrate)) == -1) + di->baudrate = 0; - di->baudrate = 0; di->databits = 8; di->stopbits = 1; di->parity = UART_PARITY_NONE; Modified: head/sys/powerpc/aim/machdep.c ============================================================================== --- head/sys/powerpc/aim/machdep.c Fri Apr 3 23:52:47 2009 (r190680) +++ head/sys/powerpc/aim/machdep.c Sat Apr 4 00:22:44 2009 (r190681) @@ -130,6 +130,8 @@ extern vm_offset_t ksym_start, ksym_end; int cold = 1; int cacheline_size = 32; +int ppc64 = 0; +int hw_direct_map = 1; struct pcpu __pcpu[MAXCPU]; @@ -230,10 +232,13 @@ cpu_startup(void *dummy) extern char kernel_text[], _end[]; +extern void *testppc64, *testppc64size; +extern void *restorebridge, *restorebridgesize; +extern void *rfid_patch, *rfi_patch1, *rfi_patch2; #ifdef SMP extern void *rstcode, *rstsize; #endif -extern void *trapcode, *trapsize; +extern void *trapcode, *trapcode64, *trapsize; extern void *alitrap, *alisize; extern void *dsitrap, *dsisize; extern void *decrint, *decrsize; @@ -245,11 +250,16 @@ powerpc_init(u_int startkernel, u_int en { struct pcpu *pc; vm_offset_t end; + void *generictrap; + size_t trap_offset; void *kmdp; char *env; + int vers; + uint32_t msr, scratch; end = 0; kmdp = NULL; + trap_offset = 0; /* * Parse metadata if present and fetch parameters. Must be done @@ -315,6 +325,26 @@ powerpc_init(u_int startkernel, u_int en printf("powerpc_init: no loader metadata.\n"); } + /* + * Set cacheline_size based on the CPU model. + */ + + vers = mfpvr() >> 16; + switch (vers) { + case IBM970: + case IBM970FX: + case IBM970MP: + case IBM970GX: + cacheline_size = 128; + break; + default: + cacheline_size = 32; + } + + /* + * Init KDB + */ + kdb_init(); /* @@ -322,47 +352,110 @@ powerpc_init(u_int startkernel, u_int en * Disable translation in case the vector area * hasn't been mapped (G5) */ - mtmsr(mfmsr() & ~(PSL_IR | PSL_DR)); + msr = mfmsr(); + mtmsr(msr & ~(PSL_IR | PSL_DR)); isync(); + + /* + * Figure out whether we need to use the 64 bit PMAP. This works by + * executing an instruction that is only legal on 64-bit PPC (mtmsrd), + * and setting ppc64 = 0 if that causes a trap. + */ + + ppc64 = 1; + + bcopy(&testppc64, (void *)EXC_PGM, (size_t)&testppc64size); + __syncicache((void *)EXC_PGM, (size_t)&testppc64size); + + __asm __volatile("\ + mfmsr %0; \ + mtsprg2 %1; \ + \ + mtmsrd %0; \ + mfsprg2 %1;" + : "=r"(scratch), "=r"(ppc64)); + + /* + * Now copy restorebridge into all the handlers, if necessary, + * and set up the trap tables. + */ + + if (ppc64) { + /* Patch the two instances of rfi -> rfid */ + bcopy(&rfid_patch,&rfi_patch1,4); + bcopy(&rfid_patch,&rfi_patch2,4); + + /* + * Copy a code snippet to restore 32-bit bridge mode + * to the top of every non-generic trap handler + */ + + trap_offset += (size_t)&restorebridgesize; + bcopy(&restorebridge, (void *)EXC_RST, trap_offset); + bcopy(&restorebridge, (void *)EXC_DSI, trap_offset); + bcopy(&restorebridge, (void *)EXC_ALI, trap_offset); + bcopy(&restorebridge, (void *)EXC_PGM, trap_offset); + bcopy(&restorebridge, (void *)EXC_MCHK, trap_offset); + bcopy(&restorebridge, (void *)EXC_TRC, trap_offset); + bcopy(&restorebridge, (void *)EXC_BPT, trap_offset); + + /* + * Set the common trap entry point to the one that + * knows to restore 32-bit operation on execution. + */ + + generictrap = &trapcode64; + } else { + generictrap = &trapcode; + } + #ifdef SMP - bcopy(&rstcode, (void *)EXC_RST, (size_t)&rstsize); + bcopy(&rstcode, (void *)(EXC_RST + trap_offset), (size_t)&rstsize); #else - bcopy(&trapcode, (void *)EXC_RST, (size_t)&trapsize); + bcopy(generictrap, (void *)EXC_RST, (size_t)&trapsize); #endif - bcopy(&trapcode, (void *)EXC_MCHK, (size_t)&trapsize); - bcopy(&dsitrap, (void *)EXC_DSI, (size_t)&dsisize); - bcopy(&trapcode, (void *)EXC_ISI, (size_t)&trapsize); - bcopy(&trapcode, (void *)EXC_EXI, (size_t)&trapsize); - bcopy(&alitrap, (void *)EXC_ALI, (size_t)&alisize); - bcopy(&trapcode, (void *)EXC_PGM, (size_t)&trapsize); - bcopy(&trapcode, (void *)EXC_FPU, (size_t)&trapsize); - bcopy(&trapcode, (void *)EXC_DECR, (size_t)&trapsize); - bcopy(&trapcode, (void *)EXC_SC, (size_t)&trapsize); - bcopy(&trapcode, (void *)EXC_TRC, (size_t)&trapsize); - bcopy(&trapcode, (void *)EXC_FPA, (size_t)&trapsize); - bcopy(&trapcode, (void *)EXC_VEC, (size_t)&trapsize); - bcopy(&trapcode, (void *)EXC_VECAST, (size_t)&trapsize); - bcopy(&trapcode, (void *)EXC_THRM, (size_t)&trapsize); - bcopy(&trapcode, (void *)EXC_BPT, (size_t)&trapsize); + #ifdef KDB - bcopy(&dblow, (void *)EXC_MCHK, (size_t)&dbsize); - bcopy(&dblow, (void *)EXC_PGM, (size_t)&dbsize); - bcopy(&dblow, (void *)EXC_TRC, (size_t)&dbsize); - bcopy(&dblow, (void *)EXC_BPT, (size_t)&dbsize); + bcopy(&dblow, (void *)(EXC_MCHK + trap_offset), (size_t)&dbsize); + bcopy(&dblow, (void *)(EXC_PGM + trap_offset), (size_t)&dbsize); + bcopy(&dblow, (void *)(EXC_TRC + trap_offset), (size_t)&dbsize); + bcopy(&dblow, (void *)(EXC_BPT + trap_offset), (size_t)&dbsize); +#else + bcopy(generictrap, (void *)EXC_MCHK, (size_t)&trapsize); + bcopy(generictrap, (void *)EXC_PGM, (size_t)&trapsize); + bcopy(generictrap, (void *)EXC_TRC, (size_t)&trapsize); + bcopy(generictrap, (void *)EXC_BPT, (size_t)&trapsize); #endif + bcopy(&dsitrap, (void *)(EXC_DSI + trap_offset), (size_t)&dsisize); + bcopy(&alitrap, (void *)(EXC_ALI + trap_offset), (size_t)&alisize); + bcopy(generictrap, (void *)EXC_ISI, (size_t)&trapsize); + bcopy(generictrap, (void *)EXC_EXI, (size_t)&trapsize); + bcopy(generictrap, (void *)EXC_FPU, (size_t)&trapsize); + bcopy(generictrap, (void *)EXC_DECR, (size_t)&trapsize); + bcopy(generictrap, (void *)EXC_SC, (size_t)&trapsize); + bcopy(generictrap, (void *)EXC_FPA, (size_t)&trapsize); + bcopy(generictrap, (void *)EXC_VEC, (size_t)&trapsize); + bcopy(generictrap, (void *)EXC_VECAST, (size_t)&trapsize); + bcopy(generictrap, (void *)EXC_THRM, (size_t)&trapsize); __syncicache(EXC_RSVD, EXC_LAST - EXC_RSVD); /* - * Make sure translation has been enabled + * Restore MSR */ - mtmsr(mfmsr() | PSL_IR|PSL_DR|PSL_ME|PSL_RI); + mtmsr(msr); isync(); /* * Initialise virtual memory. */ - pmap_mmu_install(MMU_TYPE_OEA, 0); /* XXX temporary */ + if (ppc64) + pmap_mmu_install(MMU_TYPE_G5, 0); + else + pmap_mmu_install(MMU_TYPE_OEA, 0); + pmap_bootstrap(startkernel, endkernel); + mtmsr(mfmsr() | PSL_IR|PSL_DR|PSL_ME|PSL_RI); + isync(); /* * Initialize params/tunables that are derived from memsize Modified: head/sys/powerpc/aim/mmu_oea.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea.c Fri Apr 3 23:52:47 2009 (r190680) +++ head/sys/powerpc/aim/mmu_oea.c Sat Apr 4 00:22:44 2009 (r190681) @@ -323,6 +323,7 @@ void moea_zero_page_area(mmu_t, vm_page_ void moea_zero_page_idle(mmu_t, vm_page_t); void moea_activate(mmu_t, struct thread *); void moea_deactivate(mmu_t, struct thread *); +void moea_cpu_bootstrap(mmu_t, int); void moea_bootstrap(mmu_t, vm_offset_t, vm_offset_t); void *moea_mapdev(mmu_t, vm_offset_t, vm_size_t); void moea_unmapdev(mmu_t, vm_offset_t, vm_size_t); @@ -364,6 +365,7 @@ static mmu_method_t moea_methods[] = { /* Internal interfaces */ MMUMETHOD(mmu_bootstrap, moea_bootstrap), + MMUMETHOD(mmu_cpu_bootstrap, moea_cpu_bootstrap), MMUMETHOD(mmu_mapdev, moea_mapdev), MMUMETHOD(mmu_unmapdev, moea_unmapdev), MMUMETHOD(mmu_kextract, moea_kextract), @@ -617,7 +619,7 @@ om_cmp(const void *a, const void *b) } void -pmap_cpu_bootstrap(int ap) +moea_cpu_bootstrap(mmu_t mmup, int ap) { u_int sdr; int i; @@ -709,6 +711,9 @@ moea_bootstrap(mmu_t mmup, vm_offset_t k __asm __volatile("mtdbatl 1,%0" :: "r"(battable[8].batl)); isync(); + /* set global direct map flag */ + hw_direct_map = 1; + mem_regions(&pregions, &pregions_sz, ®ions, ®ions_sz); CTR0(KTR_PMAP, "moea_bootstrap: physical memory"); @@ -895,7 +900,7 @@ moea_bootstrap(mmu_t mmup, vm_offset_t k kernel_pmap->pm_sr[KERNEL2_SR] = KERNEL2_SEGMENT; kernel_pmap->pm_active = ~0; - pmap_cpu_bootstrap(0); + moea_cpu_bootstrap(mmup,0); pmap_bootstrapped++; Added: head/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/powerpc/aim/mmu_oea64.c Sat Apr 4 00:22:44 2009 (r190681) @@ -0,0 +1,2443 @@ +/*- + * Copyright (c) 2001 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Matt Thomas of Allegro Networks, Inc. + * + * 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 FOUNDATION 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. + */ +/*- + * Copyright (C) 1995, 1996 Wolfgang Solfrank. + * Copyright (C) 1995, 1996 TooLs GmbH. + * 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by TooLs GmbH. + * 4. The name of TooLs GmbH may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``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 TOOLS GMBH 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. + * + * $NetBSD: pmap.c,v 1.28 2000/03/26 20:42:36 kleink Exp $ + */ +/*- + * Copyright (C) 2001 Benno Rice. + * 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 Benno Rice ``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 TOOLS GMBH 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +/* + * Manages physical address maps. + * + * In addition to hardware address maps, this module is called upon to + * provide software-use-only maps which may or may not be stored in the + * same form as hardware maps. These pseudo-maps are used to store + * intermediate results from copy operations to and from address spaces. + * + * Since the information managed by this module is also stored by the + * logical address mapping module, this module may throw away valid virtual + * to physical mappings at almost any time. However, invalidations of + * mappings must be done as requested. + * + * In order to cope with hardware architectures which make virtual to + * physical map invalidates expensive, this module may delay invalidate + * reduced protection operations until such time as they are actually + * necessary. This module is given full information as to which processors + * are currently using which maps, and to when physical maps must be made + * correct. + */ + +#include "opt_kstack_pages.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "mmu_if.h" + +#define MOEA_DEBUG + +#define TODO panic("%s: not implemented", __func__); + +static __inline u_int32_t +cntlzw(volatile u_int32_t a) { + u_int32_t b; + __asm ("cntlzw %0, %1" : "=r"(b) : "r"(a)); + return b; +} + +static __inline uint64_t +va_to_vsid(pmap_t pm, vm_offset_t va) +{ + return ((pm->pm_sr[(uintptr_t)va >> ADDR_SR_SHFT]) & SR_VSID_MASK); +} + +#define TLBSYNC() __asm __volatile("tlbsync; ptesync"); +#define SYNC() __asm __volatile("sync"); +#define EIEIO() __asm __volatile("eieio"); + +/* + * The tlbie instruction must be executed in 64-bit mode + * so we have to twiddle MSR[SF] around every invocation. + * Just to add to the fun, exceptions must be off as well + * so that we can't trap in 64-bit mode. What a pain. + */ + +static __inline void +TLBIE(pmap_t pmap, vm_offset_t va) { + register_t msr; + register_t scratch; + + uint64_t vpn; + register_t vpn_hi, vpn_lo; + +#if 1 + /* + * CPU documentation says that tlbie takes the VPN, not the + * VA. I think the code below does this correctly. We will see. + */ + + vpn = (uint64_t)(va & ADDR_PIDX); + if (pmap != NULL) + vpn |= (va_to_vsid(pmap,va) << 28); +#else + vpn = va; +#endif + + vpn_hi = (uint32_t)(vpn >> 32); + vpn_lo = (uint32_t)vpn; + + __asm __volatile("\ + mfmsr %0; \ + clrldi %1,%0,49; \ + insrdi %1,1,1,0; \ + mtmsrd %1; \ + ptesync; \ + \ + sld %1,%2,%4; \ + or %1,%1,%3; \ + tlbie %1; \ + \ + mtmsrd %0; \ + eieio; \ + tlbsync; \ + ptesync;" + : "=r"(msr), "=r"(scratch) : "r"(vpn_hi), "r"(vpn_lo), "r"(32)); +} + +#define DISABLE_TRANS(msr) msr = mfmsr(); mtmsr(msr & ~PSL_DR); isync() +#define ENABLE_TRANS(msr) mtmsr(msr); isync() + +#define VSID_MAKE(sr, hash) ((sr) | (((hash) & 0xfffff) << 4)) +#define VSID_TO_SR(vsid) ((vsid) & 0xf) +#define VSID_TO_HASH(vsid) (((vsid) >> 4) & 0xfffff) + +#define PVO_PTEGIDX_MASK 0x007 /* which PTEG slot */ +#define PVO_PTEGIDX_VALID 0x008 /* slot is valid */ +#define PVO_WIRED 0x010 /* PVO entry is wired */ +#define PVO_MANAGED 0x020 /* PVO entry is managed */ +#define PVO_BOOTSTRAP 0x080 /* PVO entry allocated during + bootstrap */ +#define PVO_FAKE 0x100 /* fictitious phys page */ +#define PVO_VADDR(pvo) ((pvo)->pvo_vaddr & ~ADDR_POFF) +#define PVO_ISFAKE(pvo) ((pvo)->pvo_vaddr & PVO_FAKE) +#define PVO_PTEGIDX_GET(pvo) ((pvo)->pvo_vaddr & PVO_PTEGIDX_MASK) +#define PVO_PTEGIDX_ISSET(pvo) ((pvo)->pvo_vaddr & PVO_PTEGIDX_VALID) +#define PVO_PTEGIDX_CLR(pvo) \ + ((void)((pvo)->pvo_vaddr &= ~(PVO_PTEGIDX_VALID|PVO_PTEGIDX_MASK))) +#define PVO_PTEGIDX_SET(pvo, i) \ + ((void)((pvo)->pvo_vaddr |= (i)|PVO_PTEGIDX_VALID)) + +#define MOEA_PVO_CHECK(pvo) + +#define LOCK_TABLE() mtx_lock(&moea64_table_mutex) +#define UNLOCK_TABLE() mtx_unlock(&moea64_table_mutex); +#define ASSERT_TABLE_LOCK() mtx_assert(&moea64_table_mutex, MA_OWNED) + +struct ofw_map { + vm_offset_t om_va; + vm_size_t om_len; + vm_offset_t om_pa_hi; + vm_offset_t om_pa_lo; + u_int om_mode; +}; + +/* + * Map of physical memory regions. + */ +static struct mem_region *regions; +static struct mem_region *pregions; +extern u_int phys_avail_count; +extern int regions_sz, pregions_sz; +extern int ofw_real_mode; +static struct ofw_map translations[64]; + +extern struct pmap ofw_pmap; + +extern void bs_remap_earlyboot(void); + + +/* + * Lock for the pteg and pvo tables. + */ +struct mtx moea64_table_mutex; + +/* + * PTEG data. + */ +static struct lpteg *moea64_pteg_table; +u_int moea64_pteg_count; +u_int moea64_pteg_mask; + +/* + * PVO data. + */ +struct pvo_head *moea64_pvo_table; /* pvo entries by pteg index */ +/* lists of unmanaged pages */ +struct pvo_head moea64_pvo_kunmanaged = + LIST_HEAD_INITIALIZER(moea64_pvo_kunmanaged); +struct pvo_head moea64_pvo_unmanaged = + LIST_HEAD_INITIALIZER(moea64_pvo_unmanaged); + +uma_zone_t moea64_upvo_zone; /* zone for pvo entries for unmanaged pages */ +uma_zone_t moea64_mpvo_zone; /* zone for pvo entries for managed pages */ + +vm_offset_t pvo_allocator_start; +vm_offset_t pvo_allocator_end; + +#define BPVO_POOL_SIZE 327680 +static struct pvo_entry *moea64_bpvo_pool; +static int moea64_bpvo_pool_index = 0; + +#define VSID_NBPW (sizeof(u_int32_t) * 8) +static u_int moea64_vsid_bitmap[NPMAPS / VSID_NBPW]; + +static boolean_t moea64_initialized = FALSE; + +/* + * Statistics. + */ +u_int moea64_pte_valid = 0; +u_int moea64_pte_overflow = 0; +u_int moea64_pvo_entries = 0; +u_int moea64_pvo_enter_calls = 0; +u_int moea64_pvo_remove_calls = 0; +SYSCTL_INT(_machdep, OID_AUTO, moea64_pte_valid, CTLFLAG_RD, + &moea64_pte_valid, 0, ""); +SYSCTL_INT(_machdep, OID_AUTO, moea64_pte_overflow, CTLFLAG_RD, + &moea64_pte_overflow, 0, ""); +SYSCTL_INT(_machdep, OID_AUTO, moea64_pvo_entries, CTLFLAG_RD, + &moea64_pvo_entries, 0, ""); +SYSCTL_INT(_machdep, OID_AUTO, moea64_pvo_enter_calls, CTLFLAG_RD, + &moea64_pvo_enter_calls, 0, ""); +SYSCTL_INT(_machdep, OID_AUTO, moea64_pvo_remove_calls, CTLFLAG_RD, + &moea64_pvo_remove_calls, 0, ""); + +vm_offset_t moea64_scratchpage_va[2]; +struct pvo_entry *moea64_scratchpage_pvo[2]; +struct lpte *moea64_scratchpage_pte[2]; +struct mtx moea64_scratchpage_mtx; + +/* + * Allocate physical memory for use in moea64_bootstrap. + */ +static vm_offset_t moea64_bootstrap_alloc(vm_size_t, u_int); + +/* + * PTE calls. + */ +static int moea64_pte_insert(u_int, struct lpte *); + +/* + * PVO calls. + */ +static int moea64_pvo_enter(pmap_t, uma_zone_t, struct pvo_head *, + vm_offset_t, vm_offset_t, uint64_t, int, int); +static void moea64_pvo_remove(struct pvo_entry *, int); +static struct pvo_entry *moea64_pvo_find_va(pmap_t, vm_offset_t, int *); +static struct lpte *moea64_pvo_to_pte(const struct pvo_entry *, int); + +/* + * Utility routines. + */ +static void moea64_bridge_bootstrap(mmu_t mmup, + vm_offset_t kernelstart, vm_offset_t kernelend); +static void moea64_bridge_cpu_bootstrap(mmu_t, int ap); +static void moea64_enter_locked(pmap_t, vm_offset_t, vm_page_t, + vm_prot_t, boolean_t); +static boolean_t moea64_query_bit(vm_page_t, u_int64_t); +static u_int moea64_clear_bit(vm_page_t, u_int64_t, u_int64_t *); +static void moea64_kremove(mmu_t, vm_offset_t); +static void moea64_syncicache(pmap_t pmap, vm_offset_t va, + vm_offset_t pa); +static void tlbia(void); + +/* + * Kernel MMU interface + */ +void moea64_change_wiring(mmu_t, pmap_t, vm_offset_t, boolean_t); +void moea64_clear_modify(mmu_t, vm_page_t); +void moea64_clear_reference(mmu_t, vm_page_t); +void moea64_copy_page(mmu_t, vm_page_t, vm_page_t); +void moea64_enter(mmu_t, pmap_t, vm_offset_t, vm_page_t, vm_prot_t, boolean_t); +void moea64_enter_object(mmu_t, pmap_t, vm_offset_t, vm_offset_t, vm_page_t, + vm_prot_t); +void moea64_enter_quick(mmu_t, pmap_t, vm_offset_t, vm_page_t, vm_prot_t); +vm_paddr_t moea64_extract(mmu_t, pmap_t, vm_offset_t); +vm_page_t moea64_extract_and_hold(mmu_t, pmap_t, vm_offset_t, vm_prot_t); +void moea64_init(mmu_t); +boolean_t moea64_is_modified(mmu_t, vm_page_t); +boolean_t moea64_ts_referenced(mmu_t, vm_page_t); +vm_offset_t moea64_map(mmu_t, vm_offset_t *, vm_offset_t, vm_offset_t, int); +boolean_t moea64_page_exists_quick(mmu_t, pmap_t, vm_page_t); +int moea64_page_wired_mappings(mmu_t, vm_page_t); +void moea64_pinit(mmu_t, pmap_t); +void moea64_pinit0(mmu_t, pmap_t); +void moea64_protect(mmu_t, pmap_t, vm_offset_t, vm_offset_t, vm_prot_t); +void moea64_qenter(mmu_t, vm_offset_t, vm_page_t *, int); +void moea64_qremove(mmu_t, vm_offset_t, int); +void moea64_release(mmu_t, pmap_t); +void moea64_remove(mmu_t, pmap_t, vm_offset_t, vm_offset_t); +void moea64_remove_all(mmu_t, vm_page_t); +void moea64_remove_write(mmu_t, vm_page_t); +void moea64_zero_page(mmu_t, vm_page_t); +void moea64_zero_page_area(mmu_t, vm_page_t, int, int); +void moea64_zero_page_idle(mmu_t, vm_page_t); +void moea64_activate(mmu_t, struct thread *); +void moea64_deactivate(mmu_t, struct thread *); +void *moea64_mapdev(mmu_t, vm_offset_t, vm_size_t); +void moea64_unmapdev(mmu_t, vm_offset_t, vm_size_t); +vm_offset_t moea64_kextract(mmu_t, vm_offset_t); +void moea64_kenter(mmu_t, vm_offset_t, vm_offset_t); +boolean_t moea64_dev_direct_mapped(mmu_t, vm_offset_t, vm_size_t); +boolean_t moea64_page_executable(mmu_t, vm_page_t); + +static mmu_method_t moea64_bridge_methods[] = { + MMUMETHOD(mmu_change_wiring, moea64_change_wiring), + MMUMETHOD(mmu_clear_modify, moea64_clear_modify), + MMUMETHOD(mmu_clear_reference, moea64_clear_reference), + MMUMETHOD(mmu_copy_page, moea64_copy_page), + MMUMETHOD(mmu_enter, moea64_enter), + MMUMETHOD(mmu_enter_object, moea64_enter_object), + MMUMETHOD(mmu_enter_quick, moea64_enter_quick), + MMUMETHOD(mmu_extract, moea64_extract), + MMUMETHOD(mmu_extract_and_hold, moea64_extract_and_hold), + MMUMETHOD(mmu_init, moea64_init), + MMUMETHOD(mmu_is_modified, moea64_is_modified), + MMUMETHOD(mmu_ts_referenced, moea64_ts_referenced), + MMUMETHOD(mmu_map, moea64_map), + MMUMETHOD(mmu_page_exists_quick,moea64_page_exists_quick), + MMUMETHOD(mmu_page_wired_mappings,moea64_page_wired_mappings), + MMUMETHOD(mmu_pinit, moea64_pinit), + MMUMETHOD(mmu_pinit0, moea64_pinit0), + MMUMETHOD(mmu_protect, moea64_protect), + MMUMETHOD(mmu_qenter, moea64_qenter), + MMUMETHOD(mmu_qremove, moea64_qremove), + MMUMETHOD(mmu_release, moea64_release), + MMUMETHOD(mmu_remove, moea64_remove), + MMUMETHOD(mmu_remove_all, moea64_remove_all), + MMUMETHOD(mmu_remove_write, moea64_remove_write), + MMUMETHOD(mmu_zero_page, moea64_zero_page), + MMUMETHOD(mmu_zero_page_area, moea64_zero_page_area), + MMUMETHOD(mmu_zero_page_idle, moea64_zero_page_idle), + MMUMETHOD(mmu_activate, moea64_activate), + MMUMETHOD(mmu_deactivate, moea64_deactivate), + + /* Internal interfaces */ + MMUMETHOD(mmu_bootstrap, moea64_bridge_bootstrap), + MMUMETHOD(mmu_cpu_bootstrap, moea64_bridge_cpu_bootstrap), + MMUMETHOD(mmu_mapdev, moea64_mapdev), + MMUMETHOD(mmu_unmapdev, moea64_unmapdev), + MMUMETHOD(mmu_kextract, moea64_kextract), + MMUMETHOD(mmu_kenter, moea64_kenter), + MMUMETHOD(mmu_dev_direct_mapped,moea64_dev_direct_mapped), + MMUMETHOD(mmu_page_executable, moea64_page_executable), + + { 0, 0 } +}; + +static mmu_def_t oea64_bridge_mmu = { + MMU_TYPE_G5, + moea64_bridge_methods, + 0 +}; +MMU_DEF(oea64_bridge_mmu); + +static __inline u_int +va_to_pteg(uint64_t vsid, vm_offset_t addr) +{ + u_int hash; + + hash = vsid ^ (((uint64_t)addr & ADDR_PIDX) >> + ADDR_PIDX_SHFT); + return (hash & moea64_pteg_mask); +} + +static __inline struct pvo_head * +pa_to_pvoh(vm_offset_t pa, vm_page_t *pg_p) +{ + struct vm_page *pg; + + pg = PHYS_TO_VM_PAGE(pa); + + if (pg_p != NULL) + *pg_p = pg; + + if (pg == NULL) + return (&moea64_pvo_unmanaged); + + return (&pg->md.mdpg_pvoh); +} + +static __inline struct pvo_head * +vm_page_to_pvoh(vm_page_t m) +{ + + return (&m->md.mdpg_pvoh); +} + +static __inline void +moea64_attr_clear(vm_page_t m, u_int64_t ptebit) +{ + + mtx_assert(&vm_page_queue_mtx, MA_OWNED); + m->md.mdpg_attrs &= ~ptebit; +} + +static __inline u_int64_t +moea64_attr_fetch(vm_page_t m) +{ + + return (m->md.mdpg_attrs); +} + +static __inline void +moea64_attr_save(vm_page_t m, u_int64_t ptebit) +{ + + mtx_assert(&vm_page_queue_mtx, MA_OWNED); + m->md.mdpg_attrs |= ptebit; +} + +static __inline int +moea64_pte_compare(const struct lpte *pt, const struct lpte *pvo_pt) +{ + if (pt->pte_hi == pvo_pt->pte_hi) + return (1); + + return (0); +} + +static __inline int +moea64_pte_match(struct lpte *pt, uint64_t vsid, vm_offset_t va, int which) +{ + return (pt->pte_hi & ~LPTE_VALID) == + ((vsid << LPTE_VSID_SHIFT) | + ((uint64_t)(va >> ADDR_API_SHFT64) & LPTE_API) | which); +} + +static __inline void +moea64_pte_create(struct lpte *pt, uint64_t vsid, vm_offset_t va, + uint64_t pte_lo) +{ + ASSERT_TABLE_LOCK(); + + /* + * Construct a PTE. Default to IMB initially. Valid bit only gets + * set when the real pte is set in memory. + * + * Note: Don't set the valid bit for correct operation of tlb update. + */ + pt->pte_hi = (vsid << LPTE_VSID_SHIFT) | + (((uint64_t)(va & ADDR_PIDX) >> ADDR_API_SHFT64) & LPTE_API); + + pt->pte_lo = pte_lo; +} + +static __inline void +moea64_pte_synch(struct lpte *pt, struct lpte *pvo_pt) +{ + + ASSERT_TABLE_LOCK(); + + pvo_pt->pte_lo |= pt->pte_lo & (LPTE_REF | LPTE_CHG); +} + +static __inline void +moea64_pte_clear(struct lpte *pt, pmap_t pmap, vm_offset_t va, u_int64_t ptebit) +{ + ASSERT_TABLE_LOCK(); + + /* + * As shown in Section 7.6.3.2.3 + */ + pt->pte_lo &= ~ptebit; + TLBIE(pmap,va); +} + +static __inline void +moea64_pte_set(struct lpte *pt, struct lpte *pvo_pt) +{ + + ASSERT_TABLE_LOCK(); + pvo_pt->pte_hi |= LPTE_VALID; + + /* + * Update the PTE as defined in section 7.6.3.1. + * Note that the REF/CHG bits are from pvo_pt and thus should have + * been saved so this routine can restore them (if desired). + */ + pt->pte_lo = pvo_pt->pte_lo; + EIEIO(); + pt->pte_hi = pvo_pt->pte_hi; + SYNC(); + moea64_pte_valid++; +} + +static __inline void +moea64_pte_unset(struct lpte *pt, struct lpte *pvo_pt, pmap_t pmap, vm_offset_t va) +{ + ASSERT_TABLE_LOCK(); + pvo_pt->pte_hi &= ~LPTE_VALID; + + /* + * Force the reg & chg bits back into the PTEs. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From nwhitehorn at FreeBSD.org Fri Apr 3 17:26:02 2009 From: nwhitehorn at FreeBSD.org (Nathan Whitehorn) Date: Fri Apr 3 17:26:13 2009 Subject: svn commit: r190682 - head/sys/dev/ata/chipsets Message-ID: <200904040026.n340Q14E039517@svn.freebsd.org> Author: nwhitehorn Date: Sat Apr 4 00:26:01 2009 New Revision: 190682 URL: http://svn.freebsd.org/changeset/base/190682 Log: The Serverworks SATA chipsets used in Apple G5 systems require requiring the ATA status register with a 4-byte read request. This updates it, and subsequent 1-byte reads will return the correct result. This commit adds a hack to do this, which is currently ifdef'd powerpc, although Linux and Darwin do this unconditionally on all platforms. Modified: head/sys/dev/ata/chipsets/ata-serverworks.c Modified: head/sys/dev/ata/chipsets/ata-serverworks.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-serverworks.c Sat Apr 4 00:22:44 2009 (r190681) +++ head/sys/dev/ata/chipsets/ata-serverworks.c Sat Apr 4 00:26:01 2009 (r190682) @@ -58,6 +58,9 @@ static int ata_serverworks_ch_detach(dev static void ata_serverworks_tf_read(struct ata_request *request); static void ata_serverworks_tf_write(struct ata_request *request); static void ata_serverworks_setmode(device_t dev, int mode); +#ifdef __powerpc__ +static int ata_serverworks_status(device_t dev); +#endif /* misc defines */ #define SWKS_33 0 @@ -98,6 +101,23 @@ ata_serverworks_probe(device_t dev) return 0; } +#ifdef __powerpc__ +static int +ata_serverworks_status(device_t dev) +{ + struct ata_channel *ch = device_get_softc(dev); + + /* + * We need to do a 4-byte read on the status reg before the values + * will report correctly + */ + + ATA_IDX_INL(ch,ATA_STATUS); + + return ata_pci_status(dev); +} +#endif + static int ata_serverworks_chipinit(device_t dev) { @@ -186,6 +206,9 @@ ata_serverworks_ch_attach(device_t dev) ata_pci_hw(dev); ch->hw.tf_read = ata_serverworks_tf_read; ch->hw.tf_write = ata_serverworks_tf_write; +#ifdef __powerpc__ + ch->hw.status = ata_serverworks_status; +#endif /* chip does not reliably do 64K DMA transfers */ ch->dma.max_iosize = 64 * DEV_BSIZE; From marcel at FreeBSD.org Fri Apr 3 19:12:38 2009 From: marcel at FreeBSD.org (Marcel Moolenaar) Date: Fri Apr 3 19:12:46 2009 Subject: svn commit: r190684 - in head/sys: conf kern powerpc/include powerpc/powerpc sys Message-ID: <200904040212.n342CbYB043763@svn.freebsd.org> Author: marcel Date: Sat Apr 4 02:12:37 2009 New Revision: 190684 URL: http://svn.freebsd.org/changeset/base/190684 Log: PowerPC, meet kernel core dumps. The support is based on a generic dumper that creates an ELF core file and uses PMAP functions to scan and iterate over memory chunks, as well as handle memory mappings used during dumping. the PMAP layer can choose to return physical memory chunks or virtual memory chunks. For minidumps, the chunks should be virtual. The default MMU I/F implementation for the scan_md() method returns NULL. Thus, when a PMAP implementation does not implement the required methods, an empty core file is created. Here, empty means having an ELF header only. Obtained from: Juniper Networks Added: head/sys/powerpc/powerpc/dump_machdep.c (contents, props changed) Modified: head/sys/conf/files.powerpc head/sys/kern/kern_shutdown.c head/sys/powerpc/include/pmap.h head/sys/powerpc/powerpc/mmu_if.m head/sys/powerpc/powerpc/pmap_dispatch.c head/sys/sys/kerneldump.h Modified: head/sys/conf/files.powerpc ============================================================================== --- head/sys/conf/files.powerpc Sat Apr 4 00:56:41 2009 (r190683) +++ head/sys/conf/files.powerpc Sat Apr 4 02:12:37 2009 (r190684) @@ -139,6 +139,7 @@ powerpc/powerpc/db_disasm.c optional ddb powerpc/powerpc/db_hwwatch.c optional ddb powerpc/powerpc/db_interface.c optional ddb powerpc/powerpc/db_trace.c optional ddb +powerpc/powerpc/dump_machdep.c standard powerpc/powerpc/elf_machdep.c standard powerpc/powerpc/fpu.c optional aim powerpc/powerpc/fuswintr.c standard Modified: head/sys/kern/kern_shutdown.c ============================================================================== --- head/sys/kern/kern_shutdown.c Sat Apr 4 00:56:41 2009 (r190683) +++ head/sys/kern/kern_shutdown.c Sat Apr 4 02:12:37 2009 (r190684) @@ -680,15 +680,6 @@ dump_write(struct dumperinfo *di, void * return (di->dumper(di->priv, virtual, physical, offset, length)); } -#if defined(__powerpc__) -void -dumpsys(struct dumperinfo *di __unused) -{ - - printf("Kernel dumps not implemented on this architecture\n"); -} -#endif - void mkdumpheader(struct kerneldumpheader *kdh, char *magic, uint32_t archver, uint64_t dumplen, uint32_t blksz) Modified: head/sys/powerpc/include/pmap.h ============================================================================== --- head/sys/powerpc/include/pmap.h Sat Apr 4 00:56:41 2009 (r190683) +++ head/sys/powerpc/include/pmap.h Sat Apr 4 02:12:37 2009 (r190684) @@ -71,6 +71,13 @@ #include #include +struct pmap_md { + u_int md_index; + vm_paddr_t md_paddr; + vm_offset_t md_vaddr; + vm_size_t md_size; +}; + #if defined(AIM) #if !defined(NPMAPS) @@ -179,6 +186,11 @@ extern vm_offset_t msgbuf_phys; extern int pmap_bootstrapped; +extern vm_offset_t pmap_dumpsys_map(struct pmap_md *, vm_size_t, vm_size_t *); +extern void pmap_dumpsys_unmap(struct pmap_md *, vm_size_t, vm_offset_t); + +extern struct pmap_md *pmap_scan_md(struct pmap_md *); + #endif #endif /* !_MACHINE_PMAP_H_ */ Added: head/sys/powerpc/powerpc/dump_machdep.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/powerpc/powerpc/dump_machdep.c Sat Apr 4 02:12:37 2009 (r190684) @@ -0,0 +1,303 @@ +/*- + * Copyright (c) 2002 Marcel Moolenaar + * 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +CTASSERT(sizeof(struct kerneldumpheader) == 512); + +/* + * Don't touch the first SIZEOF_METADATA bytes on the dump device. This + * is to protect us from metadata and to protect metadata from us. + */ +#define SIZEOF_METADATA (64*1024) + +#define MD_ALIGN(x) (((off_t)(x) + PAGE_MASK) & ~PAGE_MASK) +#define DEV_ALIGN(x) (((off_t)(x) + (DEV_BSIZE-1)) & ~(DEV_BSIZE-1)) + +typedef int callback_t(struct pmap_md *, int, void *); + +static struct kerneldumpheader kdh; +static off_t dumplo, fileofs; + +/* Handle buffered writes. */ +static char buffer[DEV_BSIZE]; +static size_t fragsz; + +int dumpsys_minidump = 1; +SYSCTL_INT(_debug, OID_AUTO, minidump, CTLFLAG_RD, &dumpsys_minidump, 0, + "Kernel makes compressed crash dumps"); + +static int +buf_write(struct dumperinfo *di, char *ptr, size_t sz) +{ + size_t len; + int error; + + while (sz) { + len = DEV_BSIZE - fragsz; + if (len > sz) + len = sz; + bcopy(ptr, buffer + fragsz, len); + fragsz += len; + ptr += len; + sz -= len; + if (fragsz == DEV_BSIZE) { + error = di->dumper(di->priv, buffer, 0, dumplo, + DEV_BSIZE); + if (error) + return error; + dumplo += DEV_BSIZE; + fragsz = 0; + } + } + + return (0); +} + +static int +buf_flush(struct dumperinfo *di) +{ + int error; + + if (fragsz == 0) + return (0); + + error = di->dumper(di->priv, buffer, 0, dumplo, DEV_BSIZE); + dumplo += DEV_BSIZE; + fragsz = 0; + return (error); +} + +static int +cb_dumpdata(struct pmap_md *md, int seqnr, void *arg) +{ + struct dumperinfo *di = (struct dumperinfo*)arg; + vm_offset_t va; + size_t counter, ofs, resid, sz; + int c, error, twiddle; + + error = 0; + counter = 0; /* Update twiddle every 16MB */ + twiddle = 0; + + ofs = 0; /* Logical offset within the chunk */ + resid = md->md_size; + + printf(" chunk %d: %lu bytes ", seqnr, (u_long)resid); + + while (resid) { + sz = (resid > DFLTPHYS) ? DFLTPHYS : resid; + va = pmap_dumpsys_map(md, ofs, &sz); + counter += sz; + if (counter >> 24) { + printf("%c\b", "|/-\\"[twiddle++ & 3]); + counter &= (1<<24) - 1; + } + error = di->dumper(di->priv, (void*)va, 0, dumplo, sz); + pmap_dumpsys_unmap(md, ofs, va); + if (error) + break; + dumplo += sz; + resid -= sz; + ofs += sz; + + /* Check for user abort. */ + c = cncheckc(); + if (c == 0x03) + return (ECANCELED); + if (c != -1) + printf("(CTRL-C to abort) "); + } + printf("... %s\n", (error) ? "fail" : "ok"); + return (error); +} + +static int +cb_dumphdr(struct pmap_md *md, int seqnr, void *arg) +{ + struct dumperinfo *di = (struct dumperinfo*)arg; + Elf32_Phdr phdr; + int error; + + bzero(&phdr, sizeof(phdr)); + phdr.p_type = PT_LOAD; + phdr.p_flags = PF_R; /* XXX */ + phdr.p_offset = fileofs; + phdr.p_vaddr = md->md_vaddr; + phdr.p_paddr = md->md_paddr; + phdr.p_filesz = md->md_size; + phdr.p_memsz = md->md_size; + phdr.p_align = PAGE_SIZE; + + error = buf_write(di, (char*)&phdr, sizeof(phdr)); + fileofs += phdr.p_filesz; + return (error); +} + +static int +cb_size(struct pmap_md *md, int seqnr, void *arg) +{ + uint32_t *sz = (uint32_t*)arg; + + *sz += md->md_size; + return (0); +} + +static int +foreach_chunk(callback_t cb, void *arg) +{ + struct pmap_md *md; + int error, seqnr; + + seqnr = 0; + md = pmap_scan_md(NULL); + while (md != NULL) { + error = (*cb)(md, seqnr++, arg); + if (error) + return (-error); + md = pmap_scan_md(md); + } + return (seqnr); +} + +void +dumpsys(struct dumperinfo *di) +{ + Elf32_Ehdr ehdr; + uint32_t dumpsize; + off_t hdrgap; + size_t hdrsz; + int error; + + bzero(&ehdr, sizeof(ehdr)); + ehdr.e_ident[EI_MAG0] = ELFMAG0; + ehdr.e_ident[EI_MAG1] = ELFMAG1; + ehdr.e_ident[EI_MAG2] = ELFMAG2; + ehdr.e_ident[EI_MAG3] = ELFMAG3; + ehdr.e_ident[EI_CLASS] = ELFCLASS32; +#if BYTE_ORDER == LITTLE_ENDIAN + ehdr.e_ident[EI_DATA] = ELFDATA2LSB; +#else + ehdr.e_ident[EI_DATA] = ELFDATA2MSB; +#endif + ehdr.e_ident[EI_VERSION] = EV_CURRENT; + ehdr.e_ident[EI_OSABI] = ELFOSABI_STANDALONE; /* XXX big picture? */ + ehdr.e_type = ET_CORE; + ehdr.e_machine = EM_PPC; + ehdr.e_phoff = sizeof(ehdr); + ehdr.e_ehsize = sizeof(ehdr); + ehdr.e_phentsize = sizeof(Elf32_Phdr); + ehdr.e_shentsize = sizeof(Elf32_Shdr); + + /* Calculate dump size. */ + dumpsize = 0L; + ehdr.e_phnum = foreach_chunk(cb_size, &dumpsize); + hdrsz = ehdr.e_phoff + ehdr.e_phnum * ehdr.e_phentsize; + fileofs = MD_ALIGN(hdrsz); + dumpsize += fileofs; + hdrgap = fileofs - DEV_ALIGN(hdrsz); + + /* For block devices, determine the dump offset on the device. */ + if (di->mediasize > 0) { + if (di->mediasize < + SIZEOF_METADATA + dumpsize + sizeof(kdh) * 2) { + error = ENOSPC; + goto fail; + } + dumplo = di->mediaoffset + di->mediasize - dumpsize; + dumplo -= sizeof(kdh) * 2; + } else + dumplo = 0; + + mkdumpheader(&kdh, KERNELDUMPMAGIC, KERNELDUMP_POWERPC_VERSION, dumpsize, + di->blocksize); + + printf("Dumping %u MB (%d chunks)\n", dumpsize >> 20, + ehdr.e_phnum); + + /* Dump leader */ + error = di->dumper(di->priv, &kdh, 0, dumplo, sizeof(kdh)); + if (error) + goto fail; + dumplo += sizeof(kdh); + + /* Dump ELF header */ + error = buf_write(di, (char*)&ehdr, sizeof(ehdr)); + if (error) + goto fail; + + /* Dump program headers */ + error = foreach_chunk(cb_dumphdr, di); + if (error < 0) + goto fail; + buf_flush(di); + + /* + * All headers are written using blocked I/O, so we know the + * current offset is (still) block aligned. Skip the alignement + * in the file to have the segment contents aligned at page + * boundary. We cannot use MD_ALIGN on dumplo, because we don't + * care and may very well be unaligned within the dump device. + */ + dumplo += hdrgap; + + /* Dump memory chunks (updates dumplo) */ + error = foreach_chunk(cb_dumpdata, di); + if (error < 0) + goto fail; + + /* Dump trailer */ + error = di->dumper(di->priv, &kdh, 0, dumplo, sizeof(kdh)); + if (error) + goto fail; + + /* Signal completion, signoff and exit stage left. */ + di->dumper(di->priv, NULL, 0, 0, 0); + printf("\nDump complete\n"); + return; + + fail: + if (error < 0) + error = -error; + + if (error == ECANCELED) + printf("\nDump aborted\n"); + else + printf("\n** DUMP FAILED (ERROR %d) **\n", error); +} Modified: head/sys/powerpc/powerpc/mmu_if.m ============================================================================== --- head/sys/powerpc/powerpc/mmu_if.m Sat Apr 4 00:56:41 2009 (r190683) +++ head/sys/powerpc/powerpc/mmu_if.m Sat Apr 4 02:12:37 2009 (r190684) @@ -105,6 +105,11 @@ CODE { { return; } + + static struct pmap_md *mmu_null_scan_md(mmu_t mmu, struct pmap_md *p) + { + return (NULL); + } }; @@ -795,3 +800,50 @@ METHOD boolean_t page_executable { vm_page_t _pg; }; + +/** + * @brief Create temporary memory mapping for use by dumpsys(). + * + * @param _md The memory chunk in which the mapping lies. + * @param _ofs The offset within the chunk of the mapping. + * @param _sz The requested size of the mapping. + * + * @retval vm_offset_t The virtual address of the mapping. + * + * The sz argument is modified to reflect the actual size of the + * mapping. + */ +METHOD vm_offset_t dumpsys_map { + mmu_t _mmu; + struct pmap_md *_md; + vm_size_t _ofs; + vm_size_t *_sz; +}; + + +/** + * @brief Remove temporary dumpsys() mapping. + * + * @param _md The memory chunk in which the mapping lies. + * @param _ofs The offset within the chunk of the mapping. + * @param _va The virtual address of the mapping. + */ +METHOD void dumpsys_unmap { + mmu_t _mmu; + struct pmap_md *_md; + vm_size_t _ofs; + vm_offset_t _va; +}; + + +/** + * @brief Scan/iterate memory chunks. + * + * @param _prev The previously returned chunk or NULL. + * + * @retval The next (or first when _prev is NULL) chunk. + */ +METHOD struct pmap_md * scan_md { + mmu_t _mmu; + struct pmap_md *_prev; +} DEFAULT mmu_null_scan_md; Modified: head/sys/powerpc/powerpc/pmap_dispatch.c ============================================================================== --- head/sys/powerpc/powerpc/pmap_dispatch.c Sat Apr 4 00:56:41 2009 (r190683) +++ head/sys/powerpc/powerpc/pmap_dispatch.c Sat Apr 4 02:12:37 2009 (r190684) @@ -465,6 +465,30 @@ pmap_page_executable(vm_page_t pg) return (MMU_PAGE_EXECUTABLE(mmu_obj, pg)); } +vm_offset_t +pmap_dumpsys_map(struct pmap_md *md, vm_size_t ofs, vm_size_t *sz) +{ + + CTR4(KTR_PMAP, "%s(%p, %#x, %#x)", __func__, md, ofs, *sz); + return (MMU_DUMPSYS_MAP(mmu_obj, md, ofs, sz)); +} + +void +pmap_dumpsys_unmap(struct pmap_md *md, vm_size_t ofs, vm_offset_t va) +{ + + CTR4(KTR_PMAP, "%s(%p, %#x, %#x)", __func__, md, ofs, va); + return (MMU_DUMPSYS_UNMAP(mmu_obj, md, ofs, va)); +} + +struct pmap_md * +pmap_scan_md(struct pmap_md *prev) +{ + + CTR2(KTR_PMAP, "%s(%p)", __func__, prev); + return (MMU_SCAN_MD(mmu_obj, prev)); +} + /* * MMU install routines. Highest priority wins, equal priority also * overrides allowing last-set to win. Modified: head/sys/sys/kerneldump.h ============================================================================== --- head/sys/sys/kerneldump.h Sat Apr 4 00:56:41 2009 (r190683) +++ head/sys/sys/kerneldump.h Sat Apr 4 02:12:37 2009 (r190684) @@ -67,12 +67,13 @@ struct kerneldumpheader { #define KERNELDUMPVERSION 1 uint32_t architectureversion; #define KERNELDUMP_ALPHA_VERSION 1 -#define KERNELDUMP_I386_VERSION 2 -#define KERNELDUMP_IA64_VERSION 1 -#define KERNELDUMP_SPARC64_VERSION 1 #define KERNELDUMP_AMD64_VERSION 2 -#define KERNELDUMP_ARM_VERSION 1 -#define KERNELDUMP_TEXT_VERSION 1 +#define KERNELDUMP_ARM_VERSION 1 +#define KERNELDUMP_I386_VERSION 2 +#define KERNELDUMP_IA64_VERSION 1 +#define KERNELDUMP_POWERPC_VERSION 1 +#define KERNELDUMP_SPARC64_VERSION 1 +#define KERNELDUMP_TEXT_VERSION 1 uint64_t dumplength; /* excl headers */ uint64_t dumptime; uint32_t blocksize; From weongyo at FreeBSD.org Sat Apr 4 04:23:03 2009 From: weongyo at FreeBSD.org (Weongyo Jeong) Date: Sat Apr 4 04:23:20 2009 Subject: svn commit: r190688 - in head: share/man/man4 sys/contrib/dev/uath sys/dev/usb/wlan sys/modules/usb/uath usr.sbin/uathload Message-ID: <200904041123.n34BN1wb069873@svn.freebsd.org> Author: weongyo Date: Sat Apr 4 11:23:00 2009 New Revision: 190688 URL: http://svn.freebsd.org/changeset/base/190688 Log: Add uath(4) wireless USB driver for Atheros AR5005UG and AR5005UX chipsets. Reviewed by: sam Added: head/share/man/man4/uath.4 (contents, props changed) head/sys/contrib/dev/uath/ head/sys/contrib/dev/uath/ar5523.bin.uu head/sys/dev/usb/wlan/if_uath.c (contents, props changed) head/sys/dev/usb/wlan/if_uathreg.h (contents, props changed) head/sys/dev/usb/wlan/if_uathvar.h (contents, props changed) head/sys/modules/usb/uath/ head/sys/modules/usb/uath/Makefile (contents, props changed) head/usr.sbin/uathload/ head/usr.sbin/uathload/Makefile (contents, props changed) head/usr.sbin/uathload/uathload.c (contents, props changed) Added: head/share/man/man4/uath.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/uath.4 Sat Apr 4 11:23:00 2009 (r190688) @@ -0,0 +1,186 @@ +.\" +.\" Copyright (c) 2006 +.\" Damien Bergamini +.\" +.\" Permission to use, copy, modify, and distribute this software for any +.\" purpose with or without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +.\" +.\" $FreeBSD$ +.\" +.Dd March 31, 2009 +.Dt UATH 4 +.Os +.Sh NAME +.Nm uath +.Nd Atheros USB IEEE 802.11a/b/g wireless network device +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device ehci" +.Cd "device uhci" +.Cd "device ohci" +.Cd "device usb" +.Cd "device uath" +.Cd "device wlan" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +if_uath_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver supports USB 2.0 wireless network devices based on Atheros +Communications fifth generation AR5005UG and AR5005UX chipsets. +.Pp +The AR5005UG chipset is made of an AR5523 multiprotocol MAC/baseband processor +and an AR2112 Radio-on-a-Chip that can operate between 2300 and 2500 MHz +(802.11b/g). +.Pp +The AR5005UX chipset is made of an AR5523 multiprotocol MAC/baseband processor +and an AR5112 dual band Radio-on-a-Chip that can operate between 2300 and +2500 MHz (802.11b/g) or 4900 and 5850 MHz (802.11a). +.Pp +The AR5005UG and AR5005UX chipsets both have an integrated 32-bit MIPS +R4000-class processor that runs a firmware and manages, among other things, +the automatic control of the transmit rate and the calibration of the radio. +.Pp +.Nm +supports +.Cm station , +and +.Cm monitor +mode operation. +Only one virtual interface may be configured at any time. +For more information on configuring this device, see +.Xr ifconfig 8 . +.Sh FIRMWARE +.Nm +requires firmware that is downloaded to the device. +This is normally done by the +.Xr uathload 8 +utility that is launched by +.Xr devd 8 +when the device is inserted. +.Xr uathload +includes the firmware in the binary program. +This firmware is licensed for general use and is included in the base system. +.Sh HARDWARE +The following adapters should work: +.Pp +.Bl -column -compact "TRENDware International TEW-444UB" "AR5005UX" -offset 6n +.It Em "Adapter Chipset" +.\".It Belkin F6D3050 AR5005UX +.It Li "Compex WLU108AG" Ta AR5005UX +.It Li "Compex WLU108G" Ta AR5005UG +.\".It Li "D-Link DWL-AG132" Ta AR5005UX +.It Li "D-Link DWL-G132" Ta AR5005UG +.\".It Li "Edimax EW-7315Ug" Ta AR5005UG (AR2414???) +.\".It Li "Lancom USB-54ag" Ta AR5005UX +.\".It Li "NEC WL54TU" Ta AR5005UX +.It Li "IODATA WN-G54/US" Ta AR5005UG +.It Li "MELCO WLI-U2-KAMG54" Ta AR5005UX +.It Li "Netgear WG111T" Ta AR5005UG +.It Li "Netgear WG111U" Ta AR5005UX +.It Li "Netgear WPN111" Ta AR5005UG +.It Li "Olitec 000544" Ta AR5005UG +.It Li "PLANET WDL-U357" Ta AR5005UX +.\".It Li "Senao WUB-8004" Ta AR5005UX +.It Li "Siemens Gigaset 108" Ta AR5005UG +.It Li "SMC SMCWUSBT-G" Ta AR5005UG +.It Li "SMC SMCWUSBT-G2" Ta AR5005UG +.\".It Li "SparkLAN WL-685GS" Ta AR5005UG +.It Li "SparkLAN WL-785A" Ta AR5005UX +.It Li "TP-Link TL-WN620G" Ta AR5005UG +.It Li "TRENDware International TEW-444UB" Ta AR5005UG +.It Li "TRENDware International TEW-504UB" Ta AR5005UX +.It Li "Unex Technology UR054ag" Ta AR5005UX +.\".It Li "Wistron NeWeb DCUA-81" Ta AR5005UX +.\".It Li "Wistron NeWeb DRUA-81" Ta AR5005UG +.\".It Li "Wistron NeWeb DRUA-82" Ta AR5005UX +.\".It Li "ZyXEL G-200 v2" Ta AR5005UG +.It Li "ZyXEL XtremeMIMO M-202" Ta AR5005UX +.El +.Pp +An up to date list can be found at +.Pa http://customerproducts.atheros.com/customerproducts/default.asp . +.Sh EXAMPLES +Join an existing BSS network (i.e., connect to an access point): +.Pp +.Bd -literal -offset indent +ifconfig wlan create wlandev uath0 inet 192.168.0.20 \e + netmask 0xffffff00 +.Ed +.Pp +Join a specific BSS network with network name +.Dq Li my_net : +.Pp +.Dl "ifconfig wlan create wlandev uath0 ssid my_net up" +.Pp +Join a specific BSS network with 64-bit WEP encryption: +.Bd -literal -offset indent +ifconfig wlan create wlandev uath0 ssid my_net \e + wepmode on wepkey 0x1234567890 weptxkey 1 up +.Ed +.Pp +Join a specific BSS network with 128-bit WEP encryption: +.Bd -literal -offset indent +ifconfig wlan create wlandev uath0 wlanmode adhoc ssid my_net \e + wepmode on wepkey 0x01020304050607080910111213 weptxkey 1 +.Ed +.Sh DIAGNOSTICS +.Bl -diag +.It "uath%d: could not send command (error=%s)" +An attempt to send a command to the firmware failed. +.It "uath%d: timeout waiting for command reply" +A read command was sent to the firmware but the firmware failed to reply in +time. +.It "uath%d: device timeout" +A frame dispatched to the hardware for transmission did not complete in time. +The driver will reset the hardware. +This should not happen. +.El +.Sh SEE ALSO +.Xr netintro 4 , +.Xr usb 4 , +.Xr wlan 4 , +.Xr wlan_ccmp 4 , +.Xr wlan_tkip 4 , +.Xr wlan_wep 4 , +.Xr devd 8 , +.Xr uathload 8 , +.Xr ifconfig 8 , +.Xr wpa_supplicant 8 . +.Sh HISTORY +The +.Nm +driver first appeared in +.Ox 4.0 . +.Sh AUTHORS +The +.Nm +driver was written by +.An Weongyo Jeong Aq weongyo@freebsd.org +and +.An Sam Leffler Aq sam@freebsd.org . +It is distantly related to a driver written by +.An Damien Bergamini Aq damien@openbsd.org . +.Sh CAVEATS +Atheros proprietary 108 Mbps mode (aka Super AG mode) is not supported. +.Pp +Dual-band adapters are presently not working; +to workaround, restriction operation to 2.4GHz channels. Added: head/sys/contrib/dev/uath/ar5523.bin.uu ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/contrib/dev/uath/ar5523.bin.uu Sat Apr 4 11:23:00 2009 (r190688) @@ -0,0 +1,3359 @@ +/*- + * Copyright (c) 2002-2008 Atheros Communications, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the following conditions are met: + * 1. The materials contained herein are unmodified and are used + * unmodified. + * 2. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following NO + * ''WARRANTY'' disclaimer below (''Disclaimer''), without + * modification. + * 3. Redistributions in binary form must reproduce at minimum a + * disclaimer similar to the Disclaimer below and any redistribution + * must be conditioned upon including a substantially similar + * Disclaimer requirement for further binary redistribution. + * 4. Neither the names of the above-listed copyright holders nor the + * names of any contributors may be used to endorse or promote + * product derived from this software without specific prior written + * permission. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, + * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE + * FOR 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 DAMAGES. + */ +begin 755 ar5523.bin +M0!I@`#P;``@#>M@D$V``#0`````#X`@A/!N``"=[!@@\'X``)_\`-`-_V"($ +M$0`!``````-_V"``(/@A`V``"``````\&P`0`WK8)!-@``T``````^`((3P; +M@``G>P8`/!^``"?_`'0#?]@B!!$``0`````#?]@@`"#X(0-@``@`````)!H` +M`D":@``#X`@A/`*``"1"!!`\'X``)_\`K`!?$"($$0`!``````!?$"``(/@A +M`$``"``````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M````````````````````````````````0!IH```````S6@!_/!N``"=[`@`# +M>M@@CWL```-@``@``````````````````````````````````````````$`: +M:```````,UH`?SP;@``G>P(``WK8((][```#8``(```````````````````` +M```````````````````````D&@"`/!N``"=[`@"/>P"``V``"``````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M``````!`@&@``````#P"$``T0O\`0()@`````````````````"0"``)`@H`` +M`````````````````^`((3P:@``G6@MT/!^``"?_!&0#7]`B!!$``0`````# +M7]`@`"#X(0-`^`D``````^`((3P:@`(G6D:X/!^``"?_!)0#7]`B!!$``0`` +M```#7]`@`"#X(0-`^`D`````0`)@```````\`___-&,`_P!#$"1`@F`````` +M````````````/`2``B2$5_``@.@A/`$?_S0A__\#H>@D/`&@``.AZ"5`!(`` +M`````````````````^`((3P:@`(G6J6$/!^``"?_!1@#7]`B!!$``0`````# +M7]`@`"#X(3P!'_\T(?__`T'0)#P!H``#0=`E`T#X"0`````\'(`#)YS&L#P$ +M@`(DA%?P`(#H(3P(@``\"8``)2D!P#P+@``E:P'DC2(``"$I``2M`@``(0@` +M!!4K__L`````-`0`$#P%@``DI09T/`:``"3&`@"LQ0``(,8`!""$__\4@/_\ +M`````#P$@``DA`(`/`6``"2E!X"LA0``/`6``"2E"RBLA0`D/`6``"2E!G2L +MA0"`K(4`A*R%`(@,``*L``````P`:5H`````#`!J>P`````,`&D:``````@` +M;<\\'P``$````0````!`&F``/!O__S=[__`#6]`D0)I@```````````````` +M`$`:\`````````````````!`FG``````````````````0!I@`#P;_[\W>___ +M`UO0)$":8``D&@"(/!N``"=[`@"/>P"(`V``"``````#H-@A([W^L*^Z`(BO +MH```KZ$`!*^B``BOHP`,KZ0`$*^E`!2OI@`8KZ<`'*^H`""OJ0`DKZH`**^K +M`"ROK``PKZT`-*^N`#BOKP`\K[``0*^Q`$2OL@!(K[,`3*^T`%"OM0!4K[8` +M6*^W`%RON`!@K[D`9*^\`'"OO@!XK[\`?```(!```"@2KZ0`@*^E`(2ONP!T +M0`AH`$`)8`!`"C@`0`M``$`,&`!`#7@`0`YP`*^H`)BOJ0",KZH`E*^K`)RO +MK`"DKZT`H*^N`)`\'(`#)YS&L`.@@"$CO?_@0!I@`#P;__\W>__P`UO0)$": +M8``````````````````,`&D.`@`@(0@``DT``````Z#8(2.]_K"ON@"(KZ`` +M`*^A``2OH@`(KZ,`#*^D`!"OI0`4KZ8`&*^G`!ROJ``@KZD`)*^J`"BOJP`L +MKZP`,*^M`#2OK@`XKZ\`/*^P`$"OL0!$K[(`2*^S`$ROM`!0K[4`5*^V`%BO +MMP!*^_`'P``"`0```H$J^D`("OI0"$K[L`=$`) +M8`!`"C@`0`MP`*^I`(ROJ@"4KZL`D#P<@`,GG,:P/`*``B1"1E2,1```((0` +M`:Q$```#H(`A)[W_X$`#8```````0`)H````````0Q`D``(2@C!"`'\\`X`` +M)&,*/`!#$""`4@```D"((20!``02(0`#`````!````P`````/!&@P#8Q`!". +M,0``,C$`?SP#@``D8PH\`'$8((!Q```F,0`&`B"0(0``````$8B`0!I@`#P; +M__\W>__P`UO0)$":8``````````````````\"H`")4HQ>`%14""-2@``/`6` +M`B2E,?``L2@@C*4```)`("$!0/@)``````!`D"$\!8`")*4R:`"Q*"",I0`` +M`@`P(0P`=7,`0"`A`D`0(2.]`"!``F``/`/__S1C__X`0Q`D0()@```````` +M`````````(^H`)2/J0"`CZH`A$"(.``!(``1`4``$X^A``2/H@`(CZ,`#(^D +M`!"/I0`4CZ8`&(^G`!R/J``@CZD`)(^J`"B/JP`LCZP`,(^M`#2/K@`XCZ\` +M/(^P`$"/L0!$C[(`2(^S`$R/M`!0C[4`5(^V`%B/MP!(^_`'R/NP",-!K_``-:T"<#>M@D0!I@````````````,UK_``-ZV"6/ +MN@"0C[T`=#=[``)`FV``````````````````0)IP```````````````````` +M``]"```8`````````0`"``$``P`!``(``0`$``$``@`!``,``0`"``$`!0`! +M``(``0`#``$``@`!``0``0`"``$``P`!``(``0`#X``(``````.@&"$`H.@A +M([W_X*^C``BOOP`0`(#X"0````"/OP`0C[T`"`/@``@`````/`2``B2$1Z@\ +M!8`#)*6B'#"&``,4P``2``````"D.",`!SE"``P(``WK8((][```#8``(`````#0:`"0( +M``&=`````#P)H,`U*0"0C24``"0$``0`I"@EK24``#P)H+,U*0`",!2U`C)!,``0`+9`(Q:/__`4P`&P`.+`)1@``! +M```!S0``(!(``!@0``,<``!E&"4``&@2``````````!PB$@"`&D0*U!```L` +M:1@C`&L8(0!K$"L40``&)(W__P!I$"M00``$`&D8(R6M__\`:Q@A`&D8(P!L +M`!LQQ/__48```0```H@!@`+9`(`C``;,6C__P'N&`8` +MZA`$`$-0)0`*+`)1@``!```!S0&`:"$`[G`$```P$@``(!``!"0``(48)0`` +M>!(``````````'#(2`(`:1`K$$``"@$`F"$`:Q@A`&L0*Q1```8DS___`&D0 +M*U!```0`:1@C)>___P!K&"$`:1@C`&T`&S%$__]1H``!```!S0``$!(``!@0 +M``,<``!D&"4``#`2``````````!P4T@"`&D0*Q!```L`#Q0``&L8(0!K$"L4 +M0``&),;__P!I$"L00``$``\4`"3&__\`:Q@A``\4``!&F"40`/^.`&E0(S1" +M__\D`P`0`$L0*R0$`!@`8"@A$`#_>0""*`L`AA`K$$``!S0"__\``#`A``"8 +M(1$`_U$`H,@A$`#_30%`P"$`1A`K%$``?#P"`/\D`@`(+,,!``!`*"$``R@+ +M/`.``@"I$`8D8Q9\`$,0(9!$```D`@`@`(4@(0!$.",4X``1`$=X(P$J$"L4 +M0``%`H@!@",`!LQ,___`>X0 +M!@#J&`0`8E`E``HL`E&```$```'-`.M8!```,!(``"`0``0D``"%&"4``$`2 +M``````````!PTV@"`&T0*Q!```H`[G`$`&D8(0!I$"L40``&),C__P!M$"M0 +M0``$`&T8(R4(__\`:1@A`&T8(P!L`!LQ1/__48```0```",!2U`C)!,``0`+9`(Q:/__`4P`&P`.+`)1 +M@``!```!S0``(!(``!@0``,<``!E&"4``&@2``````````!PB$@"`&D0*U!` +M``L`:1@C`&L8(0!K$"L40``&)(W__P!I$"M00``$`&D8(R6M__\`:Q@A`&D8 +M(P!L`!LQQ/__48```0```H@!@`+9`(`C``;,6C__P'N +M&`8`ZA`$`$-0)0`*+`)1@``!```!S0&`:"$`[G`$```P$@``(!``!"0``(48 +M)0``>!(``````````'#(2`(`:1`K$$``"@$`F"$`:Q@A`&L0*Q1```8DS___ +M`&D0*U!```0`:1@C)>___P!K&"$`:1@C`&T`&S%$__]1H``!```!S0``$!(` +M`!@0``,<``!D&"4``#`2``````````!P4T@"`&D0*Q!```L`#Q0``&L8(0!K +M$"L40``&),;__P!I$"L00``$``\4`"3&__\`:Q@A``\4``!&F"40`/^.`&E0 +M(S1"__\D`P`0`$L0*R0$`!@`8"@A$`#_>0""*`L`AA`K$$``!S0"__\``#`A +M``"8(1$`_U$`H,@A$`#_30%`P"$`1A`K%$``?#P"`/\D`@`(+,,!``!`*"$` +M`R@+/`.``@"I$`8D8Q9\`$,0(9!$```D`@`@`(4@(0!$.",4X``1`$=X(P$J +M$"L40``%`H@!@",`!LQ,___ +M`>X0!@#J&`0`8E`E``HL`E&```$```'-`.M8!```,!(``"`0``0D``"%&"4` +M`$`2``````````!PTV@"`&T0*Q!```H`[G`$`&D8(0!I$"L40``&),C__P!M +M$"M00``$`&T8(R4(__\`:1@A`&T8(P!L`!LQ1/__48```0```]`"`G +MO?_0K[``$`"`@"$D!`!]`#"/H@`` +M`$`@(0P`!L^N8@`$%$#_\0!`B"$,`!FN`F`@(11`_^T`0(@A#``2D`)@("$4 +M0/_I`$"((0P`&=D"8"`A`$"0(1!`_^0D$0`"C[````!`("$,`!G1)`4'(`!` +MB"$D`@<@K@(;[`)`*"$"8"`A#``<@JYR```\`X`"K'-'J!``_]6N8@`()[W_ +M\*^P``"OOP`$#``4GP"`@"$"`"`A#``4K```*"$00``&)`,`%H^_``2/L``` +M`&`0(0/@``@GO0`0#``?*P(`("$`0!@A)@4;<`(`("$40/_U)`8``0P`-X4` +M`````$`8(20%``$40/_O`@`@(0P`%*P`````)`,`%A``_^H``A@*K*0`!`/@ +M``BLX```)[W_H*^S`$P`H)@A```H(:^Q`$2OOP!0K[(`2*^P`$`,`!2L`("( +M(11``!6OH@`PCB(7W!1``"T#H"`A#`!Z=0````"/I@`@CZ4`'#P$@`(DT,0` +M`!`7P@("$"$``I!##`!P="2$"(@"("`A#``)M@)`*"&OH@`P$$``"P.@("$2 +M8``"CZ(`,*YB``"/OP!0C[,`3(^R`$B/L0!$C[``0`/@``@GO0!@#`!Z=0`` +M``"/H@`@`B`@(210Q``,``RQ`@`H(3P$@`(DA`BD`@`H(0)`,"$40/_JKZ(` +M,`P`<'0`````)`(``:XB%]P"("`A#``'5R>E`#"/H@`P4$#_X*X@%^@0`/_> +M`````">]_^"OL0`4K[``$*^_`!B,@Q?@)`(``0"@B"$`@(`A`Z`H(1!B``NO +MH```$B``!JX`%^B/OP`8C[$`%(^P`!`#X``()[T`((^B```0`/_YKB(```P` +M!Y4`````CZ(``!1`__("`"`A#`!1E``````"`"`A#``4K"0%``$0`/_K```` +M`">]_^"OL@`(`*"0(0``*"&OLP`,K[$`!*^P``"OOP`0#``4K`"`@"$D$P`! +M`$"((1!```L"`"`A$D```JX`%^BN40``C[\`$(^S``R/L@`(C[$`!(^P```# +MX``()[T`(*X`&QP,``A^KA,;)`P`"A@"`"`A#`!Q7``````D8P#(+&4`R(X$ +M&`@`11`A`$`P(20(```D"0#(#`!Q=`!@."$,`'%<`````"1C`,@L90#(C@08 +M0`!%$"$`0#`A)`@``"0)`,@,`'%T`&`X(8X"``0,`!T8C$0```(`("$,`"D\ +M/`6```P`!_8"`"`AKA,7X!``_]$`````)[W_\*^R``BOL0`$K[```*^_``R, +M@A?@)!(``0"@B"$`@(`A$%(`"@``*"$2(``"KA(7Z*X@``"/OP`,C[(`"(^Q +M``2/L````^``"">]`!`,`!2L`````#P%@``,`"EL`@`@(0P`<7N.!!@(#`!Q +M>XX$&$`,``LT`@`@(0P`$7<"`"`A#``(E0(`("$D!0`!#``*2`(`("$,``@' +M`@`@(8X"``0,`!T*C$0``*X`%^`0`/_>`````">]__"OL````*"`(:^Q``0` +MP"@A`("((0(`("&OOP`,K[(`"`P`!S8`P)`A#`!1E`(`("$"("`A)`4`"``` +M,"$,`!$9)`<``59```&N0```C[\`#(^R``B/L0`$C[````/@``@GO0`0)[W_ +M\*^Q``2OL````("((0"@@"&OOP`(#``4;20%``$"("`A$@``"SP%``0,`"D\ +M``````(@("$,`!1M```H(8^_``B/L0`$C[````/@``@GO0`0#``I;#P%``00 +M`/_V`B`@(2>]__`D`@`!K((]_]"OM0`4`*"H(20%``&OOP`@K[<` +M'*^V`!BOM``0K[,`#`$`H"$`X)@AK[(`"*^Q``0`P)`A`("((:^P```,`!1M +M/!:``CP0@`(FI``0/!>``@``*"&N$C.`KM,SA`P`:S2N]#.(`J`@(0P`:S0D +M!0`!CB4``(X$,X`\`O_QC*-`$#1"__\`!"1``&(8)#P"``X`@B`D`&08):RC +M0!".)0``CL0SA#P"_X^,HT`0-$+__P`$)0``8A@D/`(`<`""("0`9!@EK*-` +M$(XE``".Y#.(/`+_?XRC0!`T0O__``0EP`!B&"0\`@"``((@)`!D&"6LHT`0 +M`B`@(0P`%&T``"@AC[\`((^W`!R/M@`8C[4`%(^T`!"/LP`,C[(`"(^Q``2/ +ML````^``"">]`#`GO?_PK[```"0&``0`@(`AK[\`!`P`-@X``"@A#`!1O28$ +M'8P00``'`@`@(0P`-;2,10`D#``UN`(`("$,`#7H`@`@(0P`<=`F!!K(C[\` +M!(^P```#X``()[T`$">]__```"@A)`8``Z^P``"OOP`$#``V#@"`@"$,`''" +M)@0:R`P`<+4`````#``U_0(`("$,`#6_`@`@(0P`<+H`````#``(VP(`("$D +M`@`!K@(;)(^_``2/L````^``"">]`!",I0`H)`/_\#"B``\D0@`G`$,X)`"C +M&"0`9Q`A`$,0*Q1```<`8#`AO'$``"1C`!``QQ`A`$,0*Q!`__L`````D*(` +M`"0#`(`P0@#\4$,`!)2C`!0``"`A`^``"`"`$"&4@AQ>5&+__```("&4HP`2 +ME((<7%1B__@``"`AE((<6I2C`!`48O_S)`0``1``__(`````C((:_(Q#```# +MX``(K(,:_(R"&ORLH@```^``"*R%&OPGO?_@)`(``:^P``"OOP`, +M1```H@`:^!``_XBN`!KT#``(TP(`("$`0(@AD@(:^"8E``0D0@`!HB(``"0" +M``.B(@`!)`(`0!``_\2F(@`"D@,:^`)`*"$D8@`!H@(:^))"``&B0P``,$(` +M_J)"``&.`@`$#``:QXQ$```0`/]P)A8=C`P`"*X"`"`A$`#_F*X"&MR/OP`< +MC[8`&(^U`!2/M``0C[,`#(^R``B/L0`$C[````"`$"$#X``()[T`(">]__"O +ML0`$K[````#`B"$`H(`A)`4``:^_``ROL@`(#``4;0"`D"$"`"`A#``W=`(@ +M*"$"`#`A`@`H(0P`4=@F1!V,`D`@(0P`%&T``"@AC[\`#(^R``B/L0`$C[`` +M``/@``@GO0`0)[W_\*^_``"0H@`!,$(``A!```8DI_^D#``(UP````"/OP`` +M`^``"">]`!"@H```H*```8R&&^RDH``"`.`H(0P`"8@DQO_\$`#_]H^_```G +MO?_0K[\`(*^W`!ROM@`8K[,`#*^Q``2OL```K[4`%*^T`!"OL@`(C((;[`"` +MF"$DA!V,)%``H`"P`!JN8!M44@```0```]`#!RT!@")`(``:YB';0D<``0#`!Z5P(`("$0 +M0``R`$"((0!`("$``"@A`@`P(0!`D"$,`'"J)C4`8`+V$"JN<1JX`B"@(:YP +M&KP00``5`J"((0+`@"&.9AOLKE0`)*Y5`"BN40`$`D`H(0)@("$,``F(),;_ +M_(YB&^PF$/__`B(H(0)"&"$"HB`A`H(0(21R`%PDE0!<)%0`7!8`_^XDL0!< +M)I$`$!K```BN8!K\`L"`(0(@*"$"8"`A#``(UR80__\6`/_[)C$`1"9P&L@, +M`'&T`@`@(0P`<]__"OL````("`(:^_ +M``0,`''0)(0:F`P`<=`F!!J$)`(``:X"&K2/OP`$C[````/@``@GO0`0)[W_ +M\*^R``BOL0`$K[```*^_``P`@)`A`("`(201``..`@`($$``#R8%``@`H!@A +M)`0``R0"``$DA/__K&(`-*1@`#"D8``R!('_^R1C``@DI0!] +M__"OL0`$`("((:X@&K0DA!J$K[\`"*^P```,`''"`*"`(0P`<<(F)!J8$@`` +M"P(@("$,``U[`B`@(0P`"B8"("`AKB`;'(^_``B/L0`$C[````/@``@GO0`0 +M#``.V0`````0`/_S`````(RB`#P\`X?_-&/__SP$?_\`0Q`D-(3__SP#_O\T +M8___`$00)`!#$"2LH``$)[W_\*R@```DI`!LC@,`.*X@```"0A`JKA$`.*QQ```40/_N +MKB,`!"8$`"0,`'&'```H(0)@$"&/OP`0C[,`#(^R``B/L0`$C[````/@``@G +MO0`@$`#_]R03``(GO?_PK[$`!*^_``BOL```C)``!`P`<+4`H(@AC@0`-(R% +M```0H``3C((`!*RB``2.`@`PC(,`!*R1``BL@@`$C@(`,*QE``"N!``PK(`` +M``P`<+JL1```#`!QHR8$`"2/OP`(C[$`!(^P```#X``()[T`$!``_^ZN`@`X +M)[W_\*^Q``0`@(@A)(0`)*^_``@,`'&.K[````P`<+4`````CB0`+(R%```0 +MH``3C((`!*RB``2.(@`XC(,`!(R0``BL@@`$CB(`.*QE``"N)``XK(```*R` +M``@,`'"ZK$0```(`$"&/OP`(C[$`!(^P```#X``()[T`$!``_^ZN(@`P)[W_ +MX*^Q`!2OL``0K[\`'*^R`!B,D@`$`("`(0.@*"$F1``D#`!QJJ^@``"/H@`` +M'$``!P``B"&/OP`]`"`,``L3`D`@(1!`__<` +M0"@A,$(`#R1"`"LD`__P`$,P)`"C&"0`9A`A`$,0*Q1```<`8"`AO'$``"1C +M`!``AA`A`$,0*Q!`__L`````C*,`""0"`!`08@`*``````P`"H,"`"`ACZ(` +M`"8Q``$"(A`J%$#_XX^_`!P0`/_=C[(`&`P`"O0"`"`A$`#_]X^B```GO?_P +MK[(`"*^P``"OOP`,K[$`!(R1``0D`@`!``"`(0(@("&N(A?8#``*@R8R&JP" +M0"`A#`!QAP``*"$,``ZZ`B`@(2H#``440``.)A```5!@``TF,!J8#`!Q7``` +M```D8P!D+&0`9`!$$"$`0#`A`&`X(0P`<94"0"`A$`#_[P`````F,!J8#`!Q +MT`(`("$,`'&C)B07T`P`<8XF)!?(`@`@(:X@%]@,`''"`````(^_``R/L@`( +MC[$`!(^P```#X``()[T`$">]_]"OL0`DK[\`+*^R`"BOL``@`*"((8R2``0` +M`%`A``!P(1"@`'X``'@AC*T`#(RD`!`QH@`/``(8P`!B&",``QC``D,8(20" +M__\0@@`8)'D8>``$$,``1!`A``(0P`!$$",``A"``D(0(8Q$``@D`P`!KZ,` +M!!2```X`6!'``&DD`@`& +MC<,`!%!B`&<``'@A)BG__(XL`!@!((`A)CC_H!$@`#\D!@`<`29`(24J_Z0E +M"``$K4@`!(TK``"10P`.)`7P```+$"L``A$`,&,`[P!B&"6A0P`.CB(``)5# +M``HE9_^D)$+_Y#!"#_\`91@D`&(8):5#``J.0AOLE40`#@`+.`H`1A`C)$+_ +M_`&"&"L!@Q`+`(4@)#!"#_\`@B`EI40`#I5&``ZM)_^DC4(`/"0#_?\`#2E` +M`$,0)#"E`@``#1E"/`3^_S2$__\`11`E,&,``0!$$"0``QX``$,0):U"`#RM +M2``HCB,`$##&#_\D`O__)&0`!*U'`""M6``PK4\`4*U.`$P08@`C`89@(ZU$ +M`#@!8$@A%6#_PP``,"$"`$@A$2``#`%`@"$E*O^DC4,`/(TK```\`G__-$+_ +M_P!B&"0!8$@AK4,`/*U9`%@58/_VK5``+`)`("$#("@A`P`P(0P`#TL``#@A +MCB(`%%!```.N``!4CB(`!*X"`%2/OP`LC[(`*(^Q`"2/L``@`^``"">]`#`D +M`G__$`#_W:U"`#@``'@A$`#_F0``<"$,``JD`Z`P(:X@``0"0"`A#``*@P(@ +M*"$0`/_NC[\`+">]_]"OL0`4K[\`(*^S`!ROL@`8K[``$`"`B"$,`'#^C)(` +M!`!`("$,`'$!```H(0(@("$,``L3)E,:F`)@("$,`''"`$"`(0)`("$,`!1M +M)`4``8X#``@D`@`0`@`H(1!B`!X"("`ACD(7X`(`*"$40``6`D`@(0P`"H,` +M````)B0`)`P`<:H#H"@ACZ(`````@"$00``$`B`@(0P`"Q,``````$"`(58` +M_^N.`P`(#`!QT`)@("$"0"`A#``4;0``*"$0`/_;`B`@(0P`"YX"("`A$`#_ +MZR8D`"0,``ML`````!``_^]`"`,`'&T)@0:F#P%@``\!X`"/`B``CP+@`(D!``!)FID$"2E +M,.@"(#`A).<(Q"4(6!`E:V08#`!PRR0)#``,`'#DCF1D$!``_^<"0!`A)[W_ +M\*^P``"OOP`$C((;]`"`@"&,0@!$%$``!20$.@"/OP`$C[````/@``@GO0`0 +M)`(`!PP`>E>N`AL`)$("`"0#_@``0Q`DK@(=Q!``__2N`AL$)[W_X*^_`!RO +MM@`8K[4`%*^T`!"OL@`(K[$`!*^P``"OLP`,C((;[`"`B"$DD!AX)%4`7`"U +M`!H\`H`"4J```0```L)E(``0)"$"H40/_X`A6`(1``_]P`````$`#_WB03``(GO?_`K[``,*^_ +M`#BOL0`TC((;](S+```D#``!C$,`"`%L$`0`@(`A`&(8)!1@`"D`H$@A+*(` +M!A!``"8`!1#`C,H`&(S#`!2,QP`0C,0`!`!%$".,Q0`(C,8`#``"$,`"`A`A +M,4@`"*^C``"OJP`(KZ0`#*^E`!"OI@`4KZ<`("11&'BOJ@`$KZ``&*^@`!RO +MH``D$0``!J^@`"@5(``6`````(X"'<0D0AP`KZ(`*`(`("$,`$IH`Z`H(0!` +M&"&.`AOTC$(`:`!B$"M40``&KB,`)(^_`#B/L0`TC[``,`/@``@GO0!`#`!Q +MM`(@("$0`/_YC[\`.%$L_^R.`AW$)`+_]P%"$"00`/_IKZ(`!">]__"OL@`( +MK[$`!*^P``"OOP`,`("`(0``D"$DD1G(C@,:<"0"``$"0A`$`&(8)`)`*"$4 +M8``+`@`@(292``$N0@`&%$#_]B8Q`!R/OP`,C[(`"(^Q``2/L````^``"">] +M`!`,`$J'``````(`("$"0"@A#``-%@(@,"$0`/_P)E(``2>]__"OL@`(K[$` +M!*^P``"OOP`,`("`(0``D"$DD1AXC@(:<"0#``$"0Q@$`$,0)%!```DF4@`! +MC@(;]`)`*"$"`"`AC$(`"`!#$"040``+)`8`!"92``$N0@`&%$#_\"8Q`#B/ +MOP`,C[(`"(^Q``2/L````^``"">]`!`,`$JV)E(``0(`("$,`!#@`B`H(1`` +M__(N0@`&)[W_\*^_``2OL```C*8`.`P`2[4`H(`AC@(`+(^_``2/L```K$`` +M0`/@``@GO0`0)[W_L*^U`#2OM``PK[,`+*^_`$"OMP`\K[8`.*^R`"BOL0`D +MK[``((RR`!0`H*@A`("8(1)``&XDE`2`CD(`/`1!``0``+`ACD(`(!!``.8` +M0)`ACD(`4%!```6.40`LC$(``%!```&N0`!0CE$`+(XB`$`40``')C<`0`)@ +M("$,`$VK`B`H(20#``T00P!9C[\`0`)@("$,`!"&`B`H(11``,\D`@`!CB,` +M0*Y@&QP08@`&CE``4%(```6.H@`(ZB`#"50P`(EF(<7E!B``.50P`&$`#_VB5"`!"68AQ<%&+_UR5"`!"50P`$ +MEF(<6E1B_],E0@`0CH(!+"1"``$0`/_TKH(!+`*@*"$,`!`!`B`P(5!`_X6. +ML@`4$`#_/8ZB`!P0`/^#KB``0(YB%]A00/^!C[\`0`P`<:,F9!JL$`#_?8^_ +M`$",@P`4$&``""0$``&,8@`\!$,`!0``("&,8@`@$$```@```````"`A`^`` +M"`"`$"$GO?_PK[$`!*^_``@`@(@AK[```(XB&\P00``4)(08>`P`#JX````` +M)B08L`P`#JX``H`K)B08Z`P`#JX``H`*)B09(`P`#JX``H`*4$```0``@"$" +M`!`AC[\`"(^Q``2/L````^``"">]`!`,``ZN`````!``__<``H`K)[W_\*^P +M``"OOP`$#`!PM0"`@"&.`AO,)@48>!!```L"`"`A#``-K0`````F!1BP#``- +MK0(`("$F!1CH#``-K0(`("$F!1D@`@`@(0P`#:T`````#`!PN@````"/OP`$ +MC[````/@``@GO0`0C*<`*```2"&0X@`!,$(`!!1``!",J``LD.(`%C!#``]4 +M8``-C*(`/)4"`$8``"`A``(1`J#B`!>1`@!',$(`#P`"$0``8A`EH.(`%@/@ +M``@`@!`AC*(`/``"%H(P0@`!5$``#Y#B``&5"0!&D.,`%C$B``\``A$`,&,` +M#P!B&"4`"1$"H.,`%J#B`!>,H@`\/`,$``!#$"6LH@`\D.(``3!"``000/_I +M`2`@(8T&`"!0P/_F`2`@(8S(`"PD!/_PC,<`*"4#``@P8@`/)$(`)P!D&"0` +M1"@D`&40(0!#$"L40``'`&`@(;QQ```D8P`0`(40(0!#$"L00/_[`````(S" +M`#P``A:",$(``51```Z0X@`!D.,`%C$B``\``A$`,&,`#P!B&"4`"1$"H.,` +M%J#B`!>,P@`\/`,$``!#$"6LP@`\D.(``3!"``140/_8C08`(!``_[T!("`A +M)[W_X*^S``P`P)@AK[4`%*^T`!"OL0`$K[```*^_`!BOL@`(`("@(0"@B"$, +M`'"U``"H(1)@`$("8(`AC@(`/``"%D(P0@`!%$``58X2`%`20`!4`H`@(8Y" +M`%000`!1`````!*@`$R.`@`LC$,``(Q"`""NHP``KJ(`((X&`"PF1`!<`@`H +M(:S``""LP```#`!1V`````".0@!X)$(``:Y"`'@2H``"`F"`(8ZP`"!6`/_C +MC@(`/!)@`"$`````EB,`-%!@`!&.(@`8CF0`*)""`!8P10`/4*``"Z8@`#0` +M`Q$"H((`%Y(B`#60@P`!,$(`#P`"$0``HA`E-&,`"*"#``&@@@`6CB(`&%1` +M`!VL4P`@)`(``:XB`"RN,P`4KC4`&`````^.(@`L5$``$(YF`"2.)0`D#`!* +MG`*`("$,`'"Z`````(^_`!B/M0`4C[0`$(^S``R/L@`(C[$`!(^P`````!`A +M`^``"">]`"".)0`D#`!*E0*`("$0`/_MKB``+(XC`!B.8@`DK&(``!``_^2N +M-0`8$`#_N(Q3`"`"@"`A#``-H0(`*"&.@ALX4$``&(XB`!Q2```6CB(`'(X" +M`#P``A9",$(``11```D"@"`ACB8`&(XG`#".*``D#`!*_@(`*"%40``*CB(` +M'`*`("$,`"EL/`6``(X"`#`"@"`A/`6```P`*3RN(@`PCB(`'"1"``$20``* +MKB(`'(XB`"2.1`!0``(0P`!2$"&40P`P)(0``:Y$`%`D8P`!I$,`,!``_Y>. +M%0`L)[W_\*^R``BOOP`,K[$`!*^P``",H@!4%$``!P"`D"$DL0!]`!",P@`LC,4` +M6`)`("&,4``@K$```*Q``"`,``]+```X(8XB`!P"`#`A)$+__Q1`__2N(@`< +M$`#_ZZX@`!@GO?_@K[0`$*^S``ROL0`$K[\`%*^R``BOL```C-``,(RB`"2, +MPP!`CA(`4``"$,``H(@A`D(H(20"``(`@*`A$&(`.22S`#".(P`4C&(`/`1" +M`"V,8@`@C@(`/#P#`@".!P`L`$,0):X"`#R.(@`] +M`""L8````&`H(:XB`!0"@"`A#``*8ZQ@`"`0`/_.C@(`/)2C`#".0@!4)`8` +M`:YF``0`0Q`AKD(`5*9C``*.`P`\/`6'_S2E__\``Q;",$(`#R1"``$P0@`/ +M``(6P`!E&"0`8A@EK@,`/(R"&V@``Q[",&,`#P!#$"M40``%CD(`5(R"&K14 +M0``1C((%@(Y"`%268P`")`7__R1"__^N0@!4CH(%A"1C__^F8P`")$(``0P` +M5NZN@@6$`H`@(0P`#]X"0"@A$`#_QB0"__\D0@`!K((%@(X"`#P``A;",$(` +M#Q!&``8`````C@,`*)!B``$T0@`($`#_DJ!B``$,``[T`@`H(1``__BF(@`T +M)[W_\*^Q``2OL```K[\`"`"@@"&.`P!`C*4`,"0"``$`@(@A$&(`3HRD`%". +M(AMH$$``1@``$"%0@`!%C[\`"(RB`"B00@`!,$(`!!!``"6.`P`@$&``/0`` +M$"&,<``LC@(`,(Q"`"B00@`6,$(`#Q!``#LF!``(,((`#R0#__`D0@`G`(,@ +M)`!#*"0`A1`A`$00*Q1```<`@!@AO)$``"2$`!``91`A`$00*Q!`__L````` +M`B`@(0(`*"$,`$Z')`8``1!``"$D`O__C@(`,(Q"`"B00@`!,$(`!!1`_]V. +M`P`@$&``&0``$"&,<``L)`3_\"8#``@P8@`/)$(`)P!D&"0`1"@D`&40(0!# +M$"L40``'`&`@(;QQ```D8P`0`(40(0!#$"L00/_[``````(@("$"`"@A#`!. +MAR0&``$D`___``(8"P!@$"&/OP`(C[$`!(^P```#X``()[T`$!``__H``!`A +M)[W_T*^Q`"0`H(@AK[(`**^P`""OOP`L#`!PM0"`D"&.,``4$@``&0````". +M0@2PCD,$M(X$`%0D8P`!+&4``0!%$"&N0@2PKD,$M!2``!]`!`0`/_JK@(`4`P`<9P` +M````)`,``11#__,D!``"$`#_W``````GO?_PK[````"`@"$DA``\K[\`#*^Q +M``2OL@`(#`!QC@"@B"$,`'"U`````(X%`$2,HP``$&``'(RB``2L8@`$C*(` +M!"8$`%2,L@`($B```ZQ#``",H@`,KB(``(X"`%`D`___K*```*RB``2.`@!0 +MK*,`"*X%`%"L10``#`!QHZR@``P,`'"Z``````)`$"&/OP`,C[(`"(^Q``2/ +ML````^``"">]`!`0`/_EK@(`2">]_^"OOP`4K[``$(R0``2OH```)@0`/`P` +M<:H#H"@ACZ(```(`("$40``()Z4`!(^B``!40/_X)@0`/(^_`!2/L``0`^`` +M"">]`"`,`!%+`````!``__>/H@``)[W_\"2E__^OL0`$K[\`#*^R``BOL``` +M+*(`&0"`B"$00``4C)(`!#P#@`(`!1"`)&,(X`!#$"&,0@```$``"`````", +MA```#``;"B0%`!$`0(`A)D8$@`!`("$D!0$X#``;/@````".)```#``:O0(` +M*"&/OP`,C[(`"(^Q``2/L````^``"">]`!```#`A`D`@(0P`+H$D!0`"CB0` +M``P`&PHD!0`2`$"`(29&!(@`0"`A$`#_ZB0%``B,A```#``;"B0%`!..)``` +M`$"`(20"`@`0`/_EK@(```P`$ZB,A``$$`#_Y(^_``P,`!/`C(0`!!``_^"/ +MOP`,)[W_T*^S`!ROOP`@K[(`&*^Q`!2OL``0C)(`!`"`F"$#H"@A`F`@(0P` +M$4LF41?L`B`@(0P`<<(`0(`A`D`@(0P`%&TD!0`!CZ8```(`*"$,`!&.`F`@ +M(0)`("$,`!1M```H(0P`<=`"("`A$`#_[0.@*"$GO?_@K[0`$*^S``ROOP`< +MK[8`&*^U`!2OL@`(K[$`!*^P``",D0`$``"@(0``F"&.(A?@5$``"HXB%]PF +M,!K(#`!QP@(`("$,`''0`@`@(8XB%^!00/_Z)C`:R(XB%]P00``X`````"8V +M&N`,`''"`L`@(8XC'*0D`@`#$&(`-0`````D!0`!`B`@(0P`%&TF,AK()C4: +MA`P`<]__"OOP``C*(`!`"@("$``#`A +MC$(7Q"0%`!@40``$```X(8^_```#X``()[T`$`P`$1D`````$`#_^X^_```G +MO?_P`*`@(0``,"$D!0`9K[\```P`$1D``#@AC[\```/@``@GO0`0)[W_\*^_ +M``BOL0`$K[```(R0``0,`'%9`("((0!`("$,`'%7)@4;7(X$&UP\!8``)@<8 +M""8(&!`"(#`A#`!Q822E20P,`'%<`````"1C`,@L90#(C@08"`!%$"$D"``` +M)`D`R`!`,"$,`'%T`&`X(8X$&UP\!8``)@<80"8(&$@"(#`A#`!Q822E24P, +M`'%<`````"1C`,B.!!A`+&4`R`!%$"$`0#`A)`@``"0)`,@,`'%T`&`X(8^_ +M``B/L0`$C[````/@``@GO0`0)[W_X"2"`$0D@P!,K[$`!`"`B"&OOP`8K[4` +M%*^S``ROL@`(K[0`$*^P```DA``\KB(`2*XC`%```"@AKB``1*X@`$PF,P!4 +M#`!QAXXT``0"8"`A#`!QAP``*"$``*@A``"0(0P`>EH).<)1"4(9+@E:VS``B`P(20)"``,`'#+ +M)`0``8X$;+@,`'#D/!"``CP%@``\!X`"/`B``CP+@`(F"GE@)*5'-"3G"50E +M"&U@)6MY:"0$``$"(#`A#`!PRR0)#``,`'#DC@1Y8`P`$ET"("`A`J`0(8^_ +M`!B/M0`4C[0`$(^S``R/L@`(C[$`!(^P```#X``()[T`(!``__4D%0`")[W_ +MT*^P`!``H(`AK[\`(*^S`!ROL@`8`("8(:^Q`!0,`'%"KZ``!`P`*.@"`"`A +M%$``$B02``$,`'%0`F`@(20"``$20@`)``````)`$"&/OP`@C[,`'(^R`!B/ +ML0`4C[``$`/@``@GO0`P#`!Q20)@("$0`/_V`D`0(0(`("$#H"@A#``H[2>F +M``0`0(@A,$(``11``%`"`"`A,B(`(%1``$:.`@2$,B((`!1``#X"`"`A,B(` +M0!1``#<"`"`A/`(`!`(B$"040``O`@`@(3(B`(`00``2`````(X"&\Q00``B +MC@48G(^B``0P0@`(5$``&HX%&42/H@`$,$(`!%1``!*.!1D,CZ(`!#!"``)4 +M0``*C@48U"0"_W\"(H@D$B#_Q:^@``".`AV$)!(``P!1$"40`/_`K@(=A`P` +M2IP"`"`A$`#_]20"_W\,`$J<`@`@(1``_^V/H@`$#`!*G`(`("$0`/_ECZ(` +M!(^B``0`LA@$`$,0)!!`_^D`````$`#_[@`````,`"EL/`4`!!``_]`R(@"` +M#``I;"0%`$`0`/_(/`(`!`P`2@HD!0`!)`+W_Q``_[\"(H@D`@`@(20%`"`D +M0@`!#``I;*X"!(00`/^V,B((``P`*6PD!0`!$`#_KS(B`"`GO?_@K[0`$*^R +M``BOL```K[\`%*^S``ROL0`$C,,] +M`"`,`#>``````%1```..!``$$`#_Z0)3D"4``#`A```X(0P`$1DD!0`#4$#_ +MY`)`*"$0`/_A`E.0)2>]__"OL```K[\`!(R"%^`00``/`("`(8R"%]P00``, +M)`(``HR#'*008@`))`(``1!B``B/OP`$#`!PM0`````,`##@`@`@(0P`<+H` +M````C[\`!(^P```#X``()[T`$">]_]"OL0`DK[\`+*^R`"BOL``@C((7X!!` +M`"8`@(@AC((7W!!``",D`@`"C(,)`(``1``_]RN(AL<)[W_X"0#``&OLP`,K[(`"*^Q``2O +ML```K[\`$`"@D"$`P)@A`("`(1"C`$8``(@A4*``,(R"'*0D`@`"$*(`$R0" +M``,0H@`,`````%(@``&N$ARD5F```:YQ``"/OP`0C[,`#(^R``B/L0`$C[`` +M``/@``@GO0`@#``4K"0%``(D$0`6$`#_\0`"B`H,`"EL/`6```(`("$,`!2L +M```H(201`!8"`"`A#``(E0`"B`HD!0`!#``*2`(`("&.`@`$#``="HQ$```, +M`%&4`@`@(0(`("&N`!?@#``I/#P%@``"`"`A#``4K"0%``$0`/_7`````!!# +M``D``````@`@(0``*"$,`!2L`````%1`_\\D$0`6$`#_S0````",@A?@4$#_ +M]P(`("&,@@`$#``=&(Q$```,`''0)@0:X!``__`"`"`AC((7X%1```2,@@`$ +M`@`@(1``_^LD!0`!#``="HQ$```,`''")@0:X!``__D"`"`A)[W_\*^P```P +ML`#_K[\`#*^R``BOL0`$``"0(0P`<+4`@(@A#`!Q-``````2```:CB(]`!`,`#3E)`8``8X#%]PD +M$@`6$&``!``"D`J.`A?@$%$`&3P%@``60/_O)`(``8X#'*A08@`/C@(%)`8``1!```0`0)`A)!(`%A9` +M_[X"0!`A`@`@(1``_]]__`D@@`4 +M)(,`'*^R``BOL```K[\`#*^Q``0`@(`AK((`&*R#`""L@``4K(``'```D"$, +M`'I7)`0`#`!`B"$2(``1)`(``@(@("$``"@A#`!PJB0&``R.`@`@)E(``2I# +M``*N$0`@KB```*XB``048/_PK%$``"8$``P,`'&'```H(0``$"&/OP`,C[(` +M"(^Q``2/L````^``"">]`!`GO?_PK[\``(R&`!R,R```$0``$0"`."&,P@`$ +MK0(`!(SB`!B,PP`$).0`#*S"``2,X@`8K&@``*S%``BLP```K.8`&`P`<:.L +M1@``C[\```/@``@GO0`0C,(`!!``__"L@@`@)[W_\*^Q``0`@(@A)(0`#*^_ +M``@,`'&.K[````P`<+4`````CB0`%(R%```0H``3C((`!*RB``2.(@`@C(,` +M!(R0``BL@@`$CB(`(*QE``"N)``@K(```*R```@,`'"ZK$0```(`$"&/OP`( +MC[$`!(^P```#X``()[T`$!``_^ZN(@`8,*8`#R>]_?`D`O_P),,`3Z^T`@`` +M8A@D`*"@(0"B*"0`HQ`AK[$!]*^_`@ROM@((K[4"!*^S`?ROL@'XK[`!\`!% +M$"L`@(@AC),`!(R6``"OH`"TKZ``H!1```<`H"`AO+$``"2E`!``@Q`A`$40 +M*Q!`__L`````CH,``"QB`$%40``1CH(`#`!F$"$D0@`/)`/_\`!#*"0"@Q@D +M`&40(0!#$"L40``'`&`@(;QQ```D8P`0`(40(0!#$"L00/_[`````(Z"``P4 +M0`.[CI``!```J"$F!?__+*(`0Q!``!L\`X`"``40@"1C"80`0Q`AC$(```!` +M``@`````)Z4`H">F`*0,`!MH`H`@(0*`("$GI0"@#``;:">F`*@"@"`A)Z4` +MH`P`&V@GI@"L`H`@(2>F`+`,`!MH)Z4`H`(@("$"8"@A#``'PR>F`+02H``' +M`L`@(8Z"``@"H"@AKJ(`"(^B`+0,`!J]KJ(`#(^_`@R/M@((C[4"!(^T`@"/ +MLP'\C[(!^(^Q`?2/L`'P`^``"">]`A`"@"`A)Z4`H`P`&V@GI@"XCZ8`N`(@ +M("$"8"@A#``&\">G`+00`/_D``````)@("$,`%>0)Z4`M!``_]\``````H`@ +M(2>E`*`,`!MH)Z8`O(^E`+P"8"`A)Z8`P```."$,`%!<)Z@`Q(^E`,`,`!LW +M`J`@(8^B`,`00``1CZ4`O`*@("$GI0#(#``;5R>F`,R/I0"\CZ<`R`)@("$G +MI@#0#`!07">H`,2/I0#0`J`@(0P`&V$`````$`#_OP`````"8"`A)Z8`P">G +M`-0,`%!<)Z@`Q(^E`-0"H"`A#``;-P`````0`/^T`````">E`*`GI@#8#``; +M:`*`("$"@"`A)Z4`H`P`&V@GI@#F`.B/ +MI0#8CZ<`Z`)@("$0`/_U```P(0*`("$GI0"@#``;:">F`.R/I0#L`F`@(2>F +M`/```#@A#`!8(2>H`/2/I0#P#``;-P*@("&/H@#P4$``#H^E`.P"H"`A)Z4` +M^`P`&UF`/`GIP$`#`!8(2>H`/2/I0$`$`#_N@*@("$"("`A)`4``0``,"$, +M`!$9```X(1``_VH``````F`@(0P`!O,GI0"T/`2``@P`<'0DA`ET$J#_:X^_ +M`@P,`"YR`F`@(0*@("$0`/^F`$`H(0)@("$,``E`+00`/].`````">E`*`GI@$$ +M#``;:`*`("$"@"`A)Z4`H`P`&V@GI@$(`H`@(2>E`*`,`!MH)Z8!#`*`("$G +MI0"@#``;F`1"/I0$$CZ8!"(^G`1`,`%#?`F`@(1``_S<`````)Z4`H">F +M`10,`!MH`H`@(0*`("$GI0"@#``;:">F`1@"@"`A)Z4`H`P`&V@GI@$E`*`,`!MH)Z8!/(^E +M`3P"8"`A#``4$">F`+00`/\#``````*`("$GI0"@#``;:">F`42/I0%$#``' +MW0)@("$0`/[Z`````">E`*`GI@%(#``;:`*`("$"@"`A)Z4`H`P`&V@GI@%, +MCZ4!2(^F`4P,``@6`F`@(1``_NP`````)Z4`H">F`5`,`!MH`H`@(0*`("$G +MI0"@#``;:">F`50"@"`A)Z4`H`P`&V@GI@%8`H`@(2>E`*`,`!MH)Z8!7(^E +M`5"/I@%4CZF`6`,`!MH`H`@ +M(0*`("$GI0"@#``;:">F`60GL``0`H`@(2>E`*`,`!MR)Z8!:`(`("$``"@A +M#`!PJB0&`!R/HP%DCZ(!:)>E`6("8"`A`@`P(:^B`!2OHP`D#`!/@*^C`!P0 +M`/ZX``````*`("$GI0"@#``;:">F`6R/I@%L`F`@(0P`3\@``"@A$`#^K@`` +M```,`!VR`F`@(1``_JH``````H`@(2>E`*`,`!MH)Z8!<(^E`7`,`"F>`F`@ +M(1``_J$`````)Z0`,```*"$,`'"J)`8`!@*`("$GI0"@#``;:">F`70"@"`A +M)Z4`H`P`&V@GI@%X`H`@(2>E`*`,`!MH)Z8!?`*`("$GI0"@#``;F`8"/ +MI@&`EZ4`-```@"&4QP`4E,0`!"3#``@XX@`'$*0`,P!B@`L`P(@ACZ,!="QB +M``040``8``,0P`!#$"$``A#``$,0(P`"$(`"8A`A)$/[F"0"``<0X@`B)`(` +M!*1B`18D`@`#$.(`&B0"`!`0X@`8)`(`$5#B`!>48@$6).+__BQ"``(40``" +M)`0`""0$``2D9`$8#``(E0)@("&.8AM4`F`@(0(@,"$D0@`!KF(;5(^E`72/ +MJ`%X#``IO`(`."$,``A^`F`@(1``_ED`````E&(!%B1"``00`/_HI&(!%J1@ +M`1@0`/_KI&`!%I>C`#*4P@`"%&+_S`#`B"&7HP`PE,(``!1B_\<``(@A$`#_ +MQX^C`70GI0"@)Z8!A`P`&V@"@"`A`H`@(2>E`*`,`!MH)Z8!B`*`("$GI0"@ +M#``;:">F`8R/IP&,CZ4!A(^F`8@,`"P_`F`@(8^C`80``A0```(D`RQB``04 +M0/XQ``,0P`!#$"$``A#``$,0(P`"$(`"8A`A$`#^*J1$_*P"@"`A)Z4`H`P` +M&V@GI@%`CZ4!0`P`5W\"8"`A$`#^(0`````GI0"@)Z8!D`P`&V@"@"`A`H`@ +M(2>E`*`,`!MH)Z8!E`*`("$GI0"@#``;:">F`9@"@"`A)Z4`H`P`&V@GI@&< +M)Z4`H">F`9P"@"`A#``;:(^P`9P"@"`A)Z4`H`P`&W(GI@&@CZ8!E(^G`9B/ +MJ`&@CZD!D`)@("$"`%`A#`!0$@``*"$0`/W^`````">E`*`GI@&D#``;:`*` +M("$"@"`A)Z4`H`P`&W(GI@&HCZ4!J`P`+2("8"`A$`#]\0`````GL``X`F`@ +M(0P`+>T"`"@A`J`@(0(`,"$D!0`(#``;/@`````0`/WF``````P`+@0"8"`A +M$`#]X@`````D`@`"KF(;L`P`+A("8"`A$`#]W``````GI0"@)Z8!K`P`&V@" +M@"`A`H`@(2>E`*`,`!MH)Z8!L">E`*`GI@&P`H`@(0P`&VB/L`&P`H`@(2>E +M`*`,`!MR)Z8!M(^C`:PD`O__$&(`)0`#$,``0Q`A``(0P`!#$"./I0&T``(0 +M@`)B$"$D1@`0`*88)3!C``,D1``($&``'R2G`"``X!@AB*(``)BB``.(IP`$ +MF*<`!XBH``B8J``+B*D`#)BI``^HP@``N,(``ZC'``2XQP`'J,@`"+C(``NH +MR0`,N,D`#R2E`!`4H__N),8`$("B``"@P@``#`!2Q0(`*"$6`/VACZ4!M`P` +M+BX"8"`A$`#]G0````",H@``C*,`!(RH``B,J0`,K,(``*S#``2LR``(K,D` +M#"2E`!`4I__V),8`$!``_^H``````H`@(2>E`*`,`!MH)Z8!N(Z"``P00``? +MCZ,!N"0"``408@`()`(`!!1B_80"8"`A```P(0P`+H$D!0`$$`#^(0*@("$" +M8"`A)Z8`0`P`+H$D!0`%CZ(`0">F`%@"H"`AKZ(`6(^B`$0D!0`4KZ(`7(^B +M`$BOH@!@CZ(`3*^B`&27H@!2IZ(`:)>B`%80`/^"IZ(`:H^E`;@"8"`A#``N +M@0``,"$0`/UE``````P`+PX"8"`A$`#^`P*@("$GI0"@)Z8!O`P`&V@"@"`A +M`H`@(2>E`*`,`!MH)Z8!P(^E`;R/I@'`#``RH0)@("$0`/U3``````P`,XT" +M8"`A$`#]3P`````"@"`A)Z4`H`P`&V@GI@'DCZ4!Y`P`,\$"8"`A$`#]1@`` +M```"@"`A)Z4`H`P`&V@GI@'HCF8<_(^E`>@,`#,5`F`@(1``_3RN8AS\)Z4` +MH">F`30,`!MH`H`@(0*`("$GI0"@#``;:">F`3B/I0$TCZ8!.`P`-@4"8"`A +M$`#]+@`````GI0"@)Z8!+`P`&V@"@"`A`H`@(2>E`*`,`!MH)Z8!,(^E`2R/ +MI@$P#``V#@)@("$0`/T@``````P`2'\"8"`AKF(%L"9E&W`,`#KG`F`@(1`` +M_1@`````)[`!Q`*`("$GI0"@#``;:`(`,"$"@"`A)Z4`H`(`,"$,`!MHE[(! +MQB>E`*`GI@'(`H`@(0P`&VB7L0'&`H`@(2>E`*`,`!MH)Z8!S`*`("$GI0"@ +M#``;:">F`=`"@"`A)Z4`H`P`&V@"`#`A`@`P(0*`("$GI0"@#``;:(^P`<2/ +MIP'(CZ@!S(^I`="/JP'$)Z(`M`)@("$"0"@A`B`P(0(`4"&OH@``#`!7EZ^@ +M``00`/SJ``````P`.F<"8"`A$`#\Y@`````"@"`A)Z4`H`P`&V@GI@'4CZ4! +MU`P`0=<"8"`A$`#\W0`````"@"`A)Z4`H`P`&V@GI@'8CZ(!V`*`("$GI0"@ +M``*`P`("@",,`!MH)Z8!W``0B("/H@'<`G&((28Q&E`*"N +M(@`$#``;:">F`=R/H@'<`H`@(2>E`*"OH@"`)Z8!W`P`&VBN(@`(CZ(!W`*` +M("$GI0"@KZ(`A">F`=P,`!MHKB(`#(^B`=P`$(#``H`@(:^B`)`GI0"@KB(` +M$">F`=P,`!MH`G"`(280&'B/H@'F`20"@"`A#``;:(^P`20" +M@"`A)Z4`H`P`&W(GI@$HCZ8!*``0$,``4!`CC,,````"$(``4Q`AK$,9R(S# +M``0D0AG()`<``:Q#``2,PP`(`@F`>"/HP'@`F`@(0`#$,``0Q`C``(0P`!3$"$, +M`$J'C$48G!``_&T``````H`@(2>E`*`,`!MH)Z8![)>B`>X0`/QFIF(;\`+` +M("$,`!L*`@`H(11`_$,`0*@A)`(``A``_&:OH@"T)[W_\*^Q``2OOP`(`("( +M(0P`]__"OL@`(K[$`!*^P``"OOP`,`("`(0P`%4,\ +M$H`#/`6``#P'@`(\"(`"/`N``P!`B"$F2HH()*5F;`(`,"$DYPJ0)0AZ""5K +MBA`D!``!$$``""0)$``"(!`AC[\`#(^R``B/L0`$C[````/@``@GO0`0#`!P +MRP`````,`'#DCD2*"!``__4"(!`A)`(``:R"`#`\`H`"K$5$1#P"@`*L140\ +M`^``"```$"$GO?_0K[0`(*^R`!BOL0`4K[``$*^_`"0\$(`"K[,`'(X%,N`\ +M!H``/`>```"`B"$DQFI0```@(23G:K@GJ@`!)Z@`!`P`66L#H$@A/`*``HQ4 +M1$`\`H`"C$9$.(X#,N"3H@``CZ4`!*QQ``"@8@`(K&4`!).B``&.!#+@``"0 +M(:""``F.`C+@K$8`$*Q4``P\$X`"CG`RX`P`>E<"@"`ACF,RX``2B(`",(`A +MK@(`%`(CB"&.)``4#``;'B92``$J0@`"5$#_\SP3@`*.9#+@#``:VB02``\\ +M$(`"C@(RX"92__\,`'I7C$0`#(X$,N`,`!KW`$`H(09#__@\$(`"C@(RX(^_ +M`"2/M``@C[,`'(^R`!B/L0`4C[``$`/@``@GO0`P)[W_T#"B``\D0@!-)`/_ +M\*^R`!@`H)`A`$,H)`)#&"0`91`A`$,0*Z^Q`!2OOP`@`("((:^S`!ROL``0 +M%$``!P!@("&\<0``)&,`$`"%$"$`0Q`K$$#_^P````"20@`!DD0``)(C`$`0 +M@P`2,%,``8XC`#B.(@`\K&```(XD`#0D0@`!$(``!:XB`#P,`!LIC)```!8` +M__T"`"`AKB``1*X@`#2B(`!`DD(``!1``$(`````DD(``%1```6.(@!$KC(` +M-*XR`#BN(`!$CB(`1)9#``*.)``X`$,0(:R2``"N(@!$%F``"ZXR`#B2(@!` +M)$(``:(B`$"/OP`@C[,`'(^R`!B/L0`4C[``$`/@``@GO0`PKD```(XC``". +M(@`THB``0"1D`"0D4@`$KB``-`.@*"&,<``$#`!QJJ^@``".0P`()`(`$!!B +M``J/H@``5$``"8XB``".`A?8)`,``5!#``6.(@``C@(:M!!#`` +M`D`H(0P`<=`"`"`A$`#_TH^_`"`,`!LI`D`@(1``_\Z/OP`@)[W_\*^_```0 +MX``-,*(`_Q!```8`P"@A#``:(@````"/OP```^``"">]`!",A```#``5:P#` +M*"$0`/_ZC[\``!!```4`P"`A#``;*0`````0`/_TC[\```P`&QX`P"`A$`#_ +M\(^_```GO?_P,*(`_Z^_```40``&`,`H(0P`&Q8`````C[\```/@``@GO0`0 +MC((```P`":*,1``$$`#_^H^_```GO?_PK[\``(RG``",A``$`*`P(0P`6@0` +M`"@AC[\```/@``@GO0`0)[W_\*^_```\`H`"C$(RY`"@,"$00``+D(4`,Y3" +M``(D1P`$#`!:!(R$``2/OP``)`0``3P#@`*L9#+D`^``"">]`!`0`/_W)`<' +M("2"`!PGO?_PK(``)```*"&OOP``#`!QAP!`("&/OP```^``"">]`!`GO?_P +MK[````"`@"$DA``]__"OOP`$K[````P`&N0`H(`AK%``!(^_``2/L``` +M)`,`(*Q#```#X``()[T`$">]__"LH``$K[\```P`&O<`````C[\```/@``@G +MO0`0)[W_\*^_```\`H`"C$(RX`"`,"$``"@A#`!9[HQ$``2/OP```^``"">] +M`!`GO?_PK[\``#P"@`*,0S+@`(`P(3P"B(B090`SC&0`!#1"B(@,`%GNK,(` +M`(^_```#X``()[T`$(R"````@A`AK$4``(R"```D0@`$`^``"*R"```GO?_P +MK[\`"*^Q``2OL````("((8R$````H(`A)`+__`(D("$`P"@AK)````(`,"$D +MA``$)A```PP`<)T"`H`DCB(``(^_``@`4!`A)$(`!*XB``"/L```C[$`!`/@ +M``@GO0`0C(,``"0"`@``0Q`C$*```@"#("&LI```5,```:S"```#X``(```` +M`(R#```DI0`#)`+__`"B*"0`91@A`^``"*R#```0H``"```8(8RC````@Q`A +MC$(`(!"@``(D8P`$K*,```/@``BLP@``C*(```""("$0P``")(0`(*S$```# +MX``(`````">]__"OOP`$K[````P`:_(`@(`A)`,``:X#``RN`@``K@``"*X` +M``2/OP`$C[````/@``@GO0`0)[W_\*^P``"OOP`$C((`.`"`@"$40``F)`0` +M`0P`:LDD!``!#`!K\@````"N`@`L#`!K]20$``*.`@`````H(0P`%-^,1``$ +M%$``$P````".`@`P%$``#```("&.`@`X%$``!0``("&/OP`$C[````/@``@G +MO0`0#`!K#P`````0`/_ZC[\`!`P`:P$`````$`#_\XX"`#@,`&OUC@0`+`P` +M:LD``"`A$`#_[8X"`#@,`&L/`````!``_]@`````)[W_\*^P``"OOP`$C((` +M.`"`@"$40``=)`0``8X"```D!0`!#``4WXQ$``000``%`````(^_``2/L``` +M`^``"">]`!`,`&OUC@0`+`P`:LD``"`AC@(`,!1```@D!``!C@(`.!!`__,` +M`"`A#`!K#P`````0`/_PC[\`!`P`:P$`````$`#_]XX"`#@,`&L/`````!`` +M_^*.`@``)[W_\*^P``"OOP`(K[$`!(S#`"@D`@`!$&(`!@#`@"&/OP`(C[$` +M!(^P```#X``()[T`$*S``#P,`'$T``````P`&[<"`"`AC@(`*!1``"```"`A +M$(``$`````".`@`\/`,``C1C2?`D0@`!K@(`/(X"`#P`8A@K$&``!P````". +M`@``C$(`!(Q1%^@D`@`!$B(`"@`````,`!S\C@0`!"0$``4,`'%)``````P` +M<3L`````$`#_VX^_``@,`!N'`@`@(20$``L0`/_VKA$`*`P`'0..!``$#``= +M(XX$``0\`P`"`$`@(1!```XT8TGPC@(`/"1"``&N`@`\C@(`/`!B$"M00``( +MC@(`*(X"``",0@`$C$,7Z"0"``$08O_-`````(X"`"@40/_I`````!``_\@` +M````)[W_\*^Q``2OL````*"((:^_``@,`'%"`("`(0(`("$"(#`A#``;W@`` +M*"&/OP`(C[$`!(^P```D`@`!`^``"">]`!`GO?_PK[```#P'@```@(`A/`B` +M`"2)`"0DB@`().=PL"0$``LE"&]X```H(:^_``0,`'$(`@`P(8X"`"040``% +M`$`@(8^_``2/L````^``"">]`!`,`'$F`````!``__J/OP`$)[W_\"0#``&O +ML```K[\`"*^Q``00HP`1`("`(5"@`!*,@@`H)`(``A"B``PD`@`#4*(`!HR" +M`"B/OP`(C[$`!(^P```#X``()[T`$%1`__JL@``H$`#_^8^_``BN```\$`#_ +M]H^_``@40/_TC[\`"(R"``",0@`$C%$7Z%8C__"/L0`$#``<]8R$``0,`'%" +M)`0`!0P`&X<"`"`AKA$`*`P`<4DD!``+$`#_Y(^_``@GO?_PK[(`"`"`D"$D +M!`!`K[$`!*^P``"OOP`,#`!Z5P"@B"$`0(`A$@``%```$"$``"@A)`8`0`P` +M<*H"`"`A)@0`+*X2``"N$0`$#``;>:X``"@,`'%))`0`!`P`'#T"`"`AC@0` +M!#P%@``DI7%8#``]`!``0/@)C(0`+!``__N/ +MOP``)[W_\*^_``",@@`H%$``!"0%``&/OP```^``"">]`!``0/@)C(0`+!`` +M__N/OP``)[W_\*^_``",@@`H%$``!"0%``*/OP```^``"">]`!``0/@)C(0` +M+!``__N/OP``)[W_\*^_``",@@`H%$``!"0%``./OP```^``"">]`!``0/@) +MC(0`+!``__N/OP``)[W_\*^_``2OL````("`(8R$``2N!@`L/`:``*X%`"@D +MQG*<#`!9U```*"&.!``$/`:``"3&]__"OOP``#`!:SXR$``2/OP`` +M`^``"">]`!`GO?_PK[\```P`6N",A``$C[\```/@``@GO0`0)[W_\*^_``2O +ML````("`(0P`6M>,A``$#``<_`(`("$,`!T#`@`@(8^_``2/L````^``"">] +M`!`GO?_PK[```*^_``0,`!SU`("`(0P`6MN.!``$C[\`!(^P```#X``()[T` +M$">]__"OOP``#`!:](R$``2/OP```^``"">]`!",@@`````H(8Q"0"`P1@#_ +M/`.``@`%$(`D8S,P`$,@(92"```DI0`!$,(`!2RC``A48/_X/`.``@/@``@` +M`!`A`^``")2"``(D`A0`I((`"B0""9ZD@@`()`(`!:2"`!0D`@`$K((`8"0" +M`!ZD@@`<)`()*J2"`'0D`@`'K((`>"0"``\D`P`")`4``20&``,D!P`\H((` +M4R0"$`"LA0!(H(8`?*"#`'VL@@!4I(<`6JR```2@@P`6H(``%ZR%`'"LA@`` +MK(``:*R``&RL@`!,K(``9*R``#2D@`!]_^"O +ML````("`(20$'`!`&"$``(`A/`*``B12,N@`$!#``%(0(91"```00P`& +M)`(`"280``$J`@`)%$#_]SP"@`(D`@`)$@(`%20#``$,`'I7)`0`O*XB&_00 +M0``0)`/__P``*"$D!@"\#`!PJ@!`("$,`!T\)B0;:``0$,``4A`AC$(`!`!` +M^`D"("`A%$``"P!`@"&N<0```@`8(8^_`!"/LP`,C[(`"(^Q``2/L````&`0 +M(0/@``@GO0`@#`!Z:HXD&_00`/_SKB`;]!``__(D$``")[W_\"0%``X``#`A +MK[(`"*^Q``2OL```K[\`#`P`'B``(40`!K)!0$```4 +M$$`D4?Z`#`!Z5P(@("$`0)@A$$#_YB0$``("(#`A`$`@(0P`<*H``"@AC@(; +M]"01`,`"-!@KK%,`M!!@``P"8)`A`B`H(0(`("$"H#`A#``LKR8Q``$40``* +M`C08*Y>B``*F0@``%&#_]B92``("@"@A#``@YP)@("$00``*`````!)@``8D +M!0`6#`!Z:@)@("&.`AOTK$``M"0%`!80`/_#`*`@(0P`>EB``(0`/^,`H*@)2Q"``440/]U)`0`%A``_VX"`"`A+((``A1`_W`D +M!``6$`#_#S0"@``GO?_PK[$`!*^P``"OOP`,K[(`"(R"&_0`@(@A)`0`(`P` +M>E>,4@"T$$``%P!`@"$`0"`A```H(0P`<*HD!@`@CB(;]`(`*"$"("`A#`!( +M#JQ0``0``(`A`@`H(0(@("$,`"F>)A```2H"`(`40/_[`@`H(8XE&_0,`#\Y +M`B`@(11```\`````$D```P`````,`'IJ`D`@(0P`'WP"("`A)`0`%H^_``R/ +ML@`(C[$`!(^P````@!`A`^``"">]`!`,`#3``B`@(0P`+V0"("`ACB0;]#P# +M@`(D8RRT/!"``CP'@``\"(``/`J``ZR#`!BN(A?$)@E'L"3G2\`E"$VH)4JA +M8```*"$"(#`A#`!Q"```("$,`'$FC@1'L`P`<4D``"`A#`!Z:@)`("&.(QOT +M)`(`"@``("&L8@!H$`#_V:Q@`+0GO?_@K[0`$*^_`!2OLP`,K[(`"*^Q``2O +ML```C)(;](Y0```2```=`("@(8X$``04@`!!`````(X$``@4@``Z`````(X$ +M``P4@``S`````(X$`!`4@``L````````F"$"`(@ACB(`%"9S``$40``B`$`@ +M(8XB`!PF,0`,%$``&@!`("$N8@`#5$#_]XXB`!0,`'IJ`@`@(:Y```".1``$ +M%(``#0`````"@"`A#``_1@)`*"&/OP`4C[0`$(^S``R/L@`(C[$`!(^P```` +M`!`A`^``"">]`"`,`'IJ`````!``__&N0``$#`!Z:@`````0`/_E+F(``PP` +M>FH`````$`#_W8XB`!P,`'IJ``"8(1``_]0"`(@A#`!Z:@`````0`/_,C@0` +M$`P`>FH`````$`#_Q8X$``P,`'IJ`````!``_[Z.!``(C(,;]"0"``XD8P`T +M`^``"``#$`LGO?_0K[0`(*^R`!BOL``0K[\`)*^S`!ROL0`4C)$;]"0%`+\# +MH#`ACB(```"`D"&GH``$#``LKXQ3``0F,``T%$``I@!`H"&.0AOTEZ,``(Q" +M``"N(P`TE$(``"Q"4`,40`"_)Z8`!`)`("$,`"RO)`4`RA1``)D`0*`AEZ(` +M!#!"#\```A%"-$(``:X"`#R.0AOTC$(``)1"```L0E`!$$``IR>F``*GH``" +MEF(`$I9D`!"68P`4``(0@`""("4``QC`EF4```"#("4T@@`"`$4@"I9C``(` +M@"@A-*(`$)>D````0R@*,*(``11```.N!```)`+__0"B*"0PH@`(%$``!"0" +M"0@D`O_O`*(H)"0""0BF`@!$ED(<]C!"`/`L0@`P$$``A*X%``260QSP)`(` +M!Q!B``4D`@G$)`(`"A!B``(D`@G$)`(*K*8"`$:7J``")`(3.*8"`$`D`A?4 +MI@(`0C$#``(D`@`!K@(`8*X``%P48``(```P(99#'/`L8@`&4$``!"0&``$D +M`@`%4&(`8I9#'/*61!SP)`(``:X&`%@L@P`&K@(`4*X``$P08`!8```P(20" +M``50@@!2ED(<\C$$__\`!!!".$(``20'``$P0@`!,0,``:X&`%2N`@!(K@<` +M"*X'``P48``#```P(3"B``D``C`K``00PCA"``$P0@`!,0,`!*X&`!"N`@`4 +M%&```P``,"$PH@`)``(P*Y9B``:.9``8``49`C!C``&N!@`8K@,`(*X'`"2N +M`@`HK@<`'!"```0``"@ACF(`'%1```,D`@`!)`4``20"``$Q`P'PK@(`,*X% +M`"P48``"``,1`B0"``HQ`_``$&``'ZX"`#0``QL")`(``0!B$`2N`@`XCD(; +M](Q#``"7H@`$,$(/P``"(4*48@``+$)0`Q1```.N!``\-((``:X"`#R"8@`@ +M`D`@(:X"`&2"8@`A#``?SJX"`&@"@!`AC[\`)(^T`""/LP`]`#`0`/_D)`(`@"Q"``@40/^N,03__Q``_ZLD!@`!)`(``A!B +M``,L8@`$5$#_G)9$'/`0`/^9)`8``1``_X0D`@G$`D`@(0P`+*\D!0#)%$#_ +MXP!`H"&7H@`"$`#_5*9B`#@"0"`A#``LKR0%`,H40/_;`$"@(9>B``0P0@P` +M``(90JX#`#P0`/]"IZ(`!">]_]"OLP`B +M``"3HP`!``(2`J(#``"B`@`!%(#_\B80``*20P`+)`(`_Q!B``H``(@AHD`` +M#(^_`""/LP`] +M__"OL````("`(:^_``0,`'I7)`0!6*X"``000`!")`,``@!`("$``"@A#`!P +MJB0&`5@,`'I7)`0#9*X"``@00``Y)`,``@!`("$``"@A#`!PJB0&`V2."0`( +M)`(`"B0(``FE(@`4)`(``Z4B`AXE(P`<)`(`"R4(__^D8@``!0'__21C`#0` +M`$`A`2`X(3P#@`(\`H`"``@@0"1C%X0D0A=\`((0(0"#&"&41@``E&,``"4( +M``$`B2`A)`(`"RD%``.D@P(@I(8")J3B`C*DX@+.%*#_[B3G`#0,`'I7)`0` +MB*X"``P00``/)`,``@!`("$``"@A#`!PJB0&`(@,`'I7)`0(`*X"`!`00``& +M)`,``@!`("$``"@A#`!PJB0&"````!@AC[\`!(^P````8!`A`^``"">]`!`G +MO?_@K[\`$*^S``ROL@`(K[$`!*^P``",@AOT`*!((3##__^,4P``EF(``"Q" +M,`,40``ICG``")8&`!0``)`A`D80*U!``!"6`@`4`@`X(0`#$$``21`AE$@` +M`"92``(D8P`!,00`_P`($@("1B@KI.(``*3D``(P8___%*#_]"3G``26`@`4 +M$$``#```D"$"`(@AEB4``)9D`````#`A#``HGB92``&6`P`4IB(```)#&"L4 +M8/_W)C$``H^_`!"/LP`,C[(`"(^Q``2/L````^``"">]`"```Q!``$40(91( +M```D8P`!,&/__P!@*"$`"#%```@8@@`($D(PQ@!_,&,`?P`%($"F!@`$I@(` +M`*8#``(`B2`AE(@``"2E``$PH___`&`@(0`($L(`""C```@9`@#","4PI0!_ +M,&,`?P`$$$"F!0`(I@8`!*8#``8`21`AE$@``"2$``$P@___`&`@(0`($T(` +M"#A```@9@@"B*"4PYP!_,&,`?P`$$$"F!P`,I@4`"*8#``H`21`AE$@``"2$ +M``$PA/__``@I@``(,\(`"!("``@80C"E`'\P0@!_`.8X)3!C`'\`!"!`I@4` +M$J8"``ZF!P`,I@,`$`")("&4B`````@2@@"B*"40`/^HI@4`$B>]_\"OMP`L +MK[4`)*^Q`!2OOP`TK[X`,*^V`"BOM``@K[,`'*^R`!BOL``0C((;]##&__^O +MI0``C%0``*^F``0``+@ACH(`!(Z2``@``(@AE%X`$@``J"$D`@`!```@(1*B +M`'>/HP`$4J``<997`!0D`@`"$J(`9P`````2X`!5``"P(0`#$$"/HP```("8 +M(0!#@"&68@``)B<`"*8B``"6"@``)A```@`*((``"BD"``HR@C"E`#\PA``_ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From rrs at FreeBSD.org Sat Apr 4 04:43:33 2009 From: rrs at FreeBSD.org (Randall Stewart) Date: Sat Apr 4 04:43:46 2009 Subject: svn commit: r190689 - head/sys/netinet Message-ID: <200904041143.n34BhWVA070325@svn.freebsd.org> Author: rrs Date: Sat Apr 4 11:43:32 2009 New Revision: 190689 URL: http://svn.freebsd.org/changeset/base/190689 Log: Many bug fixes (from the IETF hack-fest): - PR-SCTP had major issues when skipping through a multi-part message. o Did not look at socket buffer. o Did not properly handle the reassmebly queue. o The MARKED segments could interfere and un-skip a chunk causing a problem with the proper FWD-TSN. o No FR of FWD-TSN's was being done. - NR-Sack code was basically disabled. It needed fixes that never got into the real code. - CMT code had issues when the two paths were NOT the same b/w. We found a few small bugs, but also the critcal one here was not dividing the rwnd amongst the paths. Obtained from: Michael Tuexen and myself at the IETF hack-fest ;-) Modified: head/sys/netinet/sctp_indata.c head/sys/netinet/sctp_input.c head/sys/netinet/sctp_output.c head/sys/netinet/sctp_pcb.c head/sys/netinet/sctp_structs.h head/sys/netinet/sctp_sysctl.c head/sys/netinet/sctp_sysctl.h head/sys/netinet/sctp_uio.h head/sys/netinet/sctp_usrreq.c head/sys/netinet/sctputil.c Modified: head/sys/netinet/sctp_indata.c ============================================================================== --- head/sys/netinet/sctp_indata.c Sat Apr 4 11:23:00 2009 (r190688) +++ head/sys/netinet/sctp_indata.c Sat Apr 4 11:43:32 2009 (r190689) @@ -423,12 +423,13 @@ abandon: if (SCTP_BASE_SYSCTL(sctp_nr_sack_on_off) && asoc->peer_supports_nr_sack) { nr_tsn = chk->rec.data.TSN_seq; - if (nr_tsn >= asoc->nr_mapping_array_base_tsn) { + if ((compare_with_wrap(nr_tsn, asoc->nr_mapping_array_base_tsn, MAX_TSN)) || + (nr_tsn == asoc->nr_mapping_array_base_tsn)) { nr_gap = nr_tsn - asoc->nr_mapping_array_base_tsn; } else { nr_gap = (MAX_TSN - asoc->nr_mapping_array_base_tsn) + nr_tsn + 1; } - if ((nr_gap >= (SCTP_NR_MAPPING_ARRAY << 3)) || + if ((nr_gap >= (uint32_t) (asoc->nr_mapping_array_size << 3)) || (nr_gap >= (uint32_t) (asoc->nr_mapping_array_size << 3))) { /* * EY The 1st should never happen, as in @@ -440,10 +441,11 @@ abandon: * nr_mapping_array is always expanded when * mapping_array is expanded */ + printf("Impossible nr_gap ack range failed\n"); } else { SCTP_TCB_LOCK_ASSERT(stcb); SCTP_SET_TSN_PRESENT(asoc->nr_mapping_array, nr_gap); - if (nr_tsn > asoc->highest_tsn_inside_nr_map) + if (compare_with_wrap(nr_tsn, asoc->highest_tsn_inside_nr_map, MAX_TSN)) asoc->highest_tsn_inside_nr_map = nr_tsn; } } @@ -550,7 +552,9 @@ abandon: } else { SCTP_TCB_LOCK_ASSERT(stcb); SCTP_SET_TSN_PRESENT(asoc->nr_mapping_array, nr_gap); - if (nr_tsn > asoc->highest_tsn_inside_nr_map) + if (compare_with_wrap(nr_tsn, + asoc->highest_tsn_inside_nr_map, + MAX_TSN)) asoc->highest_tsn_inside_nr_map = nr_tsn; } } @@ -699,7 +703,7 @@ protocol_error: } else { SCTP_TCB_LOCK_ASSERT(stcb); SCTP_SET_TSN_PRESENT(asoc->nr_mapping_array, nr_gap); - if (nr_tsn > asoc->highest_tsn_inside_nr_map) + if (compare_with_wrap(nr_tsn, asoc->highest_tsn_inside_nr_map, MAX_TSN)) asoc->highest_tsn_inside_nr_map = nr_tsn; } } @@ -760,7 +764,8 @@ protocol_error: } else { SCTP_TCB_LOCK_ASSERT(stcb); SCTP_SET_TSN_PRESENT(asoc->nr_mapping_array, nr_gap); - if (nr_tsn > asoc->highest_tsn_inside_nr_map) + if (compare_with_wrap(nr_tsn, asoc->highest_tsn_inside_nr_map, + MAX_TSN)) asoc->highest_tsn_inside_nr_map = nr_tsn; } } @@ -2390,6 +2395,15 @@ finish_express_del: } SCTP_TCB_LOCK_ASSERT(stcb); SCTP_SET_TSN_PRESENT(asoc->mapping_array, gap); + + if (SCTP_BASE_SYSCTL(sctp_nr_sack_on_off) && + asoc->peer_supports_nr_sack && + (SCTP_BASE_SYSCTL(sctp_do_drain) == 0)) { + SCTP_SET_TSN_PRESENT(asoc->nr_mapping_array, gap); + if (compare_with_wrap(tsn, asoc->highest_tsn_inside_nr_map, MAX_TSN)) { + asoc->highest_tsn_inside_nr_map = tsn; + } + } /* check the special flag for stream resets */ if (((liste = TAILQ_FIRST(&asoc->resetHead)) != NULL) && ((compare_with_wrap(asoc->cumulative_tsn, liste->tsn, MAX_TSN)) || @@ -2498,9 +2512,9 @@ sctp_sack_check(struct sctp_tcb *stcb, i int slide_from, slide_end, lgap, distance; /* EY nr_mapping array variables */ - int nr_at; - int nr_last_all_ones = 0; - int nr_slide_from, nr_slide_end, nr_lgap, nr_distance; + /* int nr_at; */ + /* int nr_last_all_ones = 0; */ + /* int nr_slide_from, nr_slide_end, nr_lgap, nr_distance; */ uint32_t old_cumack, old_base, old_highest; unsigned char aux_array[64]; @@ -2683,102 +2697,19 @@ sctp_sack_check(struct sctp_tcb *stcb, i asoc->cumulative_tsn, asoc->highest_tsn_inside_map, SCTP_MAP_SLIDE_RESULT); } - } - } - /* - * EY if doing nr_sacks then slide the nr_mapping_array accordingly - * please - */ - if (SCTP_BASE_SYSCTL(sctp_nr_sack_on_off) && asoc->peer_supports_nr_sack) { - - nr_at = 0; - for (nr_slide_from = 0; nr_slide_from < stcb->asoc.nr_mapping_array_size; nr_slide_from++) { - - if (asoc->nr_mapping_array[nr_slide_from] == 0xff) { - nr_at += 8; - nr_last_all_ones = 1; - } else { - /* there is a 0 bit */ - nr_at += sctp_map_lookup_tab[asoc->nr_mapping_array[nr_slide_from]]; - nr_last_all_ones = 0; - break; - } - } - - nr_at++; - - if (compare_with_wrap(asoc->cumulative_tsn, - asoc->highest_tsn_inside_nr_map, MAX_TSN) && (at >= 8)) { - /* The complete array was completed by a single FR */ - /* higest becomes the cum-ack */ - int clr; - - clr = (nr_at >> 3) + 1; - - if (clr > asoc->nr_mapping_array_size) - clr = asoc->nr_mapping_array_size; - - memset(asoc->nr_mapping_array, 0, clr); - /* base becomes one ahead of the cum-ack */ - asoc->nr_mapping_array_base_tsn = asoc->cumulative_tsn + 1; - asoc->highest_tsn_inside_nr_map = asoc->cumulative_tsn; - - } else if (nr_at >= 8) { - /* we can slide the mapping array down */ - /* Calculate the new byte postion we can move down */ - /* - * now calculate the ceiling of the move using our - * highest TSN value + * EY if doing nr_sacks then slide the + * nr_mapping_array accordingly please */ - if (asoc->highest_tsn_inside_nr_map >= asoc->nr_mapping_array_base_tsn) { - nr_lgap = asoc->highest_tsn_inside_nr_map - - asoc->nr_mapping_array_base_tsn; - } else { - nr_lgap = (MAX_TSN - asoc->nr_mapping_array_base_tsn) + - asoc->highest_tsn_inside_nr_map + 1; - } - nr_slide_end = nr_lgap >> 3; - if (nr_slide_end < nr_slide_from) { -#ifdef INVARIANTS - panic("impossible slide"); -#else - printf("impossible slide?\n"); - return; -#endif - } - if (nr_slide_end > asoc->nr_mapping_array_size) { -#ifdef INVARIANTS - panic("would overrun buffer"); -#else - printf("Gak, would have overrun map end:%d nr_slide_end:%d\n", - asoc->nr_mapping_array_size, nr_slide_end); - nr_slide_end = asoc->nr_mapping_array_size; -#endif - } - nr_distance = (nr_slide_end - nr_slide_from) + 1; - - if (nr_distance + nr_slide_from > asoc->nr_mapping_array_size || - nr_distance < 0) { - /* - * Here we do NOT slide forward the array so - * that hopefully when more data comes in to - * fill it up we will be able to slide it - * forward. Really I don't think this should - * happen :-0 - */ - ; - } else { - int ii; - - for (ii = 0; ii < nr_distance; ii++) { + if (SCTP_BASE_SYSCTL(sctp_nr_sack_on_off) && asoc->peer_supports_nr_sack) { + for (ii = 0; ii < distance; ii++) { asoc->nr_mapping_array[ii] = - asoc->nr_mapping_array[nr_slide_from + ii]; + asoc->nr_mapping_array[slide_from + ii]; } - for (ii = nr_distance; ii <= nr_slide_end; ii++) { + for (ii = distance; ii <= slide_end; ii++) { asoc->nr_mapping_array[ii] = 0; } - asoc->nr_mapping_array_base_tsn += (nr_slide_from << 3); + asoc->nr_mapping_array_base_tsn += (slide_from << 3); } } } @@ -2802,7 +2733,7 @@ sctp_sack_check(struct sctp_tcb *stcb, i * EY if nr_sacks used then send an nr-sack , a sack * otherwise */ - if (SCTP_BASE_SYSCTL(sctp_nr_sack_on_off) && asoc->peer_supports_nr_sack) + if (SCTP_BASE_SYSCTL(sctp_nr_sack_on_off) && stcb->asoc.peer_supports_nr_sack) sctp_send_nr_sack(stcb); else sctp_send_sack(stcb); @@ -3496,9 +3427,13 @@ sctp_handle_segments(struct mbuf *m, int /* * All chunks NOT UNSENT * fall through here and are - * marked + * marked (leave PR-SCTP + * ones that are to skip + * alone though) */ - tp1->sent = SCTP_DATAGRAM_MARKED; + if (tp1->sent != SCTP_FORWARD_TSN_SKIP) + tp1->sent = SCTP_DATAGRAM_MARKED; + if (tp1->rec.data.chunk_was_revoked) { /* deflate the cwnd */ tp1->whoTo->cwnd -= tp1->book_size; @@ -5798,7 +5733,9 @@ sctp_kick_prsctp_reorder_queue(struct sc } else { SCTP_TCB_LOCK_ASSERT(stcb); SCTP_SET_TSN_PRESENT(asoc->nr_mapping_array, nr_gap); - if (nr_tsn > asoc->highest_tsn_inside_nr_map) + if (compare_with_wrap(nr_tsn, + asoc->highest_tsn_inside_nr_map, + MAX_TSN)) asoc->highest_tsn_inside_nr_map = nr_tsn; } @@ -5901,7 +5838,8 @@ sctp_kick_prsctp_reorder_queue(struct sc } else { SCTP_TCB_LOCK_ASSERT(stcb); SCTP_SET_TSN_PRESENT(asoc->nr_mapping_array, nr_gap); - if (nr_tsn > asoc->highest_tsn_inside_nr_map) + if (compare_with_wrap(nr_tsn, asoc->highest_tsn_inside_nr_map, + MAX_TSN)) asoc->highest_tsn_inside_nr_map = nr_tsn; } @@ -5963,6 +5901,91 @@ sctp_kick_prsctp_reorder_queue(struct sc } } +static void +sctp_flush_reassm_for_str_seq(struct sctp_tcb *stcb, + struct sctp_association *asoc, + uint16_t stream, uint16_t seq) +{ + struct sctp_tmit_chunk *chk, *at; + + if (!TAILQ_EMPTY(&asoc->reasmqueue)) { + /* For each one on here see if we need to toss it */ + /* + * For now large messages held on the reasmqueue that are + * complete will be tossed too. We could in theory do more + * work to spin through and stop after dumping one msg aka + * seeing the start of a new msg at the head, and call the + * delivery function... to see if it can be delivered... But + * for now we just dump everything on the queue. + */ + chk = TAILQ_FIRST(&asoc->reasmqueue); + while (chk) { + at = TAILQ_NEXT(chk, sctp_next); + if (chk->rec.data.stream_number != stream) { + chk = at; + continue; + } + if (chk->rec.data.stream_seq == seq) { + /* It needs to be tossed */ + TAILQ_REMOVE(&asoc->reasmqueue, chk, sctp_next); + if (compare_with_wrap(chk->rec.data.TSN_seq, + asoc->tsn_last_delivered, MAX_TSN)) { + asoc->tsn_last_delivered = + chk->rec.data.TSN_seq; + asoc->str_of_pdapi = + chk->rec.data.stream_number; + asoc->ssn_of_pdapi = + chk->rec.data.stream_seq; + asoc->fragment_flags = + chk->rec.data.rcv_flags; + } + asoc->size_on_reasm_queue -= chk->send_size; + sctp_ucount_decr(asoc->cnt_on_reasm_queue); + + /* Clear up any stream problem */ + if ((chk->rec.data.rcv_flags & SCTP_DATA_UNORDERED) != + SCTP_DATA_UNORDERED && + (compare_with_wrap(chk->rec.data.stream_seq, + asoc->strmin[chk->rec.data.stream_number].last_sequence_delivered, + MAX_SEQ))) { + /* + * We must dump forward this streams + * sequence number if the chunk is + * not unordered that is being + * skipped. There is a chance that + * if the peer does not include the + * last fragment in its FWD-TSN we + * WILL have a problem here since + * you would have a partial chunk in + * queue that may not be + * deliverable. Also if a Partial + * delivery API as started the user + * may get a partial chunk. The next + * read returning a new chunk... + * really ugly but I see no way + * around it! Maybe a notify?? + */ + asoc->strmin[chk->rec.data.stream_number].last_sequence_delivered = + chk->rec.data.stream_seq; + } + if (chk->data) { + sctp_m_freem(chk->data); + chk->data = NULL; + } + sctp_free_a_chunk(stcb, chk); + } else if (compare_with_wrap(chk->rec.data.stream_seq, seq, MAX_SEQ)) { + /* + * If the stream_seq is > than the purging + * one, we are done + */ + break; + } + chk = at; + } + } +} + + void sctp_handle_forward_tsn(struct sctp_tcb *stcb, struct sctp_forward_tsn_chunk *fwd, int *abort_flag, struct mbuf *m, int offset) @@ -5992,13 +6015,14 @@ sctp_handle_forward_tsn(struct sctp_tcb */ struct sctp_association *asoc; uint32_t new_cum_tsn, gap; - unsigned int i, cnt_gone, fwd_sz, cumack_set_flag, m_size; + unsigned int i, fwd_sz, cumack_set_flag, m_size; + uint32_t str_seq; struct sctp_stream_in *strm; struct sctp_tmit_chunk *chk, *at; + struct sctp_queued_to_read *ctl, *sv; cumack_set_flag = 0; asoc = &stcb->asoc; - cnt_gone = 0; if ((fwd_sz = ntohs(fwd->ch.chunk_length)) < sizeof(struct sctp_forward_tsn_chunk)) { SCTPDBG(SCTP_DEBUG_INDATA1, "Bad size too small/big fwd-tsn\n"); @@ -6102,6 +6126,14 @@ sctp_handle_forward_tsn(struct sctp_tcb SCTP_TCB_LOCK_ASSERT(stcb); for (i = 0; i <= gap; i++) { SCTP_SET_TSN_PRESENT(asoc->mapping_array, i); + /* + * EY if drain is off then every gap-ack is an + * nr-gap-ack + */ + if (SCTP_BASE_SYSCTL(sctp_nr_sack_on_off) && asoc->peer_supports_nr_sack + && SCTP_BASE_SYSCTL(sctp_do_drain) == 0) { + SCTP_SET_TSN_PRESENT(asoc->nr_mapping_array, i); + } } /* * Now after marking all, slide thing forward but no sack @@ -6152,7 +6184,6 @@ sctp_handle_forward_tsn(struct sctp_tcb } asoc->size_on_reasm_queue -= chk->send_size; sctp_ucount_decr(asoc->cnt_on_reasm_queue); - cnt_gone++; /* Clear up any stream problem */ if ((chk->rec.data.rcv_flags & SCTP_DATA_UNORDERED) != @@ -6188,45 +6219,17 @@ sctp_handle_forward_tsn(struct sctp_tcb } else { /* * Ok we have gone beyond the end of the - * fwd-tsn's mark. Some checks... + * fwd-tsn's mark. */ - if ((asoc->fragmented_delivery_inprogress) && - (chk->rec.data.rcv_flags & SCTP_DATA_FIRST_FRAG)) { - uint32_t str_seq; - - /* - * Special case PD-API is up and - * what we fwd-tsn' over includes - * one that had the LAST_FRAG. We no - * longer need to do the PD-API. - */ - asoc->fragmented_delivery_inprogress = 0; - - str_seq = (asoc->str_of_pdapi << 16) | asoc->ssn_of_pdapi; - sctp_ulp_notify(SCTP_NOTIFY_PARTIAL_DELVIERY_INDICATION, - stcb, SCTP_PARTIAL_DELIVERY_ABORTED, (void *)&str_seq, SCTP_SO_NOT_LOCKED); - - } break; } chk = at; } } - if (asoc->fragmented_delivery_inprogress) { - /* - * Ok we removed cnt_gone chunks in the PD-API queue that - * were being delivered. So now we must turn off the flag. - */ - uint32_t str_seq; - - str_seq = (asoc->str_of_pdapi << 16) | asoc->ssn_of_pdapi; - sctp_ulp_notify(SCTP_NOTIFY_PARTIAL_DELVIERY_INDICATION, - stcb, SCTP_PARTIAL_DELIVERY_ABORTED, (void *)&str_seq, SCTP_SO_NOT_LOCKED); - asoc->fragmented_delivery_inprogress = 0; - } - /*************************************************************/ - /* 3. Update the PR-stream re-ordering queues */ - /*************************************************************/ + /*******************************************************/ + /* 3. Update the PR-stream re-ordering queues and fix */ + /* delivery issues as needed. */ + /*******************************************************/ fwd_sz -= sizeof(*fwd); if (m && fwd_sz) { /* New method. */ @@ -6235,6 +6238,7 @@ sctp_handle_forward_tsn(struct sctp_tcb offset += sizeof(*fwd); + SCTP_INP_READ_LOCK(stcb->sctp_ep); num_str = fwd_sz / sizeof(struct sctp_strseq); for (i = 0; i < num_str; i++) { uint16_t st; @@ -6251,11 +6255,49 @@ sctp_handle_forward_tsn(struct sctp_tcb stseq->stream = st; st = ntohs(stseq->sequence); stseq->sequence = st; + /* now process */ + + /* + * Ok we now look for the stream/seq on the read + * queue where its not all delivered. If we find it + * we transmute the read entry into a PDI_ABORTED. + */ if (stseq->stream >= asoc->streamincnt) { /* screwed up streams, stop! */ break; } + if ((asoc->str_of_pdapi == stseq->stream) && + (asoc->ssn_of_pdapi == stseq->sequence)) { + /* + * If this is the one we were partially + * delivering now then we no longer are. + * Note this will change with the reassembly + * re-write. + */ + asoc->fragmented_delivery_inprogress = 0; + } + sctp_flush_reassm_for_str_seq(stcb, asoc, stseq->stream, stseq->sequence); + TAILQ_FOREACH(ctl, &stcb->sctp_ep->read_queue, next) { + if ((ctl->sinfo_stream == stseq->stream) && + (ctl->sinfo_ssn == stseq->sequence)) { + str_seq = (stseq->stream << 16) | stseq->sequence; + ctl->end_added = 1; + ctl->pdapi_aborted = 1; + sv = stcb->asoc.control_pdapi; + stcb->asoc.control_pdapi = ctl; + sctp_notify_partial_delivery_indication(stcb, + SCTP_PARTIAL_DELIVERY_ABORTED, + SCTP_HOLDS_LOCK, + str_seq); + stcb->asoc.control_pdapi = sv; + break; + } else if ((ctl->sinfo_stream == stseq->stream) && + (compare_with_wrap(ctl->sinfo_ssn, stseq->sequence, MAX_SEQ))) { + /* We are past our victim SSN */ + break; + } + } strm = &asoc->strmin[stseq->stream]; if (compare_with_wrap(stseq->sequence, strm->last_sequence_delivered, MAX_SEQ)) { @@ -6267,6 +6309,7 @@ sctp_handle_forward_tsn(struct sctp_tcb /* sa_ignore NO_NULL_CHK */ sctp_kick_prsctp_reorder_queue(stcb, strm); } + SCTP_INP_READ_UNLOCK(stcb->sctp_ep); } if (TAILQ_FIRST(&asoc->reasmqueue)) { /* now lets kick out and check for more fragmented delivery */ @@ -7067,7 +7110,8 @@ sctp_handle_nr_sack_segments(struct mbuf * fall through here and are * marked */ - tp1->sent = SCTP_DATAGRAM_MARKED; + if (tp1->sent != SCTP_FORWARD_TSN_SKIP) + tp1->sent = SCTP_DATAGRAM_NR_MARKED; if (tp1->rec.data.chunk_was_revoked) { /* deflate the cwnd */ tp1->whoTo->cwnd -= tp1->book_size; @@ -7079,7 +7123,8 @@ sctp_handle_nr_sack_segments(struct mbuf * nr_marked */ if (all_bit) { - tp1->sent = SCTP_DATAGRAM_NR_MARKED; + if (tp1->sent != SCTP_FORWARD_TSN_SKIP) + tp1->sent = SCTP_DATAGRAM_NR_MARKED; /* * TAILQ_REMOVE(&asoc * ->sent_queue, @@ -7198,7 +7243,8 @@ sctp_handle_nr_sack_segments(struct mbuf while (tp1) { if (tp1->rec.data.TSN_seq == j) { if (tp1->sent != SCTP_DATAGRAM_UNSENT) { - tp1->sent = SCTP_DATAGRAM_NR_MARKED; + if (tp1->sent != SCTP_FORWARD_TSN_SKIP) + tp1->sent = SCTP_DATAGRAM_NR_MARKED; /* * TAILQ_REMOVE(&asoc * ->sent_queue, Modified: head/sys/netinet/sctp_input.c ============================================================================== --- head/sys/netinet/sctp_input.c Sat Apr 4 11:23:00 2009 (r190688) +++ head/sys/netinet/sctp_input.c Sat Apr 4 11:43:32 2009 (r190689) @@ -3150,8 +3150,10 @@ process_chunk_drop(struct sctp_tcb *stcb (uintptr_t) stcb, tp1->rec.data.TSN_seq); } - sctp_flight_size_decrease(tp1); - sctp_total_flight_decrease(stcb, tp1); + if (tp1->sent < SCTP_DATAGRAM_RESEND) { + sctp_flight_size_decrease(tp1); + sctp_total_flight_decrease(stcb, tp1); + } } { /* audit code */ unsigned int audit; @@ -5606,11 +5608,14 @@ sctp_common_input_processing(struct mbuf /* there was a gap before this data was processed */ was_a_gap = 1; } + stcb->asoc.send_sack = 1; sctp_sack_check(stcb, 1, was_a_gap, &abort_flag); if (abort_flag) { /* Again, we aborted so NO UNLOCK needed */ goto out_now; } + } else if (fwd_tsn_seen) { + stcb->asoc.send_sack = 1; } /* trigger send of any chunks in queue... */ trigger_send: Modified: head/sys/netinet/sctp_output.c ============================================================================== --- head/sys/netinet/sctp_output.c Sat Apr 4 11:23:00 2009 (r190688) +++ head/sys/netinet/sctp_output.c Sat Apr 4 11:43:32 2009 (r190689) @@ -1859,1812 +1859,6 @@ struct sack_track sack_array[256] = { } }; -/* EY below are nr_sacks version of the preceeding two data structures, identical except their names */ -#define SCTP_MAX_NR_GAPS_INARRAY 4 -struct nr_sack_track { - uint8_t right_edge; /* mergable on the right edge */ - uint8_t left_edge; /* mergable on the left edge */ - uint8_t num_entries; - uint8_t spare; - struct sctp_nr_gap_ack_block nr_gaps[SCTP_MAX_NR_GAPS_INARRAY]; -}; - -struct nr_sack_track nr_sack_array[256] = { - {0, 0, 0, 0, /* 0x00 */ - {{0, 0}, - {0, 0}, - {0, 0}, - {0, 0} - } - }, - {1, 0, 1, 0, /* 0x01 */ - {{0, 0}, - {0, 0}, - {0, 0}, - {0, 0} - } - }, - {0, 0, 1, 0, /* 0x02 */ - {{1, 1}, - {0, 0}, - {0, 0}, - {0, 0} - } - }, - {1, 0, 1, 0, /* 0x03 */ - {{0, 1}, - {0, 0}, - {0, 0}, - {0, 0} - } - }, - {0, 0, 1, 0, /* 0x04 */ - {{2, 2}, - {0, 0}, - {0, 0}, - {0, 0} - } - }, - {1, 0, 2, 0, /* 0x05 */ - {{0, 0}, - {2, 2}, - {0, 0}, - {0, 0} - } - }, - {0, 0, 1, 0, /* 0x06 */ - {{1, 2}, - {0, 0}, - {0, 0}, - {0, 0} - } - }, - {1, 0, 1, 0, /* 0x07 */ - {{0, 2}, - {0, 0}, - {0, 0}, - {0, 0} - } - }, - {0, 0, 1, 0, /* 0x08 */ - {{3, 3}, - {0, 0}, - {0, 0}, - {0, 0} - } - }, - {1, 0, 2, 0, /* 0x09 */ - {{0, 0}, - {3, 3}, - {0, 0}, - {0, 0} - } - }, - {0, 0, 2, 0, /* 0x0a */ - {{1, 1}, - {3, 3}, - {0, 0}, - {0, 0} - } - }, - {1, 0, 2, 0, /* 0x0b */ - {{0, 1}, - {3, 3}, - {0, 0}, - {0, 0} - } - }, - {0, 0, 1, 0, /* 0x0c */ - {{2, 3}, - {0, 0}, - {0, 0}, - {0, 0} - } - }, - {1, 0, 2, 0, /* 0x0d */ - {{0, 0}, - {2, 3}, - {0, 0}, - {0, 0} - } - }, - {0, 0, 1, 0, /* 0x0e */ - {{1, 3}, - {0, 0}, - {0, 0}, - {0, 0} - } - }, - {1, 0, 1, 0, /* 0x0f */ - {{0, 3}, - {0, 0}, - {0, 0}, - {0, 0} - } - }, - {0, 0, 1, 0, /* 0x10 */ - {{4, 4}, - {0, 0}, - {0, 0}, - {0, 0} - } - }, - {1, 0, 2, 0, /* 0x11 */ - {{0, 0}, - {4, 4}, - {0, 0}, - {0, 0} - } - }, - {0, 0, 2, 0, /* 0x12 */ - {{1, 1}, - {4, 4}, - {0, 0}, - {0, 0} - } - }, - {1, 0, 2, 0, /* 0x13 */ - {{0, 1}, - {4, 4}, - {0, 0}, - {0, 0} - } - }, - {0, 0, 2, 0, /* 0x14 */ - {{2, 2}, - {4, 4}, - {0, 0}, - {0, 0} - } - }, - {1, 0, 3, 0, /* 0x15 */ - {{0, 0}, - {2, 2}, - {4, 4}, - {0, 0} - } - }, - {0, 0, 2, 0, /* 0x16 */ - {{1, 2}, - {4, 4}, - {0, 0}, - {0, 0} - } - }, - {1, 0, 2, 0, /* 0x17 */ - {{0, 2}, - {4, 4}, - {0, 0}, - {0, 0} - } - }, - {0, 0, 1, 0, /* 0x18 */ - {{3, 4}, - {0, 0}, - {0, 0}, - {0, 0} - } - }, - {1, 0, 2, 0, /* 0x19 */ - {{0, 0}, - {3, 4}, - {0, 0}, - {0, 0} - } - }, - {0, 0, 2, 0, /* 0x1a */ - {{1, 1}, - {3, 4}, - {0, 0}, - {0, 0} - } - }, - {1, 0, 2, 0, /* 0x1b */ - {{0, 1}, - {3, 4}, - {0, 0}, - {0, 0} - } - }, - {0, 0, 1, 0, /* 0x1c */ - {{2, 4}, - {0, 0}, - {0, 0}, - {0, 0} - } - }, - {1, 0, 2, 0, /* 0x1d */ - {{0, 0}, - {2, 4}, - {0, 0}, - {0, 0} - } - }, - {0, 0, 1, 0, /* 0x1e */ - {{1, 4}, - {0, 0}, - {0, 0}, - {0, 0} - } - }, - {1, 0, 1, 0, /* 0x1f */ - {{0, 4}, - {0, 0}, - {0, 0}, - {0, 0} - } - }, - {0, 0, 1, 0, /* 0x20 */ - {{5, 5}, - {0, 0}, - {0, 0}, - {0, 0} - } - }, - {1, 0, 2, 0, /* 0x21 */ - {{0, 0}, - {5, 5}, - {0, 0}, - {0, 0} - } - }, - {0, 0, 2, 0, /* 0x22 */ - {{1, 1}, - {5, 5}, - {0, 0}, - {0, 0} - } - }, - {1, 0, 2, 0, /* 0x23 */ - {{0, 1}, - {5, 5}, - {0, 0}, - {0, 0} - } - }, - {0, 0, 2, 0, /* 0x24 */ - {{2, 2}, - {5, 5}, - {0, 0}, - {0, 0} - } - }, - {1, 0, 3, 0, /* 0x25 */ - {{0, 0}, - {2, 2}, - {5, 5}, - {0, 0} - } - }, - {0, 0, 2, 0, /* 0x26 */ - {{1, 2}, - {5, 5}, - {0, 0}, - {0, 0} - } - }, - {1, 0, 2, 0, /* 0x27 */ - {{0, 2}, - {5, 5}, - {0, 0}, - {0, 0} - } - }, - {0, 0, 2, 0, /* 0x28 */ - {{3, 3}, - {5, 5}, - {0, 0}, - {0, 0} - } - }, - {1, 0, 3, 0, /* 0x29 */ - {{0, 0}, - {3, 3}, - {5, 5}, - {0, 0} - } - }, - {0, 0, 3, 0, /* 0x2a */ - {{1, 1}, - {3, 3}, - {5, 5}, - {0, 0} - } - }, - {1, 0, 3, 0, /* 0x2b */ - {{0, 1}, - {3, 3}, - {5, 5}, - {0, 0} - } - }, - {0, 0, 2, 0, /* 0x2c */ - {{2, 3}, - {5, 5}, - {0, 0}, - {0, 0} - } - }, - {1, 0, 3, 0, /* 0x2d */ - {{0, 0}, - {2, 3}, - {5, 5}, - {0, 0} - } - }, - {0, 0, 2, 0, /* 0x2e */ - {{1, 3}, - {5, 5}, - {0, 0}, - {0, 0} - } - }, - {1, 0, 2, 0, /* 0x2f */ - {{0, 3}, - {5, 5}, - {0, 0}, - {0, 0} - } - }, - {0, 0, 1, 0, /* 0x30 */ - {{4, 5}, - {0, 0}, - {0, 0}, - {0, 0} - } - }, - {1, 0, 2, 0, /* 0x31 */ - {{0, 0}, - {4, 5}, - {0, 0}, - {0, 0} - } - }, - {0, 0, 2, 0, /* 0x32 */ - {{1, 1}, - {4, 5}, - {0, 0}, - {0, 0} - } - }, - {1, 0, 2, 0, /* 0x33 */ - {{0, 1}, - {4, 5}, - {0, 0}, - {0, 0} - } - }, - {0, 0, 2, 0, /* 0x34 */ - {{2, 2}, - {4, 5}, - {0, 0}, - {0, 0} - } - }, - {1, 0, 3, 0, /* 0x35 */ - {{0, 0}, - {2, 2}, - {4, 5}, - {0, 0} - } - }, - {0, 0, 2, 0, /* 0x36 */ - {{1, 2}, - {4, 5}, - {0, 0}, - {0, 0} - } - }, - {1, 0, 2, 0, /* 0x37 */ - {{0, 2}, - {4, 5}, - {0, 0}, - {0, 0} - } - }, - {0, 0, 1, 0, /* 0x38 */ - {{3, 5}, - {0, 0}, - {0, 0}, - {0, 0} - } - }, - {1, 0, 2, 0, /* 0x39 */ - {{0, 0}, - {3, 5}, - {0, 0}, - {0, 0} - } - }, - {0, 0, 2, 0, /* 0x3a */ - {{1, 1}, - {3, 5}, - {0, 0}, - {0, 0} - } - }, - {1, 0, 2, 0, /* 0x3b */ - {{0, 1}, - {3, 5}, - {0, 0}, - {0, 0} - } - }, - {0, 0, 1, 0, /* 0x3c */ - {{2, 5}, - {0, 0}, - {0, 0}, - {0, 0} - } - }, - {1, 0, 2, 0, /* 0x3d */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From kib at FreeBSD.org Sat Apr 4 05:19:53 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Sat Apr 4 05:20:05 2009 Subject: svn commit: r190690 - head/sys/ufs/ffs Message-ID: <200904041219.n34CJq7P071063@svn.freebsd.org> Author: kib Date: Sat Apr 4 12:19:52 2009 New Revision: 190690 URL: http://svn.freebsd.org/changeset/base/190690 Log: When removing or renaming snaphost, do not delve into request_cleanup(). The later may need blocks from the underlying device that belongs to normal files, that should not be locked while snap lock is held. Reported and tested by: pho MFC after: 1 month Modified: head/sys/ufs/ffs/ffs_softdep.c Modified: head/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- head/sys/ufs/ffs/ffs_softdep.c Sat Apr 4 11:43:32 2009 (r190689) +++ head/sys/ufs/ffs/ffs_softdep.c Sat Apr 4 12:19:52 2009 (r190690) @@ -3309,7 +3309,7 @@ newdirrem(bp, dp, ip, isrmdir, prevdirre * the number of freefile and freeblks structures. */ ACQUIRE_LOCK(&lk); - if (num_dirrem > max_softdeps / 2) + if (!(ip->i_flags & SF_SNAPSHOT) && num_dirrem > max_softdeps / 2) (void) request_cleanup(ITOV(dp)->v_mount, FLUSH_REMOVE); num_dirrem += 1; FREE_LOCK(&lk); From bms at FreeBSD.org Sat Apr 4 08:26:36 2009 From: bms at FreeBSD.org (Bruce M Simpson) Date: Sat Apr 4 08:26:41 2009 Subject: svn commit: r190691 - head/sys/netinet Message-ID: <200904041526.n34FQWJu074503@svn.freebsd.org> Author: bms Date: Sat Apr 4 15:26:32 2009 New Revision: 190691 URL: http://svn.freebsd.org/changeset/base/190691 Log: Do not obliterate QQI with MAXRESP. Found during MLDv2 port. Modified: head/sys/netinet/igmp.c Modified: head/sys/netinet/igmp.c ============================================================================== --- head/sys/netinet/igmp.c Sat Apr 4 12:19:52 2009 (r190690) +++ head/sys/netinet/igmp.c Sat Apr 4 15:26:32 2009 (r190691) @@ -1004,8 +1004,8 @@ igmp_input_v3_query(struct ifnet *ifp, c qqi = igmpv3->igmp_qqi; if (qqi >= 128) { - maxresp = IGMP_MANT(igmpv3->igmp_qqi) << - (IGMP_EXP(igmpv3->igmp_qqi) + 3); + qqi = IGMP_MANT(igmpv3->igmp_qqi) << + (IGMP_EXP(igmpv3->igmp_qqi) + 3); } timer = maxresp * PR_FASTHZ / IGMP_TIMER_SCALE; From bms at FreeBSD.org Sat Apr 4 08:32:24 2009 From: bms at FreeBSD.org (Bruce M Simpson) Date: Sat Apr 4 08:32:36 2009 Subject: svn commit: r190692 - head/sys/netinet Message-ID: <200904041532.n34FWNEl074651@svn.freebsd.org> Author: bms Date: Sat Apr 4 15:32:23 2009 New Revision: 190692 URL: http://svn.freebsd.org/changeset/base/190692 Log: Fix mbuf chain layout pessimization: in the case where a single mbuf is allocated due to m_getcl() returning NULL, we already call MH_ALIGN, so do not increment m->m_data in this case. Found during MLDv2 port. Modified: head/sys/netinet/igmp.c Modified: head/sys/netinet/igmp.c ============================================================================== --- head/sys/netinet/igmp.c Sat Apr 4 15:26:32 2009 (r190691) +++ head/sys/netinet/igmp.c Sat Apr 4 15:32:23 2009 (r190692) @@ -2784,8 +2784,11 @@ igmp_v3_enqueue_group_record(struct ifqu m = NULL; m0srcs = (ifp->if_mtu - IGMP_LEADINGSPACE - sizeof(struct igmp_grouprec)) / sizeof(in_addr_t); - if (!is_state_change && !is_group_query) + if (!is_state_change && !is_group_query) { m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); + if (m) + m->m_data += IGMP_LEADINGSPACE; + } if (m == NULL) { m = m_gethdr(M_DONTWAIT, MT_DATA); if (m) @@ -2793,7 +2796,6 @@ igmp_v3_enqueue_group_record(struct ifqu } if (m == NULL) return (-ENOMEM); - m->m_data += IGMP_LEADINGSPACE; igmp_save_context(m, ifp); @@ -2909,6 +2911,8 @@ igmp_v3_enqueue_group_record(struct ifqu return (-ENOMEM); } m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); + if (m) + m->m_data += IGMP_LEADINGSPACE; if (m == NULL) { m = m_gethdr(M_DONTWAIT, MT_DATA); if (m) @@ -2917,7 +2921,6 @@ igmp_v3_enqueue_group_record(struct ifqu if (m == NULL) return (-ENOMEM); igmp_save_context(m, ifp); - m->m_data += IGMP_LEADINGSPACE; md = m_getptr(m, 0, &off); pig = (struct igmp_grouprec *)(mtod(md, uint8_t *) + off); CTR1(KTR_IGMPV3, "%s: allocated next packet", __func__); @@ -3063,6 +3066,8 @@ igmp_v3_enqueue_filter_change(struct ifq "%s: use previous packet", __func__); } else { m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); + if (m) + m->m_data += IGMP_LEADINGSPACE; if (m == NULL) { m = m_gethdr(M_DONTWAIT, MT_DATA); if (m) @@ -3075,7 +3080,6 @@ igmp_v3_enqueue_filter_change(struct ifq } m->m_pkthdr.PH_vt.vt_nrecs = 0; igmp_save_context(m, ifp); - m->m_data += IGMP_LEADINGSPACE; m0srcs = (ifp->if_mtu - IGMP_LEADINGSPACE - sizeof(struct igmp_grouprec)) / sizeof(in_addr_t); From ru at FreeBSD.org Sat Apr 4 08:48:10 2009 From: ru at FreeBSD.org (Ruslan Ermilov) Date: Sat Apr 4 08:48:21 2009 Subject: svn commit: r190693 - head/usr.sbin/fifolog/fifolog_create Message-ID: <200904041548.n34Fm9Hd074979@svn.freebsd.org> Author: ru Date: Sat Apr 4 15:48:09 2009 New Revision: 190693 URL: http://svn.freebsd.org/changeset/base/190693 Log: Fixed NAME section. Modified: head/usr.sbin/fifolog/fifolog_create/fifolog.1 Modified: head/usr.sbin/fifolog/fifolog_create/fifolog.1 ============================================================================== --- head/usr.sbin/fifolog/fifolog_create/fifolog.1 Sat Apr 4 15:32:23 2009 (r190692) +++ head/usr.sbin/fifolog/fifolog_create/fifolog.1 Sat Apr 4 15:48:09 2009 (r190693) @@ -28,7 +28,7 @@ .Os .Dt FIFOLOG 1 .Sh NAME -.Nm fifolog_create , fifolog_write , fifolog_read +.Nm fifolog_create , fifolog_writer , fifolog_reader .Nd "initialize, write, seek and extract data from a fifolog" .Sh SYNOPSIS .Nm fifolog_create @@ -84,7 +84,7 @@ of hand-work all but the first record ca If the .Ar file does not already exist, -.Nm +.Nm fifolog_create will attempt to create and .Xr ftruncate 2 it to the specified size, defaulting to 86400 records of 512 bytes From ru at FreeBSD.org Sat Apr 4 09:03:29 2009 From: ru at FreeBSD.org (Ruslan Ermilov) Date: Sat Apr 4 09:03:40 2009 Subject: svn commit: r190694 - head/usr.sbin/jexec Message-ID: <200904041603.n34G3Sfp075321@svn.freebsd.org> Author: ru Date: Sat Apr 4 16:03:28 2009 New Revision: 190694 URL: http://svn.freebsd.org/changeset/base/190694 Log: - Style: size_t can't be negative. - Don't exit with a zero status code when no jails are configured on a system. - Style: simplify some code constructs. - If a single jail cannot be found, let the caller print a nicer diagnostic message. Reviewed by: bz MFC after: 3 days Modified: head/usr.sbin/jexec/jexec.c Modified: head/usr.sbin/jexec/jexec.c ============================================================================== --- head/usr.sbin/jexec/jexec.c Sat Apr 4 15:48:09 2009 (r190693) +++ head/usr.sbin/jexec/jexec.c Sat Apr 4 16:03:28 2009 (r190694) @@ -119,8 +119,8 @@ lookup_jail(int jid, char *jailname) j = len; for (i = 0; i < 4; i++) { - if (len <= 0) - exit(0); + if (len == 0) + return (-1); p = q = malloc(len); if (p == NULL) err(1, "malloc()"); @@ -174,27 +174,21 @@ lookup_jail(int jid, char *jailname) /* NOTREACHED */ break; } - /* Possible match. */ - if (id > 0) { - /* Do we have a jail ID to match as well? */ - if (jid > 0) { - if (jid == id) { - xid = id; - count++; - } - } else { - xid = id; - count++; - } + /* Possible match; see if we have a jail ID to match as well. */ + if (id > 0 && (jid <= 0 || id == jid)) { + xid = id; + count++; } } free(p); - if (count != 1) + if (count == 1) + return (xid); + else if (count > 1) errx(1, "Could not uniquely identify the jail."); - - return (xid); + else + return (-1); } #define GET_USER_INFO do { \ From attilio at FreeBSD.org Sat Apr 4 10:01:33 2009 From: attilio at FreeBSD.org (Attilio Rao) Date: Sat Apr 4 10:01:40 2009 Subject: svn commit: r190695 - head/sys/dev/acpi_support Message-ID: <200904041701.n34H1WbF076416@svn.freebsd.org> Author: attilio Date: Sat Apr 4 17:01:32 2009 New Revision: 190695 URL: http://svn.freebsd.org/changeset/base/190695 Log: - Add the support for the Asus A3F and A3E device - Fix style for A3N and for a comment Submitted by: Akira Funahashi Tested by: Marcin Nowak , Diego Sardina PR: kern/128634 Modified: head/sys/dev/acpi_support/acpi_asus.c Modified: head/sys/dev/acpi_support/acpi_asus.c ============================================================================== --- head/sys/dev/acpi_support/acpi_asus.c Sat Apr 4 16:03:28 2009 (r190694) +++ head/sys/dev/acpi_support/acpi_asus.c Sat Apr 4 17:01:32 2009 (r190695) @@ -176,16 +176,39 @@ static struct acpi_asus_model acpi_asus_ .disp_set = "SDSP" }, { + .name = "A3E", + .mled_set = "MLED", + .wled_set = "WLED", + .lcd_get = "\\_SB.PCI0.SBRG.EC0.RPIN(0x67)", + .lcd_set = "\\_SB.PCI0.SBRG.EC0._Q10", + .brn_get = "GPLV", + .brn_set = "SPLV", + .disp_get = "\\_SB.PCI0.P0P2.VGA.GETD", + .disp_set = "SDSP" + }, + { + .name = "A3F", + .mled_set = "MLED", + .wled_set = "WLED", + .bled_set = "BLED", + .lcd_get = "\\_SB.PCI0.SBRG.EC0.RPIN(0x11)", + .lcd_set = "\\_SB.PCI0.SBRG.EC0._Q10", + .brn_get = "GPLV", + .brn_set = "SPLV", + .disp_get = "\\SSTE", + .disp_set = "SDSP" + }, + { .name = "A3N", .mled_set = "MLED", .bled_set = "BLED", .wled_set = "WLED", - .lcd_get = NULL, + .lcd_get = "\\BKLT", .lcd_set = "\\_SB.PCI0.SBRG.EC0._Q10", + .brn_get = "GPLV", .brn_set = "SPLV", - .brn_get = "SDSP", - .disp_set = "SDSP", - .disp_get = "\\_SB.PCI0.P0P3.VGA.GETD" + .disp_get = "\\_SB.PCI0.P0P3.VGA.GETD", + .disp_set = "SDSP" }, { .name = "A4D", @@ -577,7 +600,7 @@ acpi_asus_probe(device_t dev) return (0); } - /* if EeePC */ + /* EeePC */ if (strncmp("ASUS010", rstr, 7) == 0) { sc->model = &acpi_eeepc_models[0]; device_set_desc(dev, "ASUS EeePC"); @@ -627,6 +650,9 @@ good: else if (strncmp(model->name, "A2x", 3) == 0 && strncmp(Obj->String.Pointer, "A2", 2) == 0) goto good; + else if (strncmp(model->name, "A3F", 3) == 0 && + strncmp(Obj->String.Pointer, "A6F", 3) == 0) + goto good; else if (strncmp(model->name, "D1x", 3) == 0 && strncmp(Obj->String.Pointer, "D1", 2) == 0) goto good; From ru at FreeBSD.org Sat Apr 4 10:03:06 2009 From: ru at FreeBSD.org (Ruslan Ermilov) Date: Sat Apr 4 10:03:18 2009 Subject: svn commit: r190007 - head In-Reply-To: <200903190044.n2J0iMlD043003@svn.freebsd.org> References: <200903190044.n2J0iMlD043003@svn.freebsd.org> Message-ID: <20090404163441.GA78727@edoofus.dev.vega.ru> On Thu, Mar 19, 2009 at 12:44:22AM +0000, Warner Losh wrote: > Author: imp > Date: Thu Mar 19 00:44:22 2009 > New Revision: 190007 > URL: http://svn.freebsd.org/changeset/base/190007 > > Log: > Add usr.bin/ar to the list of cross tools. Before, when we had gnu > ar, it was built in the gnu/usr.bin/binutils tree. Now it isn't. > > Submitted by: John Hein > Please back this change out. 1) ar(1) was moved from cross-tools to bootstrap-tools when we switched to BSD ar. 2) ar(1) isn't a cross-tool as it doesn't test for TARGET{_ARCH,}; all cross-tools do. Cheers, -- Ruslan Ermilov ru@FreeBSD.org FreeBSD committer From nwhitehorn at FreeBSD.org Sat Apr 4 10:05:18 2009 From: nwhitehorn at FreeBSD.org (Nathan Whitehorn) Date: Sat Apr 4 10:05:25 2009 Subject: svn commit: r190696 - head/sys/conf Message-ID: <200904041705.n34H5H2N076534@svn.freebsd.org> Author: nwhitehorn Date: Sat Apr 4 17:05:17 2009 New Revision: 190696 URL: http://svn.freebsd.org/changeset/base/190696 Log: Modularize the Macintosh built-in ATA along the lines of the rest of the ATA system as an optional atamacio device. PR: powerpc/133161 Submitted by: Bruce Cran Modified: head/sys/conf/files.powerpc Modified: head/sys/conf/files.powerpc ============================================================================== --- head/sys/conf/files.powerpc Sat Apr 4 17:01:32 2009 (r190695) +++ head/sys/conf/files.powerpc Sat Apr 4 17:05:17 2009 (r190696) @@ -112,9 +112,9 @@ powerpc/mpc85xx/pci_ocp.c optional pci m powerpc/ofw/ofw_pcibus.c optional pci aim powerpc/ofw/ofw_pcib_pci.c optional pci aim powerpc/ofw/ofw_syscons.c optional sc aim -powerpc/powermac/ata_kauai.c optional powermac ata -powerpc/powermac/ata_macio.c optional powermac ata -powerpc/powermac/ata_dbdma.c optional powermac ata +powerpc/powermac/ata_kauai.c optional powermac ata | powermac atamacio +powerpc/powermac/ata_macio.c optional powermac ata | powermac atamacio +powerpc/powermac/ata_dbdma.c optional powermac ata | powermac atamacio powerpc/powermac/dbdma.c optional powermac pci powerpc/powermac/grackle.c optional powermac pci powerpc/powermac/hrowpic.c optional powermac pci From kan at FreeBSD.org Sat Apr 4 10:48:39 2009 From: kan at FreeBSD.org (Alexander Kabaev) Date: Sat Apr 4 10:48:45 2009 Subject: svn commit: r190697 - head/sys/kern Message-ID: <200904041748.n34Hmcie077357@svn.freebsd.org> Author: kan Date: Sat Apr 4 17:48:38 2009 New Revision: 190697 URL: http://svn.freebsd.org/changeset/base/190697 Log: Revert change 190655 temporarily. It breaks many setups where nullfs is used and needs to be revisited. Modified: head/sys/kern/vfs_cache.c Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Sat Apr 4 17:05:17 2009 (r190696) +++ head/sys/kern/vfs_cache.c Sat Apr 4 17:48:38 2009 (r190697) @@ -971,7 +971,6 @@ vn_vptocnp(struct vnode **vp, char **bp, vdrop(*vp); VFS_UNLOCK_GIANT(vfslocked); if (error) { - CACHE_RLOCK(); numfullpathfail2++; return (error); } @@ -980,6 +979,7 @@ vn_vptocnp(struct vnode **vp, char **bp, CACHE_RLOCK(); if ((*vp)->v_iflag & VI_DOOMED) { /* forced unmount */ + CACHE_RUNLOCK(); vdrop(*vp); return (ENOENT); } From imp at bsdimp.com Sat Apr 4 11:14:16 2009 From: imp at bsdimp.com (M. Warner Losh) Date: Sat Apr 4 11:14:21 2009 Subject: svn commit: r190007 - head In-Reply-To: <20090404163441.GA78727@edoofus.dev.vega.ru> References: <200903190044.n2J0iMlD043003@svn.freebsd.org> <20090404163441.GA78727@edoofus.dev.vega.ru> Message-ID: <20090404.121130.163263885.imp@bsdimp.com> In message: <20090404163441.GA78727@edoofus.dev.vega.ru> Ruslan Ermilov writes: : On Thu, Mar 19, 2009 at 12:44:22AM +0000, Warner Losh wrote: : > Author: imp : > Date: Thu Mar 19 00:44:22 2009 : > New Revision: 190007 : > URL: http://svn.freebsd.org/changeset/base/190007 : > : > Log: : > Add usr.bin/ar to the list of cross tools. Before, when we had gnu : > ar, it was built in the gnu/usr.bin/binutils tree. Now it isn't. : > : > Submitted by: John Hein : > : Please back this change out. : : 1) ar(1) was moved from cross-tools to bootstrap-tools when we switched : to BSD ar. : : 2) ar(1) isn't a cross-tool as it doesn't test for TARGET{_ARCH,}; all : cross-tools do. I'll 1/2 back this out. I'll back out this part of the change, but keep the other part which is needed. Warner From stefanf at FreeBSD.org Sat Apr 4 12:06:55 2009 From: stefanf at FreeBSD.org (Stefan Farfeleder) Date: Sat Apr 4 12:07:01 2009 Subject: svn commit: r190698 - head/bin/sh Message-ID: <200904041906.n34J6raw078841@svn.freebsd.org> Author: stefanf Date: Sat Apr 4 19:06:52 2009 New Revision: 190698 URL: http://svn.freebsd.org/changeset/base/190698 Log: Don't let trailing empty lines overwrite the result of the last command with 0. This affects the built-ins eval, fc, and trap and also the string passed to sh with the -c option. Submitted by: Jilles Tjoelker Modified: head/bin/sh/eval.c Modified: head/bin/sh/eval.c ============================================================================== --- head/bin/sh/eval.c Sat Apr 4 17:48:38 2009 (r190697) +++ head/bin/sh/eval.c Sat Apr 4 19:06:52 2009 (r190698) @@ -166,7 +166,8 @@ evalstring(char *s) setstackmark(&smark); setinputstring(s, 1); while ((n = parsecmd(0)) != NEOF) { - evaltree(n, 0); + if (n != NULL) + evaltree(n, 0); popstackmark(&smark); } popfile(); From kientzle at FreeBSD.org Sat Apr 4 13:08:09 2009 From: kientzle at FreeBSD.org (Tim Kientzle) Date: Sat Apr 4 13:08:16 2009 Subject: svn commit: r190699 - head/lib/libarchive Message-ID: <200904042008.n34K88Bv079947@svn.freebsd.org> Author: kientzle Date: Sat Apr 4 20:08:08 2009 New Revision: 190699 URL: http://svn.freebsd.org/changeset/base/190699 Log: Temporary hack to unbreak user/group lookups; use a larger buffer for getpwuid_r/getgrgid_r. This needs to be dynamically sized. Modified: head/lib/libarchive/archive_read_disk_set_standard_lookup.c Modified: head/lib/libarchive/archive_read_disk_set_standard_lookup.c ============================================================================== --- head/lib/libarchive/archive_read_disk_set_standard_lookup.c Sat Apr 4 19:06:52 2009 (r190698) +++ head/lib/libarchive/archive_read_disk_set_standard_lookup.c Sat Apr 4 20:08:08 2009 (r190699) @@ -182,7 +182,7 @@ lookup_uname(void *data, uid_t uid) static const char * lookup_uname_helper(struct archive *a, id_t id) { - char buffer[64]; + char buffer[512]; struct passwd pwent, *result; int r; @@ -210,7 +210,7 @@ lookup_gname(void *data, gid_t gid) static const char * lookup_gname_helper(struct archive *a, id_t id) { - char buffer[64]; + char buffer[512]; struct group grent, *result; int r; From csjp at FreeBSD.org Sat Apr 4 13:58:19 2009 From: csjp at FreeBSD.org (Christian S.J. Peron) Date: Sat Apr 4 13:58:25 2009 Subject: svn commit: r190700 - head/usr.bin/su Message-ID: <200904042058.n34KwIjC080902@svn.freebsd.org> Author: csjp Date: Sat Apr 4 20:58:18 2009 New Revision: 190700 URL: http://svn.freebsd.org/changeset/base/190700 Log: Fixup the parameters to audit_submit(3) the order is errno then return value. This bug went un-noticed for so long because EPERM == 1 MFC after: 1 week Spotted by: sson, rwatson Modified: head/usr.bin/su/su.c Modified: head/usr.bin/su/su.c ============================================================================== --- head/usr.bin/su/su.c Sat Apr 4 20:08:08 2009 (r190699) +++ head/usr.bin/su/su.c Sat Apr 4 20:58:18 2009 (r190700) @@ -231,7 +231,7 @@ main(int argc, char *argv[]) if (strlen(user) > MAXLOGNAME - 1) { #ifdef USE_BSM_AUDIT if (audit_submit(AUE_su, auid, - 1, EPERM, "username too long: '%s'", user)) + EPERM, 1, "username too long: '%s'", user)) errx(1, "Permission denied"); #endif errx(1, "username too long"); @@ -264,7 +264,7 @@ main(int argc, char *argv[]) pwd = getpwuid(ruid); if (pwd == NULL) { #ifdef USE_BSM_AUDIT - if (audit_submit(AUE_su, auid, 1, EPERM, + if (audit_submit(AUE_su, auid, EPERM, 1, "unable to determine invoking subject: '%s'", username)) errx(1, "Permission denied"); #endif @@ -305,7 +305,7 @@ main(int argc, char *argv[]) retcode = pam_authenticate(pamh, 0); if (retcode != PAM_SUCCESS) { #ifdef USE_BSM_AUDIT - if (audit_submit(AUE_su, auid, 1, EPERM, "bad su %s to %s on %s", + if (audit_submit(AUE_su, auid, EPERM, 1, "bad su %s to %s on %s", username, user, mytty)) errx(1, "Permission denied"); #endif @@ -326,7 +326,7 @@ main(int argc, char *argv[]) pwd = getpwnam(user); if (pwd == NULL) { #ifdef USE_BSM_AUDIT - if (audit_submit(AUE_su, auid, 1, EPERM, + if (audit_submit(AUE_su, auid, EPERM, 1, "unknown subject: %s", user)) errx(1, "Permission denied"); #endif @@ -342,7 +342,7 @@ main(int argc, char *argv[]) aerr = pam_strerror(pamh, retcode); if (aerr == NULL) aerr = "Unknown PAM error"; - if (audit_submit(AUE_su, auid, 1, EPERM, + if (audit_submit(AUE_su, auid, EPERM, 1, "pam_chauthtok: %s", aerr)) errx(1, "Permission denied"); #endif @@ -353,7 +353,7 @@ main(int argc, char *argv[]) } if (retcode != PAM_SUCCESS) { #ifdef USE_BSM_AUDIT - if (audit_submit(AUE_su, auid, 1, EPERM, "pam_acct_mgmt: %s", + if (audit_submit(AUE_su, auid, EPERM, 1, "pam_acct_mgmt: %s", pam_strerror(pamh, retcode))) errx(1, "Permission denied"); #endif @@ -368,7 +368,7 @@ main(int argc, char *argv[]) else { if (ruid != 0) { #ifdef USE_BSM_AUDIT - if (audit_submit(AUE_su, auid, 1, EPERM, + if (audit_submit(AUE_su, auid, EPERM, 1, "only root may use -c")) errx(1, "Permission denied"); #endif From marcel at FreeBSD.org Sat Apr 4 15:01:44 2009 From: marcel at FreeBSD.org (Marcel Moolenaar) Date: Sat Apr 4 15:01:51 2009 Subject: svn commit: r190701 - head/sys/powerpc/booke Message-ID: <200904042201.n34M1hHW082133@svn.freebsd.org> Author: marcel Date: Sat Apr 4 22:01:43 2009 New Revision: 190701 URL: http://svn.freebsd.org/changeset/base/190701 Log: Implement kernel core dump support for Book-E processors. Both raw physical memory dumps and virtual minidumps are supported. The default being minidumps. Obtained from: Juniper Networks Modified: head/sys/powerpc/booke/pmap.c Modified: head/sys/powerpc/booke/pmap.c ============================================================================== --- head/sys/powerpc/booke/pmap.c Sat Apr 4 20:58:18 2009 (r190700) +++ head/sys/powerpc/booke/pmap.c Sat Apr 4 22:01:43 2009 (r190701) @@ -39,7 +39,7 @@ * 0x0000_0000 - 0xafff_ffff : user process * 0xb000_0000 - 0xbfff_ffff : pmap_mapdev()-ed area (PCI/PCIE etc.) * 0xc000_0000 - 0xc0ff_ffff : kernel reserved - * 0xc000_0000 - kernelend : kernel code+data, env, metadata etc. + * 0xc000_0000 - data_end : kernel code+data, env, metadata etc. * 0xc100_0000 - 0xfeef_ffff : KVA * 0xc100_0000 - 0xc100_3fff : reserved for page zero/copy * 0xc100_4000 - 0xc200_3fff : reserved for ptbl bufs @@ -76,6 +76,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -107,8 +108,19 @@ __FBSDID("$FreeBSD$"); #endif extern struct mtx sched_lock; +extern int dumpsys_minidump; + +extern unsigned char _etext[]; +extern unsigned char _end[]; + /* Kernel physical load address. */ extern uint32_t kernload; +vm_offset_t kernstart; +vm_size_t kernsize; + +/* Message buffer and tables. */ +static vm_offset_t data_start; +static vm_size_t data_end; struct mem_region availmem_regions[MEM_REGIONS]; int availmem_regions_sz; @@ -304,6 +316,11 @@ static void mmu_booke_kenter(mmu_t, vm_ static void mmu_booke_kremove(mmu_t, vm_offset_t); static boolean_t mmu_booke_dev_direct_mapped(mmu_t, vm_offset_t, vm_size_t); static boolean_t mmu_booke_page_executable(mmu_t, vm_page_t); +static vm_offset_t mmu_booke_dumpsys_map(mmu_t, struct pmap_md *, + vm_size_t, vm_size_t *); +static void mmu_booke_dumpsys_unmap(mmu_t, struct pmap_md *, + vm_size_t, vm_offset_t); +static struct pmap_md *mmu_booke_scan_md(mmu_t, struct pmap_md *); static mmu_method_t mmu_booke_methods[] = { /* pmap dispatcher interface */ @@ -352,6 +369,11 @@ static mmu_method_t mmu_booke_methods[] MMUMETHOD(mmu_page_executable, mmu_booke_page_executable), MMUMETHOD(mmu_unmapdev, mmu_booke_unmapdev), + /* dumpsys() support */ + MMUMETHOD(mmu_dumpsys_map, mmu_booke_dumpsys_map), + MMUMETHOD(mmu_dumpsys_unmap, mmu_booke_dumpsys_unmap), + MMUMETHOD(mmu_scan_md, mmu_booke_scan_md), + { 0, 0 } }; @@ -884,7 +906,7 @@ pte_find(mmu_t mmu, pmap_t pmap, vm_offs * This is called during e500_init, before the system is really initialized. */ static void -mmu_booke_bootstrap(mmu_t mmu, vm_offset_t kernelstart, vm_offset_t kernelend) +mmu_booke_bootstrap(mmu_t mmu, vm_offset_t start, vm_offset_t kernelend) { vm_offset_t phys_kernelend; struct mem_region *mp, *mp1; @@ -904,47 +926,52 @@ mmu_booke_bootstrap(mmu_t mmu, vm_offset tlb0_get_tlbconf(); /* Align kernel start and end address (kernel image). */ - kernelstart = trunc_page(kernelstart); - kernelend = round_page(kernelend); + kernstart = trunc_page(start); + data_start = round_page(kernelend); + kernsize = data_start - kernstart; + + data_end = data_start; /* Allocate space for the message buffer. */ - msgbufp = (struct msgbuf *)kernelend; - kernelend += MSGBUF_SIZE; + msgbufp = (struct msgbuf *)data_end; + data_end += MSGBUF_SIZE; debugf(" msgbufp at 0x%08x end = 0x%08x\n", (uint32_t)msgbufp, - kernelend); + data_end); - kernelend = round_page(kernelend); + data_end = round_page(data_end); /* Allocate space for ptbl_bufs. */ - ptbl_bufs = (struct ptbl_buf *)kernelend; - kernelend += sizeof(struct ptbl_buf) * PTBL_BUFS; + ptbl_bufs = (struct ptbl_buf *)data_end; + data_end += sizeof(struct ptbl_buf) * PTBL_BUFS; debugf(" ptbl_bufs at 0x%08x end = 0x%08x\n", (uint32_t)ptbl_bufs, - kernelend); + data_end); - kernelend = round_page(kernelend); + data_end = round_page(data_end); /* Allocate PTE tables for kernel KVA. */ - kernel_pdir = kernelend; + kernel_pdir = data_end; kernel_ptbls = (VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS + PDIR_SIZE - 1) / PDIR_SIZE; - kernelend += kernel_ptbls * PTBL_PAGES * PAGE_SIZE; + data_end += kernel_ptbls * PTBL_PAGES * PAGE_SIZE; debugf(" kernel ptbls: %d\n", kernel_ptbls); - debugf(" kernel pdir at 0x%08x end = 0x%08x\n", kernel_pdir, kernelend); + debugf(" kernel pdir at 0x%08x end = 0x%08x\n", kernel_pdir, data_end); - debugf(" kernelend: 0x%08x\n", kernelend); - if (kernelend - kernelstart > 0x1000000) { - kernelend = (kernelend + 0x3fffff) & ~0x3fffff; - tlb1_mapin_region(kernelstart + 0x1000000, - kernload + 0x1000000, kernelend - kernelstart - 0x1000000); + debugf(" data_end: 0x%08x\n", data_end); + if (data_end - kernstart > 0x1000000) { + data_end = (data_end + 0x3fffff) & ~0x3fffff; + tlb1_mapin_region(kernstart + 0x1000000, + kernload + 0x1000000, data_end - kernstart - 0x1000000); } else - kernelend = (kernelend + 0xffffff) & ~0xffffff; + data_end = (data_end + 0xffffff) & ~0xffffff; - debugf(" updated kernelend: 0x%08x\n", kernelend); + debugf(" updated data_end: 0x%08x\n", data_end); + + kernsize += data_end - data_start; /* * Clear the structures - note we can only do it safely after the * possible additional TLB1 translations are in place (above) so that - * all range up to the currently calculated 'kernelend' is covered. + * all range up to the currently calculated 'data_end' is covered. */ memset((void *)ptbl_bufs, 0, sizeof(struct ptbl_buf) * PTBL_SIZE); memset((void *)kernel_pdir, 0, kernel_ptbls * PTBL_PAGES * PAGE_SIZE); @@ -952,7 +979,7 @@ mmu_booke_bootstrap(mmu_t mmu, vm_offset /*******************************************************/ /* Set the start and end of kva. */ /*******************************************************/ - virtual_avail = kernelend; + virtual_avail = round_page(data_end); virtual_end = VM_MAX_KERNEL_ADDRESS; /* Allocate KVA space for page zero/copy operations. */ @@ -980,12 +1007,11 @@ mmu_booke_bootstrap(mmu_t mmu, vm_offset ptbl_buf_pool_vabase, virtual_avail); /* Calculate corresponding physical addresses for the kernel region. */ - phys_kernelend = kernload + (kernelend - kernelstart); + phys_kernelend = kernload + kernsize; debugf("kernel image and allocated data:\n"); debugf(" kernload = 0x%08x\n", kernload); - debugf(" kernelstart = 0x%08x\n", kernelstart); - debugf(" kernelend = 0x%08x\n", kernelend); - debugf(" kernel size = 0x%08x\n", kernelend - kernelstart); + debugf(" kernstart = 0x%08x\n", kernstart); + debugf(" kernsize = 0x%08x\n", kernsize); if (sizeof(phys_avail) / sizeof(phys_avail[0]) < availmem_regions_sz) panic("mmu_booke_bootstrap: phys_avail too small"); @@ -2287,6 +2313,140 @@ mmu_booke_dev_direct_mapped(mmu_t mmu, v return (EFAULT); } +vm_offset_t +mmu_booke_dumpsys_map(mmu_t mmu, struct pmap_md *md, vm_size_t ofs, + vm_size_t *sz) +{ + vm_paddr_t pa, ppa; + vm_offset_t va; + vm_size_t gran; + + /* Raw physical memory dumps don't have a virtual address. */ + if (md->md_vaddr == ~0UL) { + /* We always map a 256MB page at 256M. */ + gran = 256 * 1024 * 1024; + pa = md->md_paddr + ofs; + ppa = pa & ~(gran - 1); + ofs = pa - ppa; + va = gran; + tlb1_set_entry(va, ppa, gran, _TLB_ENTRY_IO); + if (*sz > (gran - ofs)) + *sz = gran - ofs; + return (va + ofs); + } + + /* Minidumps are based on virtual memory addresses. */ + va = md->md_vaddr + ofs; + if (va >= kernstart + kernsize) { + gran = PAGE_SIZE - (va & PAGE_MASK); + if (*sz > gran) + *sz = gran; + } + return (va); +} + +void +mmu_booke_dumpsys_unmap(mmu_t mmu, struct pmap_md *md, vm_size_t ofs, + vm_offset_t va) +{ + + /* Raw physical memory dumps don't have a virtual address. */ + if (md->md_vaddr == ~0UL) { + tlb1_idx--; + tlb1[tlb1_idx].mas1 = 0; + tlb1[tlb1_idx].mas2 = 0; + tlb1[tlb1_idx].mas3 = 0; + tlb1_write_entry(tlb1_idx); + return; + } + + /* Minidumps are based on virtual memory addresses. */ + /* Nothing to do... */ +} + +struct pmap_md * +mmu_booke_scan_md(mmu_t mmu, struct pmap_md *prev) +{ + static struct pmap_md md; + struct bi_mem_region *mr; + pte_t *pte; + vm_offset_t va; + + if (dumpsys_minidump) { + md.md_paddr = ~0UL; /* Minidumps use virtual addresses. */ + if (prev == NULL) { + /* 1st: kernel .data and .bss. */ + md.md_index = 1; + md.md_vaddr = trunc_page((uintptr_t)_etext); + md.md_size = round_page((uintptr_t)_end) - md.md_vaddr; + return (&md); + } + switch (prev->md_index) { + case 1: + /* 2nd: msgbuf and tables (see pmap_bootstrap()). */ + md.md_index = 2; + md.md_vaddr = data_start; + md.md_size = data_end - data_start; + break; + case 2: + /* 3rd: kernel VM. */ + va = prev->md_vaddr + prev->md_size; + /* Find start of next chunk (from va). */ + while (va < virtual_end) { + /* Don't dump the buffer cache. */ + if (va >= kmi.buffer_sva && + va < kmi.buffer_eva) { + va = kmi.buffer_eva; + continue; + } + pte = pte_find(mmu, kernel_pmap, va); + if (pte != NULL && PTE_ISVALID(pte)) + break; + va += PAGE_SIZE; + } + if (va < virtual_end) { + md.md_vaddr = va; + va += PAGE_SIZE; + /* Find last page in chunk. */ + while (va < virtual_end) { + /* Don't run into the buffer cache. */ + if (va == kmi.buffer_sva) + break; + pte = pte_find(mmu, kernel_pmap, va); + if (pte == NULL || !PTE_ISVALID(pte)) + break; + va += PAGE_SIZE; + } + md.md_size = va - md.md_vaddr; + break; + } + md.md_index = 3; + /* FALLTHROUGH */ + default: + return (NULL); + } + } else { /* minidumps */ + mr = bootinfo_mr(); + if (prev == NULL) { + /* first physical chunk. */ + md.md_paddr = mr->mem_base; + md.md_size = mr->mem_size; + md.md_vaddr = ~0UL; + md.md_index = 1; + } else if (md.md_index < bootinfo->bi_mem_reg_no) { + md.md_paddr = mr[md.md_index].mem_base; + md.md_size = mr[md.md_index].mem_size; + md.md_vaddr = ~0UL; + md.md_index++; + } else { + /* There's no next physical chunk. */ + return (NULL); + } + } + + return (&md); +} + /* * Map a set of physical memory pages into the kernel virtual address space. * Return a pointer to where it is mapped. This routine is intended to be used From marcel at FreeBSD.org Sat Apr 4 15:03:20 2009 From: marcel at FreeBSD.org (Marcel Moolenaar) Date: Sat Apr 4 15:03:27 2009 Subject: svn commit: r190702 - head/sys/powerpc/include Message-ID: <200904042203.n34M3JaH082220@svn.freebsd.org> Author: marcel Date: Sat Apr 4 22:03:19 2009 New Revision: 190702 URL: http://svn.freebsd.org/changeset/base/190702 Log: First round of cleanups. There's a lot of NetBSDism in this header. Modified: head/sys/powerpc/include/intr.h Modified: head/sys/powerpc/include/intr.h ============================================================================== --- head/sys/powerpc/include/intr.h Sat Apr 4 22:01:43 2009 (r190701) +++ head/sys/powerpc/include/intr.h Sat Apr 4 22:03:19 2009 (r190702) @@ -63,48 +63,11 @@ #ifndef LOCORE -#if 0 -/* - * Interrupt handler chains. intr_establish() inserts a handler into - * the list. The handler is called with its (single) argument. - */ -struct intrhand { - int (*ih_fun)(void *); - void *ih_arg; - u_long ih_count; - struct intrhand *ih_next; - int ih_level; - int ih_irq; -}; -#endif - -void setsoftclock(void); -void clearsoftclock(void); -void setsoftnet(void); -void clearsoftnet(void); - void do_pending_int(void); -static __inline void softintr(int); - extern u_int cpl, ipending, tickspending; extern int imask[]; -/* Following code should be implemented with lwarx/stwcx to avoid - * the disable/enable. i need to read the manual once more.... */ -static __inline void -softintr(int ipl) -{ - unsigned int msrsave; - - msrsave = mfmsr(); - mtmsr(msrsave & ~PSL_EE); - - ipending |= 1 << ipl; - - mtmsr(msrsave); -} - #define ICU_LEN 64 /* Soft interrupt masks. */ @@ -113,46 +76,6 @@ softintr(int ipl) #define SIR_SERIAL 30 #define SPL_CLOCK 31 -#if 0 - -/* - * Hardware interrupt masks - */ - -#define splbio() splraise(imask[IPL_BIO]) -#define splnet() splraise(imask[IPL_NET]) -#define spltty() splraise(imask[IPL_TTY]) -#define splaudio() splraise(imask[IPL_AUDIO]) -#define splclock() splraise(imask[IPL_CLOCK]) -#define splstatclock() splclock() -#define splserial() splraise(imask[IPL_SERIAL]) - -#define spllpt() spltty() - -/* - * Software interrupt masks - * - * NOTE: splsoftclock() is used by hardclock() to lower the priority from - * clock to softclock before it calls softclock(). - */ -#define spllowersoftclock() spllower(imask[IPL_SOFTCLOCK]) -#define splsoftclock() splraise(imask[IPL_SOFTCLOCK]) -#define splsoftnet() splraise(imask[IPL_SOFTNET]) -#define splsoftserial() splraise(imask[IPL_SOFTSERIAL]) - -/* - * Miscellaneous - */ -#define splimp() splraise(imask[IPL_IMP]) -#define splhigh() splraise(imask[IPL_HIGH]) -#define spl0() spllower(0) - -#endif /* 0 */ - -#define setsoftclock() softintr(SIR_CLOCK) -#define setsoftnet() softintr(SIR_NET) -#define setsoftserial() softintr(SIR_SERIAL) - #define CNT_IRQ0 0 #define CNT_CLOCK 64 #define CNT_SOFTCLOCK 65 From marcel at FreeBSD.org Sat Apr 4 15:05:37 2009 From: marcel at FreeBSD.org (Marcel Moolenaar) Date: Sat Apr 4 15:05:43 2009 Subject: svn commit: r190703 - head/sys/powerpc/include Message-ID: <200904042205.n34M5aob082302@svn.freebsd.org> Author: marcel Date: Sat Apr 4 22:05:36 2009 New Revision: 190703 URL: http://svn.freebsd.org/changeset/base/190703 Log: Add sysarch.h. It's included by drm(4). Added: head/sys/powerpc/include/sysarch.h (contents, props changed) Added: head/sys/powerpc/include/sysarch.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/powerpc/include/sysarch.h Sat Apr 4 22:05:36 2009 (r190703) @@ -0,0 +1,43 @@ +/*- + * Copyright (c) 1993 The Regents of the University of California. + * 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. + * 3. Neither the name of the University 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 REGENTS 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. + * + * $FreeBSD$ + */ + +#ifndef _MACHINE_SYSARCH_H_ +#define _MACHINE_SYSARCH_H_ + +#ifndef _KERNEL +#include + +__BEGIN_DECLS +int sysarch(int, void *); +__END_DECLS +#endif + +#endif /* !_MACHINE_SYSARCH_H_ */ From marcel at FreeBSD.org Sat Apr 4 15:23:04 2009 From: marcel at FreeBSD.org (Marcel Moolenaar) Date: Sat Apr 4 15:23:10 2009 Subject: svn commit: r190704 - head/sys/powerpc/aim Message-ID: <200904042223.n34MN3RG082677@svn.freebsd.org> Author: marcel Date: Sat Apr 4 22:23:03 2009 New Revision: 190704 URL: http://svn.freebsd.org/changeset/base/190704 Log: Perform a dummy stwcx. when we switch contexts. The context being switched out may hold a reservation. The stwcx. will clear the reservation. This is architecturally recommended. The scenario this addresses is as follows: 1. Thread 1 performs a lwarx and as such holds a reservation. 2. Thread 1 gets switched out (before doing the matching stwcx.) and thread 2 is switched in. 3. Thread 2 performs a stwcx. to the same reservation granule. This will succeed because the processor has the reservation even though thread 2 didn't do the lwarx. Note that on some processors the address given the stwcx. is not checked. On these processors the mere condition of having a reservation would cause the stwcx. to succeed, irrespective of whether the addresses are the same. The dummy stwcx. is especially important for those processors. Modified: head/sys/powerpc/aim/swtch.S Modified: head/sys/powerpc/aim/swtch.S ============================================================================== --- head/sys/powerpc/aim/swtch.S Sat Apr 4 22:05:36 2009 (r190703) +++ head/sys/powerpc/aim/swtch.S Sat Apr 4 22:23:03 2009 (r190704) @@ -155,6 +155,12 @@ cpu_switchin: mtsr USER_SR,%r5 isync lwz %r1,PCB_SP(%r3) /* Load the stack pointer */ + /* + * Perform a dummy stwcx. to clear any reservations we may have + * inherited from the previous thread. It doesn't matter if the + * stwcx succeeds or not. pcb_context[0] can be clobbered. + */ + stwcx. %r1, 0, %r3 blr /* From alc at FreeBSD.org Sat Apr 4 16:12:15 2009 From: alc at FreeBSD.org (Alan Cox) Date: Sat Apr 4 16:12:22 2009 Subject: svn commit: r190705 - in head/sys: arm/include i386/include vm Message-ID: <200904042312.n34NCEQF084035@svn.freebsd.org> Author: alc Date: Sat Apr 4 23:12:14 2009 New Revision: 190705 URL: http://svn.freebsd.org/changeset/base/190705 Log: Retire VM_PROT_READ_IS_EXEC. It was intended to be a micro-optimization, but I see no benefit from it today. VM_PROT_READ_IS_EXEC was only intended for use on processors that do not distinguish between read and execute permission. On an mmap(2) or mprotect(2), it automatically added execute permission if the caller specified permissions included read permission. The hope was that this would reduce the number of vm map entries needed to implement an address space because there would be fewer neighboring vm map entries that differed only in the presence or absence of VM_PROT_EXECUTE. (See vm/vm_mmap.c revision 1.56.) Today, I don't see any real applications that benefit from VM_PROT_READ_IS_EXEC. In any case, vm map entries are now organized as a self-adjusting binary search tree instead of an ordered list. So, the need for coalescing vm map entries is not as great as it once was. Modified: head/sys/arm/include/vmparam.h head/sys/i386/include/vmparam.h head/sys/vm/vm_mmap.c Modified: head/sys/arm/include/vmparam.h ============================================================================== --- head/sys/arm/include/vmparam.h Sat Apr 4 22:23:03 2009 (r190704) +++ head/sys/arm/include/vmparam.h Sat Apr 4 23:12:14 2009 (r190705) @@ -141,8 +141,6 @@ #define SGROWSIZ (128*1024) #define MAXSLP 20 -#define VM_PROT_READ_IS_EXEC - #ifdef ARM_USE_SMALL_ALLOC #define UMA_MD_SMALL_ALLOC #endif /* ARM_USE_SMALL_ALLOC */ Modified: head/sys/i386/include/vmparam.h ============================================================================== --- head/sys/i386/include/vmparam.h Sat Apr 4 22:23:03 2009 (r190704) +++ head/sys/i386/include/vmparam.h Sat Apr 4 23:12:14 2009 (r190705) @@ -43,10 +43,6 @@ * Machine dependent constants for 386. */ -#ifndef PAE -#define VM_PROT_READ_IS_EXEC /* if you can read -- then you can exec */ -#endif - /* * Virtual memory related constants, all in bytes */ Modified: head/sys/vm/vm_mmap.c ============================================================================== --- head/sys/vm/vm_mmap.c Sat Apr 4 22:23:03 2009 (r190704) +++ head/sys/vm/vm_mmap.c Sat Apr 4 23:12:14 2009 (r190705) @@ -620,10 +620,6 @@ mprotect(td, uap) addr = (vm_offset_t) uap->addr; size = uap->len; prot = uap->prot & VM_PROT_ALL; -#if defined(VM_PROT_READ_IS_EXEC) - if (prot & VM_PROT_READ) - prot |= VM_PROT_EXECUTE; -#endif pageoff = (addr & PAGE_MASK); addr -= pageoff; @@ -1441,14 +1437,6 @@ vm_mmap(vm_map_t map, vm_offset_t *addr, if (flags & MAP_NOCORE) docow |= MAP_DISABLE_COREDUMP; -#if defined(VM_PROT_READ_IS_EXEC) - if (prot & VM_PROT_READ) - prot |= VM_PROT_EXECUTE; - - if (maxprot & VM_PROT_READ) - maxprot |= VM_PROT_EXECUTE; -#endif - if (flags & MAP_STACK) rv = vm_map_stack(map, *addr, size, prot, maxprot, docow | MAP_STACK_GROWS_DOWN); From imp at FreeBSD.org Sat Apr 4 17:24:52 2009 From: imp at FreeBSD.org (Warner Losh) Date: Sat Apr 4 17:25:04 2009 Subject: svn commit: r190706 - head Message-ID: <200904050024.n350OnlC087191@svn.freebsd.org> Author: imp Date: Sun Apr 5 00:24:49 2009 New Revision: 190706 URL: http://svn.freebsd.org/changeset/base/190706 Log: Revert c190007 at the request of Ruslan. It was not correct because ar had been moved from cross tools to bootstrap tools when bsd ar was introduced. Submitted by: ru@ Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Sat Apr 4 23:12:14 2009 (r190705) +++ head/Makefile.inc1 Sun Apr 5 00:24:49 2009 (r190706) @@ -1017,7 +1017,6 @@ cross-tools: .for _tool in \ gnu/usr.bin/binutils \ gnu/usr.bin/cc \ - usr.bin/ar \ usr.bin/sed \ usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \ ${_btxld} \ From ru at FreeBSD.org Sat Apr 4 17:43:55 2009 From: ru at FreeBSD.org (Ruslan Ermilov) Date: Sat Apr 4 17:44:01 2009 Subject: svn commit: r190706 - head In-Reply-To: <200904050024.n350OnlC087191@svn.freebsd.org> References: <200904050024.n350OnlC087191@svn.freebsd.org> Message-ID: <20090405004333.GA38720@edoofus.dev.vega.ru> On Sun, Apr 05, 2009 at 12:24:49AM +0000, Warner Losh wrote: > Author: imp > Date: Sun Apr 5 00:24:49 2009 > New Revision: 190706 > URL: http://svn.freebsd.org/changeset/base/190706 > > Log: > Revert c190007 at the request of Ruslan. It was not correct because > ar had been moved from cross tools to bootstrap tools when bsd ar was > introduced. > > Submitted by: ru@ > > Modified: > head/Makefile.inc1 > Thanks! -- Ruslan Ermilov ru@FreeBSD.org FreeBSD committer From ru at FreeBSD.org Sat Apr 4 17:52:01 2009 From: ru at FreeBSD.org (Ruslan Ermilov) Date: Sat Apr 4 17:52:07 2009 Subject: svn commit: r190707 - stable/7 Message-ID: <200904050051.n350pxtS088818@svn.freebsd.org> Author: ru Date: Sun Apr 5 00:51:59 2009 New Revision: 190707 URL: http://svn.freebsd.org/changeset/base/190707 Log: MFC: Don't put "install-info" to the list of install-tools if we're installing with -DWITHOUT_INFO. Approved by: re (kib) Modified: stable/7/Makefile.inc1 (contents, props changed) Modified: stable/7/Makefile.inc1 ============================================================================== --- stable/7/Makefile.inc1 Sun Apr 5 00:24:49 2009 (r190706) +++ stable/7/Makefile.inc1 Sun Apr 5 00:51:59 2009 (r190707) @@ -597,10 +597,14 @@ installcheck_UGID: # # Installs everything compiled by a 'buildworld'. # +.if ${MK_INFO} != "no" +_install-info= install-info +.endif + distributeworld installworld: installcheck mkdir -p ${INSTALLTMP} for prog in [ awk cap_mkdb cat chflags chmod chown \ - date echo egrep find grep install-info \ + date echo egrep find grep ${_install-info} \ ln lockf make mkdir mtree mv pwd_mkdb rm sed sh sysctl \ test true uname wc zic; do \ cp `which $$prog` ${INSTALLTMP}; \ From raj at semihalf.com Sun Apr 5 02:00:06 2009 From: raj at semihalf.com (Rafal Jaworowski) Date: Sun Apr 5 02:00:21 2009 Subject: svn commit: r190701 - head/sys/powerpc/booke In-Reply-To: <200904042201.n34M1hHW082133@svn.freebsd.org> References: <200904042201.n34M1hHW082133@svn.freebsd.org> Message-ID: <41033BDC-25ED-41F7-864F-D1F8E9DDD813@semihalf.com> On 2009-04-05, at 00:01, Marcel Moolenaar wrote: > Author: marcel > Date: Sat Apr 4 22:01:43 2009 > New Revision: 190701 > URL: http://svn.freebsd.org/changeset/base/190701 > > Log: > Implement kernel core dump support for Book-E processors. > Both raw physical memory dumps and virtual minidumps are > supported. The default being minidumps. > > Obtained from: Juniper Networks Thanks, Marcel! Great to see this coming. Rafal From raj at semihalf.com Sun Apr 5 02:04:00 2009 From: raj at semihalf.com (Rafal Jaworowski) Date: Sun Apr 5 02:04:07 2009 Subject: svn commit: r190704 - head/sys/powerpc/aim In-Reply-To: <200904042223.n34MN3RG082677@svn.freebsd.org> References: <200904042223.n34MN3RG082677@svn.freebsd.org> Message-ID: <7F1FC303-3EFC-4182-9260-FE35C4BD9909@semihalf.com> On 2009-04-05, at 00:23, Marcel Moolenaar wrote: > Author: marcel > Date: Sat Apr 4 22:23:03 2009 > New Revision: 190704 > URL: http://svn.freebsd.org/changeset/base/190704 > > Log: > Perform a dummy stwcx. when we switch contexts. The context > being switched out may hold a reservation. The stwcx. will > clear the reservation. This is architecturally recommended. > > The scenario this addresses is as follows: > 1. Thread 1 performs a lwarx and as such holds a reservation. > 2. Thread 1 gets switched out (before doing the matching > stwcx.) and thread 2 is switched in. > 3. Thread 2 performs a stwcx. to the same reservation granule. > This will succeed because the processor has the reservation > even though thread 2 didn't do the lwarx. > > Note that on some processors the address given the stwcx. is > not checked. On these processors the mere condition of having > a reservation would cause the stwcx. to succeed, irrespective > of whether the addresses are the same. The dummy stwcx. is > especially important for those processors. Have you seen this false stwcx. actually succeed in some real scenarios on AIM? Were there any tangible [corruption?] effects observed without this fix? We're seeing some hang with the dual E500 under very heavy loads, but only with ULE (or we could only correlate this with ULE so far), but didn't get to really close investigation of this issue yet. I'm wondering if it's something of this sort too. Rafal From dchagin at FreeBSD.org Sun Apr 5 02:27:21 2009 From: dchagin at FreeBSD.org (Dmitry Chagin) Date: Sun Apr 5 02:27:33 2009 Subject: svn commit: r190708 - in head/sys: amd64/amd64 amd64/linux32 arm/arm compat/ia32 i386/i386 i386/linux ia64/ia64 kern mips/mips powerpc/powerpc sparc64/sparc64 sys Message-ID: <200904050927.n359RK4o012300@svn.freebsd.org> Author: dchagin Date: Sun Apr 5 09:27:19 2009 New Revision: 190708 URL: http://svn.freebsd.org/changeset/base/190708 Log: Fix KBI breakage by r190520 which affects older linux.ko binaries: 1) Move the new field (brand_note) to the end of the Brandinfo structure. 2) Add a new flag BI_BRAND_NOTE that indicates that the brand_note pointer is valid. 3) Use the brand_note field if the flag BI_BRAND_NOTE is set and as old modules won't have the flag set, so the new field brand_note would be ignored. Suggested by: jhb Reviewed by: jhb Approved by: kib (mentor) MFC after: 6 days Modified: head/sys/amd64/amd64/elf_machdep.c head/sys/amd64/linux32/linux32_sysvec.c head/sys/arm/arm/elf_machdep.c head/sys/compat/ia32/ia32_sysvec.c head/sys/i386/i386/elf_machdep.c head/sys/i386/linux/linux_sysvec.c head/sys/ia64/ia64/elf_machdep.c head/sys/kern/imgact_elf.c head/sys/mips/mips/elf64_machdep.c head/sys/mips/mips/elf_machdep.c head/sys/powerpc/powerpc/elf_machdep.c head/sys/sparc64/sparc64/elf_machdep.c head/sys/sys/imgact_elf.h Modified: head/sys/amd64/amd64/elf_machdep.c ============================================================================== --- head/sys/amd64/amd64/elf_machdep.c Sun Apr 5 00:51:59 2009 (r190707) +++ head/sys/amd64/amd64/elf_machdep.c Sun Apr 5 09:27:19 2009 (r190708) @@ -85,7 +85,7 @@ static Elf64_Brandinfo freebsd_brand_inf .sysvec = &elf64_freebsd_sysvec, .interp_newpath = NULL, .brand_note = &elf64_freebsd_brandnote, - .flags = BI_CAN_EXEC_DYN + .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE }; SYSINIT(elf64, SI_SUB_EXEC, SI_ORDER_ANY, @@ -101,7 +101,7 @@ static Elf64_Brandinfo freebsd_brand_oin .sysvec = &elf64_freebsd_sysvec, .interp_newpath = NULL, .brand_note = &elf64_freebsd_brandnote, - .flags = BI_CAN_EXEC_DYN + .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE }; SYSINIT(oelf64, SI_SUB_EXEC, SI_ORDER_ANY, Modified: head/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- head/sys/amd64/linux32/linux32_sysvec.c Sun Apr 5 00:51:59 2009 (r190707) +++ head/sys/amd64/linux32/linux32_sysvec.c Sun Apr 5 09:27:19 2009 (r190708) @@ -1072,7 +1072,7 @@ static Elf32_Brandinfo linux_brand = { .sysvec = &elf_linux_sysvec, .interp_newpath = NULL, .brand_note = &linux32_brandnote, - .flags = BI_CAN_EXEC_DYN + .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE }; static Elf32_Brandinfo linux_glibc2brand = { @@ -1084,7 +1084,7 @@ static Elf32_Brandinfo linux_glibc2brand .sysvec = &elf_linux_sysvec, .interp_newpath = NULL, .brand_note = &linux32_brandnote, - .flags = BI_CAN_EXEC_DYN + .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE }; Elf32_Brandinfo *linux_brandlist[] = { Modified: head/sys/arm/arm/elf_machdep.c ============================================================================== --- head/sys/arm/arm/elf_machdep.c Sun Apr 5 00:51:59 2009 (r190707) +++ head/sys/arm/arm/elf_machdep.c Sun Apr 5 09:27:19 2009 (r190708) @@ -85,7 +85,7 @@ static Elf32_Brandinfo freebsd_brand_inf .sysvec = &elf32_freebsd_sysvec, .interp_newpath = NULL, .brand_note = &elf32_freebsd_brandnote, - .flags = BI_CAN_EXEC_DYN + .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE }; SYSINIT(elf32, SI_SUB_EXEC, SI_ORDER_ANY, @@ -101,7 +101,7 @@ static Elf32_Brandinfo freebsd_brand_oin .sysvec = &elf32_freebsd_sysvec, .interp_newpath = NULL, .brand_note = &elf32_freebsd_brandnote, - .flags = BI_CAN_EXEC_DYN + .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE }; SYSINIT(oelf32, SI_SUB_EXEC, SI_ORDER_ANY, Modified: head/sys/compat/ia32/ia32_sysvec.c ============================================================================== --- head/sys/compat/ia32/ia32_sysvec.c Sun Apr 5 00:51:59 2009 (r190707) +++ head/sys/compat/ia32/ia32_sysvec.c Sun Apr 5 09:27:19 2009 (r190708) @@ -149,7 +149,7 @@ static Elf32_Brandinfo ia32_brand_info = .sysvec = &ia32_freebsd_sysvec, .interp_newpath = "/libexec/ld-elf32.so.1", .brand_note = &elf32_freebsd_brandnote, - .flags = BI_CAN_EXEC_DYN + .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE }; SYSINIT(ia32, SI_SUB_EXEC, SI_ORDER_ANY, @@ -165,7 +165,7 @@ static Elf32_Brandinfo ia32_brand_oinfo .sysvec = &ia32_freebsd_sysvec, .interp_newpath = "/libexec/ld-elf32.so.1", .brand_note = &elf32_freebsd_brandnote, - .flags = BI_CAN_EXEC_DYN + .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE }; SYSINIT(oia32, SI_SUB_EXEC, SI_ORDER_ANY, Modified: head/sys/i386/i386/elf_machdep.c ============================================================================== --- head/sys/i386/i386/elf_machdep.c Sun Apr 5 00:51:59 2009 (r190707) +++ head/sys/i386/i386/elf_machdep.c Sun Apr 5 09:27:19 2009 (r190708) @@ -85,7 +85,7 @@ static Elf32_Brandinfo freebsd_brand_inf .sysvec = &elf32_freebsd_sysvec, .interp_newpath = NULL, .brand_note = &elf32_freebsd_brandnote, - .flags = BI_CAN_EXEC_DYN + .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE }; SYSINIT(elf32, SI_SUB_EXEC, SI_ORDER_ANY, @@ -101,7 +101,7 @@ static Elf32_Brandinfo freebsd_brand_oin .sysvec = &elf32_freebsd_sysvec, .interp_newpath = NULL, .brand_note = &elf32_freebsd_brandnote, - .flags = BI_CAN_EXEC_DYN + .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE }; SYSINIT(oelf32, SI_SUB_EXEC, SI_ORDER_ANY, Modified: head/sys/i386/linux/linux_sysvec.c ============================================================================== --- head/sys/i386/linux/linux_sysvec.c Sun Apr 5 00:51:59 2009 (r190707) +++ head/sys/i386/linux/linux_sysvec.c Sun Apr 5 09:27:19 2009 (r190708) @@ -1038,7 +1038,7 @@ static Elf32_Brandinfo linux_brand = { .sysvec = &elf_linux_sysvec, .interp_newpath = NULL, .brand_note = &linux_brandnote, - .flags = BI_CAN_EXEC_DYN + .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE }; static Elf32_Brandinfo linux_glibc2brand = { @@ -1050,7 +1050,7 @@ static Elf32_Brandinfo linux_glibc2brand .sysvec = &elf_linux_sysvec, .interp_newpath = NULL, .brand_note = &linux_brandnote, - .flags = BI_CAN_EXEC_DYN + .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE }; Elf32_Brandinfo *linux_brandlist[] = { Modified: head/sys/ia64/ia64/elf_machdep.c ============================================================================== --- head/sys/ia64/ia64/elf_machdep.c Sun Apr 5 00:51:59 2009 (r190707) +++ head/sys/ia64/ia64/elf_machdep.c Sun Apr 5 09:27:19 2009 (r190708) @@ -93,7 +93,7 @@ static Elf64_Brandinfo freebsd_brand_inf .sysvec = &elf64_freebsd_sysvec, .interp_newpath = NULL, .brand_note = &elf64_freebsd_brandnote, - .flags = BI_CAN_EXEC_DYN + .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE }; SYSINIT(elf64, SI_SUB_EXEC, SI_ORDER_ANY, (sysinit_cfunc_t)elf64_insert_brand_entry, &freebsd_brand_info); @@ -107,7 +107,7 @@ static Elf64_Brandinfo freebsd_brand_oin .sysvec = &elf64_freebsd_sysvec, .interp_newpath = NULL, .brand_note = &elf64_freebsd_brandnote, - .flags = BI_CAN_EXEC_DYN + .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE }; SYSINIT(oelf64, SI_SUB_EXEC, SI_ORDER_ANY, (sysinit_cfunc_t)elf64_insert_brand_entry, &freebsd_brand_oinfo); Modified: head/sys/kern/imgact_elf.c ============================================================================== --- head/sys/kern/imgact_elf.c Sun Apr 5 00:51:59 2009 (r190707) +++ head/sys/kern/imgact_elf.c Sun Apr 5 09:27:19 2009 (r190708) @@ -189,7 +189,7 @@ __elfN(get_brandinfo)(struct image_param for (i = 0; i < MAX_BRANDS; i++) { bi = elf_brand_list[i]; if (bi != NULL && hdr->e_machine == bi->machine && - bi->brand_note != NULL) { + (bi->flags & BI_BRAND_NOTE) != 0) { ret = __elfN(check_note)(imgp, bi->brand_note, osrel); if (ret) return (bi); Modified: head/sys/mips/mips/elf64_machdep.c ============================================================================== --- head/sys/mips/mips/elf64_machdep.c Sun Apr 5 00:51:59 2009 (r190707) +++ head/sys/mips/mips/elf64_machdep.c Sun Apr 5 09:27:19 2009 (r190708) @@ -89,7 +89,7 @@ static Elf64_Brandinfo freebsd_brand_gnu .sysvec = &elf64_freebsd_sysvec, .interp_path = "/libexec/ld-elf.so.1", .brand_note = &elf64_freebsd_brandnote, - .flags = BI_CAN_EXEC_DYN + .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE }; SYSINIT(gnu_mips_elf64, SI_SUB_EXEC, SI_ORDER_ANY, @@ -105,7 +105,7 @@ static Elf64_Brandinfo freebsd_brand_inf .sysvec = &elf64_freebsd_sysvec, .interp_newpath = NULL, .brand_note = &elf64_freebsd_brandnote, - .flags = 0 + .flags = BI_BRAND_NOTE }; SYSINIT(elf64, SI_SUB_EXEC, SI_ORDER_ANY, Modified: head/sys/mips/mips/elf_machdep.c ============================================================================== --- head/sys/mips/mips/elf_machdep.c Sun Apr 5 00:51:59 2009 (r190707) +++ head/sys/mips/mips/elf_machdep.c Sun Apr 5 09:27:19 2009 (r190708) @@ -87,7 +87,7 @@ static Elf32_Brandinfo freebsd_brand_inf .sysvec = &elf32_freebsd_sysvec, .interp_newpath = NULL, .brand_note = &elf32_freebsd_brandnote, - .flags = 0 + .flags = BI_BRAND_NOTE }; SYSINIT(elf32, SI_SUB_EXEC, SI_ORDER_ANY, Modified: head/sys/powerpc/powerpc/elf_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/elf_machdep.c Sun Apr 5 00:51:59 2009 (r190707) +++ head/sys/powerpc/powerpc/elf_machdep.c Sun Apr 5 09:27:19 2009 (r190708) @@ -88,7 +88,7 @@ static Elf32_Brandinfo freebsd_brand_inf .sysvec = &elf32_freebsd_sysvec, .interp_newpath = NULL, .brand_note = &elf32_freebsd_brandnote, - .flags = BI_CAN_EXEC_DYN + .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE }; SYSINIT(elf32, SI_SUB_EXEC, SI_ORDER_ANY, @@ -104,7 +104,7 @@ static Elf32_Brandinfo freebsd_brand_oin .sysvec = &elf32_freebsd_sysvec, .interp_newpath = NULL, .brand_note = &elf32_freebsd_brandnote, - .flags = BI_CAN_EXEC_DYN + .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE }; SYSINIT(oelf32, SI_SUB_EXEC, SI_ORDER_ANY, Modified: head/sys/sparc64/sparc64/elf_machdep.c ============================================================================== --- head/sys/sparc64/sparc64/elf_machdep.c Sun Apr 5 00:51:59 2009 (r190707) +++ head/sys/sparc64/sparc64/elf_machdep.c Sun Apr 5 09:27:19 2009 (r190708) @@ -100,7 +100,7 @@ static Elf64_Brandinfo freebsd_brand_inf .sysvec = &elf64_freebsd_sysvec, .interp_newpath = NULL, .brand_note = &elf64_freebsd_brandnote, - .flags = BI_CAN_EXEC_DYN + .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE }; SYSINIT(elf64, SI_SUB_EXEC, SI_ORDER_ANY, @@ -116,7 +116,7 @@ static Elf64_Brandinfo freebsd_brand_oin .sysvec = &elf64_freebsd_sysvec, .interp_newpath = NULL, .brand_note = &elf64_freebsd_brandnote, - .flags = BI_CAN_EXEC_DYN + .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE }; SYSINIT(oelf64, SI_SUB_EXEC, SI_ORDER_ANY, Modified: head/sys/sys/imgact_elf.h ============================================================================== --- head/sys/sys/imgact_elf.h Sun Apr 5 00:51:59 2009 (r190707) +++ head/sys/sys/imgact_elf.h Sun Apr 5 09:27:19 2009 (r190708) @@ -69,9 +69,10 @@ typedef struct { const char *interp_path; struct sysentvec *sysvec; const char *interp_newpath; - Elf_Brandnote *brand_note; int flags; + Elf_Brandnote *brand_note; #define BI_CAN_EXEC_DYN 0x0001 +#define BI_BRAND_NOTE 0x0002 } __ElfN(Brandinfo); __ElfType(Auxargs); From phk at FreeBSD.org Sun Apr 5 05:42:00 2009 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Sun Apr 5 05:42:06 2009 Subject: svn commit: r190709 - head/sbin/routed Message-ID: <200904051241.n35CfxsA018304@svn.freebsd.org> Author: phk Date: Sun Apr 5 12:41:59 2009 New Revision: 190709 URL: http://svn.freebsd.org/changeset/base/190709 Log: Send multicast on p2p interfaces if they can and are not prohibited from doing so with no_rip_mcast in /etc/gateways. This allows routed(8) to work with the way ports/security/openvpn employs the tun(4) interface. Modified: head/sbin/routed/output.c Modified: head/sbin/routed/output.c ============================================================================== --- head/sbin/routed/output.c Sun Apr 5 09:27:19 2009 (r190708) +++ head/sbin/routed/output.c Sun Apr 5 12:41:59 2009 (r190709) @@ -139,7 +139,8 @@ output(enum output_type type, flags = MSG_DONTROUTE; break; case OUT_MULTICAST: - if (ifp->int_if_flags & IFF_POINTOPOINT) { + if (ifp->int_if_flags & (IFF_POINTOPOINT|IFF_MULTICAST) == + IFF_POINTOPOINT) { msg = "Send pt-to-pt"; } else if (ifp->int_state & IS_DUP) { trace_act("abort multicast output via %s" @@ -859,7 +860,13 @@ rip_bcast(int flash) } else if (ifp->int_if_flags & IFF_POINTOPOINT) { /* point-to-point hardware interface */ dst.sin_addr.s_addr = ifp->int_dstaddr; - type = OUT_UNICAST; + if (vers == RIPv2 && + ifp->int_if_flags & IFF_MULTICAST && + !(ifp->int_state & IS_NO_RIP_MCAST)) { + type = OUT_MULTICAST; + } else { + type = OUT_UNICAST; + } } else if (ifp->int_state & IS_REMOTE) { /* remote interface */ From phk at FreeBSD.org Sun Apr 5 06:48:07 2009 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Sun Apr 5 06:48:13 2009 Subject: svn commit: r190710 - head/sbin/routed Message-ID: <200904051348.n35Dm6O6019595@svn.freebsd.org> Author: phk Date: Sun Apr 5 13:48:06 2009 New Revision: 190710 URL: http://svn.freebsd.org/changeset/base/190710 Log: Remove newlines from string argument of __COPYRIGHT(), it results in assembler warning messages. Modified: head/sbin/routed/main.c Modified: head/sbin/routed/main.c ============================================================================== --- head/sbin/routed/main.c Sun Apr 5 12:41:59 2009 (r190709) +++ head/sbin/routed/main.c Sun Apr 5 13:48:06 2009 (r190710) @@ -38,9 +38,9 @@ #include #include -__COPYRIGHT("@(#) Copyright (c) 1983, 1988, 1993\n" +__COPYRIGHT("@(#) Copyright (c) 1983, 1988, 1993 " "The Regents of the University of California." - " All rights reserved.\n"); + " All rights reserved."); #ifdef __NetBSD__ __RCSID("$NetBSD$"); #include From phk at FreeBSD.org Sun Apr 5 07:01:40 2009 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Sun Apr 5 07:01:52 2009 Subject: svn commit: r190711 - head/sbin/routed Message-ID: <200904051401.n35E1dBC019916@svn.freebsd.org> Author: phk Date: Sun Apr 5 14:01:39 2009 New Revision: 190711 URL: http://svn.freebsd.org/changeset/base/190711 Log: Use to manage the interface list. Modified: head/sbin/routed/defs.h head/sbin/routed/if.c head/sbin/routed/main.c head/sbin/routed/output.c head/sbin/routed/parms.c head/sbin/routed/rdisc.c head/sbin/routed/table.c head/sbin/routed/trace.c Modified: head/sbin/routed/defs.h ============================================================================== --- head/sbin/routed/defs.h Sun Apr 5 13:48:06 2009 (r190710) +++ head/sbin/routed/defs.h Sun Apr 5 14:01:39 2009 (r190711) @@ -80,6 +80,7 @@ #include #include #include +#include #ifdef sgi #define _USER_ROUTE_TREE #include @@ -262,7 +263,7 @@ struct rt_entry { * handles "logical" or "IS_REMOTE" interfaces (remote gateways). */ struct interface { - struct interface *int_next, **int_prev; + LIST_ENTRY(interface) int_list; struct interface *int_ahash, **int_ahash_prev; struct interface *int_bhash, **int_bhash_prev; struct interface *int_rlink, **int_rlink_prev; @@ -353,6 +354,7 @@ struct interface { #define iff_up(f) ((f) & IFF_UP) +LIST_HEAD(ifhead, interface); /* Information for aggregating routes */ #define NUM_AG_SLOTS 32 @@ -483,7 +485,7 @@ extern struct timeval ifinit_timer; /* t extern naddr loopaddr; /* our address on loopback */ extern int tot_interfaces; /* # of remote and local interfaces */ extern int rip_interfaces; /* # of interfaces doing RIP */ -extern struct interface *ifnet; /* all interfaces */ +extern struct ifhead ifnet; /* all interfaces */ extern struct interface *remote_if; /* remote interfaces */ extern int have_ripv1_out; /* have a RIPv1 interface */ extern int have_ripv1_in; Modified: head/sbin/routed/if.c ============================================================================== --- head/sbin/routed/if.c Sun Apr 5 13:48:06 2009 (r190710) +++ head/sbin/routed/if.c Sun Apr 5 14:01:39 2009 (r190711) @@ -41,7 +41,7 @@ __RCSID("$Revision: 2.27 $"); #ident "$Revision: 2.27 $" #endif -struct interface *ifnet; /* all interfaces */ +struct ifhead ifnet = LIST_HEAD_INITIALIZER(ifnet); /* all interfaces */ /* hash table for all interfaces, big enough to tolerate ridiculous * numbers of IP aliases. Crazy numbers of aliases such as 7000 @@ -101,11 +101,7 @@ if_link(struct interface *ifp) { struct interface **hifp; - ifp->int_prev = &ifnet; - ifp->int_next = ifnet; - if (ifnet != 0) - ifnet->int_prev = &ifp->int_next; - ifnet = ifp; + LIST_INSERT_HEAD(&ifnet, ifp, int_list); hifp = AHASH(ifp->int_addr); ifp->int_ahash_prev = hifp; @@ -217,7 +213,7 @@ ifwithindex(u_short ifindex, struct interface *ifp; for (;;) { - for (ifp = ifnet; 0 != ifp; ifp = ifp->int_next) { + LIST_FOREACH(ifp, &ifnet, int_list) { if (ifp->int_index == ifindex) return ifp; } @@ -245,7 +241,7 @@ iflookup(naddr addr) maybe = 0; for (;;) { - for (ifp = ifnet; ifp; ifp = ifp->int_next) { + LIST_FOREACH(ifp, &ifnet, int_list) { if (ifp->int_if_flags & IFF_POINTOPOINT) { /* finished with a match */ if (ifp->int_dstaddr == addr) @@ -322,7 +318,7 @@ ripv1_mask_net(naddr addr, /* in networ * such interface, prefer the interface with the longest * match. */ - for (ifp = ifnet; ifp != 0; ifp = ifp->int_next) { + LIST_FOREACH(ifp, &ifnet, int_list) { if (on_net(addr, ifp->int_std_net, ifp->int_std_mask) && ifp->int_ripv1_mask > mask && ifp->int_ripv1_mask != HOST_MASK) @@ -394,7 +390,7 @@ check_dup(naddr addr, /* IP address, s { struct interface *ifp; - for (ifp = ifnet; 0 != ifp; ifp = ifp->int_next) { + LIST_FOREACH(ifp, &ifnet, int_list) { if (ifp->int_mask != mask) continue; @@ -459,11 +455,7 @@ ifdel(struct interface *ifp) ifp->int_state |= IS_BROKE; - /* unlink the interface - */ - *ifp->int_prev = ifp->int_next; - if (ifp->int_next != 0) - ifp->int_next->int_prev = ifp->int_prev; + LIST_REMOVE(ifp, int_list); *ifp->int_ahash_prev = ifp->int_ahash; if (ifp->int_ahash != 0) ifp->int_ahash->int_ahash_prev = ifp->int_ahash_prev; @@ -484,7 +476,7 @@ ifdel(struct interface *ifp) if (!(ifp->int_state & IS_ALIAS)) { /* delete aliases when the main interface dies */ - for (ifp1 = ifnet; 0 != ifp1; ifp1 = ifp1->int_next) { + LIST_FOREACH(ifp1, &ifnet, int_list) { if (ifp1 != ifp && !strcmp(ifp->int_name, ifp1->int_name)) ifdel(ifp1); @@ -570,7 +562,7 @@ if_bad(struct interface *ifp) trace_if("Chg", ifp); if (!(ifp->int_state & IS_ALIAS)) { - for (ifp1 = ifnet; 0 != ifp1; ifp1 = ifp1->int_next) { + LIST_FOREACH(ifp1, &ifnet, int_list) { if (ifp1 != ifp && !strcmp(ifp->int_name, ifp1->int_name)) if_bad(ifp1); @@ -606,7 +598,7 @@ if_ok(struct interface *ifp, ifp->int_data.ts = 0; if (!(ifp->int_state & IS_ALIAS)) { - for (ifp1 = ifnet; 0 != ifp1; ifp1 = ifp1->int_next) { + LIST_FOREACH(ifp1, &ifnet, int_list) { if (ifp1 != ifp && !strcmp(ifp->int_name, ifp1->int_name)) if_ok(ifp1, type); @@ -687,7 +679,7 @@ ifinit(void) : CHECK_QUIET_INTERVAL); /* mark all interfaces so we can get rid of those that disappear */ - for (ifp = ifnet; 0 != ifp; ifp = ifp->int_next) + LIST_FOREACH(ifp, &ifnet, int_list) ifp->int_state &= ~(IS_CHECKED | IS_DUP); /* Fetch the interface list, without too many system calls @@ -1111,7 +1103,7 @@ ifinit(void) if (!(prev_complaints & COMP_NETMASK) && !(ifp->int_if_flags & IFF_POINTOPOINT) && ifp->int_addr != RIP_DEFAULT) { - for (ifp1 = ifnet; 0 != ifp1; ifp1 = ifp1->int_next) { + LIST_FOREACH(ifp1, &ifnet, int_list) { if (ifp1->int_mask == ifp->int_mask) continue; if (ifp1->int_if_flags & IFF_POINTOPOINT) @@ -1188,9 +1180,7 @@ ifinit(void) } } - for (ifp = ifnet; ifp != 0; ifp = ifp1) { - ifp1 = ifp->int_next; /* because we may delete it */ - + LIST_FOREACH_SAFE(ifp, &ifnet, int_list, ifp1) { /* Forget any interfaces that have disappeared. */ if (!(ifp->int_state & (IS_CHECKED | IS_REMOTE))) { @@ -1213,7 +1203,7 @@ ifinit(void) have_ripv1_in = 1; } - for (ifp = ifnet; ifp != 0; ifp = ifp->int_next) { + LIST_FOREACH(ifp, &ifnet, int_list) { /* Ensure there is always a network route for interfaces, * after any dead interfaces have been deleted, which * might affect routes for point-to-point links. Modified: head/sbin/routed/main.c ============================================================================== --- head/sbin/routed/main.c Sun Apr 5 13:48:06 2009 (r190710) +++ head/sbin/routed/main.c Sun Apr 5 14:01:39 2009 (r190711) @@ -529,7 +529,9 @@ usage: n--; } - for (ifp = ifnet; n > 0 && 0 != ifp; ifp = ifp->int_next) { + LIST_FOREACH(ifp, &ifnet, int_list) { + if (n <= 0) + break; if (ifp->int_rip_sock >= 0 && FD_ISSET(ifp->int_rip_sock, &ibits)) { read_rip(ifp->int_rip_sock, ifp); @@ -578,7 +580,7 @@ fix_select(void) if (sock_max <= rip_sock) sock_max = rip_sock+1; } - for (ifp = ifnet; 0 != ifp; ifp = ifp->int_next) { + LIST_FOREACH(ifp, &ifnet, int_list) { if (ifp->int_rip_sock >= 0) { FD_SET(ifp->int_rip_sock, &fdbits); if (sock_max <= ifp->int_rip_sock) @@ -690,7 +692,7 @@ rip_off(void) /* get non-broadcast sockets to listen to queries. */ - for (ifp = ifnet; ifp != 0; ifp = ifp->int_next) { + LIST_FOREACH(ifp, &ifnet, int_list) { if (ifp->int_state & IS_REMOTE) continue; if (ifp->int_rip_sock < 0) { @@ -761,7 +763,7 @@ rip_on(struct interface *ifp) * since that would let two daemons bind to the broadcast * socket. */ - for (ifp = ifnet; ifp != 0; ifp = ifp->int_next) { + LIST_FOREACH(ifp, &ifnet, int_list) { if (ifp->int_rip_sock >= 0) { (void)close(ifp->int_rip_sock); ifp->int_rip_sock = -1; @@ -776,7 +778,7 @@ rip_on(struct interface *ifp) if (next_bcast.tv_sec < now.tv_sec+MIN_WAITTIME) next_bcast.tv_sec = now.tv_sec+MIN_WAITTIME; - for (ifp = ifnet; ifp != 0; ifp = ifp->int_next) { + LIST_FOREACH(ifp, &ifnet, int_list) { ifp->int_query_time = NEVER; rip_mcast_on(ifp); } Modified: head/sbin/routed/output.c ============================================================================== --- head/sbin/routed/output.c Sun Apr 5 13:48:06 2009 (r190710) +++ head/sbin/routed/output.c Sun Apr 5 14:01:39 2009 (r190711) @@ -833,7 +833,7 @@ rip_bcast(int flash) flash ? "dynamic update" : "all routes", rtime.tv_sec + ((float)rtime.tv_usec)/1000000.0); - for (ifp = ifnet; ifp != 0; ifp = ifp->int_next) { + LIST_FOREACH(ifp, &ifnet, int_list) { /* Skip interfaces not doing RIP. * Do try broken interfaces to see if they have healed. */ @@ -907,7 +907,7 @@ rip_query(void) memset(&buf, 0, sizeof(buf)); - for (ifp = ifnet; ifp; ifp = ifp->int_next) { + LIST_FOREACH(ifp, &ifnet, int_list) { /* Skip interfaces those already queried. * Do not ask via interfaces through which we don't * accept input. Do not ask via interfaces that cannot Modified: head/sbin/routed/parms.c ============================================================================== --- head/sbin/routed/parms.c Sun Apr 5 13:48:06 2009 (r190710) +++ head/sbin/routed/parms.c Sun Apr 5 14:01:39 2009 (r190711) @@ -350,7 +350,7 @@ gwkludge(void) /* After all of the parameter lines have been read, * apply them to any remote interfaces. */ - for (ifp = ifnet; 0 != ifp; ifp = ifp->int_next) { + LIST_FOREACH(ifp, &ifnet, int_list) { get_parms(ifp); tot_interfaces++; Modified: head/sbin/routed/rdisc.c ============================================================================== --- head/sbin/routed/rdisc.c Sun Apr 5 13:48:06 2009 (r190710) +++ head/sbin/routed/rdisc.c Sun Apr 5 14:01:39 2009 (r190711) @@ -278,7 +278,7 @@ set_supplier(void) /* Switch router discovery multicast groups from soliciting * to advertising. */ - for (ifp = ifnet; ifp; ifp = ifp->int_next) { + LIST_FOREACH(ifp, &ifnet, int_list) { if (ifp->int_state & IS_BROKE) continue; ifp->int_rdisc_cnt = 0; @@ -817,7 +817,7 @@ rdisc_adv(void) rdisc_timer.tv_sec = now.tv_sec + NEVER; - for (ifp = ifnet; ifp; ifp = ifp->int_next) { + LIST_FOREACH(ifp, &ifnet, int_list) { if (0 != (ifp->int_state & (IS_NO_ADV_OUT | IS_BROKE))) continue; @@ -859,7 +859,7 @@ rdisc_sol(void) rdisc_timer.tv_sec = now.tv_sec + NEVER; - for (ifp = ifnet; ifp; ifp = ifp->int_next) { + LIST_FOREACH(ifp, &ifnet, int_list) { if (0 != (ifp->int_state & (IS_NO_SOL_OUT | IS_BROKE)) || ifp->int_rdisc_cnt >= MAX_SOLICITATIONS) continue; Modified: head/sbin/routed/table.c ============================================================================== --- head/sbin/routed/table.c Sun Apr 5 13:48:06 2009 (r190710) +++ head/sbin/routed/table.c Sun Apr 5 14:01:39 2009 (r190711) @@ -1918,7 +1918,7 @@ rtbad_sub(struct rt_entry *rt) * If so, see if it is used by any other interfaces, such * as a point-to-point interface with the same local address. */ - for (ifp = ifnet; ifp != 0; ifp = ifp->int_next) { + LIST_FOREACH(ifp, &ifnet, int_list) { /* Retain it if another interface needs it. */ if (ifp->int_addr == rt->rt_ifp->int_addr) { @@ -1935,7 +1935,7 @@ rtbad_sub(struct rt_entry *rt) * interface that justifies it. */ if (rt->rt_state & RS_NET_SYN) { - for (ifp = ifnet; ifp != 0; ifp = ifp->int_next) { + LIST_FOREACH(ifp, &ifnet, int_list) { if ((ifp->int_state & IS_NEED_NET_SYN) && rt->rt_mask == ifp->int_std_mask && rt->rt_dst == ifp->int_std_addr) { @@ -2105,7 +2105,7 @@ age(naddr bad_gate) /* Check for dead IS_REMOTE interfaces by timing their * transmissions. */ - for (ifp = ifnet; ifp; ifp = ifp->int_next) { + LIST_FOREACH(ifp, &ifnet, int_list) { if (!(ifp->int_state & IS_REMOTE)) continue; Modified: head/sbin/routed/trace.c ============================================================================== --- head/sbin/routed/trace.c Sun Apr 5 13:48:06 2009 (r190710) +++ head/sbin/routed/trace.c Sun Apr 5 14:01:39 2009 (r190711) @@ -870,7 +870,7 @@ trace_dump(void) lastlog(); (void)fputs("current daemon state:\n", ftrace); - for (ifp = ifnet; ifp != 0; ifp = ifp->int_next) + LIST_FOREACH(ifp, &ifnet, int_list) trace_if("", ifp); (void)rn_walktree(rhead, walk_trace, 0); } From phk at FreeBSD.org Sun Apr 5 07:15:07 2009 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Sun Apr 5 07:15:18 2009 Subject: svn commit: r190712 - head/sbin/routed Message-ID: <200904051415.n35EF5tq020195@svn.freebsd.org> Author: phk Date: Sun Apr 5 14:15:05 2009 New Revision: 190712 URL: http://svn.freebsd.org/changeset/base/190712 Log: Kick WARNS level up to 6 by fixing various trivial warnings. Modified: head/sbin/routed/Makefile head/sbin/routed/if.c head/sbin/routed/output.c head/sbin/routed/radix.c head/sbin/routed/radix.h head/sbin/routed/table.c Modified: head/sbin/routed/Makefile ============================================================================== --- head/sbin/routed/Makefile Sun Apr 5 14:01:39 2009 (r190711) +++ head/sbin/routed/Makefile Sun Apr 5 14:15:05 2009 (r190712) @@ -7,6 +7,6 @@ MAN= routed.8 SUBDIR= rtquery LDADD= -lmd DPADD= ${LIBMD} -WARNS?= 0 +WARNS?= 6 .include Modified: head/sbin/routed/if.c ============================================================================== --- head/sbin/routed/if.c Sun Apr 5 14:01:39 2009 (r190711) +++ head/sbin/routed/if.c Sun Apr 5 14:15:05 2009 (r190712) @@ -955,7 +955,8 @@ ifinit(void) trace_act("interface %s has been off" " %ld seconds; forget it", ifp->int_name, - now.tv_sec-ifp->int_data.ts); + (long)now.tv_sec- + ifp->int_data.ts); ifdel(ifp); } continue; Modified: head/sbin/routed/output.c ============================================================================== --- head/sbin/routed/output.c Sun Apr 5 14:01:39 2009 (r190711) +++ head/sbin/routed/output.c Sun Apr 5 14:15:05 2009 (r190712) @@ -139,7 +139,7 @@ output(enum output_type type, flags = MSG_DONTROUTE; break; case OUT_MULTICAST: - if (ifp->int_if_flags & (IFF_POINTOPOINT|IFF_MULTICAST) == + if ((ifp->int_if_flags & (IFF_POINTOPOINT|IFF_MULTICAST)) == IFF_POINTOPOINT) { msg = "Send pt-to-pt"; } else if (ifp->int_state & IS_DUP) { Modified: head/sbin/routed/radix.c ============================================================================== --- head/sbin/routed/radix.c Sun Apr 5 14:01:39 2009 (r190711) +++ head/sbin/routed/radix.c Sun Apr 5 14:15:05 2009 (r190712) @@ -846,7 +846,7 @@ rn_walktree(struct radix_node_head *h, } int -rn_inithead(void **head, int off) +rn_inithead(struct radix_node_head **head, int off) { struct radix_node_head *rnh; struct radix_node *t, *tt, *ttt; @@ -887,7 +887,7 @@ rn_init(void) addmask_key = cplim = rn_ones + max_keylen; while (cp < cplim) *cp++ = -1; - if (rn_inithead((void **)&mask_rnhead, 0) == 0) + if (rn_inithead(&mask_rnhead, 0) == 0) panic("rn_init 2"); } Modified: head/sbin/routed/radix.h ============================================================================== --- head/sbin/routed/radix.h Sun Apr 5 14:01:39 2009 (r190711) +++ head/sbin/routed/radix.h Sun Apr 5 14:15:05 2009 (r190712) @@ -138,7 +138,7 @@ struct radix_node_head { #define Free(p) free((void *)p); void rn_init(void); -int rn_inithead(void **, int); +int rn_inithead(struct radix_node_head **head, int off); int rn_refines(void *, void *); int rn_walktree(struct radix_node_head *, int (*)(struct radix_node *, struct walkarg *), Modified: head/sbin/routed/table.c ============================================================================== --- head/sbin/routed/table.c Sun Apr 5 14:01:39 2009 (r190711) +++ head/sbin/routed/table.c Sun Apr 5 14:15:05 2009 (r190712) @@ -1631,7 +1631,7 @@ rtinit(void) /* Initialize the radix trees */ max_keylen = sizeof(struct sockaddr_in); rn_init(); - rn_inithead((void**)&rhead, 32); + rn_inithead(&rhead, 32); /* mark all of the slots in the table free */ ag_avail = ag_slots; @@ -2124,8 +2124,8 @@ age(naddr bad_gate) " %ld:%ld", ifp->int_name, naddr_ntoa(ifp->int_dstaddr), - (now.tv_sec - ifp->int_act_time)/60, - (now.tv_sec - ifp->int_act_time)%60); + (long)(now.tv_sec - ifp->int_act_time)/60, + (long)(now.tv_sec - ifp->int_act_time)%60); if_sick(ifp); } From phk at FreeBSD.org Sun Apr 5 08:06:02 2009 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Sun Apr 5 08:06:10 2009 Subject: svn commit: r190713 - head/sbin/routed Message-ID: <200904051506.n35F62bM021182@svn.freebsd.org> Author: phk Date: Sun Apr 5 15:06:02 2009 New Revision: 190713 URL: http://svn.freebsd.org/changeset/base/190713 Log: Convert list of remote interfaces to LIST_* macros Modified: head/sbin/routed/defs.h head/sbin/routed/if.c head/sbin/routed/input.c Modified: head/sbin/routed/defs.h ============================================================================== --- head/sbin/routed/defs.h Sun Apr 5 14:15:05 2009 (r190712) +++ head/sbin/routed/defs.h Sun Apr 5 15:06:02 2009 (r190713) @@ -264,9 +264,9 @@ struct rt_entry { */ struct interface { LIST_ENTRY(interface) int_list; + LIST_ENTRY(interface) remote_list; struct interface *int_ahash, **int_ahash_prev; struct interface *int_bhash, **int_bhash_prev; - struct interface *int_rlink, **int_rlink_prev; struct interface *int_nhash, **int_nhash_prev; char int_name[IF_NAME_LEN+1]; u_short int_index; @@ -486,7 +486,7 @@ extern naddr loopaddr; /* our address o extern int tot_interfaces; /* # of remote and local interfaces */ extern int rip_interfaces; /* # of interfaces doing RIP */ extern struct ifhead ifnet; /* all interfaces */ -extern struct interface *remote_if; /* remote interfaces */ +extern struct ifhead remote_if; /* remote interfaces */ extern int have_ripv1_out; /* have a RIPv1 interface */ extern int have_ripv1_in; extern int need_flash; /* flash update needed */ Modified: head/sbin/routed/if.c ============================================================================== --- head/sbin/routed/if.c Sun Apr 5 14:15:05 2009 (r190712) +++ head/sbin/routed/if.c Sun Apr 5 15:06:02 2009 (r190713) @@ -42,6 +42,7 @@ __RCSID("$Revision: 2.27 $"); #endif struct ifhead ifnet = LIST_HEAD_INITIALIZER(ifnet); /* all interfaces */ +struct ifhead remote_if = LIST_HEAD_INITIALIZER(ifnet); /* remote interfaces */ /* hash table for all interfaces, big enough to tolerate ridiculous * numbers of IP aliases. Crazy numbers of aliases such as 7000 @@ -56,7 +57,6 @@ struct interface *ahash_tbl[AHASH_LEN]; #define BHASH(a) &bhash_tbl[(a)%BHASH_LEN] struct interface *bhash_tbl[BHASH_LEN]; -struct interface *remote_if; /* remote interfaces */ /* hash for physical interface names. * Assume there are never more 100 or 200 real interfaces, and that @@ -117,13 +117,8 @@ if_link(struct interface *ifp) *hifp = ifp; } - if (ifp->int_state & IS_REMOTE) { - ifp->int_rlink_prev = &remote_if; - ifp->int_rlink = remote_if; - if (remote_if != 0) - remote_if->int_rlink_prev = &ifp->int_rlink; - remote_if = ifp; - } + if (ifp->int_state & IS_REMOTE) + LIST_INSERT_HEAD(&remote_if, ifp, remote_list); hifp = nhash(ifp->int_name); if (ifp->int_state & IS_ALIAS) { @@ -467,11 +462,8 @@ ifdel(struct interface *ifp) if (ifp->int_bhash != 0) ifp->int_bhash->int_bhash_prev = ifp->int_bhash_prev; } - if (ifp->int_state & IS_REMOTE) { - *ifp->int_rlink_prev = ifp->int_rlink; - if (ifp->int_rlink != 0) - ifp->int_rlink->int_rlink_prev = ifp->int_rlink_prev; - } + if (ifp->int_state & IS_REMOTE) + LIST_REMOVE(ifp, remote_list); if (!(ifp->int_state & IS_ALIAS)) { /* delete aliases when the main interface dies Modified: head/sbin/routed/input.c ============================================================================== --- head/sbin/routed/input.c Sun Apr 5 14:15:05 2009 (r190712) +++ head/sbin/routed/input.c Sun Apr 5 15:06:02 2009 (r190713) @@ -96,7 +96,7 @@ read_rip(int sock, cc+sizeof(inbuf.ifname)); /* check the remote interfaces first */ - for (aifp = remote_if; aifp; aifp = aifp->int_rlink) { + LIST_FOREACH(aifp, &remote_if, remote_list) { if (aifp->int_addr == from.sin_addr.s_addr) break; } From piso at FreeBSD.org Sun Apr 5 08:24:28 2009 From: piso at FreeBSD.org (Paolo Pisati) Date: Sun Apr 5 08:24:40 2009 Subject: svn commit: r190714 - head/sbin/ipfw Message-ID: <200904051524.n35FORM8021539@svn.freebsd.org> Author: piso Date: Sun Apr 5 15:24:27 2009 New Revision: 190714 URL: http://svn.freebsd.org/changeset/base/190714 Log: Improve a bit reass documentation: -document fragment handling sysctls -mention some caveats about fragments handling (and to deal with it) Modified: head/sbin/ipfw/ipfw.8 Modified: head/sbin/ipfw/ipfw.8 ============================================================================== --- head/sbin/ipfw/ipfw.8 Sun Apr 5 15:06:02 2009 (r190713) +++ head/sbin/ipfw/ipfw.8 Sun Apr 5 15:24:27 2009 (r190714) @@ -873,6 +873,31 @@ If the packet is the last logical fragme .Va net.inet.ip.fw.one_pass is set to 0, processing continues with the next rule, else packet is allowed to pass and search terminates. If the packet is a fragment in the middle, it is consumed and processing stops immediately. +.Pp +Fragments handling can be tuned via +.Va net.inet.ip.maxfragpackets +and +.Va net.inet.ip.maxfragsperpacket +which limit, respectively, the maximum number of processable fragments (default: 800) and +the maximum number of fragments per packet (default: 16). +.Pp +NOTA BENE: since fragments don't contain port numbers, beware not to use them whe issuing a +.Nm reass +rule. Alternatively, direction-based (like +.Nm in +/ +.Nm out +) and source-based (like +.Nm via +) match patterns can be used to select fragments. +.Pp +Usually a simple rule like: +.Bd -literal -offset indent +# reassemble incoming fragments +ipfw add reass all from any to any in +.Ed +.Pp +is all you need at the beginning of your ruleset. .El .Ss RULE BODY The body of a rule contains zero or more patterns (such as From phk at FreeBSD.org Sun Apr 5 08:55:11 2009 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Sun Apr 5 08:55:17 2009 Subject: svn commit: r190715 - head/sbin/routed Message-ID: <200904051555.n35Ft9aJ022487@svn.freebsd.org> Author: phk Date: Sun Apr 5 15:55:09 2009 New Revision: 190715 URL: http://svn.freebsd.org/changeset/base/190715 Log: Modernize prototypes (ie: no extern) Make lots of stuff static. Modified: head/sbin/routed/defs.h head/sbin/routed/if.c head/sbin/routed/main.c head/sbin/routed/output.c head/sbin/routed/parms.c head/sbin/routed/radix.c head/sbin/routed/radix.h head/sbin/routed/rdisc.c head/sbin/routed/table.c head/sbin/routed/trace.c Modified: head/sbin/routed/defs.h ============================================================================== --- head/sbin/routed/defs.h Sun Apr 5 15:24:27 2009 (r190714) +++ head/sbin/routed/defs.h Sun Apr 5 15:55:09 2009 (r190715) @@ -150,12 +150,10 @@ #define MaxMaxAdvertiseInterval 1800 #define MinMaxAdvertiseInterval 4 #define DefMaxAdvertiseInterval 600 -#define DEF_PreferenceLevel 0 #define MIN_PreferenceLevel 0x80000000 #define MAX_INITIAL_ADVERT_INTERVAL 16 #define MAX_INITIAL_ADVERTS 3 -#define MAX_RESPONSE_DELAY 2 #define MAX_SOLICITATION_DELAY 1 #define SOLICITATION_INTERVAL 3 @@ -392,7 +390,7 @@ struct ag_info { /* parameters for interfaces */ -extern struct parm { +struct parm { struct parm *parm_next; char parm_name[IF_NAME_LEN+1]; naddr parm_net; @@ -405,7 +403,7 @@ extern struct parm { int parm_rdisc_pref; /* signed IRDP preference */ int parm_rdisc_int; /* IRDP advertising interval */ struct auth parm_auth[MAX_AUTH_KEYS]; -} *parms; +}; /* authority for internal networks */ extern struct intnet { @@ -444,24 +442,21 @@ extern struct ws_buf { struct netinfo *base; struct netinfo *lim; enum output_type type; -} v12buf, v2buf; +} v12buf; extern pid_t mypid; extern naddr myaddr; /* main address of this system */ extern int stopint; /* !=0 to stop */ -extern int sock_max; extern int rip_sock; /* RIP socket */ extern struct interface *rip_sock_mcast; /* current multicast interface */ extern int rt_sock; /* routing socket */ extern int rt_sock_seqno; extern int rdisc_sock; /* router-discovery raw socket */ -extern int seqno; /* sequence number for messages */ extern int supplier; /* process should supply updates */ extern int supplier_set; /* -s or -q requested */ -extern int lookforinterfaces; /* 1=probe for new up interfaces */ extern int ridhosts; /* 1=reduce host routes */ extern int mhome; /* 1=want multi-homed host route */ extern int advertise_mhome; /* 1=must continue advertising it */ @@ -474,7 +469,6 @@ extern time_t now_stale; extern time_t now_expire; extern time_t now_garbage; -extern struct timeval next_bcast; /* next general broadcast */ extern struct timeval age_timer; /* next check of old routes */ extern struct timeval no_flash; /* inhibit flash update until then */ extern struct timeval rdisc_timer; /* next advert. or solicitation */ @@ -488,7 +482,6 @@ extern int rip_interfaces; /* # of inte extern struct ifhead ifnet; /* all interfaces */ extern struct ifhead remote_if; /* remote interfaces */ extern int have_ripv1_out; /* have a RIPv1 interface */ -extern int have_ripv1_in; extern int need_flash; /* flash update needed */ extern struct timeval need_kern; /* need to update kernel table */ extern u_int update_seqno; /* a route has changed */ @@ -510,21 +503,21 @@ extern struct radix_node_head *rhead; #define dup2(x,y) BSDdup2(x,y) #endif /* sgi */ -extern void fix_sock(int, const char *); -extern void fix_select(void); -extern void rip_off(void); -extern void rip_on(struct interface *); +void fix_sock(int, const char *); +void fix_select(void); +void rip_off(void); +void rip_on(struct interface *); -extern void bufinit(void); -extern int output(enum output_type, struct sockaddr_in *, +void bufinit(void); +int output(enum output_type, struct sockaddr_in *, struct interface *, struct rip *, int); -extern void clr_ws_buf(struct ws_buf *, struct auth *); -extern void rip_query(void); -extern void rip_bcast(int); -extern void supply(struct sockaddr_in *, struct interface *, +void clr_ws_buf(struct ws_buf *, struct auth *); +void rip_query(void); +void rip_bcast(int); +void supply(struct sockaddr_in *, struct interface *, enum output_type, int, int, int); -extern void msglog(const char *, ...) PATTRIB(1,2); +void msglog(const char *, ...) PATTRIB(1,2); struct msg_limit { time_t reuse; struct msg_sub { @@ -533,118 +526,110 @@ struct msg_limit { # define MSG_SUBJECT_N 8 } subs[MSG_SUBJECT_N]; }; -extern void msglim(struct msg_limit *, naddr, +void msglim(struct msg_limit *, naddr, const char *, ...) PATTRIB(3,4); #define LOGERR(msg) msglog(msg ": %s", strerror(errno)) -extern void logbad(int, const char *, ...) PATTRIB(2,3); +void logbad(int, const char *, ...) PATTRIB(2,3); #define BADERR(dump,msg) logbad(dump,msg ": %s", strerror(errno)) #ifdef DEBUG #define DBGERR(dump,msg) BADERR(dump,msg) #else #define DBGERR(dump,msg) LOGERR(msg) #endif -extern char *naddr_ntoa(naddr); -extern const char *saddr_ntoa(struct sockaddr *); +char *naddr_ntoa(naddr); +const char *saddr_ntoa(struct sockaddr *); -extern void *rtmalloc(size_t, const char *); -extern void timevaladd(struct timeval *, struct timeval *); -extern void intvl_random(struct timeval *, u_long, u_long); -extern int getnet(char *, naddr *, naddr *); -extern int gethost(char *, naddr *); -extern void gwkludge(void); -extern const char *parse_parms(char *, int); -extern const char *check_parms(struct parm *); -extern void get_parms(struct interface *); - -extern void lastlog(void); -extern void trace_close(int); -extern void set_tracefile(const char *, const char *, int); -extern void tracelevel_msg(const char *, int); -extern void trace_off(const char*, ...) PATTRIB(1,2); -extern void set_tracelevel(void); -extern void trace_flush(void); -extern void trace_misc(const char *, ...) PATTRIB(1,2); -extern void trace_act(const char *, ...) PATTRIB(1,2); -extern void trace_pkt(const char *, ...) PATTRIB(1,2); -extern void trace_add_del(const char *, struct rt_entry *); -extern void trace_change(struct rt_entry *, u_int, struct rt_spare *, +void *rtmalloc(size_t, const char *); +void timevaladd(struct timeval *, struct timeval *); +void intvl_random(struct timeval *, u_long, u_long); +int getnet(char *, naddr *, naddr *); +int gethost(char *, naddr *); +void gwkludge(void); +const char *parse_parms(char *, int); +const char *check_parms(struct parm *); +void get_parms(struct interface *); + +void lastlog(void); +void trace_close(int); +void set_tracefile(const char *, const char *, int); +void tracelevel_msg(const char *, int); +void trace_off(const char*, ...) PATTRIB(1,2); +void set_tracelevel(void); +void trace_flush(void); +void trace_misc(const char *, ...) PATTRIB(1,2); +void trace_act(const char *, ...) PATTRIB(1,2); +void trace_pkt(const char *, ...) PATTRIB(1,2); +void trace_add_del(const char *, struct rt_entry *); +void trace_change(struct rt_entry *, u_int, struct rt_spare *, const char *); -extern void trace_if(const char *, struct interface *); -extern void trace_upslot(struct rt_entry *, struct rt_spare *, +void trace_if(const char *, struct interface *); +void trace_upslot(struct rt_entry *, struct rt_spare *, struct rt_spare *); -extern void trace_rip(const char*, const char*, struct sockaddr_in *, +void trace_rip(const char*, const char*, struct sockaddr_in *, struct interface *, struct rip *, int); -extern char *addrname(naddr, naddr, int); -extern char *rtname(naddr, naddr, naddr); +char *addrname(naddr, naddr, int); +char *rtname(naddr, naddr, naddr); -extern void rdisc_age(naddr); -extern void set_rdisc_mg(struct interface *, int); -extern void set_supplier(void); -extern void if_bad_rdisc(struct interface *); -extern void if_ok_rdisc(struct interface *); -extern void read_rip(int, struct interface *); -extern void read_rt(void); -extern void read_d(void); -extern void rdisc_adv(void); -extern void rdisc_sol(void); - -extern void sigalrm(int); -extern void sigterm(int); +void rdisc_age(naddr); +void set_rdisc_mg(struct interface *, int); +void set_supplier(void); +void if_bad_rdisc(struct interface *); +void if_ok_rdisc(struct interface *); +void read_rip(int, struct interface *); +void read_rt(void); +void read_d(void); +void rdisc_adv(void); +void rdisc_sol(void); -extern void sigtrace_on(int); -extern void sigtrace_off(int); +void sigtrace_on(int); +void sigtrace_off(int); -extern void flush_kern(void); -extern void age(naddr); +void flush_kern(void); +void age(naddr); -extern void ag_flush(naddr, naddr, void (*)(struct ag_info *)); -extern void ag_check(naddr, naddr, naddr, naddr, char, char, u_int, +void ag_flush(naddr, naddr, void (*)(struct ag_info *)); +void ag_check(naddr, naddr, naddr, naddr, char, char, u_int, u_short, u_short, void (*)(struct ag_info *)); -extern void del_static(naddr, naddr, naddr, int); -extern void del_redirects(naddr, time_t); -extern struct rt_entry *rtget(naddr, naddr); -extern struct rt_entry *rtfind(naddr); -extern void rtinit(void); -extern void rtadd(naddr, naddr, u_int, struct rt_spare *); -extern void rtchange(struct rt_entry *, u_int, struct rt_spare *, char *); -extern void rtdelete(struct rt_entry *); -extern void rts_delete(struct rt_entry *, struct rt_spare *); -extern void rtbad_sub(struct rt_entry *); -extern void rtswitch(struct rt_entry *, struct rt_spare *); -extern void rtbad(struct rt_entry *); +void del_static(naddr, naddr, naddr, int); +void del_redirects(naddr, time_t); +struct rt_entry *rtget(naddr, naddr); +struct rt_entry *rtfind(naddr); +void rtinit(void); +void rtadd(naddr, naddr, u_int, struct rt_spare *); +void rtchange(struct rt_entry *, u_int, struct rt_spare *, char *); +void rtdelete(struct rt_entry *); +void rts_delete(struct rt_entry *, struct rt_spare *); +void rtbad_sub(struct rt_entry *); +void rtswitch(struct rt_entry *, struct rt_spare *); #define S_ADDR(x) (((struct sockaddr_in *)(x))->sin_addr.s_addr) #define INFO_DST(I) ((I)->rti_info[RTAX_DST]) #define INFO_GATE(I) ((I)->rti_info[RTAX_GATEWAY]) #define INFO_MASK(I) ((I)->rti_info[RTAX_NETMASK]) #define INFO_IFA(I) ((I)->rti_info[RTAX_IFA]) -#define INFO_IFP(I) ((I)->rti_info[RTAX_IFP]) #define INFO_AUTHOR(I) ((I)->rti_info[RTAX_AUTHOR]) #define INFO_BRD(I) ((I)->rti_info[RTAX_BRD]) void rt_xaddrs(struct rt_addrinfo *, struct sockaddr *, struct sockaddr *, int); -extern naddr std_mask(naddr); -extern naddr ripv1_mask_net(naddr, struct interface *); -extern naddr ripv1_mask_host(naddr,struct interface *); +naddr std_mask(naddr); +naddr ripv1_mask_net(naddr, struct interface *); +naddr ripv1_mask_host(naddr,struct interface *); #define on_net(a,net,mask) (((ntohl(a) ^ (net)) & (mask)) == 0) -extern int check_dst(naddr); -extern struct interface *check_dup(naddr, naddr, naddr, int); -extern int check_remote(struct interface *); -extern int addrouteforif(struct interface *); -extern void ifinit(void); -extern int walk_bad(struct radix_node *, struct walkarg *); -extern int if_ok(struct interface *, const char *); -extern void if_sick(struct interface *); -extern void if_bad(struct interface *); -extern void if_link(struct interface *); -extern struct interface *ifwithaddr(naddr, int, int); -extern struct interface *ifwithname(char *, naddr); -extern struct interface *ifwithindex(u_short, int); -extern struct interface *iflookup(naddr); +int check_dst(naddr); +struct interface *check_dup(naddr, naddr, naddr, int); +int check_remote(struct interface *); +void ifinit(void); +int walk_bad(struct radix_node *, struct walkarg *); +int if_ok(struct interface *, const char *); +void if_sick(struct interface *); +void if_link(struct interface *); +struct interface *ifwithaddr(naddr addr, int bcast, int remote); +struct interface *ifwithindex(u_short, int); +struct interface *iflookup(naddr); -extern struct auth *find_auth(struct interface *); -extern void end_md5_auth(struct ws_buf *, struct auth *); +struct auth *find_auth(struct interface *); +void end_md5_auth(struct ws_buf *, struct auth *); #if defined(__FreeBSD__) || defined(__NetBSD__) #include @@ -655,7 +640,7 @@ typedef struct { u_int32_t count[2]; /* # of bits, modulo 2^64 (LSB 1st) */ unsigned char buffer[64]; /* input buffer */ } MD5_CTX; -extern void MD5Init(MD5_CTX*); -extern void MD5Update(MD5_CTX*, u_char*, u_int); -extern void MD5Final(u_char[MD5_DIGEST_LEN], MD5_CTX*); +void MD5Init(MD5_CTX*); +void MD5Update(MD5_CTX*, u_char*, u_int); +void MD5Final(u_char[MD5_DIGEST_LEN], MD5_CTX*); #endif Modified: head/sbin/routed/if.c ============================================================================== --- head/sbin/routed/if.c Sun Apr 5 15:24:27 2009 (r190714) +++ head/sbin/routed/if.c Sun Apr 5 15:55:09 2009 (r190715) @@ -51,11 +51,11 @@ struct ifhead remote_if = LIST_HEAD_INIT */ #define AHASH_LEN 211 /* must be prime */ #define AHASH(a) &ahash_tbl[(a)%AHASH_LEN] -struct interface *ahash_tbl[AHASH_LEN]; +static struct interface *ahash_tbl[AHASH_LEN]; #define BHASH_LEN 211 /* must be prime */ #define BHASH(a) &bhash_tbl[(a)%BHASH_LEN] -struct interface *bhash_tbl[BHASH_LEN]; +static struct interface *bhash_tbl[BHASH_LEN]; /* hash for physical interface names. @@ -63,13 +63,13 @@ struct interface *bhash_tbl[BHASH_LEN]; * aliases are put on the end of the hash chains. */ #define NHASH_LEN 97 -struct interface *nhash_tbl[NHASH_LEN]; +static struct interface *nhash_tbl[NHASH_LEN]; int tot_interfaces; /* # of remote and local interfaces */ int rip_interfaces; /* # of interfaces doing RIP */ -int foundloopback; /* valid flag for loopaddr */ +static int foundloopback; /* valid flag for loopaddr */ naddr loopaddr; /* our address on loopback */ -struct rt_spare loop_rts; +static struct rt_spare loop_rts; struct timeval ifinit_timer; static struct timeval last_ifinit; @@ -78,9 +78,12 @@ static struct timeval last_ifinit; && timercmp(&ifinit_timer, &now, >)) int have_ripv1_out; /* have a RIPv1 interface */ -int have_ripv1_in; +static int have_ripv1_in; +static void if_bad(struct interface *); +static int addrouteforif(struct interface *); + static struct interface** nhash(char *p) { @@ -173,7 +176,7 @@ ifwithaddr(naddr addr, /* find the interface with a name */ -struct interface * +static struct interface * ifwithname(char *name, /* "ec0" or whatever */ naddr addr) /* 0 or network address */ { @@ -535,7 +538,7 @@ if_sick(struct interface *ifp) /* Mark an interface dead. */ -void +static void if_bad(struct interface *ifp) { struct interface *ifp1; @@ -1309,7 +1312,7 @@ check_net_syn(struct interface *ifp) * Create route to other end if a point-to-point link, * otherwise a route to this (sub)network. */ -int /* 0=bad interface */ +static int /* 0=bad interface */ addrouteforif(struct interface *ifp) { struct rt_entry *rt; Modified: head/sbin/routed/main.c ============================================================================== --- head/sbin/routed/main.c Sun Apr 5 15:24:27 2009 (r190714) +++ head/sbin/routed/main.c Sun Apr 5 15:55:09 2009 (r190715) @@ -54,38 +54,39 @@ __RCSID("$Revision: 2.31 $"); pid_t mypid; naddr myaddr; /* system address */ -char myname[MAXHOSTNAMELEN+1]; +static char myname[MAXHOSTNAMELEN+1]; -int verbose; +static int verbose; int supplier; /* supply or broadcast updates */ int supplier_set; -int ipforwarding = 1; /* kernel forwarding on */ +static int ipforwarding = 1; /* kernel forwarding on */ -int default_gateway; /* 1=advertise default */ -int background = 1; +static int default_gateway; /* 1=advertise default */ +static int background = 1; int ridhosts; /* 1=reduce host routes */ int mhome; /* 1=want multi-homed host route */ int advertise_mhome; /* 1=must continue advertising it */ int auth_ok = 1; /* 1=ignore auth if we do not care */ struct timeval epoch; /* when started */ -struct timeval clk, prev_clk; +struct timeval clk; +static struct timeval prev_clk; static int usec_fudge; struct timeval now; /* current idea of time */ time_t now_stale; time_t now_expire; time_t now_garbage; -struct timeval next_bcast; /* next general broadcast */ +static struct timeval next_bcast; /* next general broadcast */ struct timeval no_flash = { /* inhibit flash update */ EPOCH+SUPPLY_INTERVAL, 0 }; -struct timeval flush_kern_timer; +static struct timeval flush_kern_timer; -fd_set fdbits; -int sock_max; +static fd_set fdbits; +static int sock_max; int rip_sock = -1; /* RIP socket */ struct interface *rip_sock_mcast; /* current multicast interface */ int rt_sock; /* routing socket */ @@ -94,6 +95,8 @@ int rt_sock_seqno; static int get_rip_sock(naddr, int); static void timevalsub(struct timeval *, struct timeval *, struct timeval *); +static void sigalrm(int s UNUSED); +static void sigterm(int sig); int main(int argc, @@ -543,7 +546,7 @@ usage: /* ARGSUSED */ -void +static void sigalrm(int s UNUSED) { /* Historically, SIGALRM would cause the daemon to check for @@ -555,7 +558,7 @@ sigalrm(int s UNUSED) /* watch for fatal signals */ -void +static void sigterm(int sig) { stopint = sig; Modified: head/sbin/routed/output.c ============================================================================== --- head/sbin/routed/output.c Sun Apr 5 15:24:27 2009 (r190714) +++ head/sbin/routed/output.c Sun Apr 5 15:55:09 2009 (r190715) @@ -46,7 +46,7 @@ u_int update_seqno; /* walk the tree of routes with this for output */ -struct { +static struct { struct sockaddr_in to; naddr to_mask; naddr to_net; @@ -69,11 +69,11 @@ struct { /* A buffer for what can be heard by both RIPv1 and RIPv2 listeners */ struct ws_buf v12buf; -union pkt_buf ripv12_buf; +static union pkt_buf ripv12_buf; /* Another for only RIPv2 listeners */ -struct ws_buf v2buf; -union pkt_buf rip_v2_buf; +static struct ws_buf v2buf; +static union pkt_buf rip_v2_buf; Modified: head/sbin/routed/parms.c ============================================================================== --- head/sbin/routed/parms.c Sun Apr 5 15:24:27 2009 (r190714) +++ head/sbin/routed/parms.c Sun Apr 5 15:55:09 2009 (r190715) @@ -43,7 +43,7 @@ __RCSID("$Revision: 2.26 $"); #endif -struct parm *parms; +static struct parm *parms; struct intnet *intnets; struct r1net *r1nets; struct tgate *tgates; Modified: head/sbin/routed/radix.c ============================================================================== --- head/sbin/routed/radix.c Sun Apr 5 15:24:27 2009 (r190714) +++ head/sbin/routed/radix.c Sun Apr 5 15:55:09 2009 (r190715) @@ -51,10 +51,11 @@ __RCSID("$Revision: 2.23 $"); #define min(a,b) (((a)<(b))?(a):(b)) int max_keylen; -struct radix_mask *rn_mkfreelist; -struct radix_node_head *mask_rnhead; +static struct radix_mask *rn_mkfreelist; +static struct radix_node_head *mask_rnhead; static char *addmask_key; -static char normal_chars[] = {0, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, -1}; +static uint8_t normal_chars[] = + { 0, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff}; static char *rn_zeros, *rn_ones; #define rn_masktop (mask_rnhead->rnh_treetop) @@ -63,6 +64,10 @@ static char *rn_zeros, *rn_ones; : memcmp((caddr_t)(a), (caddr_t)(b), (size_t)l)) static int rn_satisfies_leaf(char *, struct radix_node *, int); +static struct radix_node *rn_addmask(void *n_arg, int search, int skip); +static struct radix_node *rn_addroute(void *v_arg, void *n_arg, + struct radix_node_head *head, struct radix_node treenodes[2]); +static struct radix_node *rn_match(void *v_arg, struct radix_node_head *head); /* * The data structure for the keys is a radix tree with one way @@ -98,7 +103,7 @@ static int rn_satisfies_leaf(char *, str * that governs a subtree. */ -struct radix_node * +static struct radix_node * rn_search(void *v_arg, struct radix_node *head) { @@ -114,7 +119,7 @@ rn_search(void *v_arg, return (x); } -struct radix_node * +static struct radix_node * rn_search_m(void *v_arg, struct radix_node *head, void *m_arg) @@ -132,7 +137,7 @@ rn_search_m(void *v_arg, return x; } -int +static int rn_refines(void* m_arg, void *n_arg) { caddr_t m = m_arg, n = n_arg; @@ -158,7 +163,7 @@ rn_refines(void* m_arg, void *n_arg) return (!masks_are_equal); } -struct radix_node * +static struct radix_node * rn_lookup(void *v_arg, void *m_arg, struct radix_node_head *head) { struct radix_node *x; @@ -197,7 +202,7 @@ rn_satisfies_leaf(char *trial, return 1; } -struct radix_node * +static struct radix_node * rn_match(void *v_arg, struct radix_node_head *head) { @@ -321,7 +326,7 @@ int rn_saveinfo; int rn_debug = 1; #endif -struct radix_node * +static struct radix_node * rn_newpair(void *v, int b, struct radix_node nodes[2]) { struct radix_node *tt = nodes, *t = tt + 1; @@ -336,7 +341,7 @@ rn_newpair(void *v, int b, struct radix_ return t; } -struct radix_node * +static struct radix_node * rn_insert(void* v_arg, struct radix_node_head *head, int *dupentry, @@ -404,7 +409,7 @@ on1: return (tt); } -struct radix_node * +static struct radix_node * rn_addmask(void *n_arg, int search, int skip) { caddr_t netmask = (caddr_t)n_arg; @@ -512,7 +517,7 @@ rn_new_radix_mask(struct radix_node *tt, return m; } -struct radix_node * +static struct radix_node * rn_addroute(void *v_arg, void *n_arg, struct radix_node_head *head, @@ -655,7 +660,7 @@ on2: return tt; } -struct radix_node * +static struct radix_node * rn_delete(void *v_arg, void *netmask_arg, struct radix_node_head *head) Modified: head/sbin/routed/radix.h ============================================================================== --- head/sbin/routed/radix.h Sun Apr 5 15:24:27 2009 (r190714) +++ head/sbin/routed/radix.h Sun Apr 5 15:55:09 2009 (r190715) @@ -80,7 +80,7 @@ struct radix_node { * Annotations to tree concerning potential routes applying to subtrees. */ -extern struct radix_mask { +struct radix_mask { short rm_b; /* bit offset; -1-index(netmask) */ char rm_unused; /* cf. rn_bmask */ u_char rm_flags; /* cf. rn_flags */ @@ -90,7 +90,7 @@ extern struct radix_mask { struct radix_node *rmu_leaf; /* for normal routes */ } rm_rmu; int rm_refs; /* # of references to this struct */ -} *rn_mkfreelist; +}; #define rm_mask rm_rmu.rmu_mask #define rm_leaf rm_rmu.rmu_leaf /* extra field would make 32 bytes */ @@ -139,23 +139,8 @@ struct radix_node_head { void rn_init(void); int rn_inithead(struct radix_node_head **head, int off); -int rn_refines(void *, void *); int rn_walktree(struct radix_node_head *, int (*)(struct radix_node *, struct walkarg *), struct walkarg *); -struct radix_node - *rn_addmask(void *, int, int), - *rn_addroute(void *, void *, struct radix_node_head *, - struct radix_node [2]), - *rn_delete(void *, void *, struct radix_node_head *), - *rn_insert(void *, struct radix_node_head *, int *, - struct radix_node [2]), - *rn_match(void *, struct radix_node_head *), - *rn_newpair(void *, int, struct radix_node[2]), - *rn_search(void *, struct radix_node *), - *rn_search_m(void *, struct radix_node *, void *); - -struct radix_node *rn_lookup(void *, void *, struct radix_node_head *); - #endif /* __RADIX_H_ */ Modified: head/sbin/routed/rdisc.c ============================================================================== --- head/sbin/routed/rdisc.c Sun Apr 5 15:24:27 2009 (r190714) +++ head/sbin/routed/rdisc.c Sun Apr 5 15:55:09 2009 (r190715) @@ -73,14 +73,14 @@ union ad_u { int rdisc_sock = -1; /* router-discovery raw socket */ -struct interface *rdisc_sock_mcast; /* current multicast interface */ +static struct interface *rdisc_sock_mcast; /* current multicast interface */ struct timeval rdisc_timer; int rdisc_ok; /* using solicited route */ #define MAX_ADS 16 /* at least one per interface */ -struct dr { /* accumulated advertisements */ +static struct dr { /* accumulated advertisements */ struct interface *dr_ifp; naddr dr_gate; /* gateway */ time_t dr_ts; /* when received */ Modified: head/sbin/routed/table.c ============================================================================== --- head/sbin/routed/table.c Sun Apr 5 15:24:27 2009 (r190714) +++ head/sbin/routed/table.c Sun Apr 5 15:55:09 2009 (r190715) @@ -48,6 +48,7 @@ static void masktrim(struct sockaddr_in #else static void masktrim(struct sockaddr_in_new *ap); #endif +static void rtbad(struct rt_entry *); struct radix_node_head *rhead; /* root of the radix tree */ @@ -66,7 +67,7 @@ int stopint; int total_routes; /* zap any old routes through this gateway */ -naddr age_bad_gate; +static naddr age_bad_gate; /* It is desirable to "aggregate" routes, to combine differing routes of @@ -93,7 +94,7 @@ naddr age_bad_gate; * sorted first by address, with the smallest address first. */ -struct ag_info ag_slots[NUM_AG_SLOTS], *ag_avail, *ag_corsest, *ag_finest; +static struct ag_info ag_slots[NUM_AG_SLOTS], *ag_avail, *ag_corsest, *ag_finest; /* #define DEBUG_AG */ #ifdef DEBUG_AG @@ -611,7 +612,7 @@ ag_check(naddr dst, static const char * rtm_type_name(u_char type) { - static const char *rtm_types[] = { + static const char * const rtm_types[] = { "RTM_ADD", "RTM_DELETE", "RTM_CHANGE", @@ -1886,7 +1887,7 @@ rts_delete(struct rt_entry *rt, /* Get rid of a bad route, and try to switch to a replacement. */ -void +static void rtbad(struct rt_entry *rt) { struct rt_spare new; Modified: head/sbin/routed/trace.c ============================================================================== --- head/sbin/routed/trace.c Sun Apr 5 15:24:27 2009 (r190714) +++ head/sbin/routed/trace.c Sun Apr 5 15:55:09 2009 (r190715) @@ -58,7 +58,7 @@ FILE *ftrace; /* output trace file */ static const char *sigtrace_pat = "%s"; static char savetracename[PATH_MAX]; char inittracename[PATH_MAX]; -int file_trace; /* 1=tracing to file, not stdout */ +static int file_trace; /* 1=tracing to file, not stdout */ static void trace_dump(void); static void tmsg(const char *, ...) PATTRIB(1,2); From phk at FreeBSD.org Sun Apr 5 09:01:57 2009 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Sun Apr 5 09:02:08 2009 Subject: svn commit: r190716 - head/sbin/routed Message-ID: <200904051601.n35G1uME022999@svn.freebsd.org> Author: phk Date: Sun Apr 5 16:01:56 2009 New Revision: 190716 URL: http://svn.freebsd.org/changeset/base/190716 Log: Some constifications Modified: head/sbin/routed/defs.h head/sbin/routed/main.c head/sbin/routed/rdisc.c Modified: head/sbin/routed/defs.h ============================================================================== --- head/sbin/routed/defs.h Sun Apr 5 15:55:09 2009 (r190715) +++ head/sbin/routed/defs.h Sun Apr 5 16:01:56 2009 (r190716) @@ -450,7 +450,7 @@ extern naddr myaddr; /* main address o extern int stopint; /* !=0 to stop */ extern int rip_sock; /* RIP socket */ -extern struct interface *rip_sock_mcast; /* current multicast interface */ +extern const struct interface *rip_sock_mcast; /* current multicast interface */ extern int rt_sock; /* routing socket */ extern int rt_sock_seqno; extern int rdisc_sock; /* router-discovery raw socket */ Modified: head/sbin/routed/main.c ============================================================================== --- head/sbin/routed/main.c Sun Apr 5 15:55:09 2009 (r190715) +++ head/sbin/routed/main.c Sun Apr 5 16:01:56 2009 (r190716) @@ -88,7 +88,7 @@ static struct timeval flush_kern_timer; static fd_set fdbits; static int sock_max; int rip_sock = -1; /* RIP socket */ -struct interface *rip_sock_mcast; /* current multicast interface */ +const struct interface *rip_sock_mcast; /* current multicast interface */ int rt_sock; /* routing socket */ int rt_sock_seqno; Modified: head/sbin/routed/rdisc.c ============================================================================== --- head/sbin/routed/rdisc.c Sun Apr 5 15:55:09 2009 (r190715) +++ head/sbin/routed/rdisc.c Sun Apr 5 16:01:56 2009 (r190716) @@ -73,21 +73,23 @@ union ad_u { int rdisc_sock = -1; /* router-discovery raw socket */ -static struct interface *rdisc_sock_mcast; /* current multicast interface */ +static const struct interface *rdisc_sock_mcast; /* current multicast interface */ struct timeval rdisc_timer; int rdisc_ok; /* using solicited route */ #define MAX_ADS 16 /* at least one per interface */ -static struct dr { /* accumulated advertisements */ +struct dr { /* accumulated advertisements */ struct interface *dr_ifp; naddr dr_gate; /* gateway */ time_t dr_ts; /* when received */ time_t dr_life; /* lifetime in host byte order */ n_long dr_recv_pref; /* received but biased preference */ n_long dr_pref; /* preference adjusted by metric */ -} *cur_drp, drs[MAX_ADS]; +}; +static const struct dr *cur_drp; +static struct dr drs[MAX_ADS]; /* convert between signed, balanced around zero, * and unsigned zero-based preferences */ From phk at FreeBSD.org Sun Apr 5 10:12:14 2009 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Sun Apr 5 10:12:26 2009 Subject: svn commit: r190717 - head/sbin/routed Message-ID: <200904051712.n35HCD44025927@svn.freebsd.org> Author: phk Date: Sun Apr 5 17:12:13 2009 New Revision: 190717 URL: http://svn.freebsd.org/changeset/base/190717 Log: Fix casts which are not by definition safe, but which malloc(3) makes safe for us. Modified: head/sbin/routed/if.c Modified: head/sbin/routed/if.c ============================================================================== --- head/sbin/routed/if.c Sun Apr 5 16:01:56 2009 (r190716) +++ head/sbin/routed/if.c Sun Apr 5 17:12:13 2009 (r190717) @@ -640,7 +640,7 @@ rt_xaddrs(struct rt_addrinfo *info, void ifinit(void) { - static char *sysctl_buf; + static struct ifa_msghdr *sysctl_buf; static size_t sysctl_buf_size = 0; uint complaints = 0; static u_int prev_complaints = 0; @@ -659,7 +659,8 @@ ifinit(void) size_t needed; int mib[6]; struct if_msghdr *ifm; - struct ifa_msghdr *ifam, *ifam_lim, *ifam2; + void *ifam_lim; + struct ifa_msghdr *ifam, *ifam2; int in, ierr, out, oerr; struct intnet *intnetp; struct rt_addrinfo info; @@ -702,10 +703,9 @@ ifinit(void) "ifinit sysctl"); } - ifam_lim = (struct ifa_msghdr *)(sysctl_buf + needed); - for (ifam = (struct ifa_msghdr *)sysctl_buf; - ifam < ifam_lim; - ifam = ifam2) { + /* XXX: thanks to malloc(3), alignment can be presumed OK */ + ifam_lim = (char *)sysctl_buf + needed; + for (ifam = sysctl_buf; (void *)ifam < ifam_lim; ifam = ifam2) { ifam2 = (struct ifa_msghdr*)((char*)ifam + ifam->ifam_msglen); From phk at FreeBSD.org Sun Apr 5 10:33:09 2009 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Sun Apr 5 10:33:21 2009 Subject: svn commit: r190718 - head/sbin/routed Message-ID: <200904051733.n35HX7bE026332@svn.freebsd.org> Author: phk Date: Sun Apr 5 17:33:07 2009 New Revision: 190718 URL: http://svn.freebsd.org/changeset/base/190718 Log: Add some consts, remove some unused stuff and other attempts to calm FlexeLint down. Modified: head/sbin/routed/defs.h head/sbin/routed/input.c head/sbin/routed/output.c head/sbin/routed/parms.c head/sbin/routed/radix.c head/sbin/routed/radix.h head/sbin/routed/rdisc.c head/sbin/routed/table.c head/sbin/routed/trace.c Modified: head/sbin/routed/defs.h ============================================================================== --- head/sbin/routed/defs.h Sun Apr 5 17:12:13 2009 (r190717) +++ head/sbin/routed/defs.h Sun Apr 5 17:33:07 2009 (r190718) @@ -60,6 +60,7 @@ * years have been simplified and integrated. */ +#include #include #include #include Modified: head/sbin/routed/input.c ============================================================================== --- head/sbin/routed/input.c Sun Apr 5 17:12:13 2009 (r190717) +++ head/sbin/routed/input.c Sun Apr 5 17:33:07 2009 (r190718) @@ -931,7 +931,7 @@ ck_passwd(struct interface *aifp, u_char hash[RIP_AUTH_PW_LEN]; int i, len; - + assert(aifp != NULL); if ((void *)NA >= lim || NA->a_family != RIP_AF_AUTH) { msglim(use_authp, from, "missing password from %s", naddr_ntoa(from)); Modified: head/sbin/routed/output.c ============================================================================== --- head/sbin/routed/output.c Sun Apr 5 17:12:13 2009 (r190717) +++ head/sbin/routed/output.c Sun Apr 5 17:33:07 2009 (r190718) @@ -107,6 +107,7 @@ output(enum output_type type, int soc; int serrno; + assert(ifp != NULL); osin = *dst; if (osin.sin_port == 0) osin.sin_port = htons(RIP_PORT); @@ -672,6 +673,7 @@ supply(struct sockaddr_in *dst, struct rt_entry *rt; int def_metric; + assert(ifp != NULL); ws.state = 0; ws.gen_limit = 1024; Modified: head/sbin/routed/parms.c ============================================================================== --- head/sbin/routed/parms.c Sun Apr 5 17:12:13 2009 (r190717) +++ head/sbin/routed/parms.c Sun Apr 5 17:33:07 2009 (r190718) @@ -437,9 +437,7 @@ parse_ts(time_t *tp, u_int bufsize) { struct tm tm; -#if defined(sgi) || defined(__NetBSD__) char *ptr; -#endif if (0 > parse_quote(valp, "| ,\n\r", delimp, buf,bufsize) @@ -450,25 +448,11 @@ parse_ts(time_t *tp, } strcat(buf,"\n"); memset(&tm, 0, sizeof(tm)); -#if defined(sgi) || defined(__NetBSD__) ptr = strptime(buf, "%y/%m/%d@%H:%M\n", &tm); if (ptr == NULL || *ptr != '\0') { sprintf(buf,"bad timestamp %.25s", val0); return buf; } -#else - if (5 != sscanf(buf, "%u/%u/%u@%u:%u\n", - &tm.tm_year, &tm.tm_mon, &tm.tm_mday, - &tm.tm_hour, &tm.tm_min) - || tm.tm_mon < 1 || tm.tm_mon > 12 - || tm.tm_mday < 1 || tm.tm_mday > 31) { - sprintf(buf,"bad timestamp %.25s", val0); - return buf; - } - tm.tm_mon--; - if (tm.tm_year <= 37) /* assume small years are in the */ - tm.tm_year += 100; /* 3rd millenium */ -#endif if ((*tp = mktime(&tm)) == -1) { sprintf(buf,"bad timestamp %.25s", val0); @@ -495,7 +479,7 @@ get_passwd(char *tgt, int i; u_long l; - + assert(val != NULL); if (!safe) return "ignore unsafe password"; @@ -658,6 +642,8 @@ parse_parms(char *line, if (0 > parse_quote(&line, " #,\n\r",&delim, buf,sizeof(buf))) return bad_str(tgt); + } else { + val0 = NULL; } if (delim != '\0') { for (;;) { Modified: head/sbin/routed/radix.c ============================================================================== --- head/sbin/routed/radix.c Sun Apr 5 17:12:13 2009 (r190717) +++ head/sbin/routed/radix.c Sun Apr 5 17:33:07 2009 (r190718) @@ -54,12 +54,11 @@ int max_keylen; static struct radix_mask *rn_mkfreelist; static struct radix_node_head *mask_rnhead; static char *addmask_key; -static uint8_t normal_chars[] = +static const uint8_t normal_chars[] = { 0, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff}; static char *rn_zeros, *rn_ones; #define rn_masktop (mask_rnhead->rnh_treetop) -#undef Bcmp #define Bcmp(a, b, l) (l == 0 ? 0 \ : memcmp((caddr_t)(a), (caddr_t)(b), (size_t)l)) Modified: head/sbin/routed/radix.h ============================================================================== --- head/sbin/routed/radix.h Sun Apr 5 17:12:13 2009 (r190717) +++ head/sbin/routed/radix.h Sun Apr 5 17:33:07 2009 (r190718) @@ -132,7 +132,6 @@ struct radix_node_head { }; -#define Bcmp(a, b, n) memcmp(((void *)(a)), ((void *)(b)), (n)) #define Bcopy(a, b, n) memmove(((void *)(b)), ((void *)(a)), (size_t)(n)) #define Bzero(p, n) memset((void *)(p), 0, (size_t)(n)); #define Free(p) free((void *)p); Modified: head/sbin/routed/rdisc.c ============================================================================== --- head/sbin/routed/rdisc.c Sun Apr 5 17:12:13 2009 (r190717) +++ head/sbin/routed/rdisc.c Sun Apr 5 17:33:07 2009 (r190718) @@ -173,6 +173,8 @@ set_rdisc_mg(struct interface *ifp, struct group_req gr; struct sockaddr_in *sin; + assert(ifp != NULL); + if (rdisc_sock < 0) { /* Create the raw socket so that we can hear at least * broadcast router discovery packets. @@ -944,7 +946,6 @@ read_d(void) #endif union { struct ip ip; - u_short s[512/2]; u_char b[512]; } pkt; } buf; Modified: head/sbin/routed/table.c ============================================================================== --- head/sbin/routed/table.c Sun Apr 5 17:12:13 2009 (r190717) +++ head/sbin/routed/table.c Sun Apr 5 17:33:07 2009 (r190718) @@ -607,8 +607,6 @@ ag_check(naddr dst, CHECK_AG(); } - -#define NAME0_LEN 14 static const char * rtm_type_name(u_char type) { Modified: head/sbin/routed/trace.c ============================================================================== --- head/sbin/routed/trace.c Sun Apr 5 17:12:13 2009 (r190717) +++ head/sbin/routed/trace.c Sun Apr 5 17:33:07 2009 (r190718) @@ -51,8 +51,6 @@ __RCSID("$Revision: 2.27 $"); #define stat stat64 #endif -#define NRECORDS 50 /* size of circular trace buffer */ - int tracelevel, new_tracelevel; FILE *ftrace; /* output trace file */ static const char *sigtrace_pat = "%s"; @@ -255,13 +253,13 @@ void tracelevel_msg(const char *pat, int dump) /* -1=no dump, 0=default, 1=force */ { - static const char *off_msgs[MAX_TRACELEVEL] = { + static const char * const off_msgs[MAX_TRACELEVEL] = { "Tracing actions stopped", "Tracing packets stopped", "Tracing packet contents stopped", "Tracing kernel changes stopped", }; - static const char *on_msgs[MAX_TRACELEVEL] = { + static const char * const on_msgs[MAX_TRACELEVEL] = { "Tracing actions started", "Tracing packets started", "Tracing packet contents started", @@ -473,13 +471,13 @@ struct bits { const char *bits_name; }; -static struct bits if_bits[] = { +static const struct bits if_bits[] = { { IFF_LOOPBACK, 0, "LOOPBACK" }, { IFF_POINTOPOINT, 0, "PT-TO-PT" }, { 0, 0, 0} }; -static struct bits is_bits[] = { +static const struct bits is_bits[] = { { IS_ALIAS, 0, "ALIAS" }, { IS_SUBNET, 0, "" }, { IS_REMOTE, (IS_NO_RDISC @@ -523,7 +521,7 @@ static struct bits is_bits[] = { { 0, 0, "%#x"} }; -static struct bits rs_bits[] = { +static const struct bits rs_bits[] = { { RS_IF, 0, "IF" }, { RS_NET_INT, RS_NET_SYN, "NET_INT" }, { RS_NET_SYN, 0, "NET_SYN" }, From thompsa at FreeBSD.org Sun Apr 5 11:18:02 2009 From: thompsa at FreeBSD.org (Andrew Thompson) Date: Sun Apr 5 11:18:09 2009 Subject: svn commit: r190719 - head/sys/dev/usb/storage Message-ID: <200904051818.n35II1wL027261@svn.freebsd.org> Author: thompsa Date: Sun Apr 5 18:18:01 2009 New Revision: 190719 URL: http://svn.freebsd.org/changeset/base/190719 Log: MFp4 //depot/projects/usb@159562 Reapply r190173 with compilation fixed on 64bit arches. Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/storage/ustorage_fs.c Modified: head/sys/dev/usb/storage/ustorage_fs.c ============================================================================== --- head/sys/dev/usb/storage/ustorage_fs.c Sun Apr 5 17:33:07 2009 (r190718) +++ head/sys/dev/usb/storage/ustorage_fs.c Sun Apr 5 18:18:01 2009 (r190719) @@ -60,12 +60,10 @@ SYSCTL_INT(_hw_usb2_ustorage_fs, OID_AUT /* Define some limits */ #ifndef USTORAGE_FS_BULK_SIZE -#define USTORAGE_FS_BULK_SIZE (1 << 17) /* bytes */ +#define USTORAGE_FS_BULK_SIZE (1UL << 17) /* bytes */ #endif #define USTORAGE_FS_MAX_LUN 8 /* units */ -#define USTORAGE_FS_RELEASE 0x0101 -#define USTORAGE_FS_RAM_SECT (1 << 13) /* * The SCSI ID string must be exactly 28 characters long @@ -976,8 +974,6 @@ static uint8_t ustorage_fs_inquiry(struct ustorage_fs_softc *sc) { uint8_t *buf = sc->sc_transfer.data_ptr; - static const char vendor_id[] = "FreeBSD "; - static const char product_id[] = "File-Stor Gadget"; struct ustorage_fs_lun *currlun = sc->sc_transfer.currlun; @@ -999,12 +995,9 @@ ustorage_fs_inquiry(struct ustorage_fs_s buf[4] = 31; /* Additional length */ /* No special options */ - /* - * NOTE: We are writing an extra zero here, that is not - * transferred to the peer: - */ - snprintf(buf + 8, 28 + 1, "%-8s%-16s%04x", vendor_id, product_id, - USTORAGE_FS_RELEASE); + /* Copy in ID string */ + memcpy(buf + 8, USTORAGE_FS_ID_STRING, 28); + return (ustorage_fs_min_len(sc, 36, 0 - 1)); } @@ -1353,7 +1346,7 @@ ustorage_fs_read(struct ustorage_fs_soft * too big */ if (sc->sc_transfer.cmd_data[0] == SC_READ_6) { - lba = (sc->sc_transfer.cmd_data[1] << 16) | + lba = (((uint32_t)sc->sc_transfer.cmd_data[1]) << 16) | get_be16(&sc->sc_transfer.cmd_data[2]); } else { lba = get_be32(&sc->sc_transfer.cmd_data[2]); @@ -1411,7 +1404,7 @@ ustorage_fs_write(struct ustorage_fs_sof * too big. */ if (sc->sc_transfer.cmd_data[0] == SC_WRITE_6) - lba = (sc->sc_transfer.cmd_data[1] << 16) | + lba = (((uint32_t)sc->sc_transfer.cmd_data[1]) << 16) | get_be16(&sc->sc_transfer.cmd_data[2]); else { lba = get_be32(&sc->sc_transfer.cmd_data[2]); @@ -1558,7 +1551,7 @@ ustorage_fs_check_cmd(struct ustorage_fs * non-zero. */ for (i = 0; i != min_cmd_size; i++) { - if (sc->sc_transfer.cmd_data[i] && !(mask & (1 << i))) { + if (sc->sc_transfer.cmd_data[i] && !(mask & (1UL << i))) { if (currlun) { currlun->sense_data = SS_INVALID_FIELD_IN_CDB; } @@ -1589,6 +1582,8 @@ ustorage_fs_do_cmd(struct ustorage_fs_so { uint8_t error = 1; uint8_t i; + uint32_t temp; + const uint32_t mask9 = (0xFFFFFFFFUL >> 9) << 9; /* set default data transfer pointer */ sc->sc_transfer.data_ptr = sc->sc_qdata; @@ -1604,7 +1599,7 @@ ustorage_fs_do_cmd(struct ustorage_fs_so break; } error = ustorage_fs_check_cmd(sc, 6, - (1 << 4) | 1, 0); + (1UL << 4) | 1, 0); if (error) { break; } @@ -1619,7 +1614,7 @@ ustorage_fs_do_cmd(struct ustorage_fs_so break; } error = ustorage_fs_check_cmd(sc, 6, - (1 << 1) | (1 << 4) | 1, 0); + (1UL << 1) | (1UL << 4) | 1, 0); if (error) { break; } @@ -1635,7 +1630,7 @@ ustorage_fs_do_cmd(struct ustorage_fs_so break; } error = ustorage_fs_check_cmd(sc, 10, - (1 << 1) | (3 << 7) | 1, 0); + (1UL << 1) | (3UL << 7) | 1, 0); if (error) { break; } @@ -1650,7 +1645,7 @@ ustorage_fs_do_cmd(struct ustorage_fs_so break; } error = ustorage_fs_check_cmd(sc, 6, - (1 << 1) | (1 << 2) | (1 << 4) | 1, 0); + (1UL << 1) | (1UL << 2) | (1UL << 4) | 1, 0); if (error) { break; } @@ -1666,7 +1661,7 @@ ustorage_fs_do_cmd(struct ustorage_fs_so break; } error = ustorage_fs_check_cmd(sc, 10, - (1 << 1) | (1 << 2) | (3 << 7) | 1, 0); + (1UL << 1) | (1UL << 2) | (3UL << 7) | 1, 0); if (error) { break; } @@ -1680,7 +1675,7 @@ ustorage_fs_do_cmd(struct ustorage_fs_so break; } error = ustorage_fs_check_cmd(sc, 6, - (1 << 4) | 1, 0); + (1UL << 4) | 1, 0); if (error) { break; } @@ -1691,13 +1686,13 @@ ustorage_fs_do_cmd(struct ustorage_fs_so case SC_READ_6: i = sc->sc_transfer.cmd_data[4]; sc->sc_transfer.cmd_dir = DIR_WRITE; - error = ustorage_fs_min_len(sc, - ((i == 0) ? 256 : i) << 9, 0 - (1 << 9)); + temp = ((i == 0) ? 256UL : i); + error = ustorage_fs_min_len(sc, temp << 9, mask9); if (error) { break; } error = ustorage_fs_check_cmd(sc, 6, - (7 << 1) | (1 << 4) | 1, 1); + (7UL << 1) | (1UL << 4) | 1, 1); if (error) { break; } @@ -1707,13 +1702,13 @@ ustorage_fs_do_cmd(struct ustorage_fs_so case SC_READ_10: sc->sc_transfer.cmd_dir = DIR_WRITE; - error = ustorage_fs_min_len(sc, - get_be16(&sc->sc_transfer.cmd_data[7]) << 9, 0 - (1 << 9)); + temp = get_be16(&sc->sc_transfer.cmd_data[7]); + error = ustorage_fs_min_len(sc, temp << 9, mask9); if (error) { break; } error = ustorage_fs_check_cmd(sc, 10, - (1 << 1) | (0xf << 2) | (3 << 7) | 1, 1); + (1UL << 1) | (0xfUL << 2) | (3UL << 7) | 1, 1); if (error) { break; } @@ -1723,13 +1718,19 @@ ustorage_fs_do_cmd(struct ustorage_fs_so case SC_READ_12: sc->sc_transfer.cmd_dir = DIR_WRITE; - error = ustorage_fs_min_len(sc, - get_be32(&sc->sc_transfer.cmd_data[6]) << 9, 0 - (1 << 9)); + temp = get_be32(&sc->sc_transfer.cmd_data[6]); + if (temp >= (1UL << (32 - 9))) { + /* numerical overflow */ + sc->sc_csw.bCSWStatus = CSWSTATUS_FAILED; + error = 1; + break; + } + error = ustorage_fs_min_len(sc, temp << 9, mask9); if (error) { break; } error = ustorage_fs_check_cmd(sc, 12, - (1 << 1) | (0xf << 2) | (0xf << 6) | 1, 1); + (1UL << 1) | (0xfUL << 2) | (0xfUL << 6) | 1, 1); if (error) { break; } @@ -1740,7 +1741,7 @@ ustorage_fs_do_cmd(struct ustorage_fs_so case SC_READ_CAPACITY: sc->sc_transfer.cmd_dir = DIR_WRITE; error = ustorage_fs_check_cmd(sc, 10, - (0xf << 2) | (1 << 8) | 1, 1); + (0xfUL << 2) | (1UL << 8) | 1, 1); if (error) { break; } @@ -1756,7 +1757,7 @@ ustorage_fs_do_cmd(struct ustorage_fs_so break; } error = ustorage_fs_check_cmd(sc, 10, - (3 << 7) | 1, 1); + (3UL << 7) | 1, 1); if (error) { break; } @@ -1771,7 +1772,7 @@ ustorage_fs_do_cmd(struct ustorage_fs_so break; } error = ustorage_fs_check_cmd(sc, 6, - (1 << 4) | 1, 0); + (1UL << 4) | 1, 0); if (error) { break; } @@ -1785,7 +1786,7 @@ ustorage_fs_do_cmd(struct ustorage_fs_so break; } error = ustorage_fs_check_cmd(sc, 6, - (1 << 1) | (1 << 4) | 1, 0); + (1UL << 1) | (1UL << 4) | 1, 0); if (error) { break; } @@ -1799,7 +1800,7 @@ ustorage_fs_do_cmd(struct ustorage_fs_so break; } error = ustorage_fs_check_cmd(sc, 10, - (0xf << 2) | (3 << 7) | 1, 1); + (0xfUL << 2) | (3UL << 7) | 1, 1); if (error) { break; } @@ -1826,7 +1827,7 @@ ustorage_fs_do_cmd(struct ustorage_fs_so break; } error = ustorage_fs_check_cmd(sc, 10, - (1 << 1) | (0xf << 2) | (3 << 7) | 1, 1); + (1UL << 1) | (0xfUL << 2) | (3UL << 7) | 1, 1); if (error) { break; } @@ -1837,13 +1838,13 @@ ustorage_fs_do_cmd(struct ustorage_fs_so case SC_WRITE_6: i = sc->sc_transfer.cmd_data[4]; sc->sc_transfer.cmd_dir = DIR_READ; - error = ustorage_fs_min_len(sc, - ((i == 0) ? 256 : i) << 9, 0 - (1 << 9)); + temp = ((i == 0) ? 256UL : i); + error = ustorage_fs_min_len(sc, temp << 9, mask9); if (error) { break; } error = ustorage_fs_check_cmd(sc, 6, - (7 << 1) | (1 << 4) | 1, 1); + (7UL << 1) | (1UL << 4) | 1, 1); if (error) { break; } @@ -1853,13 +1854,13 @@ ustorage_fs_do_cmd(struct ustorage_fs_so case SC_WRITE_10: sc->sc_transfer.cmd_dir = DIR_READ; - error = ustorage_fs_min_len(sc, - get_be16(&sc->sc_transfer.cmd_data[7]) << 9, 0 - (1 << 9)); + temp = get_be16(&sc->sc_transfer.cmd_data[7]); + error = ustorage_fs_min_len(sc, temp << 9, mask9); if (error) { break; } error = ustorage_fs_check_cmd(sc, 10, - (1 << 1) | (0xf << 2) | (3 << 7) | 1, 1); + (1UL << 1) | (0xfUL << 2) | (3UL << 7) | 1, 1); if (error) { break; } @@ -1869,13 +1870,19 @@ ustorage_fs_do_cmd(struct ustorage_fs_so case SC_WRITE_12: sc->sc_transfer.cmd_dir = DIR_READ; - error = ustorage_fs_min_len(sc, - get_be32(&sc->sc_transfer.cmd_data[6]) << 9, 0 - (1 << 9)); + temp = get_be32(&sc->sc_transfer.cmd_data[6]); + if (temp > (mask9 >> 9)) { + /* numerical overflow */ + sc->sc_csw.bCSWStatus = CSWSTATUS_FAILED; + error = 1; + break; + } + error = ustorage_fs_min_len(sc, temp << 9, mask9); if (error) { break; } error = ustorage_fs_check_cmd(sc, 12, - (1 << 1) | (0xf << 2) | (0xf << 6) | 1, 1); + (1UL << 1) | (0xfUL << 2) | (0xfUL << 6) | 1, 1); if (error) { break; } From thompsa at FreeBSD.org Sun Apr 5 11:18:11 2009 From: thompsa at FreeBSD.org (Andrew Thompson) Date: Sun Apr 5 11:18:26 2009 Subject: svn commit: r190720 - head/sys/dev/usb/controller Message-ID: <200904051818.n35II77S027302@svn.freebsd.org> Author: thompsa Date: Sun Apr 5 18:18:07 2009 New Revision: 190720 URL: http://svn.freebsd.org/changeset/base/190720 Log: MFp4 //depot/projects/usb@159671 Fix interrupt register setting on the atmegadci controller. Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/controller/atmegadci.c Modified: head/sys/dev/usb/controller/atmegadci.c ============================================================================== --- head/sys/dev/usb/controller/atmegadci.c Sun Apr 5 18:18:01 2009 (r190719) +++ head/sys/dev/usb/controller/atmegadci.c Sun Apr 5 18:18:07 2009 (r190720) @@ -649,7 +649,7 @@ atmegadci_interrupt(struct atmegadci_sof status = ATMEGA_READ_1(sc, ATMEGA_UDINT); /* clear all set interrupts */ - ATMEGA_WRITE_1(sc, ATMEGA_UDINT, ~status); + ATMEGA_WRITE_1(sc, ATMEGA_UDINT, (~status) & 0x7D); DPRINTFN(14, "UDINT=0x%02x\n", status); @@ -719,7 +719,7 @@ atmegadci_interrupt(struct atmegadci_sof status = ATMEGA_READ_1(sc, ATMEGA_USBINT); /* clear all set interrupts */ - ATMEGA_WRITE_1(sc, ATMEGA_USBINT, ~status); + ATMEGA_WRITE_1(sc, ATMEGA_USBINT, (~status) & 0x03); if (status & ATMEGA_USBINT_VBUSTI) { uint8_t temp; @@ -731,10 +731,7 @@ atmegadci_interrupt(struct atmegadci_sof } /* check for any endpoint interrupts */ status = ATMEGA_READ_1(sc, ATMEGA_UEINT); - - /* clear all set interrupts */ - ATMEGA_WRITE_1(sc, ATMEGA_UEINT, ~status); - + /* the hardware will clear the UEINT bits automatically */ if (status) { DPRINTFN(5, "real endpoint interrupt UEINT=0x%02x\n", status); @@ -1249,6 +1246,12 @@ atmegadci_init(struct atmegadci_softc *s ATMEGA_WRITE_1(sc, ATMEGA_UHWCON, ATMEGA_UHWCON_UVREGE | ATMEGA_UHWCON_UIMOD); #endif + /* make sure USB is enabled */ + ATMEGA_WRITE_1(sc, ATMEGA_USBCON, + ATMEGA_USBCON_USBE | + ATMEGA_USBCON_OTGPADE | + ATMEGA_USBCON_VBUSTE); + /* turn on clocks */ (sc->sc_clocks_on) (&sc->sc_bus); From thompsa at FreeBSD.org Sun Apr 5 11:18:22 2009 From: thompsa at FreeBSD.org (Andrew Thompson) Date: Sun Apr 5 11:18:44 2009 Subject: svn commit: r190721 - head/sys/dev/usb/controller Message-ID: <200904051818.n35IIGik027341@svn.freebsd.org> Author: thompsa Date: Sun Apr 5 18:18:16 2009 New Revision: 190721 URL: http://svn.freebsd.org/changeset/base/190721 Log: MFp4 //depot/projects/usb@159673 Fix a corner case around stalling SETUP packets in device side mode. Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/controller/at91dci.c head/sys/dev/usb/controller/atmegadci.c head/sys/dev/usb/controller/musb_otg.c head/sys/dev/usb/controller/uss820dci.c Modified: head/sys/dev/usb/controller/at91dci.c ============================================================================== --- head/sys/dev/usb/controller/at91dci.c Sun Apr 5 18:18:07 2009 (r190720) +++ head/sys/dev/usb/controller/at91dci.c Sun Apr 5 18:18:16 2009 (r190721) @@ -305,14 +305,11 @@ at91dci_setup_rx(struct at91dci_td *td) AT91_UDP_CSR_TXCOMP); if (!(csr & AT91_UDP_CSR_RXSETUP)) { - /* abort any ongoing transfer */ - if (!td->did_stall) { - DPRINTFN(5, "stalling\n"); - temp |= AT91_UDP_CSR_FORCESTALL; - td->did_stall = 1; - } goto not_complete; } + /* clear did stall */ + td->did_stall = 0; + /* get the packet byte count */ count = (csr & AT91_UDP_CSR_RXBYTECNT) >> 16; @@ -362,6 +359,13 @@ at91dci_setup_rx(struct at91dci_td *td) return (0); /* complete */ not_complete: + /* abort any ongoing transfer */ + if (!td->did_stall) { + DPRINTFN(5, "stalling\n"); + temp |= AT91_UDP_CSR_FORCESTALL; + td->did_stall = 1; + } + /* clear interrupts, if any */ if (temp) { DPRINTFN(5, "clearing 0x%08x\n", temp); Modified: head/sys/dev/usb/controller/atmegadci.c ============================================================================== --- head/sys/dev/usb/controller/atmegadci.c Sun Apr 5 18:18:07 2009 (r190720) +++ head/sys/dev/usb/controller/atmegadci.c Sun Apr 5 18:18:16 2009 (r190721) @@ -250,16 +250,10 @@ atmegadci_setup_rx(struct atmegadci_td * DPRINTFN(5, "UEINTX=0x%02x\n", temp); if (!(temp & ATMEGA_UEINTX_RXSTPI)) { - /* abort any ongoing transfer */ - if (!td->did_stall) { - DPRINTFN(5, "stalling\n"); - ATMEGA_WRITE_1(sc, ATMEGA_UECONX, - ATMEGA_UECONX_EPEN | - ATMEGA_UECONX_STALLRQ); - td->did_stall = 1; - } goto not_complete; } + /* clear did stall */ + td->did_stall = 0; /* get the packet byte count */ count = (ATMEGA_READ_1(sc, ATMEGA_UEBCHX) << 8) | @@ -304,6 +298,15 @@ atmegadci_setup_rx(struct atmegadci_td * return (0); /* complete */ not_complete: + /* abort any ongoing transfer */ + if (!td->did_stall) { + DPRINTFN(5, "stalling\n"); + ATMEGA_WRITE_1(sc, ATMEGA_UECONX, + ATMEGA_UECONX_EPEN | + ATMEGA_UECONX_STALLRQ); + td->did_stall = 1; + } + /* we only want to know if there is a SETUP packet */ ATMEGA_WRITE_1(sc, ATMEGA_UEIENX, ATMEGA_UEIENX_RXSTPE); return (1); /* not complete */ Modified: head/sys/dev/usb/controller/musb_otg.c ============================================================================== --- head/sys/dev/usb/controller/musb_otg.c Sun Apr 5 18:18:07 2009 (r190720) +++ head/sys/dev/usb/controller/musb_otg.c Sun Apr 5 18:18:16 2009 (r190721) @@ -255,6 +255,8 @@ musbotg_setup_rx(struct musbotg_td *td) * callback, hence the status stage is not complete. */ if (csr & MUSB2_MASK_CSR0L_DATAEND) { + /* do not stall at this point */ + td->did_stall = 1; /* wait for interrupt */ goto not_complete; } @@ -276,18 +278,13 @@ musbotg_setup_rx(struct musbotg_td *td) sc->sc_ep0_busy = 0; } if (sc->sc_ep0_busy) { - /* abort any ongoing transfer */ - if (!td->did_stall) { - DPRINTFN(4, "stalling\n"); - MUSB2_WRITE_1(sc, MUSB2_REG_TXCSRL, - MUSB2_MASK_CSR0L_SENDSTALL); - td->did_stall = 1; - } goto not_complete; } if (!(csr & MUSB2_MASK_CSR0L_RXPKTRDY)) { goto not_complete; } + /* clear did stall flag */ + td->did_stall = 0; /* get the packet byte count */ count = MUSB2_READ_2(sc, MUSB2_REG_RXCOUNT); @@ -328,6 +325,13 @@ musbotg_setup_rx(struct musbotg_td *td) return (0); /* complete */ not_complete: + /* abort any ongoing transfer */ + if (!td->did_stall) { + DPRINTFN(4, "stalling\n"); + MUSB2_WRITE_1(sc, MUSB2_REG_TXCSRL, + MUSB2_MASK_CSR0L_SENDSTALL); + td->did_stall = 1; + } return (1); /* not complete */ } Modified: head/sys/dev/usb/controller/uss820dci.c ============================================================================== --- head/sys/dev/usb/controller/uss820dci.c Sun Apr 5 18:18:07 2009 (r190720) +++ head/sys/dev/usb/controller/uss820dci.c Sun Apr 5 18:18:16 2009 (r190721) @@ -248,19 +248,11 @@ uss820dci_setup_rx(struct uss820dci_td * DPRINTFN(5, "rx_stat=0x%02x rem=%u\n", rx_stat, td->remainder); if (!(rx_stat & USS820_RXSTAT_RXSETUP)) { - /* abort any ongoing transfer */ - if (!td->did_stall) { - DPRINTFN(5, "stalling\n"); - - /* set stall */ - - uss820dci_update_shared_1(sc, USS820_EPCON, 0xFF, - (USS820_EPCON_TXSTL | USS820_EPCON_RXSTL)); - - td->did_stall = 1; - } goto not_complete; } + /* clear did stall */ + td->did_stall = 0; + /* clear stall and all I/O */ uss820dci_update_shared_1(sc, USS820_EPCON, 0xFF ^ (USS820_EPCON_TXSTL | @@ -332,6 +324,18 @@ uss820dci_setup_rx(struct uss820dci_td * return (0); /* complete */ not_complete: + /* abort any ongoing transfer */ + if (!td->did_stall) { + DPRINTFN(5, "stalling\n"); + + /* set stall */ + + uss820dci_update_shared_1(sc, USS820_EPCON, 0xFF, + (USS820_EPCON_TXSTL | USS820_EPCON_RXSTL)); + + td->did_stall = 1; + } + /* clear end overwrite flag, if any */ if (rx_stat & USS820_RXSTAT_RXSETUP) { uss820dci_update_shared_1(sc, USS820_RXSTAT, From thompsa at FreeBSD.org Sun Apr 5 11:18:31 2009 From: thompsa at FreeBSD.org (Andrew Thompson) Date: Sun Apr 5 11:19:05 2009 Subject: svn commit: r190722 - head/sys/dev/usb/controller Message-ID: <200904051818.n35IIQgo027383@svn.freebsd.org> Author: thompsa Date: Sun Apr 5 18:18:25 2009 New Revision: 190722 URL: http://svn.freebsd.org/changeset/base/190722 Log: MFp4 //depot/projects/usb@159674 Fix more corner cases around reception of SETUP packets. Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/controller/atmegadci.c head/sys/dev/usb/controller/musb_otg.c head/sys/dev/usb/controller/uss820dci.c Modified: head/sys/dev/usb/controller/atmegadci.c ============================================================================== --- head/sys/dev/usb/controller/atmegadci.c Sun Apr 5 18:18:16 2009 (r190721) +++ head/sys/dev/usb/controller/atmegadci.c Sun Apr 5 18:18:25 2009 (r190722) @@ -306,7 +306,10 @@ not_complete: ATMEGA_UECONX_STALLRQ); td->did_stall = 1; } - + if (temp & ATMEGA_UEINTX_RXSTPI) { + /* clear SETUP packet interrupt */ + ATMEGA_WRITE_1(sc, ATMEGA_UEINTX, ~ATMEGA_UEINTX_RXSTPI); + } /* we only want to know if there is a SETUP packet */ ATMEGA_WRITE_1(sc, ATMEGA_UEIENX, ATMEGA_UEIENX_RXSTPE); return (1); /* not complete */ Modified: head/sys/dev/usb/controller/musb_otg.c ============================================================================== --- head/sys/dev/usb/controller/musb_otg.c Sun Apr 5 18:18:16 2009 (r190721) +++ head/sys/dev/usb/controller/musb_otg.c Sun Apr 5 18:18:25 2009 (r190722) @@ -292,11 +292,15 @@ musbotg_setup_rx(struct musbotg_td *td) if (count != td->remainder) { DPRINTFN(0, "Invalid SETUP packet " "length, %d bytes\n", count); + MUSB2_WRITE_1(sc, MUSB2_REG_TXCSRL, + MUSB2_MASK_CSR0L_RXPKTRDY_CLR); goto not_complete; } if (count != sizeof(req)) { DPRINTFN(0, "Unsupported SETUP packet " "length, %d bytes\n", count); + MUSB2_WRITE_1(sc, MUSB2_REG_TXCSRL, + MUSB2_MASK_CSR0L_RXPKTRDY_CLR); goto not_complete; } /* receive data */ Modified: head/sys/dev/usb/controller/uss820dci.c ============================================================================== --- head/sys/dev/usb/controller/uss820dci.c Sun Apr 5 18:18:16 2009 (r190721) +++ head/sys/dev/usb/controller/uss820dci.c Sun Apr 5 18:18:25 2009 (r190722) @@ -275,12 +275,12 @@ uss820dci_setup_rx(struct uss820dci_td * if (count != td->remainder) { DPRINTFN(0, "Invalid SETUP packet " "length, %d bytes\n", count); - goto not_complete; + goto setup_not_complete; } if (count != sizeof(req)) { DPRINTFN(0, "Unsupported SETUP packet " "length, %d bytes\n", count); - goto not_complete; + goto setup_not_complete; } /* receive data */ bus_space_read_multi_1(td->io_tag, td->io_hdl, @@ -323,13 +323,22 @@ uss820dci_setup_rx(struct uss820dci_td * } return (0); /* complete */ +setup_not_complete: + + /* set RXFFRC bit */ + temp = bus_space_read_1(td->io_tag, td->io_hdl, + td->rx_cntl_reg); + temp |= USS820_RXCON_RXFFRC; + bus_space_write_1(td->io_tag, td->io_hdl, + td->rx_cntl_reg, temp); + + /* FALLTHROUGH */ + not_complete: /* abort any ongoing transfer */ if (!td->did_stall) { DPRINTFN(5, "stalling\n"); - /* set stall */ - uss820dci_update_shared_1(sc, USS820_EPCON, 0xFF, (USS820_EPCON_TXSTL | USS820_EPCON_RXSTL)); From thompsa at FreeBSD.org Sun Apr 5 11:18:44 2009 From: thompsa at FreeBSD.org (Andrew Thompson) Date: Sun Apr 5 11:19:21 2009 Subject: svn commit: r190723 - head/sys/dev/usb Message-ID: <200904051818.n35IIbQj027424@svn.freebsd.org> Author: thompsa Date: Sun Apr 5 18:18:36 2009 New Revision: 190723 URL: http://svn.freebsd.org/changeset/base/190723 Log: MFp4 //depot/projects/usb@159677 Remove redundant locking. Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/usb_device.c Modified: head/sys/dev/usb/usb_device.c ============================================================================== --- head/sys/dev/usb/usb_device.c Sun Apr 5 18:18:25 2009 (r190722) +++ head/sys/dev/usb/usb_device.c Sun Apr 5 18:18:36 2009 (r190723) @@ -1647,9 +1647,7 @@ repeat_set_config: DPRINTF("setting config %u\n", config_index); /* get the USB device configured */ - sx_xlock(udev->default_sx + 1); err = usb2_set_config_index(udev, config_index); - sx_unlock(udev->default_sx + 1); if (err) { if (udev->ddesc.bNumConfigurations != 0) { if (!set_config_failed) { From thompsa at FreeBSD.org Sun Apr 5 11:18:54 2009 From: thompsa at FreeBSD.org (Andrew Thompson) Date: Sun Apr 5 11:19:48 2009 Subject: svn commit: r190724 - head/sys/dev/usb/controller Message-ID: <200904051818.n35IIlS7027463@svn.freebsd.org> Author: thompsa Date: Sun Apr 5 18:18:47 2009 New Revision: 190724 URL: http://svn.freebsd.org/changeset/base/190724 Log: MFp4 //depot/projects/usb@159700 Get rid of the last CALLOUT_RETURNUNLOCKED reference. Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/controller/usb_controller.c Modified: head/sys/dev/usb/controller/usb_controller.c ============================================================================== --- head/sys/dev/usb/controller/usb_controller.c Sun Apr 5 18:18:36 2009 (r190723) +++ head/sys/dev/usb/controller/usb_controller.c Sun Apr 5 18:18:47 2009 (r190724) @@ -277,7 +277,7 @@ usb2_power_wdog(void *arg) usb2_bus_power_update(bus); - return; + USB_BUS_LOCK(bus); } /*------------------------------------------------------------------------* @@ -356,11 +356,8 @@ usb2_bus_attach(struct usb2_proc_msg *pm /* set softc - we are ready */ device_set_softc(dev, bus); - /* start watchdog - this function will unlock the BUS lock ! */ + /* start watchdog */ usb2_power_wdog(bus); - - /* need to return locked */ - USB_BUS_LOCK(bus); } /*------------------------------------------------------------------------* @@ -534,7 +531,7 @@ usb2_bus_mem_alloc_all(struct usb2_bus * NULL, MTX_DEF | MTX_RECURSE); usb2_callout_init_mtx(&bus->power_wdog, - &bus->bus_mtx, CALLOUT_RETURNUNLOCKED); + &bus->bus_mtx, 0); TAILQ_INIT(&bus->intr_q.head); From thompsa at FreeBSD.org Sun Apr 5 11:19:05 2009 From: thompsa at FreeBSD.org (Andrew Thompson) Date: Sun Apr 5 11:20:05 2009 Subject: svn commit: r190725 - head/sys/dev/usb Message-ID: <200904051819.n35IJ0lW027502@svn.freebsd.org> Author: thompsa Date: Sun Apr 5 18:19:00 2009 New Revision: 190725 URL: http://svn.freebsd.org/changeset/base/190725 Log: MFp4 //depot/projects/usb@159797 Remove unused field in "struct usb2_pipe". Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/usb_device.h Modified: head/sys/dev/usb/usb_device.h ============================================================================== --- head/sys/dev/usb/usb_device.h Sun Apr 5 18:18:47 2009 (r190724) +++ head/sys/dev/usb/usb_device.h Sun Apr 5 18:19:00 2009 (r190725) @@ -44,7 +44,6 @@ struct usb2_clear_stall_msg { struct usb2_pipe { struct usb2_xfer_queue pipe_q; /* queue of USB transfers */ - struct usb2_xfer *xfer_block; /* blocking USB transfer */ struct usb2_endpoint_descriptor *edesc; struct usb2_pipe_methods *methods; /* set by HC driver */ From thompsa at FreeBSD.org Sun Apr 5 11:19:13 2009 From: thompsa at FreeBSD.org (Andrew Thompson) Date: Sun Apr 5 11:20:15 2009 Subject: svn commit: r190726 - head/sys/dev/usb Message-ID: <200904051819.n35IJAgL027545@svn.freebsd.org> Author: thompsa Date: Sun Apr 5 18:19:10 2009 New Revision: 190726 URL: http://svn.freebsd.org/changeset/base/190726 Log: MFp4 //depot/projects/usb@159806 Properly name usb2_uref_location() so that it is not confused with usb2_unref_location() . Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/usb_dev.c Modified: head/sys/dev/usb/usb_dev.c ============================================================================== --- head/sys/dev/usb/usb_dev.c Sun Apr 5 18:19:00 2009 (r190725) +++ head/sys/dev/usb/usb_dev.c Sun Apr 5 18:19:10 2009 (r190726) @@ -89,7 +89,7 @@ static void usb2_loc_fill(struct usb2_fs struct usb2_cdev_privdata *); static void usb2_close(void *); static usb2_error_t usb2_ref_device(struct usb2_cdev_privdata *, int); -static usb2_error_t usb2_uref_location(struct usb2_cdev_privdata *); +static usb2_error_t usb2_usb_ref_location(struct usb2_cdev_privdata *); static void usb2_unref_device(struct usb2_cdev_privdata *); static d_open_t usb2_open; @@ -264,7 +264,7 @@ error: } /*------------------------------------------------------------------------* - * usb2_uref_location + * usb2_usb_ref_location * * This function is used to upgrade an USB reference to include the * USB device reference on a USB location. @@ -274,7 +274,7 @@ error: * Else: Failure. *------------------------------------------------------------------------*/ static usb2_error_t -usb2_uref_location(struct usb2_cdev_privdata *cpd) +usb2_usb_ref_location(struct usb2_cdev_privdata *cpd) { /* * Check if we already got an USB reference on this location: @@ -1038,7 +1038,7 @@ usb2_ioctl(struct cdev *dev, u_long cmd, err = (f->methods->f_ioctl) (f, cmd, addr, fflags); DPRINTFN(2, "f_ioctl cmd 0x%lx = %d\n", cmd, err); if (err == ENOIOCTL) { - if (usb2_uref_location(cpd)) { + if (usb2_usb_ref_location(cpd)) { err = ENXIO; goto done; } From thompsa at FreeBSD.org Sun Apr 5 11:19:22 2009 From: thompsa at FreeBSD.org (Andrew Thompson) Date: Sun Apr 5 11:20:32 2009 Subject: svn commit: r190727 - head/sys/dev/usb Message-ID: <200904051819.n35IJKWS027589@svn.freebsd.org> Author: thompsa Date: Sun Apr 5 18:19:19 2009 New Revision: 190727 URL: http://svn.freebsd.org/changeset/base/190727 Log: MFp4 //depot/projects/usb@159811 First patch in a series of memory save patches. Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/usb_device.c head/sys/dev/usb/usb_request.c head/sys/dev/usb/usb_request.h Modified: head/sys/dev/usb/usb_device.c ============================================================================== --- head/sys/dev/usb/usb_device.c Sun Apr 5 18:19:10 2009 (r190726) +++ head/sys/dev/usb/usb_device.c Sun Apr 5 18:19:19 2009 (r190727) @@ -504,8 +504,9 @@ usb2_free_iface_data(struct usb2_device } /* free "cdesc" after "ifaces", if any */ - if (udev->cdesc) { - free(udev->cdesc, M_USB); + if (udev->cdesc != NULL) { + if (udev->flags.usb2_mode != USB_MODE_DEVICE) + free(udev->cdesc, M_USB); udev->cdesc = NULL; } /* set unconfigured state */ @@ -569,8 +570,14 @@ usb2_set_config_index(struct usb2_device goto done; } /* get the full config descriptor */ - err = usb2_req_get_config_desc_full(udev, - NULL, &cdp, M_USB, index); + if (udev->flags.usb2_mode == USB_MODE_DEVICE) { + /* save some memory */ + err = usb2_req_get_config_desc_ptr(udev, &cdp, index); + } else { + /* normal request */ + err = usb2_req_get_config_desc_full(udev, + NULL, &cdp, M_USB, index); + } if (err) { goto done; } @@ -1713,10 +1720,9 @@ repeat_set_config: udev->ugen_symlink = usb2_alloc_symlink(udev->ugen_name); /* Announce device */ -#if USB_HAVE_STRINGS printf("%s: <%s> at %s\n", udev->ugen_name, udev->manufacturer, device_get_nameunit(udev->bus->bdev)); -#endif + usb2_notify_addq("+", udev); #endif done: @@ -1851,10 +1857,8 @@ usb2_free_device(struct usb2_device *ude #if USB_HAVE_UGEN usb2_notify_addq("-", udev); -#if USB_HAVE_STRINGS printf("%s: <%s> at %s (disconnected)\n", udev->ugen_name, udev->manufacturer, device_get_nameunit(bus->bdev)); -#endif /* Destroy UGEN symlink, if any */ if (udev->ugen_symlink) { Modified: head/sys/dev/usb/usb_request.c ============================================================================== --- head/sys/dev/usb/usb_request.c Sun Apr 5 18:19:10 2009 (r190726) +++ head/sys/dev/usb/usb_request.c Sun Apr 5 18:19:19 2009 (r190727) @@ -833,6 +833,40 @@ usb2_req_get_string_desc(struct usb2_dev } /*------------------------------------------------------------------------* + * usb2_req_get_config_desc_ptr + * + * This function is used in device side mode to retrieve the pointer + * to the generated config descriptor. This saves allocating space for + * an additional config descriptor when setting the configuration. + * + * Returns: + * 0: Success + * Else: Failure + *------------------------------------------------------------------------*/ +usb2_error_t +usb2_req_get_config_desc_ptr(struct usb2_device *udev, + struct usb2_config_descriptor **ppcd, uint8_t config_index) +{ + uint16_t len; + + struct usb2_device_request req; + + if (udev->flags.usb2_mode != USB_MODE_DEVICE) + return (USB_ERR_INVAL); + + req.bmRequestType = UT_READ_CLASS_DEVICE; + req.bRequest = UR_GET_DESCRIPTOR; + USETW2(req.wValue, UDESC_CONFIG, config_index); + USETW(req.wIndex, 0); + USETW(req.wLength, 0); + + (usb2_temp_get_desc_p) (udev, &req, + __DECONST(const void **, ppcd), &len); + + return (*ppcd ? USB_ERR_NORMAL_COMPLETION : USB_ERR_INVAL); +} + +/*------------------------------------------------------------------------* * usb2_req_get_config_desc * * Returns: Modified: head/sys/dev/usb/usb_request.h ============================================================================== --- head/sys/dev/usb/usb_request.h Sun Apr 5 18:19:10 2009 (r190726) +++ head/sys/dev/usb/usb_request.h Sun Apr 5 18:19:19 2009 (r190727) @@ -44,6 +44,8 @@ usb2_error_t usb2_req_get_alt_interface_ uint8_t iface_index); usb2_error_t usb2_req_get_config(struct usb2_device *udev, struct mtx *mtx, uint8_t *pconf); +usb2_error_t usb2_req_get_config_desc_ptr(struct usb2_device *udev, + struct usb2_config_descriptor **ppcd, uint8_t config_index); usb2_error_t usb2_req_get_config_desc(struct usb2_device *udev, struct mtx *mtx, struct usb2_config_descriptor *d, uint8_t conf_index); usb2_error_t usb2_req_get_config_desc_full(struct usb2_device *udev, From thompsa at FreeBSD.org Sun Apr 5 11:19:36 2009 From: thompsa at FreeBSD.org (Andrew Thompson) Date: Sun Apr 5 11:20:48 2009 Subject: svn commit: r190728 - head/sys/dev/usb/bluetooth Message-ID: <200904051819.n35IJU43027637@svn.freebsd.org> Author: thompsa Date: Sun Apr 5 18:19:30 2009 New Revision: 190728 URL: http://svn.freebsd.org/changeset/base/190728 Log: MFp4 //depot/projects/usb@159863 Speed up the endpoint descriptor search Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/bluetooth/ng_ubt.c Modified: head/sys/dev/usb/bluetooth/ng_ubt.c ============================================================================== --- head/sys/dev/usb/bluetooth/ng_ubt.c Sun Apr 5 18:19:19 2009 (r190727) +++ head/sys/dev/usb/bluetooth/ng_ubt.c Sun Apr 5 18:19:30 2009 (r190728) @@ -426,6 +426,7 @@ ubt_attach(device_t dev) struct usb2_attach_arg *uaa = device_get_ivars(dev); struct ubt_softc *sc = device_get_softc(dev); struct usb2_endpoint_descriptor *ed; + struct usb2_interface_descriptor *id; uint16_t wMaxPacketSize; uint8_t alt_index, i, j; uint8_t iface_index[2] = { 0, 1 }; @@ -496,31 +497,34 @@ ubt_attach(device_t dev) alt_index = 0; i = 0; j = 0; + ed = NULL; - /* Search through all the descriptors looking for bidir mode */ - while (1) { - uint16_t temp; - - ed = usb2_find_edesc(usb2_get_config_descriptor(uaa->device), - 1, i, j); - if (ed == NULL) { - if (j != 0) { - /* next interface */ - j = 0; - i ++; - continue; + /* + * Search through all the descriptors looking for the largest + * packet size: + */ + while ((ed = (struct usb2_endpoint_descriptor *)usb2_desc_foreach( + usb2_get_config_descriptor(uaa->device), + (struct usb2_descriptor *)ed))) { + + if ((ed->bDescriptorType == UDESC_INTERFACE) && + (ed->bLength >= sizeof(*id))) { + id = (struct usb2_interface_descriptor *)ed; + i = id->bInterfaceNumber; + j = id->bAlternateSetting; + } + + if ((ed->bDescriptorType == UDESC_ENDPOINT) && + (ed->bLength >= sizeof(*ed)) && + (i == 1)) { + uint16_t temp; + + temp = UGETW(ed->wMaxPacketSize); + if (temp > wMaxPacketSize) { + wMaxPacketSize = temp; + alt_index = j; } - - break; /* end of interfaces */ } - - temp = UGETW(ed->wMaxPacketSize); - if (temp > wMaxPacketSize) { - wMaxPacketSize = temp; - alt_index = i; - } - - j ++; } /* Set alt configuration on interface #1 only if we found it */ From thompsa at FreeBSD.org Sun Apr 5 11:19:50 2009 From: thompsa at FreeBSD.org (Andrew Thompson) Date: Sun Apr 5 11:21:06 2009 Subject: svn commit: r190729 - head/sys/dev/usb Message-ID: <200904051819.n35IJg9r027683@svn.freebsd.org> Author: thompsa Date: Sun Apr 5 18:19:42 2009 New Revision: 190729 URL: http://svn.freebsd.org/changeset/base/190729 Log: MFp4 //depot/projects/usb@159864 Fix possible deadlock with UGEN at detach. Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/usb_dev.c Modified: head/sys/dev/usb/usb_dev.c ============================================================================== --- head/sys/dev/usb/usb_dev.c Sun Apr 5 18:19:30 2009 (r190728) +++ head/sys/dev/usb/usb_dev.c Sun Apr 5 18:19:42 2009 (r190729) @@ -89,7 +89,7 @@ static void usb2_loc_fill(struct usb2_fs struct usb2_cdev_privdata *); static void usb2_close(void *); static usb2_error_t usb2_ref_device(struct usb2_cdev_privdata *, int); -static usb2_error_t usb2_usb_ref_location(struct usb2_cdev_privdata *); +static usb2_error_t usb2_usb_ref_device(struct usb2_cdev_privdata *); static void usb2_unref_device(struct usb2_cdev_privdata *); static d_open_t usb2_open; @@ -180,6 +180,22 @@ usb2_ref_device(struct usb2_cdev_privdat DPRINTFN(2, "no dev ref\n"); goto error; } + if (need_uref) { + DPRINTFN(2, "ref udev - needed\n"); + cpd->udev->refcount++; + cpd->is_uref = 1; + + mtx_unlock(&usb2_ref_lock); + + /* + * We need to grab the sx-lock before grabbing the + * FIFO refs to avoid deadlock at detach! + */ + sx_xlock(cpd->udev->default_sx + 1); + + mtx_lock(&usb2_ref_lock); + } + /* check if we are doing an open */ if (cpd->fflags == 0) { /* set defaults */ @@ -240,31 +256,28 @@ usb2_ref_device(struct usb2_cdev_privdat DPRINTFN(2, "ref read\n"); cpd->rxfifo->refcount++; } - if (need_uref) { - DPRINTFN(2, "ref udev - needed\n"); - cpd->udev->refcount++; - cpd->is_uref = 1; - } mtx_unlock(&usb2_ref_lock); if (cpd->is_uref) { - /* - * We are about to alter the bus-state. Apply the - * required locks. - */ - sx_xlock(cpd->udev->default_sx + 1); mtx_lock(&Giant); /* XXX */ } return (0); error: + if (cpd->is_uref) { + sx_unlock(cpd->udev->default_sx + 1); + if (--(cpd->udev->refcount) == 0) { + usb2_cv_signal(cpd->udev->default_cv + 1); + } + cpd->is_uref = 0; + } mtx_unlock(&usb2_ref_lock); DPRINTFN(2, "fail\n"); return (USB_ERR_INVAL); } /*------------------------------------------------------------------------* - * usb2_usb_ref_location + * usb2_usb_ref_device * * This function is used to upgrade an USB reference to include the * USB device reference on a USB location. @@ -274,46 +287,21 @@ error: * Else: Failure. *------------------------------------------------------------------------*/ static usb2_error_t -usb2_usb_ref_location(struct usb2_cdev_privdata *cpd) +usb2_usb_ref_device(struct usb2_cdev_privdata *cpd) { /* * Check if we already got an USB reference on this location: */ - if (cpd->is_uref) { + if (cpd->is_uref) return (0); /* success */ - } - mtx_lock(&usb2_ref_lock); - if (cpd->bus != devclass_get_softc(usb2_devclass_ptr, cpd->bus_index)) { - DPRINTFN(2, "bus changed at %u\n", cpd->bus_index); - goto error; - } - if (cpd->udev != cpd->bus->devices[cpd->dev_index]) { - DPRINTFN(2, "device changed at %u\n", cpd->dev_index); - goto error; - } - if (cpd->udev->refcount == USB_DEV_REF_MAX) { - DPRINTFN(2, "no dev ref\n"); - goto error; - } - DPRINTFN(2, "ref udev\n"); - cpd->udev->refcount++; - mtx_unlock(&usb2_ref_lock); - - /* set "uref" */ - cpd->is_uref = 1; /* - * We are about to alter the bus-state. Apply the - * required locks. + * To avoid deadlock at detach we need to drop the FIFO ref + * and re-acquire a new ref! */ - sx_xlock(cpd->udev->default_sx + 1); - mtx_lock(&Giant); /* XXX */ - return (0); + usb2_unref_device(cpd); -error: - mtx_unlock(&usb2_ref_lock); - DPRINTFN(2, "fail\n"); - return (USB_ERR_INVAL); + return (usb2_ref_device(cpd, 1 /* need uref */)); } /*------------------------------------------------------------------------* @@ -1038,7 +1026,7 @@ usb2_ioctl(struct cdev *dev, u_long cmd, err = (f->methods->f_ioctl) (f, cmd, addr, fflags); DPRINTFN(2, "f_ioctl cmd 0x%lx = %d\n", cmd, err); if (err == ENOIOCTL) { - if (usb2_usb_ref_location(cpd)) { + if (usb2_usb_ref_device(cpd)) { err = ENXIO; goto done; } From thompsa at FreeBSD.org Sun Apr 5 11:20:03 2009 From: thompsa at FreeBSD.org (Andrew Thompson) Date: Sun Apr 5 11:21:21 2009 Subject: svn commit: r190730 - in head/sys/dev/usb: . controller Message-ID: <200904051819.n35IJqZu027724@svn.freebsd.org> Author: thompsa Date: Sun Apr 5 18:19:52 2009 New Revision: 190730 URL: http://svn.freebsd.org/changeset/base/190730 Log: MFp4 //depot/projects/usb@159866 - memory usage reduction by only allocating the required USB pipes and USB interfaces. - cleanup some USB parsing functions to be more flexible. Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/controller/usb_controller.c head/sys/dev/usb/usb_device.c head/sys/dev/usb/usb_device.h head/sys/dev/usb/usb_hub.c head/sys/dev/usb/usb_parse.c head/sys/dev/usb/usb_parse.h Modified: head/sys/dev/usb/controller/usb_controller.c ============================================================================== --- head/sys/dev/usb/controller/usb_controller.c Sun Apr 5 18:19:42 2009 (r190729) +++ head/sys/dev/usb/controller/usb_controller.c Sun Apr 5 18:19:52 2009 (r190730) @@ -254,8 +254,8 @@ usb2_bus_detach(struct usb2_proc_msg *pm * Free USB Root device, but not any sub-devices, hence they * are freed by the caller of this function: */ - usb2_detach_device(udev, USB_IFACE_INDEX_ANY, 0); - usb2_free_device(udev); + usb2_free_device(udev, + USB_UNCFG_FLAG_FREE_EP0); mtx_unlock(&Giant); USB_BUS_LOCK(bus); Modified: head/sys/dev/usb/usb_device.c ============================================================================== --- head/sys/dev/usb/usb_device.c Sun Apr 5 18:19:42 2009 (r190729) +++ head/sys/dev/usb/usb_device.c Sun Apr 5 18:19:52 2009 (r190730) @@ -57,10 +57,10 @@ /* function prototypes */ -static void usb2_fill_pipe_data(struct usb2_device *, uint8_t, +static void usb2_init_pipe(struct usb2_device *, uint8_t, struct usb2_endpoint_descriptor *, struct usb2_pipe *); -static void usb2_free_pipe_data(struct usb2_device *, uint8_t, uint8_t); -static void usb2_free_iface_data(struct usb2_device *); +static void usb2_unconfigure(struct usb2_device *, uint8_t); +static void usb2_detach_device(struct usb2_device *, uint8_t, uint8_t); static void usb2_detach_device_sub(struct usb2_device *, device_t *, uint8_t); static uint8_t usb2_probe_and_attach_sub(struct usb2_device *, @@ -70,11 +70,10 @@ static void usb2_init_attach_arg(struct static void usb2_suspend_resume_sub(struct usb2_device *, device_t, uint8_t); static void usb2_clear_stall_proc(struct usb2_proc_msg *_pm); +usb2_error_t usb2_config_parse(struct usb2_device *, uint8_t, uint8_t); #if USB_HAVE_STRINGS static void usb2_check_strings(struct usb2_device *); #endif -static usb2_error_t usb2_fill_iface_data(struct usb2_device *, uint8_t, - uint8_t); #if USB_HAVE_UGEN static void usb2_notify_addq(const char *type, struct usb2_device *); static void usb2_fifo_free_wrap(struct usb2_device *, uint8_t, uint8_t); @@ -268,30 +267,32 @@ usb2_interface_count(struct usb2_device *count = 0; return (USB_ERR_NOT_CONFIGURED); } - *count = udev->cdesc->bNumInterface; + *count = udev->ifaces_max; return (USB_ERR_NORMAL_COMPLETION); } /*------------------------------------------------------------------------* - * usb2_fill_pipe_data + * usb2_init_pipe * * This function will initialise the USB pipe structure pointed to by - * the "pipe" argument. + * the "pipe" argument. The structure pointed to by "pipe" must be + * zeroed before calling this function. *------------------------------------------------------------------------*/ static void -usb2_fill_pipe_data(struct usb2_device *udev, uint8_t iface_index, +usb2_init_pipe(struct usb2_device *udev, uint8_t iface_index, struct usb2_endpoint_descriptor *edesc, struct usb2_pipe *pipe) { + struct usb2_bus_methods *methods; - bzero(pipe, sizeof(*pipe)); + methods = udev->bus->methods; - (udev->bus->methods->pipe_init) (udev, edesc, pipe); + (methods->pipe_init) (udev, edesc, pipe); - if (pipe->methods == NULL) { - /* the pipe is invalid: just return */ + /* check for invalid pipe */ + if (pipe->methods == NULL) return; - } + /* initialise USB pipe structure */ pipe->edesc = edesc; pipe->iface_index = iface_index; @@ -299,40 +300,14 @@ usb2_fill_pipe_data(struct usb2_device * pipe->pipe_q.command = &usb2_pipe_start; /* clear stall, if any */ - if (udev->bus->methods->clear_stall) { + if (methods->clear_stall != NULL) { USB_BUS_LOCK(udev->bus); - (udev->bus->methods->clear_stall) (udev, pipe); + (methods->clear_stall) (udev, pipe); USB_BUS_UNLOCK(udev->bus); } } -/*------------------------------------------------------------------------* - * usb2_free_pipe_data - * - * This function will free USB pipe data for the given interface - * index. Hence we do not have any dynamic allocations we simply clear - * "pipe->edesc" to indicate that the USB pipe structure can be - * reused. The pipes belonging to the given interface should not be in - * use when this function is called and no check is performed to - * prevent this. - *------------------------------------------------------------------------*/ -static void -usb2_free_pipe_data(struct usb2_device *udev, - uint8_t iface_index, uint8_t iface_mask) -{ - struct usb2_pipe *pipe = udev->pipes; - struct usb2_pipe *pipe_end = udev->pipes + USB_EP_MAX; - - while (pipe != pipe_end) { - if ((pipe->iface_index & iface_mask) == iface_index) { - /* free pipe */ - pipe->edesc = NULL; - } - pipe++; - } -} - -/*------------------------------------------------------------------------* +/*-----------------------------------------------------------------------* * usb2_pipe_foreach * * This function will iterate all the USB endpoints except the control @@ -367,123 +342,38 @@ usb2_pipe_foreach(struct usb2_device *ud } /*------------------------------------------------------------------------* - * usb2_fill_iface_data + * usb2_unconfigure + * + * This function will free all USB interfaces and USB pipes belonging + * to an USB device. * - * This function will fill in interface data and allocate USB pipes - * for all the endpoints that belong to the given interface. This - * function is typically called when setting the configuration or when - * setting an alternate interface. + * Flag values, see "USB_UNCFG_FLAG_XXX". *------------------------------------------------------------------------*/ -static usb2_error_t -usb2_fill_iface_data(struct usb2_device *udev, - uint8_t iface_index, uint8_t alt_index) +static void +usb2_unconfigure(struct usb2_device *udev, uint8_t flag) { - struct usb2_interface *iface = usb2_get_iface(udev, iface_index); - struct usb2_pipe *pipe; - struct usb2_pipe *pipe_end; - struct usb2_interface_descriptor *id; - struct usb2_endpoint_descriptor *ed = NULL; - struct usb2_descriptor *desc; - uint8_t nendpt; + uint8_t do_unlock; - if (iface == NULL) { - return (USB_ERR_INVAL); + /* automatic locking */ + if (sx_xlocked(udev->default_sx + 1)) { + do_unlock = 0; + } else { + do_unlock = 1; + sx_xlock(udev->default_sx + 1); } - DPRINTFN(5, "iface_index=%d alt_index=%d\n", - iface_index, alt_index); - - sx_assert(udev->default_sx + 1, SA_LOCKED); - - pipe = udev->pipes; - pipe_end = udev->pipes + USB_EP_MAX; - /* - * Check if any USB pipes on the given USB interface are in - * use: - */ - while (pipe != pipe_end) { - if ((pipe->edesc != NULL) && - (pipe->iface_index == iface_index) && - (pipe->refcount != 0)) { - return (USB_ERR_IN_USE); - } - pipe++; - } + /* detach all interface drivers */ + usb2_detach_device(udev, USB_IFACE_INDEX_ANY, flag); - pipe = &udev->pipes[0]; +#if USB_HAVE_UGEN + /* free all FIFOs except control endpoint FIFOs */ + usb2_fifo_free_wrap(udev, USB_IFACE_INDEX_ANY, flag); - id = usb2_find_idesc(udev->cdesc, iface_index, alt_index); - if (id == NULL) { - return (USB_ERR_INVAL); - } /* - * Free old pipes after we know that an interface descriptor exists, - * if any. + * Free all cdev's, if any. */ - usb2_free_pipe_data(udev, iface_index, 0 - 1); - - /* Setup USB interface structure */ - iface->idesc = id; - iface->alt_index = alt_index; - iface->parent_iface_index = USB_IFACE_INDEX_ANY; - - nendpt = id->bNumEndpoints; - DPRINTFN(5, "found idesc nendpt=%d\n", nendpt); - - desc = (void *)id; - - while (nendpt--) { - DPRINTFN(11, "endpt=%d\n", nendpt); - - while ((desc = usb2_desc_foreach(udev->cdesc, desc))) { - if ((desc->bDescriptorType == UDESC_ENDPOINT) && - (desc->bLength >= sizeof(*ed))) { - goto found; - } - if (desc->bDescriptorType == UDESC_INTERFACE) { - break; - } - } - goto error; - -found: - ed = (void *)desc; - - /* find a free pipe */ - while (pipe != pipe_end) { - if (pipe->edesc == NULL) { - /* pipe is free */ - usb2_fill_pipe_data(udev, iface_index, ed, pipe); - break; - } - pipe++; - } - } - return (USB_ERR_NORMAL_COMPLETION); - -error: - /* passed end, or bad desc */ - DPRINTFN(0, "%s: bad descriptor(s), addr=%d!\n", - __FUNCTION__, udev->address); - - /* free old pipes if any */ - usb2_free_pipe_data(udev, iface_index, 0 - 1); - return (USB_ERR_INVAL); -} - -/*------------------------------------------------------------------------* - * usb2_free_iface_data - * - * This function will free all USB interfaces and USB pipes belonging - * to an USB device. - *------------------------------------------------------------------------*/ -static void -usb2_free_iface_data(struct usb2_device *udev) -{ - struct usb2_interface *iface = udev->ifaces; - struct usb2_interface *iface_end = udev->ifaces + USB_IFACE_MAX; - - /* mtx_assert() */ + usb2_cdev_free(udev); +#endif #if USB_HAVE_COMPAT_LINUX /* free Linux compat device, if any */ @@ -492,18 +382,10 @@ usb2_free_iface_data(struct usb2_device udev->linux_dev = NULL; } #endif - /* free all pipes, if any */ - usb2_free_pipe_data(udev, 0, 0); - /* free all interfaces, if any */ - while (iface != iface_end) { - iface->idesc = NULL; - iface->alt_index = 0; - iface->parent_iface_index = USB_IFACE_INDEX_ANY; - iface++; - } + usb2_config_parse(udev, USB_IFACE_INDEX_ANY, USB_CFG_FREE); - /* free "cdesc" after "ifaces", if any */ + /* free "cdesc" after "ifaces" and "pipes", if any */ if (udev->cdesc != NULL) { if (udev->flags.usb2_mode != USB_MODE_DEVICE) free(udev->cdesc, M_USB); @@ -512,6 +394,10 @@ usb2_free_iface_data(struct usb2_device /* set unconfigured state */ udev->curr_config_no = USB_UNCONFIG_NO; udev->curr_config_index = USB_UNCONFIG_INDEX; + + if (do_unlock) { + sx_unlock(udev->default_sx + 1); + } } /*------------------------------------------------------------------------* @@ -533,7 +419,6 @@ usb2_set_config_index(struct usb2_device struct usb2_config_descriptor *cdp; uint16_t power; uint16_t max_power; - uint8_t nifc; uint8_t selfpowered; uint8_t do_unlock; usb2_error_t err; @@ -548,22 +433,12 @@ usb2_set_config_index(struct usb2_device sx_xlock(udev->default_sx + 1); } - /* detach all interface drivers */ - usb2_detach_device(udev, USB_IFACE_INDEX_ANY, 1); - -#if USB_HAVE_UGEN - /* free all FIFOs except control endpoint FIFOs */ - usb2_fifo_free_wrap(udev, USB_IFACE_INDEX_ANY, 0); - - /* free all configuration data structures */ - usb2_cdev_free(udev); -#endif - usb2_free_iface_data(udev); + usb2_unconfigure(udev, USB_UNCFG_FLAG_FREE_SUBDEV); if (index == USB_UNCONFIG_INDEX) { /* * Leave unallocated when unconfiguring the - * device. "usb2_free_iface_data()" will also reset + * device. "usb2_unconfigure()" will also reset * the current config number and index. */ err = usb2_req_set_config(udev, NULL, USB_UNCONFIG_NO); @@ -585,10 +460,6 @@ usb2_set_config_index(struct usb2_device udev->cdesc = cdp; - if (cdp->bNumInterface > USB_IFACE_MAX) { - DPRINTFN(0, "too many interfaces: %d\n", cdp->bNumInterface); - cdp->bNumInterface = USB_IFACE_MAX; - } /* Figure out if the device is self or bus powered. */ selfpowered = 0; if ((!udev->flags.uq_bus_powered) && @@ -665,14 +536,17 @@ usb2_set_config_index(struct usb2_device if (err) { goto done; } - /* Allocate and fill interface data. */ - nifc = cdp->bNumInterface; - while (nifc--) { - err = usb2_fill_iface_data(udev, nifc, 0); - if (err) { - goto done; - } + + err = usb2_config_parse(udev, USB_IFACE_INDEX_ANY, USB_CFG_ALLOC); + if (err) { + goto done; + } + + err = usb2_config_parse(udev, USB_IFACE_INDEX_ANY, USB_CFG_INIT); + if (err) { + goto done; } + #if USB_HAVE_UGEN /* create device nodes for each endpoint */ usb2_cdev_create(udev); @@ -681,10 +555,7 @@ usb2_set_config_index(struct usb2_device done: DPRINTF("error=%s\n", usb2_errstr(err)); if (err) { -#if USB_HAVE_UGEN - usb2_cdev_free(udev); -#endif - usb2_free_iface_data(udev); + usb2_unconfigure(udev, USB_UNCFG_FLAG_FREE_SUBDEV); } if (do_unlock) { sx_unlock(udev->default_sx + 1); @@ -693,6 +564,205 @@ done: } /*------------------------------------------------------------------------* + * usb2_config_parse + * + * This function will allocate and free USB interfaces and USB pipes, + * parse the USB configuration structure and initialise the USB pipes + * and interfaces. If "iface_index" is not equal to + * "USB_IFACE_INDEX_ANY" then the "cmd" parameter is the + * alternate_setting to be selected for the given interface. Else the + * "cmd" parameter is defined by "USB_CFG_XXX". "iface_index" can be + * "USB_IFACE_INDEX_ANY" or a valid USB interface index. This function + * is typically called when setting the configuration or when setting + * an alternate interface. + * + * Returns: + * 0: Success + * Else: Failure + *------------------------------------------------------------------------*/ +usb2_error_t +usb2_config_parse(struct usb2_device *udev, uint8_t iface_index, uint8_t cmd) +{ + struct usb2_idesc_parse_state ips; + struct usb2_interface_descriptor *id; + struct usb2_endpoint_descriptor *ed; + struct usb2_interface *iface; + struct usb2_pipe *pipe; + usb2_error_t err; + uint8_t ep_curr; + uint8_t ep_max; + uint8_t temp; + uint8_t do_init; + uint8_t alt_index; + + if (iface_index != USB_IFACE_INDEX_ANY) { + /* parameter overload */ + alt_index = cmd; + cmd = USB_CFG_INIT; + } else { + /* not used */ + alt_index = 0; + } + + err = 0; + + DPRINTFN(5, "iface_index=%d cmd=%d\n", + iface_index, cmd); + + if (cmd == USB_CFG_FREE) + goto cleanup; + + if (cmd == USB_CFG_INIT) { + sx_assert(udev->default_sx + 1, SA_LOCKED); + + /* check for in-use pipes */ + + pipe = udev->pipes; + ep_max = udev->pipes_max; + while (ep_max--) { + /* look for matching pipes */ + if ((iface_index == USB_IFACE_INDEX_ANY) || + (iface_index == pipe->iface_index)) { + if (pipe->refcount != 0) { + /* + * This typically indicates a + * more serious error. + */ + err = USB_ERR_IN_USE; + } else { + /* reset pipe */ + memset(pipe, 0, sizeof(*pipe)); + /* make sure we don't zero the pipe again */ + pipe->iface_index = USB_IFACE_INDEX_ANY; + } + } + pipe++; + } + + if (err) + return (err); + } + + memset(&ips, 0, sizeof(ips)); + + ep_curr = 0; + ep_max = 0; + + while ((id = usb2_idesc_foreach(udev->cdesc, &ips))) { + + /* check for interface overflow */ + if (ips.iface_index == USB_IFACE_MAX) + break; /* crazy */ + + iface = udev->ifaces + ips.iface_index; + + /* check for specific interface match */ + + if (cmd == USB_CFG_INIT) { + if ((iface_index != USB_IFACE_INDEX_ANY) && + (iface_index != ips.iface_index)) { + /* wrong interface */ + do_init = 0; + } else if (alt_index != ips.iface_index_alt) { + /* wrong alternate setting */ + do_init = 0; + } else { + /* initialise interface */ + do_init = 1; + } + } else + do_init = 0; + + /* check for new interface */ + if (ips.iface_index_alt == 0) { + /* update current number of endpoints */ + ep_curr = ep_max; + } + /* check for init */ + if (do_init) { + /* setup the USB interface structure */ + iface->idesc = id; + /* default setting */ + iface->parent_iface_index = USB_IFACE_INDEX_ANY; + /* set alternate index */ + iface->alt_index = alt_index; + } + + DPRINTFN(5, "found idesc nendpt=%d\n", id->bNumEndpoints); + + ed = (struct usb2_endpoint_descriptor *)id; + + temp = ep_curr; + + /* iterate all the endpoint descriptors */ + while ((ed = usb2_edesc_foreach(udev->cdesc, ed))) { + + if (temp == USB_EP_MAX) + break; /* crazy */ + + pipe = udev->pipes + temp; + + if (do_init) { + usb2_init_pipe(udev, + ips.iface_index, ed, pipe); + } + + temp ++; + + /* find maximum number of endpoints */ + if (ep_max < temp) + ep_max = temp; + + /* optimalisation */ + id = (struct usb2_interface_descriptor *)ed; + } + } + + /* NOTE: It is valid to have no interfaces and no endpoints! */ + + if (cmd == USB_CFG_ALLOC) { + udev->ifaces_max = ips.iface_index; + udev->ifaces = NULL; + if (udev->ifaces_max != 0) { + udev->ifaces = malloc(sizeof(*iface) * udev->ifaces_max, + M_USB, M_WAITOK | M_ZERO); + if (udev->ifaces == NULL) { + err = USB_ERR_NOMEM; + goto done; + } + } + udev->pipes_max = ep_max; + udev->pipes = NULL; + if (udev->pipes_max != 0) { + udev->pipes = malloc(sizeof(*pipe) * udev->pipes_max, + M_USB, M_WAITOK | M_ZERO); + if (udev->pipes == NULL) { + err = USB_ERR_NOMEM; + goto done; + } + } + } + +done: + if (err) { + if (cmd == USB_CFG_ALLOC) { +cleanup: + /* cleanup */ + if (udev->ifaces != NULL) + free(udev->ifaces, M_USB); + if (udev->pipes != NULL) + free(udev->pipes, M_USB); + + udev->ifaces = NULL; + udev->pipes = NULL; + udev->ifaces_max = 0; + udev->pipes_max = 0; + } + } + return (err); +} + +/*------------------------------------------------------------------------* * usb2_set_alt_interface_index * * This function will select an alternate interface index for the @@ -726,7 +796,8 @@ usb2_set_alt_interface_index(struct usb2 goto done; } if (udev->flags.usb2_mode == USB_MODE_DEVICE) { - usb2_detach_device(udev, iface_index, 1); + usb2_detach_device(udev, iface_index, + USB_UNCFG_FLAG_FREE_SUBDEV); } else { if (iface->alt_index == alt_index) { /* @@ -744,7 +815,8 @@ usb2_set_alt_interface_index(struct usb2 */ usb2_fifo_free_wrap(udev, iface_index, 0); #endif - err = usb2_fill_iface_data(udev, iface_index, alt_index); + + err = usb2_config_parse(udev, iface_index, alt_index); if (err) { goto done; } @@ -874,15 +946,17 @@ usb2_reset_iface_endpoints(struct usb2_d * * This function will try to detach an USB device. If it fails a panic * will result. + * + * Flag values, see "USB_UNCFG_FLAG_XXX". *------------------------------------------------------------------------*/ static void usb2_detach_device_sub(struct usb2_device *udev, device_t *ppdev, - uint8_t free_subdev) + uint8_t flag) { device_t dev; int err; - if (!free_subdev) { + if (!(flag & USB_UNCFG_FLAG_FREE_SUBDEV)) { *ppdev = NULL; @@ -928,14 +1002,15 @@ error: * * The following function will detach the matching interfaces. * This function is NULL safe. + * + * Flag values, see "USB_UNCFG_FLAG_XXX". *------------------------------------------------------------------------*/ void usb2_detach_device(struct usb2_device *udev, uint8_t iface_index, - uint8_t free_subdev) + uint8_t flag) { struct usb2_interface *iface; uint8_t i; - uint8_t do_unlock; if (udev == NULL) { /* nothing to do */ @@ -943,13 +1018,7 @@ usb2_detach_device(struct usb2_device *u } DPRINTFN(4, "udev=%p\n", udev); - /* automatic locking */ - if (sx_xlocked(udev->default_sx + 1)) { - do_unlock = 0; - } else { - do_unlock = 1; - sx_xlock(udev->default_sx + 1); - } + sx_assert(udev->default_sx + 1, SA_LOCKED); /* * First detach the child to give the child's detach routine a @@ -974,11 +1043,7 @@ usb2_detach_device(struct usb2_device *u /* looks like the end of the USB interfaces */ break; } - usb2_detach_device_sub(udev, &iface->subdev, free_subdev); - } - - if (do_unlock) { - sx_unlock(udev->default_sx + 1); + usb2_detach_device_sub(udev, &iface->subdev, flag); } } @@ -1445,7 +1510,7 @@ usb2_alloc_device(device_t parent_dev, s } /* init the default pipe */ - usb2_fill_pipe_data(udev, 0, + usb2_init_pipe(udev, 0, &udev->default_ep_desc, &udev->default_pipe); @@ -1682,7 +1747,8 @@ repeat_set_config: } else if ((config_index + 1) < udev->ddesc.bNumConfigurations) { if ((udev->cdesc->bNumInterface < 2) && - (usb2_get_no_endpoints(udev->cdesc) == 0)) { + (usb2_get_no_descriptors(udev->cdesc, + UDESC_ENDPOINT) == 0)) { DPRINTFN(0, "Found no endpoints " "(trying next config)!\n"); config_index++; @@ -1728,7 +1794,9 @@ repeat_set_config: done: if (err) { /* free device */ - usb2_free_device(udev); + usb2_free_device(udev, + USB_UNCFG_FLAG_FREE_SUBDEV | + USB_UNCFG_FLAG_FREE_EP0); udev = NULL; } return (udev); @@ -1846,14 +1914,21 @@ usb2_cdev_cleanup(void* arg) * usb2_free_device * * This function is NULL safe and will free an USB device. + * + * Flag values, see "USB_UNCFG_FLAG_XXX". *------------------------------------------------------------------------*/ void -usb2_free_device(struct usb2_device *udev) +usb2_free_device(struct usb2_device *udev, uint8_t flag) { - struct usb2_bus *bus = udev->bus;; + struct usb2_bus *bus; + + if (udev == NULL) + return; /* already freed */ DPRINTFN(4, "udev=%p port=%d\n", udev, udev->port_no); + bus = udev->bus;; + #if USB_HAVE_UGEN usb2_notify_addq("-", udev); @@ -1882,26 +1957,18 @@ usb2_free_device(struct usb2_device *ude usb2_cv_wait(udev->default_cv + 1, &usb2_ref_lock); } mtx_unlock(&usb2_ref_lock); + + destroy_dev_sched_cb(udev->default_dev, usb2_cdev_cleanup, + udev->default_dev->si_drv1); #endif if (udev->flags.usb2_mode == USB_MODE_DEVICE) { /* stop receiving any control transfers (Device Side Mode) */ usb2_transfer_unsetup(udev->default_xfer, USB_DEFAULT_XFER_MAX); } -#if USB_HAVE_UGEN - /* free all FIFOs */ - usb2_fifo_free_wrap(udev, USB_IFACE_INDEX_ANY, 1); - /* - * Free all interface related data and FIFOs, if any. - */ - usb2_cdev_free(udev); -#endif - usb2_free_iface_data(udev); -#if USB_HAVE_UGEN - destroy_dev_sched_cb(udev->default_dev, usb2_cdev_cleanup, - udev->default_dev->si_drv1); -#endif + /* the following will get the device unconfigured in software */ + usb2_unconfigure(udev, flag); /* unsetup any leftover default USB transfers */ usb2_transfer_unsetup(udev->default_xfer, USB_DEFAULT_XFER_MAX); @@ -1948,12 +2015,8 @@ usb2_get_iface(struct usb2_device *udev, { struct usb2_interface *iface = udev->ifaces + iface_index; - if ((iface < udev->ifaces) || - (iface_index >= USB_IFACE_MAX) || - (udev->cdesc == NULL) || - (iface_index >= udev->cdesc->bNumInterface)) { + if (iface_index >= udev->ifaces_max) return (NULL); - } return (iface); } @@ -2303,12 +2366,12 @@ usb2_notify_addq(const char *type, struc * * This function will free the FIFOs. * - * Flag values, if "iface_index" is equal to "USB_IFACE_INDEX_ANY". - * 0: Free all FIFOs except generic control endpoints. - * 1: Free all FIFOs. - * - * Flag values, if "iface_index" is not equal to "USB_IFACE_INDEX_ANY". - * Not used. + * Description of "flag" argument: If the USB_UNCFG_FLAG_FREE_EP0 flag + * is set and "iface_index" is set to "USB_IFACE_INDEX_ANY", we free + * all FIFOs. If the USB_UNCFG_FLAG_FREE_EP0 flag is not set and + * "iface_index" is set to "USB_IFACE_INDEX_ANY", we free all non + * control endpoint FIFOs. If "iface_index" is not set to + * "USB_IFACE_INDEX_ANY" the flag has no effect. *------------------------------------------------------------------------*/ static void usb2_fifo_free_wrap(struct usb2_device *udev, @@ -2341,7 +2404,8 @@ usb2_fifo_free_wrap(struct usb2_device * } } else if (iface_index == USB_IFACE_INDEX_ANY) { if ((f->methods == &usb2_ugen_methods) && - (f->dev_ep_index == 0) && (flag == 0) && + (f->dev_ep_index == 0) && + (!(flag & USB_UNCFG_FLAG_FREE_EP0)) && (f->fs_xfer == NULL)) { /* no need to free this FIFO */ continue; Modified: head/sys/dev/usb/usb_device.h ============================================================================== --- head/sys/dev/usb/usb_device.h Sun Apr 5 18:19:42 2009 (r190729) +++ head/sys/dev/usb/usb_device.h Sun Apr 5 18:19:52 2009 (r190730) @@ -32,6 +32,18 @@ struct usb_device; /* linux compat */ #define USB_DEFAULT_XFER_MAX 2 +/* "usb2_parse_config()" commands */ + +#define USB_CFG_ALLOC 0 +#define USB_CFG_FREE 1 +#define USB_CFG_INIT 2 + +/* "usb2_unconfigure()" flags */ + +#define USB_UNCFG_FLAG_NONE 0x00 +#define USB_UNCFG_FLAG_FREE_SUBDEV 0x01 /* subdevices are freed */ +#define USB_UNCFG_FLAG_FREE_EP0 0x02 /* endpoint zero is freed */ + struct usb2_clear_stall_msg { struct usb2_proc_msg hdr; struct usb2_device *udev; @@ -103,10 +115,9 @@ struct usb2_device { struct sx default_sx[2]; struct mtx default_mtx[1]; struct cv default_cv[2]; - struct usb2_interface ifaces[USB_IFACE_MAX]; + struct usb2_interface *ifaces; struct usb2_pipe default_pipe; /* Control Endpoint 0 */ - struct cdev *default_dev; /* Control Endpoint 0 device node */ - struct usb2_pipe pipes[USB_EP_MAX]; + struct usb2_pipe *pipes; struct usb2_power_save pwr_save;/* power save data */ struct usb2_bus *bus; /* our USB BUS */ @@ -123,6 +134,7 @@ struct usb2_device { #if USB_HAVE_UGEN struct usb2_fifo *fifo[USB_FIFO_MAX]; struct usb2_symlink *ugen_symlink; /* our generic symlink */ + struct cdev *default_dev; /* Control Endpoint 0 device node */ LIST_HEAD(,usb2_fs_privdata) pd_list; char ugen_name[20]; /* name of ugenX.X device */ #endif @@ -146,6 +158,8 @@ struct usb2_device { uint8_t hs_port_no; /* high-speed HUB port number */ uint8_t driver_added_refcount; /* our driver added generation count */ uint8_t power_mode; /* see USB_POWER_XXX */ + uint8_t ifaces_max; /* number of interfaces present */ + uint8_t pipes_max; /* number of pipes present */ /* the "flags" field is write-protected by "bus->mtx" */ @@ -184,10 +198,8 @@ usb2_error_t usb2_set_endpoint_stall(str struct usb2_pipe *pipe, uint8_t do_stall); usb2_error_t usb2_suspend_resume(struct usb2_device *udev, uint8_t do_suspend); -void usb2_detach_device(struct usb2_device *udev, uint8_t iface_index, - uint8_t free_subdev); void usb2_devinfo(struct usb2_device *udev, char *dst_ptr, uint16_t dst_len); -void usb2_free_device(struct usb2_device *udev); +void usb2_free_device(struct usb2_device *, uint8_t); void *usb2_find_descriptor(struct usb2_device *udev, void *id, uint8_t iface_index, uint8_t type, uint8_t type_mask, uint8_t subtype, uint8_t subtype_mask); Modified: head/sys/dev/usb/usb_hub.c ============================================================================== --- head/sys/dev/usb/usb_hub.c Sun Apr 5 18:19:42 2009 (r190729) +++ head/sys/dev/usb/usb_hub.c Sun Apr 5 18:19:52 2009 (r190730) @@ -297,8 +297,9 @@ repeat: /* detach any existing devices */ if (child) { - usb2_detach_device(child, USB_IFACE_INDEX_ANY, 1); - usb2_free_device(child); + usb2_free_device(child, + USB_UNCFG_FLAG_FREE_SUBDEV | + USB_UNCFG_FLAG_FREE_EP0); child = NULL; } /* get fresh status */ @@ -417,8 +418,9 @@ repeat: error: if (child) { - usb2_detach_device(child, USB_IFACE_INDEX_ANY, 1); - usb2_free_device(child); + usb2_free_device(child, + USB_UNCFG_FLAG_FREE_SUBDEV | + USB_UNCFG_FLAG_FREE_EP0); child = NULL; } if (err == 0) { @@ -852,9 +854,8 @@ uhub_detach(device_t dev) * Subdevices are not freed, because the caller of * uhub_detach() will do that. */ - usb2_detach_device(child, USB_IFACE_INDEX_ANY, 0); - usb2_free_device(child); - child = NULL; + usb2_free_device(child, + USB_UNCFG_FLAG_FREE_EP0); } usb2_transfer_unsetup(sc->sc_xfer, UHUB_N_TRANSFER); Modified: head/sys/dev/usb/usb_parse.c ============================================================================== --- head/sys/dev/usb/usb_parse.c Sun Apr 5 18:19:42 2009 (r190729) +++ head/sys/dev/usb/usb_parse.c Sun Apr 5 18:19:52 2009 (r190730) @@ -84,113 +84,109 @@ usb2_desc_foreach(struct usb2_config_des } /*------------------------------------------------------------------------* - * usb2_find_idesc + * usb2_idesc_foreach * - * This function will return the interface descriptor, if any, that - * has index "iface_index" and alternate index "alt_index". + * This function will iterate the interface descriptors in the config + * descriptor. The parse state structure should be zeroed before + * calling this function the first time. * * Return values: * NULL: End of descriptors * Else: A valid interface descriptor *------------------------------------------------------------------------*/ struct usb2_interface_descriptor * -usb2_find_idesc(struct usb2_config_descriptor *cd, - uint8_t iface_index, uint8_t alt_index) +usb2_idesc_foreach(struct usb2_config_descriptor *cd, + struct usb2_idesc_parse_state *ps) { - struct usb2_descriptor *desc = NULL; struct usb2_interface_descriptor *id; - uint8_t curidx = 0; - uint8_t lastidx = 0; - uint8_t curaidx = 0; - uint8_t first = 1; - - while ((desc = usb2_desc_foreach(cd, desc))) { - if ((desc->bDescriptorType == UDESC_INTERFACE) && - (desc->bLength >= sizeof(*id))) { - id = (void *)desc; - - if (first) { - first = 0; - lastidx = id->bInterfaceNumber; - - } else if (id->bInterfaceNumber != lastidx) { + uint8_t new_iface; - lastidx = id->bInterfaceNumber; - curidx++; - curaidx = 0; - - } else { - curaidx++; - } - - if ((iface_index == curidx) && (alt_index == curaidx)) { - return (id); - } + /* retrieve current descriptor */ + id = (struct usb2_interface_descriptor *)ps->desc; + /* default is to start a new interface */ + new_iface = 1; + + while (1) { + id = (struct usb2_interface_descriptor *) + usb2_desc_foreach(cd, (struct usb2_descriptor *)id); + if (id == NULL) + break; + if ((id->bDescriptorType == UDESC_INTERFACE) && + (id->bLength >= sizeof(*id))) { + if (ps->iface_no_last == id->bInterfaceNumber) + new_iface = 0; + ps->iface_no_last = id->bInterfaceNumber; + break; } } - return (NULL); + + if (ps->desc == NULL) { + /* first time */ + } else if (new_iface) { + /* new interface */ + ps->iface_index ++; + ps->iface_index_alt = 0; + } else { + /* new alternate interface */ + ps->iface_index_alt ++; + } + + /* store and return current descriptor */ + ps->desc = (struct usb2_descriptor *)id; + return (id); } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From thompsa at FreeBSD.org Sun Apr 5 11:20:11 2009 From: thompsa at FreeBSD.org (Andrew Thompson) Date: Sun Apr 5 11:21:49 2009 Subject: svn commit: r190731 - head/sys/dev/usb Message-ID: <200904051820.n35IK3Yr027776@svn.freebsd.org> Author: thompsa Date: Sun Apr 5 18:20:03 2009 New Revision: 190731 URL: http://svn.freebsd.org/changeset/base/190731 Log: MFp4 //depot/projects/usb@159871 - bugfixes after the memory usage reduction patch - Use "udev->pipes_max" instead of USB_EP_MAX - Use correct "bmRequestType" for getting the config descriptor. Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/usb_device.c head/sys/dev/usb/usb_request.c Modified: head/sys/dev/usb/usb_device.c ============================================================================== --- head/sys/dev/usb/usb_device.c Sun Apr 5 18:19:52 2009 (r190730) +++ head/sys/dev/usb/usb_device.c Sun Apr 5 18:20:03 2009 (r190731) @@ -105,7 +105,7 @@ struct usb2_pipe * usb2_get_pipe_by_addr(struct usb2_device *udev, uint8_t ea_val) { struct usb2_pipe *pipe = udev->pipes; - struct usb2_pipe *pipe_end = udev->pipes + USB_EP_MAX; + struct usb2_pipe *pipe_end = udev->pipes + udev->pipes_max; enum { EA_MASK = (UE_DIR_IN | UE_DIR_OUT | UE_ADDR), }; @@ -160,7 +160,7 @@ usb2_get_pipe(struct usb2_device *udev, const struct usb2_config *setup) { struct usb2_pipe *pipe = udev->pipes; - struct usb2_pipe *pipe_end = udev->pipes + USB_EP_MAX; + struct usb2_pipe *pipe_end = udev->pipes + udev->pipes_max; uint8_t index = setup->ep_index; uint8_t ea_mask; uint8_t ea_val; @@ -320,7 +320,7 @@ usb2_init_pipe(struct usb2_device *udev, struct usb2_pipe * usb2_pipe_foreach(struct usb2_device *udev, struct usb2_pipe *pipe) { - struct usb2_pipe *pipe_end = udev->pipes + USB_EP_MAX; + struct usb2_pipe *pipe_end = udev->pipes + udev->pipes_max; /* be NULL safe */ if (udev == NULL) @@ -924,7 +924,7 @@ usb2_reset_iface_endpoints(struct usb2_d usb2_error_t err; pipe = udev->pipes; - pipe_end = udev->pipes + USB_EP_MAX; + pipe_end = udev->pipes + udev->pipes_max; for (; pipe != pipe_end; pipe++) { Modified: head/sys/dev/usb/usb_request.c ============================================================================== --- head/sys/dev/usb/usb_request.c Sun Apr 5 18:19:52 2009 (r190730) +++ head/sys/dev/usb/usb_request.c Sun Apr 5 18:20:03 2009 (r190731) @@ -97,7 +97,7 @@ usb2_do_clear_stall_callback(struct usb2 struct usb2_pipe *pipe; struct usb2_pipe *pipe_end; struct usb2_pipe *pipe_first; - uint8_t to = USB_EP_MAX; + uint8_t to; udev = xfer->xroot->udev; @@ -106,8 +106,9 @@ usb2_do_clear_stall_callback(struct usb2 /* round robin pipe clear stall */ pipe = udev->pipe_curr; - pipe_end = udev->pipes + USB_EP_MAX; + pipe_end = udev->pipes + udev->pipes_max; pipe_first = udev->pipes; + to = udev->pipes_max; if (pipe == NULL) { pipe = pipe_first; } @@ -854,7 +855,7 @@ usb2_req_get_config_desc_ptr(struct usb2 if (udev->flags.usb2_mode != USB_MODE_DEVICE) return (USB_ERR_INVAL); - req.bmRequestType = UT_READ_CLASS_DEVICE; + req.bmRequestType = UT_READ_DEVICE; req.bRequest = UR_GET_DESCRIPTOR; USETW2(req.wValue, UDESC_CONFIG, config_index); USETW(req.wIndex, 0); From thompsa at FreeBSD.org Sun Apr 5 11:20:19 2009 From: thompsa at FreeBSD.org (Andrew Thompson) Date: Sun Apr 5 11:21:59 2009 Subject: svn commit: r190732 - head/sys/dev/usb Message-ID: <200904051820.n35IKDDL027820@svn.freebsd.org> Author: thompsa Date: Sun Apr 5 18:20:13 2009 New Revision: 190732 URL: http://svn.freebsd.org/changeset/base/190732 Log: MFp4 //depot/projects/usb@159897 Add new endpoint direction values for use with usb2_config Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/usb.h head/sys/dev/usb/usb_device.c Modified: head/sys/dev/usb/usb.h ============================================================================== --- head/sys/dev/usb/usb.h Sun Apr 5 18:20:03 2009 (r190731) +++ head/sys/dev/usb/usb.h Sun Apr 5 18:20:13 2009 (r190732) @@ -461,8 +461,10 @@ struct usb2_endpoint_descriptor { uByte bEndpointAddress; #define UE_GET_DIR(a) ((a) & 0x80) #define UE_SET_DIR(a,d) ((a) | (((d)&1) << 7)) -#define UE_DIR_IN 0x80 -#define UE_DIR_OUT 0x00 +#define UE_DIR_IN 0x80 /* IN-token endpoint, fixed */ +#define UE_DIR_OUT 0x00 /* OUT-token endpoint, fixed */ +#define UE_DIR_RX 0xfd /* for internal use only! */ +#define UE_DIR_TX 0xfe /* for internal use only! */ #define UE_DIR_ANY 0xff /* for internal use only! */ #define UE_ADDR 0x0f #define UE_ADDR_ANY 0xff /* for internal use only! */ Modified: head/sys/dev/usb/usb_device.c ============================================================================== --- head/sys/dev/usb/usb_device.c Sun Apr 5 18:20:03 2009 (r190731) +++ head/sys/dev/usb/usb_device.c Sun Apr 5 18:20:13 2009 (r190732) @@ -174,7 +174,15 @@ usb2_get_pipe(struct usb2_device *udev, /* setup expected endpoint direction mask and value */ - if (setup->direction == UE_DIR_ANY) { + if (setup->direction == UE_DIR_RX) { + ea_mask = (UE_DIR_IN | UE_DIR_OUT); + ea_val = (udev->flags.usb2_mode == USB_MODE_DEVICE) ? + UE_DIR_OUT : UE_DIR_IN; + } else if (setup->direction == UE_DIR_TX) { + ea_mask = (UE_DIR_IN | UE_DIR_OUT); + ea_val = (udev->flags.usb2_mode == USB_MODE_DEVICE) ? + UE_DIR_IN : UE_DIR_OUT; + } else if (setup->direction == UE_DIR_ANY) { /* match any endpoint direction */ ea_mask = 0; ea_val = 0; From thompsa at FreeBSD.org Sun Apr 5 11:20:33 2009 From: thompsa at FreeBSD.org (Andrew Thompson) Date: Sun Apr 5 11:22:16 2009 Subject: svn commit: r190733 - head/sys/dev/usb/storage Message-ID: <200904051820.n35IKOje027868@svn.freebsd.org> Author: thompsa Date: Sun Apr 5 18:20:24 2009 New Revision: 190733 URL: http://svn.freebsd.org/changeset/base/190733 Log: MFp4 //depot/projects/usb@159908 Reduce the amount of memory used by better sizing buffer arrays. Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/storage/ustorage_fs.c Modified: head/sys/dev/usb/storage/ustorage_fs.c ============================================================================== --- head/sys/dev/usb/storage/ustorage_fs.c Sun Apr 5 18:20:13 2009 (r190732) +++ head/sys/dev/usb/storage/ustorage_fs.c Sun Apr 5 18:20:24 2009 (r190733) @@ -63,7 +63,15 @@ SYSCTL_INT(_hw_usb2_ustorage_fs, OID_AUT #define USTORAGE_FS_BULK_SIZE (1UL << 17) /* bytes */ #endif -#define USTORAGE_FS_MAX_LUN 8 /* units */ +#ifndef USTORAGE_FS_MAX_LUN +#define USTORAGE_FS_MAX_LUN 8 /* units */ +#endif + +#ifndef USTORAGE_QDATA_MAX +#define USTORAGE_QDATA_MAX 40 /* bytes */ +#endif + +#define sc_cmd_data sc_cbw.CBWCDB /* * The SCSI ID string must be exactly 28 characters long @@ -172,7 +180,6 @@ struct ustorage_fs_softc { uint8_t cbw_dir; uint8_t cmd_dir; uint8_t lun; - uint8_t cmd_data[CBWCDBLENGTH]; uint8_t cmd_len; uint8_t data_short:1; uint8_t data_error:1; @@ -182,13 +189,10 @@ struct ustorage_fs_softc { struct usb2_device *sc_udev; struct usb2_xfer *sc_xfer[USTORAGE_FS_T_BBB_MAX]; - uint32_t sc_unit; - - uint8_t sc_name[16]; uint8_t sc_iface_no; /* interface number */ uint8_t sc_last_lun; uint8_t sc_last_xfer_index; - uint8_t sc_qdata[1024]; + uint8_t sc_qdata[USTORAGE_QDATA_MAX]; }; /* prototypes */ @@ -258,45 +262,50 @@ struct usb2_config ustorage_fs_bbb_confi .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, - .md.bufsize = sizeof(ustorage_fs_bbb_cbw_t), - .md.flags = {.ext_buffer = 1,}, - .md.callback = &ustorage_fs_t_bbb_command_callback, + .bufsize = sizeof(ustorage_fs_bbb_cbw_t), + .flags = {.ext_buffer = 1,}, + .callback = &ustorage_fs_t_bbb_command_callback, + .usb_mode = USB_MODE_DEVICE, }, [USTORAGE_FS_T_BBB_DATA_DUMP] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, - .md.bufsize = 0, /* use wMaxPacketSize */ - .md.flags = {.proxy_buffer = 1,.short_xfer_ok = 1,}, - .md.callback = &ustorage_fs_t_bbb_data_dump_callback, + .bufsize = 0, /* use wMaxPacketSize */ + .flags = {.proxy_buffer = 1,.short_xfer_ok = 1,}, + .callback = &ustorage_fs_t_bbb_data_dump_callback, + .usb_mode = USB_MODE_DEVICE, }, [USTORAGE_FS_T_BBB_DATA_READ] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, - .md.bufsize = USTORAGE_FS_BULK_SIZE, - .md.flags = {.proxy_buffer = 1,.short_xfer_ok = 1,.ext_buffer = 1}, - .md.callback = &ustorage_fs_t_bbb_data_read_callback, + .bufsize = USTORAGE_FS_BULK_SIZE, + .flags = {.proxy_buffer = 1,.short_xfer_ok = 1,.ext_buffer = 1}, + .callback = &ustorage_fs_t_bbb_data_read_callback, + .usb_mode = USB_MODE_DEVICE, }, [USTORAGE_FS_T_BBB_DATA_WRITE] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, - .md.bufsize = USTORAGE_FS_BULK_SIZE, - .md.flags = {.proxy_buffer = 1,.short_xfer_ok = 1,.ext_buffer = 1}, - .md.callback = &ustorage_fs_t_bbb_data_write_callback, + .bufsize = USTORAGE_FS_BULK_SIZE, + .flags = {.proxy_buffer = 1,.short_xfer_ok = 1,.ext_buffer = 1}, + .callback = &ustorage_fs_t_bbb_data_write_callback, + .usb_mode = USB_MODE_DEVICE, }, [USTORAGE_FS_T_BBB_STATUS] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, - .md.bufsize = sizeof(ustorage_fs_bbb_csw_t), - .md.flags = {.short_xfer_ok = 1,.ext_buffer = 1,}, - .md.callback = &ustorage_fs_t_bbb_status_callback, + .bufsize = sizeof(ustorage_fs_bbb_csw_t), + .flags = {.short_xfer_ok = 1,.ext_buffer = 1,}, + .callback = &ustorage_fs_t_bbb_status_callback, + .usb_mode = USB_MODE_DEVICE, }, }; @@ -335,6 +344,7 @@ ustorage_fs_attach(device_t dev) struct usb2_attach_arg *uaa = device_get_ivars(dev); struct usb2_interface_descriptor *id; int err; + int unit; /* * NOTE: the softc struct is bzero-ed in device_set_driver. @@ -344,9 +354,9 @@ ustorage_fs_attach(device_t dev) sc->sc_dev = dev; sc->sc_udev = uaa->device; - sc->sc_unit = device_get_unit(dev); + unit = device_get_unit(dev); - if (sc->sc_unit == 0) { + if (unit == 0) { if (ustorage_fs_ramdisk == NULL) { /* * allocate a memory image for our ramdisk until @@ -362,8 +372,6 @@ ustorage_fs_attach(device_t dev) sc->sc_lun[0].num_sectors = USTORAGE_FS_RAM_SECT; sc->sc_lun[0].removable = 1; } - snprintf(sc->sc_name, sizeof(sc->sc_name), - "%s", device_get_nameunit(dev)); device_set_usb2_desc(dev); @@ -544,11 +552,6 @@ ustorage_fs_t_bbb_command_callback(struc sc->sc_transfer.cmd_len); break; } - bcopy(sc->sc_cbw.CBWCDB, sc->sc_transfer.cmd_data, - sc->sc_transfer.cmd_len); - - bzero(sc->sc_cbw.CBWCDB + sc->sc_transfer.cmd_len, - sizeof(sc->sc_cbw.CBWCDB) - sc->sc_transfer.cmd_len); error = ustorage_fs_do_cmd(sc); if (error) { @@ -927,17 +930,17 @@ ustorage_fs_verify(struct ustorage_fs_so /* * Get the starting Logical Block Address */ - lba = get_be32(&sc->sc_transfer.cmd_data[2]); + lba = get_be32(&sc->sc_cmd_data[2]); /* * We allow DPO (Disable Page Out = don't save data in the cache) * but we don't implement it. */ - if ((sc->sc_transfer.cmd_data[1] & ~0x10) != 0) { + if ((sc->sc_cmd_data[1] & ~0x10) != 0) { currlun->sense_data = SS_INVALID_FIELD_IN_CDB; return (1); } - vlen = get_be16(&sc->sc_transfer.cmd_data[7]); + vlen = get_be16(&sc->sc_cmd_data[7]); if (vlen == 0) { goto done; } @@ -998,6 +1001,9 @@ ustorage_fs_inquiry(struct ustorage_fs_s /* Copy in ID string */ memcpy(buf + 8, USTORAGE_FS_ID_STRING, 28); +#if (USTORAGE_QDATA_MAX < 36) +#error "(USTORAGE_QDATA_MAX < 36)" +#endif return (ustorage_fs_min_len(sc, 36, 0 - 1)); } @@ -1063,10 +1069,13 @@ ustorage_fs_request_sense(struct ustorag /* Additional sense length */ buf[12] = ASC(sd); buf[13] = ASCQ(sd); + +#if (USTORAGE_QDATA_MAX < 18) +#error "(USTORAGE_QDATA_MAX < 18)" +#endif return (ustorage_fs_min_len(sc, 18, 0 - 1)); } - /*------------------------------------------------------------------------* * ustorage_fs_read_capacity * @@ -1079,22 +1088,25 @@ ustorage_fs_read_capacity(struct ustorag { uint8_t *buf = sc->sc_transfer.data_ptr; struct ustorage_fs_lun *currlun = sc->sc_transfer.currlun; - uint32_t lba = get_be32(&sc->sc_transfer.cmd_data[2]); - uint8_t pmi = sc->sc_transfer.cmd_data[8]; + uint32_t lba = get_be32(&sc->sc_cmd_data[2]); + uint8_t pmi = sc->sc_cmd_data[8]; /* Check the PMI and LBA fields */ if ((pmi > 1) || ((pmi == 0) && (lba != 0))) { currlun->sense_data = SS_INVALID_FIELD_IN_CDB; return (1); } - put_be32(&buf[0], currlun->num_sectors - 1); /* Max logical block */ - put_be32(&buf[4], 512); + put_be32(&buf[0], currlun->num_sectors - 1); /* Block length */ + put_be32(&buf[4], 512); + +#if (USTORAGE_QDATA_MAX < 8) +#error "(USTORAGE_QDATA_MAX < 8)" +#endif return (ustorage_fs_min_len(sc, 8, 0 - 1)); } - /*------------------------------------------------------------------------* * ustorage_fs_mode_sense * @@ -1110,7 +1122,7 @@ ustorage_fs_mode_sense(struct ustorage_f uint8_t *buf0; uint16_t len; uint16_t limit; - uint8_t mscmnd = sc->sc_transfer.cmd_data[0]; + uint8_t mscmnd = sc->sc_cmd_data[0]; uint8_t pc; uint8_t page_code; uint8_t changeable_values; @@ -1118,13 +1130,13 @@ ustorage_fs_mode_sense(struct ustorage_f buf0 = buf; - if ((sc->sc_transfer.cmd_data[1] & ~0x08) != 0) { + if ((sc->sc_cmd_data[1] & ~0x08) != 0) { /* Mask away DBD */ currlun->sense_data = SS_INVALID_FIELD_IN_CDB; return (1); } - pc = sc->sc_transfer.cmd_data[2] >> 6; - page_code = sc->sc_transfer.cmd_data[2] & 0x3f; + pc = sc->sc_cmd_data[2] >> 6; + page_code = sc->sc_cmd_data[2] & 0x3f; if (pc == 3) { currlun->sense_data = SS_SAVING_PARAMETERS_NOT_SUPPORTED; return (1); @@ -1195,6 +1207,10 @@ ustorage_fs_mode_sense(struct ustorage_f buf0[0] = len - 1; else put_be16(buf0, len - 2); + +#if (USTORAGE_QDATA_MAX < 24) +#error "(USTORAGE_QDATA_MAX < 24)" +#endif return (ustorage_fs_min_len(sc, len, 0 - 1)); } @@ -1217,9 +1233,9 @@ ustorage_fs_start_stop(struct ustorage_f currlun->sense_data = SS_INVALID_COMMAND; return (1); } - immed = sc->sc_transfer.cmd_data[1] & 0x01; - loej = sc->sc_transfer.cmd_data[4] & 0x02; - start = sc->sc_transfer.cmd_data[4] & 0x01; + immed = sc->sc_cmd_data[1] & 0x01; + loej = sc->sc_cmd_data[4] & 0x02; + start = sc->sc_cmd_data[4] & 0x01; if (immed || loej || start) { /* compile fix */ @@ -1244,8 +1260,8 @@ ustorage_fs_prevent_allow(struct ustorag currlun->sense_data = SS_INVALID_COMMAND; return (1); } - prevent = sc->sc_transfer.cmd_data[4] & 0x01; - if ((sc->sc_transfer.cmd_data[4] & ~0x01) != 0) { + prevent = sc->sc_cmd_data[4] & 0x01; + if ((sc->sc_cmd_data[4] & ~0x01) != 0) { /* Mask away Prevent */ currlun->sense_data = SS_INVALID_FIELD_IN_CDB; return (1); @@ -1275,12 +1291,16 @@ ustorage_fs_read_format_capacities(struc /* Only the Current / Maximum Capacity Descriptor */ buf += 4; - put_be32(&buf[0], currlun->num_sectors); /* Number of blocks */ - put_be32(&buf[4], 512); + put_be32(&buf[0], currlun->num_sectors); /* Block length */ - buf[4] = 0x02; + put_be32(&buf[4], 512); /* Current capacity */ + buf[4] = 0x02; + +#if (USTORAGE_QDATA_MAX < 12) +#error "(USTORAGE_QDATA_MAX < 12)" +#endif return (ustorage_fs_min_len(sc, 12, 0 - 1)); } @@ -1345,18 +1365,18 @@ ustorage_fs_read(struct ustorage_fs_soft * Get the starting Logical Block Address and check that it's not * too big */ - if (sc->sc_transfer.cmd_data[0] == SC_READ_6) { - lba = (((uint32_t)sc->sc_transfer.cmd_data[1]) << 16) | - get_be16(&sc->sc_transfer.cmd_data[2]); + if (sc->sc_cmd_data[0] == SC_READ_6) { + lba = (((uint32_t)sc->sc_cmd_data[1]) << 16) | + get_be16(&sc->sc_cmd_data[2]); } else { - lba = get_be32(&sc->sc_transfer.cmd_data[2]); + lba = get_be32(&sc->sc_cmd_data[2]); /* * We allow DPO (Disable Page Out = don't save data in the * cache) and FUA (Force Unit Access = don't read from the * cache), but we don't implement them. */ - if ((sc->sc_transfer.cmd_data[1] & ~0x18) != 0) { + if ((sc->sc_cmd_data[1] & ~0x18) != 0) { currlun->sense_data = SS_INVALID_FIELD_IN_CDB; return (1); } @@ -1403,11 +1423,11 @@ ustorage_fs_write(struct ustorage_fs_sof * Get the starting Logical Block Address and check that it's not * too big. */ - if (sc->sc_transfer.cmd_data[0] == SC_WRITE_6) - lba = (((uint32_t)sc->sc_transfer.cmd_data[1]) << 16) | - get_be16(&sc->sc_transfer.cmd_data[2]); + if (sc->sc_cmd_data[0] == SC_WRITE_6) + lba = (((uint32_t)sc->sc_cmd_data[1]) << 16) | + get_be16(&sc->sc_cmd_data[2]); else { - lba = get_be32(&sc->sc_transfer.cmd_data[2]); + lba = get_be32(&sc->sc_cmd_data[2]); /* * We allow DPO (Disable Page Out = don't save data in the @@ -1415,11 +1435,11 @@ ustorage_fs_write(struct ustorage_fs_sof * medium). We don't implement DPO; we implement FUA by * performing synchronous output. */ - if ((sc->sc_transfer.cmd_data[1] & ~0x18) != 0) { + if ((sc->sc_cmd_data[1] & ~0x18) != 0) { currlun->sense_data = SS_INVALID_FIELD_IN_CDB; return (1); } - if (sc->sc_transfer.cmd_data[1] & 0x08) { + if (sc->sc_cmd_data[1] & 0x08) { /* FUA */ /* XXX set SYNC flag here */ } @@ -1495,7 +1515,7 @@ ustorage_fs_check_cmd(struct ustorage_fs uint16_t mask, uint8_t needs_medium) { struct ustorage_fs_lun *currlun; - uint8_t lun = (sc->sc_transfer.cmd_data[1] >> 5); + uint8_t lun = (sc->sc_cmd_data[1] >> 5); uint8_t i; /* Verify the length of the command itself */ @@ -1506,7 +1526,7 @@ ustorage_fs_check_cmd(struct ustorage_fs return (1); } /* Mask away the LUN */ - sc->sc_transfer.cmd_data[1] &= 0x1f; + sc->sc_cmd_data[1] &= 0x1f; /* Check if LUN is correct */ if (lun != sc->sc_transfer.lun) { @@ -1516,7 +1536,7 @@ ustorage_fs_check_cmd(struct ustorage_fs if (sc->sc_transfer.lun <= sc->sc_last_lun) { sc->sc_transfer.currlun = currlun = sc->sc_lun + sc->sc_transfer.lun; - if (sc->sc_transfer.cmd_data[0] != SC_REQUEST_SENSE) { + if (sc->sc_cmd_data[0] != SC_REQUEST_SENSE) { currlun->sense_data = SS_NO_SENSE; currlun->sense_data_info = 0; currlun->info_valid = 0; @@ -1527,8 +1547,8 @@ ustorage_fs_check_cmd(struct ustorage_fs * else must fail! */ if ((currlun->unit_attention_data != SS_NO_SENSE) && - (sc->sc_transfer.cmd_data[0] != SC_INQUIRY) && - (sc->sc_transfer.cmd_data[0] != SC_REQUEST_SENSE)) { + (sc->sc_cmd_data[0] != SC_INQUIRY) && + (sc->sc_cmd_data[0] != SC_REQUEST_SENSE)) { currlun->sense_data = currlun->unit_attention_data; currlun->unit_attention_data = SS_NO_SENSE; return (1); @@ -1540,8 +1560,8 @@ ustorage_fs_check_cmd(struct ustorage_fs * INQUIRY and REQUEST SENSE commands are explicitly allowed * to use unsupported LUNs; all others may not. */ - if ((sc->sc_transfer.cmd_data[0] != SC_INQUIRY) && - (sc->sc_transfer.cmd_data[0] != SC_REQUEST_SENSE)) { + if ((sc->sc_cmd_data[0] != SC_INQUIRY) && + (sc->sc_cmd_data[0] != SC_REQUEST_SENSE)) { return (1); } } @@ -1551,7 +1571,7 @@ ustorage_fs_check_cmd(struct ustorage_fs * non-zero. */ for (i = 0; i != min_cmd_size; i++) { - if (sc->sc_transfer.cmd_data[i] && !(mask & (1UL << i))) { + if (sc->sc_cmd_data[i] && !(mask & (1UL << i))) { if (currlun) { currlun->sense_data = SS_INVALID_FIELD_IN_CDB; } @@ -1589,12 +1609,12 @@ ustorage_fs_do_cmd(struct ustorage_fs_so sc->sc_transfer.data_ptr = sc->sc_qdata; DPRINTF("cmd_data[0]=0x%02x, data_rem=0x%08x\n", - sc->sc_transfer.cmd_data[0], sc->sc_transfer.data_rem); + sc->sc_cmd_data[0], sc->sc_transfer.data_rem); - switch (sc->sc_transfer.cmd_data[0]) { + switch (sc->sc_cmd_data[0]) { case SC_INQUIRY: sc->sc_transfer.cmd_dir = DIR_WRITE; - error = ustorage_fs_min_len(sc, sc->sc_transfer.cmd_data[4], 0 - 1); + error = ustorage_fs_min_len(sc, sc->sc_cmd_data[4], 0 - 1); if (error) { break; } @@ -1609,7 +1629,7 @@ ustorage_fs_do_cmd(struct ustorage_fs_so case SC_MODE_SELECT_6: sc->sc_transfer.cmd_dir = DIR_READ; - error = ustorage_fs_min_len(sc, sc->sc_transfer.cmd_data[4], 0 - 1); + error = ustorage_fs_min_len(sc, sc->sc_cmd_data[4], 0 - 1); if (error) { break; } @@ -1625,7 +1645,7 @@ ustorage_fs_do_cmd(struct ustorage_fs_so case SC_MODE_SELECT_10: sc->sc_transfer.cmd_dir = DIR_READ; error = ustorage_fs_min_len(sc, - get_be16(&sc->sc_transfer.cmd_data[7]), 0 - 1); + get_be16(&sc->sc_cmd_data[7]), 0 - 1); if (error) { break; } @@ -1640,7 +1660,7 @@ ustorage_fs_do_cmd(struct ustorage_fs_so case SC_MODE_SENSE_6: sc->sc_transfer.cmd_dir = DIR_WRITE; - error = ustorage_fs_min_len(sc, sc->sc_transfer.cmd_data[4], 0 - 1); + error = ustorage_fs_min_len(sc, sc->sc_cmd_data[4], 0 - 1); if (error) { break; } @@ -1656,7 +1676,7 @@ ustorage_fs_do_cmd(struct ustorage_fs_so case SC_MODE_SENSE_10: sc->sc_transfer.cmd_dir = DIR_WRITE; error = ustorage_fs_min_len(sc, - get_be16(&sc->sc_transfer.cmd_data[7]), 0 - 1); + get_be16(&sc->sc_cmd_data[7]), 0 - 1); if (error) { break; } @@ -1684,7 +1704,7 @@ ustorage_fs_do_cmd(struct ustorage_fs_so break; case SC_READ_6: - i = sc->sc_transfer.cmd_data[4]; + i = sc->sc_cmd_data[4]; sc->sc_transfer.cmd_dir = DIR_WRITE; temp = ((i == 0) ? 256UL : i); error = ustorage_fs_min_len(sc, temp << 9, mask9); @@ -1702,7 +1722,7 @@ ustorage_fs_do_cmd(struct ustorage_fs_so case SC_READ_10: sc->sc_transfer.cmd_dir = DIR_WRITE; - temp = get_be16(&sc->sc_transfer.cmd_data[7]); + temp = get_be16(&sc->sc_cmd_data[7]); error = ustorage_fs_min_len(sc, temp << 9, mask9); if (error) { break; @@ -1718,7 +1738,7 @@ ustorage_fs_do_cmd(struct ustorage_fs_so case SC_READ_12: sc->sc_transfer.cmd_dir = DIR_WRITE; - temp = get_be32(&sc->sc_transfer.cmd_data[6]); + temp = get_be32(&sc->sc_cmd_data[6]); if (temp >= (1UL << (32 - 9))) { /* numerical overflow */ sc->sc_csw.bCSWStatus = CSWSTATUS_FAILED; @@ -1752,7 +1772,7 @@ ustorage_fs_do_cmd(struct ustorage_fs_so case SC_READ_FORMAT_CAPACITIES: sc->sc_transfer.cmd_dir = DIR_WRITE; error = ustorage_fs_min_len(sc, - get_be16(&sc->sc_transfer.cmd_data[7]), 0 - 1); + get_be16(&sc->sc_cmd_data[7]), 0 - 1); if (error) { break; } @@ -1767,7 +1787,7 @@ ustorage_fs_do_cmd(struct ustorage_fs_so case SC_REQUEST_SENSE: sc->sc_transfer.cmd_dir = DIR_WRITE; - error = ustorage_fs_min_len(sc, sc->sc_transfer.cmd_data[4], 0 - 1); + error = ustorage_fs_min_len(sc, sc->sc_cmd_data[4], 0 - 1); if (error) { break; } @@ -1836,7 +1856,7 @@ ustorage_fs_do_cmd(struct ustorage_fs_so break; case SC_WRITE_6: - i = sc->sc_transfer.cmd_data[4]; + i = sc->sc_cmd_data[4]; sc->sc_transfer.cmd_dir = DIR_READ; temp = ((i == 0) ? 256UL : i); error = ustorage_fs_min_len(sc, temp << 9, mask9); @@ -1854,7 +1874,7 @@ ustorage_fs_do_cmd(struct ustorage_fs_so case SC_WRITE_10: sc->sc_transfer.cmd_dir = DIR_READ; - temp = get_be16(&sc->sc_transfer.cmd_data[7]); + temp = get_be16(&sc->sc_cmd_data[7]); error = ustorage_fs_min_len(sc, temp << 9, mask9); if (error) { break; @@ -1870,7 +1890,7 @@ ustorage_fs_do_cmd(struct ustorage_fs_so case SC_WRITE_12: sc->sc_transfer.cmd_dir = DIR_READ; - temp = get_be32(&sc->sc_transfer.cmd_data[6]); + temp = get_be32(&sc->sc_cmd_data[6]); if (temp > (mask9 >> 9)) { /* numerical overflow */ sc->sc_csw.bCSWStatus = CSWSTATUS_FAILED; From thompsa at FreeBSD.org Sun Apr 5 11:20:44 2009 From: thompsa at FreeBSD.org (Andrew Thompson) Date: Sun Apr 5 11:22:34 2009 Subject: svn commit: r190734 - in head/sys: compat/ndis dev/sound/usb dev/usb dev/usb/bluetooth dev/usb/controller dev/usb/input dev/usb/misc dev/usb/net dev/usb/serial dev/usb/storage dev/usb/wlan Message-ID: <200904051820.n35IKcje027916@svn.freebsd.org> Author: thompsa Date: Sun Apr 5 18:20:38 2009 New Revision: 190734 URL: http://svn.freebsd.org/changeset/base/190734 Log: MFp4 //depot/projects/usb@159909 - make usb2_power_mask_t 16-bit - remove "usb2_config_sub" structure from "usb2_config". To compensate for this "usb2_config" has a new field called "usb_mode" which select for which mode the current xfer entry is active. Options are: a) Device mode only b) Host mode only (default-by-zero) c) Both modes. This change was scripted using the following sed script: "s/\.mh\././g". - the standard packet size table in "usb_transfer.c" is now a function, hence the code for the function uses less memory than the table itself. Submitted by: Hans Petter Selasky Modified: head/sys/compat/ndis/subr_usbd.c head/sys/dev/sound/usb/uaudio.c head/sys/dev/usb/bluetooth/ng_ubt.c head/sys/dev/usb/bluetooth/ubtbcmfw.c head/sys/dev/usb/controller/usb_controller.c head/sys/dev/usb/input/uhid.c head/sys/dev/usb/input/ukbd.c head/sys/dev/usb/input/ums.c head/sys/dev/usb/misc/udbp.c head/sys/dev/usb/net/if_aue.c head/sys/dev/usb/net/if_axe.c head/sys/dev/usb/net/if_cdce.c head/sys/dev/usb/net/if_cdcereg.h head/sys/dev/usb/net/if_cue.c head/sys/dev/usb/net/if_kue.c head/sys/dev/usb/net/if_rue.c head/sys/dev/usb/net/if_udav.c head/sys/dev/usb/serial/u3g.c head/sys/dev/usb/serial/uark.c head/sys/dev/usb/serial/ubsa.c head/sys/dev/usb/serial/ubser.c head/sys/dev/usb/serial/uchcom.c head/sys/dev/usb/serial/ucycom.c head/sys/dev/usb/serial/ufoma.c head/sys/dev/usb/serial/uftdi.c head/sys/dev/usb/serial/ugensa.c head/sys/dev/usb/serial/uipaq.c head/sys/dev/usb/serial/ulpt.c head/sys/dev/usb/serial/umct.c head/sys/dev/usb/serial/umodem.c head/sys/dev/usb/serial/umoscom.c head/sys/dev/usb/serial/uplcom.c head/sys/dev/usb/serial/uslcom.c head/sys/dev/usb/serial/uvisor.c head/sys/dev/usb/serial/uvscom.c head/sys/dev/usb/storage/umass.c head/sys/dev/usb/storage/urio.c head/sys/dev/usb/usb_compat_linux.c head/sys/dev/usb/usb_core.h head/sys/dev/usb/usb_device.c head/sys/dev/usb/usb_device.h head/sys/dev/usb/usb_generic.c head/sys/dev/usb/usb_handle_request.c head/sys/dev/usb/usb_hub.c head/sys/dev/usb/usb_hub.h head/sys/dev/usb/usb_msctest.c head/sys/dev/usb/usb_request.c head/sys/dev/usb/usb_transfer.c head/sys/dev/usb/usb_transfer.h head/sys/dev/usb/wlan/if_rum.c head/sys/dev/usb/wlan/if_ural.c head/sys/dev/usb/wlan/if_zyd.c Modified: head/sys/compat/ndis/subr_usbd.c ============================================================================== --- head/sys/compat/ndis/subr_usbd.c Sun Apr 5 18:20:24 2009 (r190733) +++ head/sys/compat/ndis/subr_usbd.c Sun Apr 5 18:20:38 2009 (r190734) @@ -93,20 +93,20 @@ static struct usb2_config usbd_default_e .endpoint = 0x00, /* control pipe */ .direction = UE_DIR_ANY, .if_index = 0, - .mh.bufsize = USBD_CTRL_READ_BUFFER_SIZE, - .mh.flags = { .short_xfer_ok = 1, }, - .mh.callback = &usbd_ctrl_callback, - .mh.timeout = 5000, /* 5 seconds */ + .bufsize = USBD_CTRL_READ_BUFFER_SIZE, + .flags = { .short_xfer_ok = 1, }, + .callback = &usbd_ctrl_callback, + .timeout = 5000, /* 5 seconds */ }, [USBD_CTRL_WRITE_PIPE] = { .type = UE_CONTROL, .endpoint = 0x00, /* control pipe */ .direction = UE_DIR_ANY, .if_index = 0, - .mh.bufsize = USBD_CTRL_WRITE_BUFFER_SIZE, - .mh.flags = { .proxy_buffer = 1, }, - .mh.callback = &usbd_ctrl_callback, - .mh.timeout = 5000, /* 5 seconds */ + .bufsize = USBD_CTRL_WRITE_BUFFER_SIZE, + .flags = { .proxy_buffer = 1, }, + .callback = &usbd_ctrl_callback, + .timeout = 5000, /* 5 seconds */ } }; @@ -674,11 +674,11 @@ usbd_setup_endpoint(ip, ifidx, ep) cfg.type = UE_GET_XFERTYPE(ep->bmAttributes); cfg.endpoint = UE_GET_ADDR(ep->bEndpointAddress); cfg.direction = UE_GET_DIR(ep->bEndpointAddress); - cfg.mh.callback = &usbd_non_isoc_callback; - cfg.mh.bufsize = UGETW(ep->wMaxPacketSize); - cfg.mh.flags.proxy_buffer = 1; + cfg.callback = &usbd_non_isoc_callback; + cfg.bufsize = UGETW(ep->wMaxPacketSize); + cfg.flags.proxy_buffer = 1; if (UE_GET_DIR(ep->bEndpointAddress) == UE_DIR_IN) - cfg.mh.flags.short_xfer_ok = 1; + cfg.flags.short_xfer_ok = 1; status = usb2_transfer_setup(sc->ndisusb_dev, &ifidx, ne->ne_xfer, &cfg, 1, sc, &sc->ndisusb_mtx); Modified: head/sys/dev/sound/usb/uaudio.c ============================================================================== --- head/sys/dev/sound/usb/uaudio.c Sun Apr 5 18:20:24 2009 (r190733) +++ head/sys/dev/sound/usb/uaudio.c Sun Apr 5 18:20:38 2009 (r190734) @@ -400,20 +400,20 @@ static const struct usb2_config .type = UE_ISOCHRONOUS, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, - .mh.bufsize = 0, /* use "wMaxPacketSize * frames" */ - .mh.frames = UAUDIO_MINFRAMES, - .mh.flags = {.short_xfer_ok = 1,}, - .mh.callback = &uaudio_chan_record_callback, + .bufsize = 0, /* use "wMaxPacketSize * frames" */ + .frames = UAUDIO_MINFRAMES, + .flags = {.short_xfer_ok = 1,}, + .callback = &uaudio_chan_record_callback, }, [1] = { .type = UE_ISOCHRONOUS, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, - .mh.bufsize = 0, /* use "wMaxPacketSize * frames" */ - .mh.frames = UAUDIO_MINFRAMES, - .mh.flags = {.short_xfer_ok = 1,}, - .mh.callback = &uaudio_chan_record_callback, + .bufsize = 0, /* use "wMaxPacketSize * frames" */ + .frames = UAUDIO_MINFRAMES, + .flags = {.short_xfer_ok = 1,}, + .callback = &uaudio_chan_record_callback, }, }; @@ -423,20 +423,20 @@ static const struct usb2_config .type = UE_ISOCHRONOUS, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, - .mh.bufsize = 0, /* use "wMaxPacketSize * frames" */ - .mh.frames = UAUDIO_MINFRAMES, - .mh.flags = {.short_xfer_ok = 1,}, - .mh.callback = &uaudio_chan_play_callback, + .bufsize = 0, /* use "wMaxPacketSize * frames" */ + .frames = UAUDIO_MINFRAMES, + .flags = {.short_xfer_ok = 1,}, + .callback = &uaudio_chan_play_callback, }, [1] = { .type = UE_ISOCHRONOUS, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, - .mh.bufsize = 0, /* use "wMaxPacketSize * frames" */ - .mh.frames = UAUDIO_MINFRAMES, - .mh.flags = {.short_xfer_ok = 1,}, - .mh.callback = &uaudio_chan_play_callback, + .bufsize = 0, /* use "wMaxPacketSize * frames" */ + .frames = UAUDIO_MINFRAMES, + .flags = {.short_xfer_ok = 1,}, + .callback = &uaudio_chan_play_callback, }, }; @@ -446,9 +446,9 @@ static const struct usb2_config .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ .direction = UE_DIR_ANY, - .mh.bufsize = (sizeof(struct usb2_device_request) + 4), - .mh.callback = &uaudio_mixer_write_cfg_callback, - .mh.timeout = 1000, /* 1 second */ + .bufsize = (sizeof(struct usb2_device_request) + 4), + .callback = &uaudio_mixer_write_cfg_callback, + .timeout = 1000, /* 1 second */ }, }; @@ -478,40 +478,40 @@ static const struct usb2_config .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, - .mh.bufsize = UMIDI_BULK_SIZE, - .mh.flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, - .mh.callback = &umidi_bulk_write_callback, + .bufsize = UMIDI_BULK_SIZE, + .flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, + .callback = &umidi_bulk_write_callback, }, [1] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, - .mh.bufsize = UMIDI_BULK_SIZE, - .mh.flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, - .mh.callback = &umidi_bulk_read_callback, + .bufsize = UMIDI_BULK_SIZE, + .flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, + .callback = &umidi_bulk_read_callback, }, [2] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ .direction = UE_DIR_ANY, - .mh.bufsize = sizeof(struct usb2_device_request), - .mh.flags = {}, - .mh.callback = &umidi_write_clear_stall_callback, - .mh.timeout = 1000, /* 1 second */ - .mh.interval = 50, /* 50ms */ + .bufsize = sizeof(struct usb2_device_request), + .flags = {}, + .callback = &umidi_write_clear_stall_callback, + .timeout = 1000, /* 1 second */ + .interval = 50, /* 50ms */ }, [3] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ .direction = UE_DIR_ANY, - .mh.bufsize = sizeof(struct usb2_device_request), - .mh.flags = {}, - .mh.callback = &umidi_read_clear_stall_callback, - .mh.timeout = 1000, /* 1 second */ - .mh.interval = 50, /* 50ms */ + .bufsize = sizeof(struct usb2_device_request), + .flags = {}, + .callback = &umidi_read_clear_stall_callback, + .timeout = 1000, /* 1 second */ + .interval = 50, /* 50ms */ }, }; Modified: head/sys/dev/usb/bluetooth/ng_ubt.c ============================================================================== --- head/sys/dev/usb/bluetooth/ng_ubt.c Sun Apr 5 18:20:24 2009 (r190733) +++ head/sys/dev/usb/bluetooth/ng_ubt.c Sun Apr 5 18:20:38 2009 (r190734) @@ -276,9 +276,9 @@ static const struct usb2_config ubt_con .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, .if_index = 0, - .mh.bufsize = UBT_BULK_WRITE_BUFFER_SIZE, - .mh.flags = { .pipe_bof = 1, .force_short_xfer = 1, }, - .mh.callback = &ubt_bulk_write_callback, + .bufsize = UBT_BULK_WRITE_BUFFER_SIZE, + .flags = { .pipe_bof = 1, .force_short_xfer = 1, }, + .callback = &ubt_bulk_write_callback, }, /* Incoming bulk transfer - ACL packets */ [UBT_IF_0_BULK_DT_RD] = { @@ -286,9 +286,9 @@ static const struct usb2_config ubt_con .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, .if_index = 0, - .mh.bufsize = UBT_BULK_READ_BUFFER_SIZE, - .mh.flags = { .pipe_bof = 1, .short_xfer_ok = 1, }, - .mh.callback = &ubt_bulk_read_callback, + .bufsize = UBT_BULK_READ_BUFFER_SIZE, + .flags = { .pipe_bof = 1, .short_xfer_ok = 1, }, + .callback = &ubt_bulk_read_callback, }, /* Incoming interrupt transfer - HCI events */ [UBT_IF_0_INTR_DT_RD] = { @@ -296,9 +296,9 @@ static const struct usb2_config ubt_con .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, .if_index = 0, - .mh.flags = { .pipe_bof = 1, .short_xfer_ok = 1, }, - .mh.bufsize = UBT_INTR_BUFFER_SIZE, - .mh.callback = &ubt_intr_read_callback, + .flags = { .pipe_bof = 1, .short_xfer_ok = 1, }, + .bufsize = UBT_INTR_BUFFER_SIZE, + .callback = &ubt_intr_read_callback, }, /* Outgoing control transfer - HCI commands */ [UBT_IF_0_CTRL_DT_WR] = { @@ -306,9 +306,9 @@ static const struct usb2_config ubt_con .endpoint = 0x00, /* control pipe */ .direction = UE_DIR_ANY, .if_index = 0, - .mh.bufsize = UBT_CTRL_BUFFER_SIZE, - .mh.callback = &ubt_ctrl_write_callback, - .mh.timeout = 5000, /* 5 seconds */ + .bufsize = UBT_CTRL_BUFFER_SIZE, + .callback = &ubt_ctrl_write_callback, + .timeout = 5000, /* 5 seconds */ }, /* @@ -321,10 +321,10 @@ static const struct usb2_config ubt_con .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, .if_index = 1, - .mh.bufsize = 0, /* use "wMaxPacketSize * frames" */ - .mh.frames = UBT_ISOC_NFRAMES, - .mh.flags = { .short_xfer_ok = 1, }, - .mh.callback = &ubt_isoc_read_callback, + .bufsize = 0, /* use "wMaxPacketSize * frames" */ + .frames = UBT_ISOC_NFRAMES, + .flags = { .short_xfer_ok = 1, }, + .callback = &ubt_isoc_read_callback, }, /* Incoming isochronous transfer #2 - SCO packets */ [UBT_IF_1_ISOC_DT_RD2] = { @@ -332,10 +332,10 @@ static const struct usb2_config ubt_con .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, .if_index = 1, - .mh.bufsize = 0, /* use "wMaxPacketSize * frames" */ - .mh.frames = UBT_ISOC_NFRAMES, - .mh.flags = { .short_xfer_ok = 1, }, - .mh.callback = &ubt_isoc_read_callback, + .bufsize = 0, /* use "wMaxPacketSize * frames" */ + .frames = UBT_ISOC_NFRAMES, + .flags = { .short_xfer_ok = 1, }, + .callback = &ubt_isoc_read_callback, }, /* Outgoing isochronous transfer #1 - SCO packets */ [UBT_IF_1_ISOC_DT_WR1] = { @@ -343,10 +343,10 @@ static const struct usb2_config ubt_con .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, .if_index = 1, - .mh.bufsize = 0, /* use "wMaxPacketSize * frames" */ - .mh.frames = UBT_ISOC_NFRAMES, - .mh.flags = { .short_xfer_ok = 1, }, - .mh.callback = &ubt_isoc_write_callback, + .bufsize = 0, /* use "wMaxPacketSize * frames" */ + .frames = UBT_ISOC_NFRAMES, + .flags = { .short_xfer_ok = 1, }, + .callback = &ubt_isoc_write_callback, }, /* Outgoing isochronous transfer #2 - SCO packets */ [UBT_IF_1_ISOC_DT_WR2] = { @@ -354,10 +354,10 @@ static const struct usb2_config ubt_con .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, .if_index = 1, - .mh.bufsize = 0, /* use "wMaxPacketSize * frames" */ - .mh.frames = UBT_ISOC_NFRAMES, - .mh.flags = { .short_xfer_ok = 1, }, - .mh.callback = &ubt_isoc_write_callback, + .bufsize = 0, /* use "wMaxPacketSize * frames" */ + .frames = UBT_ISOC_NFRAMES, + .flags = { .short_xfer_ok = 1, }, + .callback = &ubt_isoc_write_callback, }, }; Modified: head/sys/dev/usb/bluetooth/ubtbcmfw.c ============================================================================== --- head/sys/dev/usb/bluetooth/ubtbcmfw.c Sun Apr 5 18:20:24 2009 (r190733) +++ head/sys/dev/usb/bluetooth/ubtbcmfw.c Sun Apr 5 18:20:38 2009 (r190734) @@ -118,10 +118,10 @@ static const struct usb2_config ubtbcmfw .endpoint = 0x02, /* fixed */ .direction = UE_DIR_OUT, .if_index = UBTBCMFW_IFACE_IDX, - .mh.bufsize = UBTBCMFW_BSIZE, - .mh.flags = { .pipe_bof = 1, .force_short_xfer = 1, + .bufsize = UBTBCMFW_BSIZE, + .flags = { .pipe_bof = 1, .force_short_xfer = 1, .proxy_buffer = 1, }, - .mh.callback = &ubtbcmfw_write_callback, + .callback = &ubtbcmfw_write_callback, }, [UBTBCMFW_INTR_DT_RD] = { @@ -129,10 +129,10 @@ static const struct usb2_config ubtbcmfw .endpoint = 0x01, /* fixed */ .direction = UE_DIR_IN, .if_index = UBTBCMFW_IFACE_IDX, - .mh.bufsize = UBTBCMFW_BSIZE, - .mh.flags = { .pipe_bof = 1, .short_xfer_ok = 1, + .bufsize = UBTBCMFW_BSIZE, + .flags = { .pipe_bof = 1, .short_xfer_ok = 1, .proxy_buffer = 1, }, - .mh.callback = &ubtbcmfw_read_callback, + .callback = &ubtbcmfw_read_callback, }, }; Modified: head/sys/dev/usb/controller/usb_controller.c ============================================================================== --- head/sys/dev/usb/controller/usb_controller.c Sun Apr 5 18:20:24 2009 (r190733) +++ head/sys/dev/usb/controller/usb_controller.c Sun Apr 5 18:20:38 2009 (r190734) @@ -209,7 +209,6 @@ usb2_bus_explore(struct usb2_proc_msg *p * First update the USB power state! */ usb2_bus_powerd(bus); - /* * Explore the Root USB HUB. This call can sleep, * exiting Giant, which is actually Giant. @@ -328,6 +327,20 @@ usb2_bus_attach(struct usb2_proc_msg *pm USB_BUS_UNLOCK(bus); mtx_lock(&Giant); /* XXX not required by USB */ + /* default power_mask value */ + bus->hw_power_state = + USB_HW_POWER_CONTROL | + USB_HW_POWER_BULK | + USB_HW_POWER_INTERRUPT | + USB_HW_POWER_ISOC | + USB_HW_POWER_NON_ROOT_HUB; + + /* make sure power is set at least once */ + + if (bus->methods->set_hw_power != NULL) { + (bus->methods->set_hw_power) (bus); + } + /* Allocate the Root USB device */ child = usb2_alloc_device(bus->bdev, bus, NULL, 0, 0, 1, Modified: head/sys/dev/usb/input/uhid.c ============================================================================== --- head/sys/dev/usb/input/uhid.c Sun Apr 5 18:20:24 2009 (r190733) +++ head/sys/dev/usb/input/uhid.c Sun Apr 5 18:20:38 2009 (r190734) @@ -316,27 +316,27 @@ static const struct usb2_config uhid_con .type = UE_INTERRUPT, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, - .mh.flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, - .mh.bufsize = UHID_BSIZE, - .mh.callback = &uhid_intr_callback, + .flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, + .bufsize = UHID_BSIZE, + .callback = &uhid_intr_callback, }, [UHID_CTRL_DT_WR] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ .direction = UE_DIR_ANY, - .mh.bufsize = sizeof(struct usb2_device_request) + UHID_BSIZE, - .mh.callback = &uhid_write_callback, - .mh.timeout = 1000, /* 1 second */ + .bufsize = sizeof(struct usb2_device_request) + UHID_BSIZE, + .callback = &uhid_write_callback, + .timeout = 1000, /* 1 second */ }, [UHID_CTRL_DT_RD] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ .direction = UE_DIR_ANY, - .mh.bufsize = sizeof(struct usb2_device_request) + UHID_BSIZE, - .mh.callback = &uhid_read_callback, - .mh.timeout = 1000, /* 1 second */ + .bufsize = sizeof(struct usb2_device_request) + UHID_BSIZE, + .callback = &uhid_read_callback, + .timeout = 1000, /* 1 second */ }, }; Modified: head/sys/dev/usb/input/ukbd.c ============================================================================== --- head/sys/dev/usb/input/ukbd.c Sun Apr 5 18:20:24 2009 (r190733) +++ head/sys/dev/usb/input/ukbd.c Sun Apr 5 18:20:38 2009 (r190734) @@ -562,28 +562,28 @@ static const struct usb2_config ukbd_con .type = UE_INTERRUPT, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, - .mh.flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, - .mh.bufsize = 0, /* use wMaxPacketSize */ - .mh.callback = &ukbd_intr_callback, + .flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, + .bufsize = 0, /* use wMaxPacketSize */ + .callback = &ukbd_intr_callback, }, [UKBD_INTR_CS] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ .direction = UE_DIR_ANY, - .mh.bufsize = sizeof(struct usb2_device_request), - .mh.callback = &ukbd_clear_stall_callback, - .mh.timeout = 1000, /* 1 second */ - .mh.interval = 50, /* 50ms */ + .bufsize = sizeof(struct usb2_device_request), + .callback = &ukbd_clear_stall_callback, + .timeout = 1000, /* 1 second */ + .interval = 50, /* 50ms */ }, [UKBD_CTRL_LED] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ .direction = UE_DIR_ANY, - .mh.bufsize = sizeof(struct usb2_device_request) + 1, - .mh.callback = &ukbd_set_leds_callback, - .mh.timeout = 1000, /* 1 second */ + .bufsize = sizeof(struct usb2_device_request) + 1, + .callback = &ukbd_set_leds_callback, + .timeout = 1000, /* 1 second */ }, }; Modified: head/sys/dev/usb/input/ums.c ============================================================================== --- head/sys/dev/usb/input/ums.c Sun Apr 5 18:20:24 2009 (r190733) +++ head/sys/dev/usb/input/ums.c Sun Apr 5 18:20:38 2009 (r190734) @@ -312,9 +312,9 @@ static const struct usb2_config ums_conf .type = UE_INTERRUPT, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, - .mh.flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, - .mh.bufsize = 0, /* use wMaxPacketSize */ - .mh.callback = &ums_intr_callback, + .flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, + .bufsize = 0, /* use wMaxPacketSize */ + .callback = &ums_intr_callback, }, }; Modified: head/sys/dev/usb/misc/udbp.c ============================================================================== --- head/sys/dev/usb/misc/udbp.c Sun Apr 5 18:20:24 2009 (r190733) +++ head/sys/dev/usb/misc/udbp.c Sun Apr 5 18:20:38 2009 (r190734) @@ -192,39 +192,39 @@ static const struct usb2_config udbp_con .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, - .mh.bufsize = UDBP_BUFFERSIZE, - .mh.flags = {.pipe_bof = 1,.force_short_xfer = 1,}, - .mh.callback = &udbp_bulk_write_callback, - .mh.timeout = UDBP_TIMEOUT, + .bufsize = UDBP_BUFFERSIZE, + .flags = {.pipe_bof = 1,.force_short_xfer = 1,}, + .callback = &udbp_bulk_write_callback, + .timeout = UDBP_TIMEOUT, }, [UDBP_T_RD] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, - .mh.bufsize = UDBP_BUFFERSIZE, - .mh.flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, - .mh.callback = &udbp_bulk_read_callback, + .bufsize = UDBP_BUFFERSIZE, + .flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, + .callback = &udbp_bulk_read_callback, }, [UDBP_T_WR_CS] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ .direction = UE_DIR_ANY, - .mh.bufsize = sizeof(struct usb2_device_request), - .mh.callback = &udbp_bulk_write_clear_stall_callback, - .mh.timeout = 1000, /* 1 second */ - .mh.interval = 50, /* 50ms */ + .bufsize = sizeof(struct usb2_device_request), + .callback = &udbp_bulk_write_clear_stall_callback, + .timeout = 1000, /* 1 second */ + .interval = 50, /* 50ms */ }, [UDBP_T_RD_CS] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ .direction = UE_DIR_ANY, - .mh.bufsize = sizeof(struct usb2_device_request), - .mh.callback = &udbp_bulk_read_clear_stall_callback, - .mh.timeout = 1000, /* 1 second */ - .mh.interval = 50, /* 50ms */ + .bufsize = sizeof(struct usb2_device_request), + .callback = &udbp_bulk_read_clear_stall_callback, + .timeout = 1000, /* 1 second */ + .interval = 50, /* 50ms */ }, }; Modified: head/sys/dev/usb/net/if_aue.c ============================================================================== --- head/sys/dev/usb/net/if_aue.c Sun Apr 5 18:20:24 2009 (r190733) +++ head/sys/dev/usb/net/if_aue.c Sun Apr 5 18:20:38 2009 (r190734) @@ -209,28 +209,28 @@ static const struct usb2_config aue_conf .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, - .mh.bufsize = (MCLBYTES + 2), - .mh.flags = {.pipe_bof = 1,.force_short_xfer = 1,}, - .mh.callback = aue_bulk_write_callback, - .mh.timeout = 10000, /* 10 seconds */ + .bufsize = (MCLBYTES + 2), + .flags = {.pipe_bof = 1,.force_short_xfer = 1,}, + .callback = aue_bulk_write_callback, + .timeout = 10000, /* 10 seconds */ }, [AUE_BULK_DT_RD] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, - .mh.bufsize = (MCLBYTES + 4 + ETHER_CRC_LEN), - .mh.flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, - .mh.callback = aue_bulk_read_callback, + .bufsize = (MCLBYTES + 4 + ETHER_CRC_LEN), + .flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, + .callback = aue_bulk_read_callback, }, [AUE_INTR_DT_RD] = { .type = UE_INTERRUPT, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, - .mh.flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, - .mh.bufsize = 0, /* use wMaxPacketSize */ - .mh.callback = aue_intr_callback, + .flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, + .bufsize = 0, /* use wMaxPacketSize */ + .callback = aue_intr_callback, }, }; Modified: head/sys/dev/usb/net/if_axe.c ============================================================================== --- head/sys/dev/usb/net/if_axe.c Sun Apr 5 18:20:24 2009 (r190733) +++ head/sys/dev/usb/net/if_axe.c Sun Apr 5 18:20:38 2009 (r190734) @@ -182,10 +182,10 @@ static const struct usb2_config axe_conf .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, - .mh.bufsize = AXE_BULK_BUF_SIZE, - .mh.flags = {.pipe_bof = 1,.force_short_xfer = 1,}, - .mh.callback = axe_bulk_write_callback, - .mh.timeout = 10000, /* 10 seconds */ + .bufsize = AXE_BULK_BUF_SIZE, + .flags = {.pipe_bof = 1,.force_short_xfer = 1,}, + .callback = axe_bulk_write_callback, + .timeout = 10000, /* 10 seconds */ }, [AXE_BULK_DT_RD] = { @@ -195,19 +195,19 @@ static const struct usb2_config axe_conf #if (MCLBYTES < 2048) #error "(MCLBYTES < 2048)" #endif - .mh.bufsize = MCLBYTES, - .mh.flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, - .mh.callback = axe_bulk_read_callback, - .mh.timeout = 0, /* no timeout */ + .bufsize = MCLBYTES, + .flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, + .callback = axe_bulk_read_callback, + .timeout = 0, /* no timeout */ }, [AXE_INTR_DT_RD] = { .type = UE_INTERRUPT, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, - .mh.flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, - .mh.bufsize = 0, /* use wMaxPacketSize */ - .mh.callback = axe_intr_callback, + .flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, + .bufsize = 0, /* use wMaxPacketSize */ + .callback = axe_intr_callback, }, }; Modified: head/sys/dev/usb/net/if_cdce.c ============================================================================== --- head/sys/dev/usb/net/if_cdce.c Sun Apr 5 18:20:24 2009 (r190733) +++ head/sys/dev/usb/net/if_cdce.c Sun Apr 5 18:20:38 2009 (r190734) @@ -96,59 +96,54 @@ SYSCTL_INT(_hw_usb2_cdce, OID_AUTO, debu static const struct usb2_config cdce_config[CDCE_N_TRANSFER] = { - [CDCE_BULK_A] = { + [CDCE_BULK_RX] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, - .direction = UE_DIR_OUT, + .direction = UE_DIR_RX, .if_index = 0, - /* Host Mode */ - .mh.frames = CDCE_FRAMES_MAX, - .mh.bufsize = (CDCE_FRAMES_MAX * MCLBYTES), - .mh.flags = {.pipe_bof = 1,.force_short_xfer = 1,.ext_buffer = 1,}, - .mh.callback = cdce_bulk_write_callback, - .mh.timeout = 10000, /* 10 seconds */ - /* Device Mode */ - .md.frames = CDCE_FRAMES_MAX, - .md.bufsize = (CDCE_FRAMES_MAX * MCLBYTES), - .md.flags = {.pipe_bof = 1,.short_frames_ok = 1,.short_xfer_ok = 1,.ext_buffer = 1,}, - .md.callback = cdce_bulk_read_callback, - .md.timeout = 0, /* no timeout */ + .frames = CDCE_FRAMES_MAX, + .bufsize = (CDCE_FRAMES_MAX * MCLBYTES), + .flags = {.pipe_bof = 1,.short_frames_ok = 1,.short_xfer_ok = 1,.ext_buffer = 1,}, + .callback = cdce_bulk_read_callback, + .timeout = 0, /* no timeout */ + .usb_mode = USB_MODE_MAX, /* both modes */ }, - [CDCE_BULK_B] = { + [CDCE_BULK_TX] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, - .direction = UE_DIR_IN, + .direction = UE_DIR_TX, .if_index = 0, - /* Host Mode */ - .mh.frames = CDCE_FRAMES_MAX, - .mh.bufsize = (CDCE_FRAMES_MAX * MCLBYTES), - .mh.flags = {.pipe_bof = 1,.short_frames_ok = 1,.short_xfer_ok = 1,.ext_buffer = 1,}, - .mh.callback = cdce_bulk_read_callback, - .mh.timeout = 0, /* no timeout */ - /* Device Mode */ - .md.frames = CDCE_FRAMES_MAX, - .md.bufsize = (CDCE_FRAMES_MAX * MCLBYTES), - .md.flags = {.pipe_bof = 1,.force_short_xfer = 1,.ext_buffer = 1,}, - .md.callback = cdce_bulk_write_callback, - .md.timeout = 10000, /* 10 seconds */ + .frames = CDCE_FRAMES_MAX, + .bufsize = (CDCE_FRAMES_MAX * MCLBYTES), + .flags = {.pipe_bof = 1,.force_short_xfer = 1,.ext_buffer = 1,}, + .callback = cdce_bulk_write_callback, + .timeout = 10000, /* 10 seconds */ + .usb_mode = USB_MODE_MAX, /* both modes */ }, - [CDCE_INTR] = { + [CDCE_INTR_RX] = { .type = UE_INTERRUPT, .endpoint = UE_ADDR_ANY, - .direction = UE_DIR_IN, + .direction = UE_DIR_RX, .if_index = 1, - /* Host Mode */ - .mh.bufsize = CDCE_IND_SIZE_MAX, - .mh.flags = {.pipe_bof = 1,.short_xfer_ok = 1,.no_pipe_ok = 1,}, - .mh.callback = cdce_intr_read_callback, - .mh.timeout = 0, - /* Device Mode */ - .md.bufsize = CDCE_IND_SIZE_MAX, - .md.flags = {.pipe_bof = 1,.force_short_xfer = 1,.no_pipe_ok = 1,}, - .md.callback = cdce_intr_write_callback, - .md.timeout = 10000, /* 10 seconds */ + .bufsize = CDCE_IND_SIZE_MAX, + .flags = {.pipe_bof = 1,.short_xfer_ok = 1,.no_pipe_ok = 1,}, + .callback = cdce_intr_read_callback, + .timeout = 0, + .usb_mode = USB_MODE_HOST, + }, + + [CDCE_INTR_TX] = { + .type = UE_INTERRUPT, + .endpoint = UE_ADDR_ANY, + .direction = UE_DIR_TX, + .if_index = 1, + .bufsize = CDCE_IND_SIZE_MAX, + .flags = {.pipe_bof = 1,.force_short_xfer = 1,.no_pipe_ok = 1,}, + .callback = cdce_intr_write_callback, + .timeout = 10000, /* 10 seconds */ + .usb_mode = USB_MODE_DEVICE, }, }; @@ -416,8 +411,8 @@ cdce_start(struct usb2_ether *ue) /* * Start the USB transfers, if not already started: */ - usb2_transfer_start(sc->sc_xfer[CDCE_BULK_B]); - usb2_transfer_start(sc->sc_xfer[CDCE_BULK_A]); + usb2_transfer_start(sc->sc_xfer[CDCE_BULK_TX]); + usb2_transfer_start(sc->sc_xfer[CDCE_BULK_RX]); } static void @@ -557,13 +552,11 @@ cdce_init(struct usb2_ether *ue) ifp->if_drv_flags |= IFF_DRV_RUNNING; /* start interrupt transfer */ - usb2_transfer_start(sc->sc_xfer[CDCE_INTR]); + usb2_transfer_start(sc->sc_xfer[CDCE_INTR_RX]); + usb2_transfer_start(sc->sc_xfer[CDCE_INTR_TX]); /* stall data write direction, which depends on USB mode */ - if (usb2_get_mode(sc->sc_ue.ue_udev) == USB_MODE_HOST) - usb2_transfer_set_stall(sc->sc_xfer[CDCE_BULK_A]); - else - usb2_transfer_set_stall(sc->sc_xfer[CDCE_BULK_B]); + usb2_transfer_set_stall(sc->sc_xfer[CDCE_BULK_TX]); /* start data transfers */ cdce_start(ue); @@ -582,9 +575,10 @@ cdce_stop(struct usb2_ether *ue) /* * stop all the transfers, if not already stopped: */ - usb2_transfer_stop(sc->sc_xfer[CDCE_BULK_A]); - usb2_transfer_stop(sc->sc_xfer[CDCE_BULK_B]); - usb2_transfer_stop(sc->sc_xfer[CDCE_INTR]); + usb2_transfer_stop(sc->sc_xfer[CDCE_BULK_RX]); + usb2_transfer_stop(sc->sc_xfer[CDCE_BULK_TX]); + usb2_transfer_stop(sc->sc_xfer[CDCE_INTR_RX]); + usb2_transfer_stop(sc->sc_xfer[CDCE_INTR_TX]); } static void Modified: head/sys/dev/usb/net/if_cdcereg.h ============================================================================== --- head/sys/dev/usb/net/if_cdcereg.h Sun Apr 5 18:20:24 2009 (r190733) +++ head/sys/dev/usb/net/if_cdcereg.h Sun Apr 5 18:20:38 2009 (r190734) @@ -39,9 +39,10 @@ #define CDCE_IND_SIZE_MAX 32 /* bytes */ enum { - CDCE_BULK_A, - CDCE_BULK_B, - CDCE_INTR, + CDCE_BULK_RX, + CDCE_BULK_TX, + CDCE_INTR_RX, + CDCE_INTR_TX, CDCE_N_TRANSFER, }; Modified: head/sys/dev/usb/net/if_cue.c ============================================================================== --- head/sys/dev/usb/net/if_cue.c Sun Apr 5 18:20:24 2009 (r190733) +++ head/sys/dev/usb/net/if_cue.c Sun Apr 5 18:20:38 2009 (r190734) @@ -121,19 +121,19 @@ static const struct usb2_config cue_conf .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, - .mh.bufsize = (MCLBYTES + 2), - .mh.flags = {.pipe_bof = 1,}, - .mh.callback = cue_bulk_write_callback, - .mh.timeout = 10000, /* 10 seconds */ + .bufsize = (MCLBYTES + 2), + .flags = {.pipe_bof = 1,}, + .callback = cue_bulk_write_callback, + .timeout = 10000, /* 10 seconds */ }, [CUE_BULK_DT_RD] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, - .mh.bufsize = (MCLBYTES + 2), - .mh.flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, - .mh.callback = cue_bulk_read_callback, + .bufsize = (MCLBYTES + 2), + .flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, + .callback = cue_bulk_read_callback, }, }; Modified: head/sys/dev/usb/net/if_kue.c ============================================================================== --- head/sys/dev/usb/net/if_kue.c Sun Apr 5 18:20:24 2009 (r190733) +++ head/sys/dev/usb/net/if_kue.c Sun Apr 5 18:20:38 2009 (r190734) @@ -163,20 +163,20 @@ static const struct usb2_config kue_conf .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, - .mh.bufsize = (MCLBYTES + 2 + 64), - .mh.flags = {.pipe_bof = 1,}, - .mh.callback = kue_bulk_write_callback, - .mh.timeout = 10000, /* 10 seconds */ + .bufsize = (MCLBYTES + 2 + 64), + .flags = {.pipe_bof = 1,}, + .callback = kue_bulk_write_callback, + .timeout = 10000, /* 10 seconds */ }, [KUE_BULK_DT_RD] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, - .mh.bufsize = (MCLBYTES + 2), - .mh.flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, - .mh.callback = kue_bulk_read_callback, - .mh.timeout = 0, /* no timeout */ + .bufsize = (MCLBYTES + 2), + .flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, + .callback = kue_bulk_read_callback, + .timeout = 0, /* no timeout */ }, }; Modified: head/sys/dev/usb/net/if_rue.c ============================================================================== --- head/sys/dev/usb/net/if_rue.c Sun Apr 5 18:20:24 2009 (r190733) +++ head/sys/dev/usb/net/if_rue.c Sun Apr 5 18:20:38 2009 (r190734) @@ -141,29 +141,29 @@ static const struct usb2_config rue_conf .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, - .mh.bufsize = MCLBYTES, - .mh.flags = {.pipe_bof = 1,.force_short_xfer = 1,}, - .mh.callback = rue_bulk_write_callback, - .mh.timeout = 10000, /* 10 seconds */ + .bufsize = MCLBYTES, + .flags = {.pipe_bof = 1,.force_short_xfer = 1,}, + .callback = rue_bulk_write_callback, + .timeout = 10000, /* 10 seconds */ }, [RUE_BULK_DT_RD] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, - .mh.bufsize = (MCLBYTES + 4), - .mh.flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, - .mh.callback = rue_bulk_read_callback, - .mh.timeout = 0, /* no timeout */ + .bufsize = (MCLBYTES + 4), + .flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, + .callback = rue_bulk_read_callback, + .timeout = 0, /* no timeout */ }, [RUE_INTR_DT_RD] = { .type = UE_INTERRUPT, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, - .mh.flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, - .mh.bufsize = 0, /* use wMaxPacketSize */ - .mh.callback = rue_intr_callback, + .flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, + .bufsize = 0, /* use wMaxPacketSize */ + .callback = rue_intr_callback, }, }; Modified: head/sys/dev/usb/net/if_udav.c ============================================================================== --- head/sys/dev/usb/net/if_udav.c Sun Apr 5 18:20:24 2009 (r190733) +++ head/sys/dev/usb/net/if_udav.c Sun Apr 5 18:20:38 2009 (r190734) @@ -101,29 +101,29 @@ static const struct usb2_config udav_con .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, - .mh.bufsize = (MCLBYTES + 2), - .mh.flags = {.pipe_bof = 1,.force_short_xfer = 1,}, - .mh.callback = udav_bulk_write_callback, - .mh.timeout = 10000, /* 10 seconds */ + .bufsize = (MCLBYTES + 2), + .flags = {.pipe_bof = 1,.force_short_xfer = 1,}, + .callback = udav_bulk_write_callback, + .timeout = 10000, /* 10 seconds */ }, [UDAV_BULK_DT_RD] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, - .mh.bufsize = (MCLBYTES + 3), - .mh.flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, - .mh.callback = udav_bulk_read_callback, - .mh.timeout = 0, /* no timeout */ + .bufsize = (MCLBYTES + 3), + .flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, + .callback = udav_bulk_read_callback, + .timeout = 0, /* no timeout */ }, [UDAV_INTR_DT_RD] = { .type = UE_INTERRUPT, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, - .mh.flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, - .mh.bufsize = 0, /* use wMaxPacketSize */ - .mh.callback = udav_intr_callback, + .flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, + .bufsize = 0, /* use wMaxPacketSize */ + .callback = udav_intr_callback, }, }; Modified: head/sys/dev/usb/serial/u3g.c ============================================================================== --- head/sys/dev/usb/serial/u3g.c Sun Apr 5 18:20:24 2009 (r190733) +++ head/sys/dev/usb/serial/u3g.c Sun Apr 5 18:20:38 2009 (r190734) @@ -116,18 +116,18 @@ static const struct usb2_config u3g_conf .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, - .mh.bufsize = U3G_BSIZE,/* bytes */ - .mh.flags = {.pipe_bof = 1,.force_short_xfer = 1,}, - .mh.callback = &u3g_write_callback, + .bufsize = U3G_BSIZE,/* bytes */ + .flags = {.pipe_bof = 1,.force_short_xfer = 1,}, + .callback = &u3g_write_callback, }, [U3G_BULK_RD] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, - .mh.bufsize = U3G_BSIZE,/* bytes */ - .mh.flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, - .mh.callback = &u3g_read_callback, + .bufsize = U3G_BSIZE,/* bytes */ + .flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, + .callback = &u3g_read_callback, }, }; Modified: head/sys/dev/usb/serial/uark.c ============================================================================== --- head/sys/dev/usb/serial/uark.c Sun Apr 5 18:20:24 2009 (r190733) +++ head/sys/dev/usb/serial/uark.c Sun Apr 5 18:20:38 2009 (r190734) @@ -106,18 +106,18 @@ static const struct usb2_config .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, - .mh.bufsize = UARK_BUF_SIZE, - .mh.flags = {.pipe_bof = 1,.force_short_xfer = 1,}, - .mh.callback = &uark_bulk_write_callback, + .bufsize = UARK_BUF_SIZE, + .flags = {.pipe_bof = 1,.force_short_xfer = 1,}, + .callback = &uark_bulk_write_callback, }, [UARK_BULK_DT_RD] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, - .mh.bufsize = UARK_BUF_SIZE, - .mh.flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, - .mh.callback = &uark_bulk_read_callback, + .bufsize = UARK_BUF_SIZE, + .flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, + .callback = &uark_bulk_read_callback, }, }; Modified: head/sys/dev/usb/serial/ubsa.c ============================================================================== --- head/sys/dev/usb/serial/ubsa.c Sun Apr 5 18:20:24 2009 (r190733) +++ head/sys/dev/usb/serial/ubsa.c Sun Apr 5 18:20:38 2009 (r190734) @@ -188,27 +188,27 @@ static const struct usb2_config ubsa_con .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, - .mh.bufsize = UBSA_BSIZE, /* bytes */ - .mh.flags = {.pipe_bof = 1,.force_short_xfer = 1,}, - .mh.callback = &ubsa_write_callback, + .bufsize = UBSA_BSIZE, /* bytes */ + .flags = {.pipe_bof = 1,.force_short_xfer = 1,}, + .callback = &ubsa_write_callback, }, [UBSA_BULK_DT_RD] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, - .mh.bufsize = UBSA_BSIZE, /* bytes */ - .mh.flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, - .mh.callback = &ubsa_read_callback, + .bufsize = UBSA_BSIZE, /* bytes */ + .flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, + .callback = &ubsa_read_callback, }, [UBSA_INTR_DT_RD] = { .type = UE_INTERRUPT, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, - .mh.flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, - .mh.bufsize = 0, /* use wMaxPacketSize */ - .mh.callback = &ubsa_intr_callback, + .flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, + .bufsize = 0, /* use wMaxPacketSize */ + .callback = &ubsa_intr_callback, }, }; Modified: head/sys/dev/usb/serial/ubser.c ============================================================================== --- head/sys/dev/usb/serial/ubser.c Sun Apr 5 18:20:24 2009 (r190733) +++ head/sys/dev/usb/serial/ubser.c Sun Apr 5 18:20:38 2009 (r190734) @@ -156,18 +156,18 @@ static const struct usb2_config ubser_co .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, - .mh.bufsize = 0, /* use wMaxPacketSize */ - .mh.flags = {.pipe_bof = 1,.force_short_xfer = 1,}, - .mh.callback = &ubser_write_callback, + .bufsize = 0, /* use wMaxPacketSize */ + .flags = {.pipe_bof = 1,.force_short_xfer = 1,}, + .callback = &ubser_write_callback, }, [UBSER_BULK_DT_RD] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From thompsa at FreeBSD.org Sun Apr 5 11:20:54 2009 From: thompsa at FreeBSD.org (Andrew Thompson) Date: Sun Apr 5 11:22:46 2009 Subject: svn commit: r190735 - in head/sys/dev/usb: . controller Message-ID: <200904051820.n35IKn23027975@svn.freebsd.org> Author: thompsa Date: Sun Apr 5 18:20:49 2009 New Revision: 190735 URL: http://svn.freebsd.org/changeset/base/190735 Log: MFp4 //depot/projects/usb@159922 Refactor how we interface with the root HUB. This cuts around 1200 lines of code totally and saves one thread per USB bus. Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/controller/at91dci.c head/sys/dev/usb/controller/at91dci.h head/sys/dev/usb/controller/atmegadci.c head/sys/dev/usb/controller/atmegadci.h head/sys/dev/usb/controller/ehci.c head/sys/dev/usb/controller/ehci.h head/sys/dev/usb/controller/musb_otg.c head/sys/dev/usb/controller/musb_otg.h head/sys/dev/usb/controller/ohci.c head/sys/dev/usb/controller/ohci.h head/sys/dev/usb/controller/uhci.c head/sys/dev/usb/controller/uhci.h head/sys/dev/usb/controller/usb_controller.c head/sys/dev/usb/controller/uss820dci.c head/sys/dev/usb/controller/uss820dci.h head/sys/dev/usb/usb_bus.h head/sys/dev/usb/usb_controller.h head/sys/dev/usb/usb_core.h head/sys/dev/usb/usb_device.c head/sys/dev/usb/usb_hub.c head/sys/dev/usb/usb_hub.h head/sys/dev/usb/usb_request.c head/sys/dev/usb/usb_sw_transfer.c head/sys/dev/usb/usb_sw_transfer.h head/sys/dev/usb/usb_transfer.c Modified: head/sys/dev/usb/controller/at91dci.c ============================================================================== --- head/sys/dev/usb/controller/at91dci.c Sun Apr 5 18:20:38 2009 (r190734) +++ head/sys/dev/usb/controller/at91dci.c Sun Apr 5 18:20:49 2009 (r190735) @@ -88,8 +88,6 @@ struct usb2_pipe_methods at91dci_device_ struct usb2_pipe_methods at91dci_device_ctrl_methods; struct usb2_pipe_methods at91dci_device_intr_methods; struct usb2_pipe_methods at91dci_device_isoc_fs_methods; -struct usb2_pipe_methods at91dci_root_ctrl_methods; -struct usb2_pipe_methods at91dci_root_intr_methods; static at91dci_cmd_t at91dci_setup_rx; static at91dci_cmd_t at91dci_data_rx; @@ -97,11 +95,8 @@ static at91dci_cmd_t at91dci_data_tx; static at91dci_cmd_t at91dci_data_tx_sync; static void at91dci_device_done(struct usb2_xfer *, usb2_error_t); static void at91dci_do_poll(struct usb2_bus *); -static void at91dci_root_ctrl_poll(struct at91dci_softc *); static void at91dci_standard_done(struct usb2_xfer *); - -static usb2_sw_transfer_func_t at91dci_root_intr_done; -static usb2_sw_transfer_func_t at91dci_root_ctrl_done; +static void at91dci_root_intr(struct at91dci_softc *sc); /* * NOTE: Some of the bits in the CSR register have inverse meaning so @@ -256,10 +251,8 @@ at91dci_pull_down(struct at91dci_softc * } static void -at91dci_wakeup_peer(struct usb2_xfer *xfer) +at91dci_wakeup_peer(struct at91dci_softc *sc) { - struct at91dci_softc *sc = AT9100_DCI_BUS2SC(xfer->xroot->bus); - if (!(sc->sc_flags.status_suspend)) { return; } @@ -736,9 +729,7 @@ at91dci_vbus_interrupt(struct at91dci_so sc->sc_flags.status_vbus = 1; /* complete root HUB interrupt endpoint */ - - usb2_sw_transfer(&sc->sc_root_intr, - &at91dci_root_intr_done); + at91dci_root_intr(sc); } } else { if (sc->sc_flags.status_vbus) { @@ -749,9 +740,7 @@ at91dci_vbus_interrupt(struct at91dci_so sc->sc_flags.change_connect = 1; /* complete root HUB interrupt endpoint */ - - usb2_sw_transfer(&sc->sc_root_intr, - &at91dci_root_intr_done); + at91dci_root_intr(sc); } } USB_BUS_UNLOCK(&sc->sc_bus); @@ -828,9 +817,7 @@ at91dci_interrupt(struct at91dci_softc * } } /* complete root HUB interrupt endpoint */ - - usb2_sw_transfer(&sc->sc_root_intr, - &at91dci_root_intr_done); + at91dci_root_intr(sc); } /* check for any endpoint interrupts */ @@ -1070,31 +1057,17 @@ at91dci_start_standard_chain(struct usb2 } static void -at91dci_root_intr_done(struct usb2_xfer *xfer, - struct usb2_sw_transfer *std) +at91dci_root_intr(struct at91dci_softc *sc) { - struct at91dci_softc *sc = AT9100_DCI_BUS2SC(xfer->xroot->bus); - DPRINTFN(9, "\n"); USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); - if (std->state != USB_SW_TR_PRE_DATA) { - if (std->state == USB_SW_TR_PRE_CALLBACK) { - /* transfer transferred */ - at91dci_device_done(xfer, std->err); - } - goto done; - } - /* setup buffer */ - std->ptr = sc->sc_hub_idata; - std->len = sizeof(sc->sc_hub_idata); - /* set port bit */ sc->sc_hub_idata[0] = 0x02; /* we only have one port */ -done: - return; + uhub_root_intr(&sc->sc_bus, sc->sc_hub_idata, + sizeof(sc->sc_hub_idata)); } static usb2_error_t @@ -1488,7 +1461,6 @@ at91dci_do_poll(struct usb2_bus *bus) USB_BUS_LOCK(&sc->sc_bus); at91dci_interrupt_poll(sc); - at91dci_root_ctrl_poll(sc); USB_BUS_UNLOCK(&sc->sc_bus); } @@ -1696,31 +1668,9 @@ struct usb2_pipe_methods at91dci_device_ /*------------------------------------------------------------------------* * at91dci root control support *------------------------------------------------------------------------* - * simulate a hardware HUB by handling - * all the necessary requests + * Simulate a hardware HUB by handling all the necessary requests. *------------------------------------------------------------------------*/ -static void -at91dci_root_ctrl_open(struct usb2_xfer *xfer) -{ - return; -} - -static void -at91dci_root_ctrl_close(struct usb2_xfer *xfer) -{ - struct at91dci_softc *sc = AT9100_DCI_BUS2SC(xfer->xroot->bus); - - if (sc->sc_root_ctrl.xfer == xfer) { - sc->sc_root_ctrl.xfer = NULL; - } - at91dci_device_done(xfer, USB_ERR_CANCELLED); -} - -/* - * USB descriptors for the virtual Root HUB: - */ - static const struct usb2_device_descriptor at91dci_devd = { .bLength = sizeof(struct usb2_device_descriptor), .bDescriptorType = UDESC_DEVICE, @@ -1765,7 +1715,6 @@ static const struct at91dci_config_desc .bInterfaceSubClass = UISUBCLASS_HUB, .bInterfaceProtocol = UIPROTO_HSHUBSTT, }, - .endpd = { .bLength = sizeof(struct usb2_endpoint_descriptor), .bDescriptorType = UDESC_ENDPOINT, @@ -1805,44 +1754,15 @@ USB_MAKE_STRING_DESC(STRING_VENDOR, at91 USB_MAKE_STRING_DESC(STRING_PRODUCT, at91dci_product); static void -at91dci_root_ctrl_enter(struct usb2_xfer *xfer) +at91dci_roothub_exec(struct usb2_bus *bus) { - return; -} - -static void -at91dci_root_ctrl_start(struct usb2_xfer *xfer) -{ - struct at91dci_softc *sc = AT9100_DCI_BUS2SC(xfer->xroot->bus); - - sc->sc_root_ctrl.xfer = xfer; - - usb2_bus_roothub_exec(xfer->xroot->bus); -} - -static void -at91dci_root_ctrl_task(struct usb2_bus *bus) -{ - at91dci_root_ctrl_poll(AT9100_DCI_BUS2SC(bus)); -} - -static void -at91dci_root_ctrl_done(struct usb2_xfer *xfer, - struct usb2_sw_transfer *std) -{ - struct at91dci_softc *sc = AT9100_DCI_BUS2SC(xfer->xroot->bus); + struct at91dci_softc *sc = AT9100_DCI_BUS2SC(bus); + struct usb2_sw_transfer *std = &sc->sc_bus.roothub_req; uint16_t value; uint16_t index; USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); - if (std->state != USB_SW_TR_SETUP) { - if (std->state == USB_SW_TR_PRE_CALLBACK) { - /* transfer transferred */ - at91dci_device_done(xfer, std->err); - } - goto done; - } /* buffer reset */ std->ptr = USB_ADD_BYTES(&sc->sc_hub_temp, 0); std->len = 0; @@ -2101,7 +2021,7 @@ tr_handle_clear_port_feature: switch (value) { case UHF_PORT_SUSPEND: - at91dci_wakeup_peer(xfer); + at91dci_wakeup_peer(sc); break; case UHF_PORT_ENABLE: @@ -2225,67 +2145,6 @@ done: } static void -at91dci_root_ctrl_poll(struct at91dci_softc *sc) -{ - usb2_sw_transfer(&sc->sc_root_ctrl, - &at91dci_root_ctrl_done); -} - -struct usb2_pipe_methods at91dci_root_ctrl_methods = -{ - .open = at91dci_root_ctrl_open, - .close = at91dci_root_ctrl_close, - .enter = at91dci_root_ctrl_enter, - .start = at91dci_root_ctrl_start, - .enter_is_cancelable = 1, - .start_is_cancelable = 0, -}; - -/*------------------------------------------------------------------------* - * at91dci root interrupt support - *------------------------------------------------------------------------*/ -static void -at91dci_root_intr_open(struct usb2_xfer *xfer) -{ - return; -} - -static void -at91dci_root_intr_close(struct usb2_xfer *xfer) -{ - struct at91dci_softc *sc = AT9100_DCI_BUS2SC(xfer->xroot->bus); - - if (sc->sc_root_intr.xfer == xfer) { - sc->sc_root_intr.xfer = NULL; - } - at91dci_device_done(xfer, USB_ERR_CANCELLED); -} - -static void -at91dci_root_intr_enter(struct usb2_xfer *xfer) -{ - return; -} - -static void -at91dci_root_intr_start(struct usb2_xfer *xfer) -{ - struct at91dci_softc *sc = AT9100_DCI_BUS2SC(xfer->xroot->bus); - - sc->sc_root_intr.xfer = xfer; -} - -struct usb2_pipe_methods at91dci_root_intr_methods = -{ - .open = at91dci_root_intr_open, - .close = at91dci_root_intr_close, - .enter = at91dci_root_intr_enter, - .start = at91dci_root_intr_start, - .enter_is_cancelable = 1, - .start_is_cancelable = 1, -}; - -static void at91dci_xfer_setup(struct usb2_setup_params *parm) { const struct usb2_hw_ep_profile *pf; @@ -2411,24 +2270,7 @@ at91dci_pipe_init(struct usb2_device *ud edesc->bEndpointAddress, udev->flags.usb2_mode, sc->sc_rt_addr); - if (udev->device_index == sc->sc_rt_addr) { - - if (udev->flags.usb2_mode != USB_MODE_HOST) { - /* not supported */ - return; - } - switch (edesc->bEndpointAddress) { - case USB_CONTROL_ENDPOINT: - pipe->methods = &at91dci_root_ctrl_methods; - break; - case UE_DIR_IN | AT9100_DCI_INTR_ENDPT: - pipe->methods = &at91dci_root_intr_methods; - break; - default: - /* do nothing */ - break; - } - } else { + if (udev->device_index != sc->sc_rt_addr) { if (udev->flags.usb2_mode != USB_MODE_DEVICE) { /* not supported */ @@ -2466,5 +2308,5 @@ struct usb2_bus_methods at91dci_bus_meth .get_hw_ep_profile = &at91dci_get_hw_ep_profile, .set_stall = &at91dci_set_stall, .clear_stall = &at91dci_clear_stall, - .roothub_exec = &at91dci_root_ctrl_task, + .roothub_exec = &at91dci_roothub_exec, }; Modified: head/sys/dev/usb/controller/at91dci.h ============================================================================== --- head/sys/dev/usb/controller/at91dci.h Sun Apr 5 18:20:38 2009 (r190734) +++ head/sys/dev/usb/controller/at91dci.h Sun Apr 5 18:20:49 2009 (r190735) @@ -204,8 +204,6 @@ struct at91dci_softc { struct usb2_bus sc_bus; union at91dci_hub_temp sc_hub_temp; LIST_HEAD(, usb2_xfer) sc_interrupt_list_head; - struct usb2_sw_transfer sc_root_ctrl; - struct usb2_sw_transfer sc_root_intr; struct usb2_device *sc_devices[AT91_MAX_DEVICES]; struct resource *sc_io_res; Modified: head/sys/dev/usb/controller/atmegadci.c ============================================================================== --- head/sys/dev/usb/controller/atmegadci.c Sun Apr 5 18:20:38 2009 (r190734) +++ head/sys/dev/usb/controller/atmegadci.c Sun Apr 5 18:20:49 2009 (r190735) @@ -81,8 +81,6 @@ struct usb2_pipe_methods atmegadci_devic struct usb2_pipe_methods atmegadci_device_ctrl_methods; struct usb2_pipe_methods atmegadci_device_intr_methods; struct usb2_pipe_methods atmegadci_device_isoc_fs_methods; -struct usb2_pipe_methods atmegadci_root_ctrl_methods; -struct usb2_pipe_methods atmegadci_root_intr_methods; static atmegadci_cmd_t atmegadci_setup_rx; static atmegadci_cmd_t atmegadci_data_rx; @@ -90,11 +88,8 @@ static atmegadci_cmd_t atmegadci_data_tx static atmegadci_cmd_t atmegadci_data_tx_sync; static void atmegadci_device_done(struct usb2_xfer *, usb2_error_t); static void atmegadci_do_poll(struct usb2_bus *); -static void atmegadci_root_ctrl_poll(struct atmegadci_softc *); static void atmegadci_standard_done(struct usb2_xfer *); - -static usb2_sw_transfer_func_t atmegadci_root_intr_done; -static usb2_sw_transfer_func_t atmegadci_root_ctrl_done; +static void atmegadci_root_intr(struct atmegadci_softc *sc); /* * Here is a list of what the chip supports: @@ -201,9 +196,8 @@ atmegadci_pull_down(struct atmegadci_sof } static void -atmegadci_wakeup_peer(struct usb2_xfer *xfer) +atmegadci_wakeup_peer(struct atmegadci_softc *sc) { - struct atmegadci_softc *sc = ATMEGA_BUS2SC(xfer->xroot->bus); uint8_t temp; if (!sc->sc_flags.status_suspend) { @@ -625,8 +619,7 @@ atmegadci_vbus_interrupt(struct atmegadc /* complete root HUB interrupt endpoint */ - usb2_sw_transfer(&sc->sc_root_intr, - &atmegadci_root_intr_done); + atmegadci_root_intr(sc); } } else { if (sc->sc_flags.status_vbus) { @@ -638,8 +631,7 @@ atmegadci_vbus_interrupt(struct atmegadc /* complete root HUB interrupt endpoint */ - usb2_sw_transfer(&sc->sc_root_intr, - &atmegadci_root_intr_done); + atmegadci_root_intr(sc); } } } @@ -676,8 +668,7 @@ atmegadci_interrupt(struct atmegadci_sof ATMEGA_UDINT_EORSTE); /* complete root HUB interrupt endpoint */ - usb2_sw_transfer(&sc->sc_root_intr, - &atmegadci_root_intr_done); + atmegadci_root_intr(sc); } /* * If resume and suspend is set at the same time we interpret @@ -699,8 +690,7 @@ atmegadci_interrupt(struct atmegadci_sof ATMEGA_UDINT_EORSTE); /* complete root HUB interrupt endpoint */ - usb2_sw_transfer(&sc->sc_root_intr, - &atmegadci_root_intr_done); + atmegadci_root_intr(sc); } } else if (status & ATMEGA_UDINT_SUSPI) { @@ -717,8 +707,7 @@ atmegadci_interrupt(struct atmegadci_sof ATMEGA_UDINT_EORSTE); /* complete root HUB interrupt endpoint */ - usb2_sw_transfer(&sc->sc_root_intr, - &atmegadci_root_intr_done); + atmegadci_root_intr(sc); } } /* check VBUS */ @@ -953,32 +942,18 @@ atmegadci_start_standard_chain(struct us } static void -atmegadci_root_intr_done(struct usb2_xfer *xfer, - struct usb2_sw_transfer *std) +atmegadci_root_intr(struct atmegadci_softc *sc) { - struct atmegadci_softc *sc = ATMEGA_BUS2SC(xfer->xroot->bus); - DPRINTFN(9, "\n"); USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); - if (std->state != USB_SW_TR_PRE_DATA) { - if (std->state == USB_SW_TR_PRE_CALLBACK) { - /* transfer transferred */ - atmegadci_device_done(xfer, std->err); - } - goto done; - } - /* setup buffer */ - std->ptr = sc->sc_hub_idata; - std->len = sizeof(sc->sc_hub_idata); - /* set port bit */ sc->sc_hub_idata[0] = 0x02; /* we only have one port */ -done: - return; -} + uhub_root_intr(&sc->sc_bus, sc->sc_hub_idata, + sizeof(sc->sc_hub_idata)); + } static usb2_error_t atmegadci_standard_done_sub(struct usb2_xfer *xfer) @@ -1363,7 +1338,6 @@ atmegadci_do_poll(struct usb2_bus *bus) USB_BUS_LOCK(&sc->sc_bus); atmegadci_interrupt_poll(sc); - atmegadci_root_ctrl_poll(sc); USB_BUS_UNLOCK(&sc->sc_bus); } @@ -1575,27 +1549,9 @@ struct usb2_pipe_methods atmegadci_devic /*------------------------------------------------------------------------* * at91dci root control support *------------------------------------------------------------------------* - * simulate a hardware HUB by handling - * all the necessary requests + * Simulate a hardware HUB by handling all the necessary requests. *------------------------------------------------------------------------*/ -static void -atmegadci_root_ctrl_open(struct usb2_xfer *xfer) -{ - return; -} - -static void -atmegadci_root_ctrl_close(struct usb2_xfer *xfer) -{ - struct atmegadci_softc *sc = ATMEGA_BUS2SC(xfer->xroot->bus); - - if (sc->sc_root_ctrl.xfer == xfer) { - sc->sc_root_ctrl.xfer = NULL; - } - atmegadci_device_done(xfer, USB_ERR_CANCELLED); -} - /* * USB descriptors for the virtual Root HUB: */ @@ -1644,7 +1600,6 @@ static const struct atmegadci_config_des .bInterfaceSubClass = UISUBCLASS_HUB, .bInterfaceProtocol = UIPROTO_HSHUBSTT, }, - .endpd = { .bLength = sizeof(struct usb2_endpoint_descriptor), .bDescriptorType = UDESC_ENDPOINT, @@ -1684,45 +1639,16 @@ USB_MAKE_STRING_DESC(STRING_VENDOR, atme USB_MAKE_STRING_DESC(STRING_PRODUCT, atmegadci_product); static void -atmegadci_root_ctrl_enter(struct usb2_xfer *xfer) -{ - return; -} - -static void -atmegadci_root_ctrl_start(struct usb2_xfer *xfer) -{ - struct atmegadci_softc *sc = ATMEGA_BUS2SC(xfer->xroot->bus); - - sc->sc_root_ctrl.xfer = xfer; - - usb2_bus_roothub_exec(xfer->xroot->bus); -} - -static void -atmegadci_root_ctrl_task(struct usb2_bus *bus) -{ - atmegadci_root_ctrl_poll(ATMEGA_BUS2SC(bus)); -} - -static void -atmegadci_root_ctrl_done(struct usb2_xfer *xfer, - struct usb2_sw_transfer *std) +atmegadci_roothub_exec(struct usb2_bus *bus) { - struct atmegadci_softc *sc = ATMEGA_BUS2SC(xfer->xroot->bus); + struct atmegadci_softc *sc = ATMEGA_BUS2SC(bus); + struct usb2_sw_transfer *std = &sc->sc_bus.roothub_req; uint16_t value; uint16_t index; uint8_t temp; USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); - if (std->state != USB_SW_TR_SETUP) { - if (std->state == USB_SW_TR_PRE_CALLBACK) { - /* transfer transferred */ - atmegadci_device_done(xfer, std->err); - } - goto done; - } /* buffer reset */ std->ptr = USB_ADD_BYTES(&sc->sc_hub_temp, 0); std->len = 0; @@ -1981,7 +1907,7 @@ tr_handle_clear_port_feature: switch (value) { case UHF_PORT_SUSPEND: - atmegadci_wakeup_peer(xfer); + atmegadci_wakeup_peer(sc); break; case UHF_PORT_ENABLE: @@ -2130,67 +2056,6 @@ done: } static void -atmegadci_root_ctrl_poll(struct atmegadci_softc *sc) -{ - usb2_sw_transfer(&sc->sc_root_ctrl, - &atmegadci_root_ctrl_done); -} - -struct usb2_pipe_methods atmegadci_root_ctrl_methods = -{ - .open = atmegadci_root_ctrl_open, - .close = atmegadci_root_ctrl_close, - .enter = atmegadci_root_ctrl_enter, - .start = atmegadci_root_ctrl_start, - .enter_is_cancelable = 1, - .start_is_cancelable = 0, -}; - -/*------------------------------------------------------------------------* - * at91dci root interrupt support - *------------------------------------------------------------------------*/ -static void -atmegadci_root_intr_open(struct usb2_xfer *xfer) -{ - return; -} - -static void -atmegadci_root_intr_close(struct usb2_xfer *xfer) -{ - struct atmegadci_softc *sc = ATMEGA_BUS2SC(xfer->xroot->bus); - - if (sc->sc_root_intr.xfer == xfer) { - sc->sc_root_intr.xfer = NULL; - } - atmegadci_device_done(xfer, USB_ERR_CANCELLED); -} - -static void -atmegadci_root_intr_enter(struct usb2_xfer *xfer) -{ - return; -} - -static void -atmegadci_root_intr_start(struct usb2_xfer *xfer) -{ - struct atmegadci_softc *sc = ATMEGA_BUS2SC(xfer->xroot->bus); - - sc->sc_root_intr.xfer = xfer; -} - -struct usb2_pipe_methods atmegadci_root_intr_methods = -{ - .open = atmegadci_root_intr_open, - .close = atmegadci_root_intr_close, - .enter = atmegadci_root_intr_enter, - .start = atmegadci_root_intr_start, - .enter_is_cancelable = 1, - .start_is_cancelable = 1, -}; - -static void atmegadci_xfer_setup(struct usb2_setup_params *parm) { const struct usb2_hw_ep_profile *pf; @@ -2313,24 +2178,7 @@ atmegadci_pipe_init(struct usb2_device * edesc->bEndpointAddress, udev->flags.usb2_mode, sc->sc_rt_addr, udev->device_index); - if (udev->device_index == sc->sc_rt_addr) { - - if (udev->flags.usb2_mode != USB_MODE_HOST) { - /* not supported */ - return; - } - switch (edesc->bEndpointAddress) { - case USB_CONTROL_ENDPOINT: - pipe->methods = &atmegadci_root_ctrl_methods; - break; - case UE_DIR_IN | ATMEGA_INTR_ENDPT: - pipe->methods = &atmegadci_root_intr_methods; - break; - default: - /* do nothing */ - break; - } - } else { + if (udev->device_index != sc->sc_rt_addr) { if (udev->flags.usb2_mode != USB_MODE_DEVICE) { /* not supported */ @@ -2368,5 +2216,5 @@ struct usb2_bus_methods atmegadci_bus_me .get_hw_ep_profile = &atmegadci_get_hw_ep_profile, .set_stall = &atmegadci_set_stall, .clear_stall = &atmegadci_clear_stall, - .roothub_exec = &atmegadci_root_ctrl_task, + .roothub_exec = &atmegadci_roothub_exec, }; Modified: head/sys/dev/usb/controller/atmegadci.h ============================================================================== --- head/sys/dev/usb/controller/atmegadci.h Sun Apr 5 18:20:38 2009 (r190734) +++ head/sys/dev/usb/controller/atmegadci.h Sun Apr 5 18:20:49 2009 (r190735) @@ -34,10 +34,6 @@ #define ATMEGA_MAX_DEVICES (USB_MIN_DEVICES + 1) -#ifndef ATMEGA_HAVE_BUS_SPACE -#define ATMEGA_HAVE_BUS_SPACE 1 -#endif - #define ATMEGA_UEINT 0xF4 #define ATMEGA_UEINT_MASK(n) (1 << (n)) /* endpoint interrupt mask */ @@ -241,8 +237,6 @@ struct atmegadci_softc { struct usb2_bus sc_bus; union atmegadci_hub_temp sc_hub_temp; LIST_HEAD(, usb2_xfer) sc_interrupt_list_head; - struct usb2_sw_transfer sc_root_ctrl; - struct usb2_sw_transfer sc_root_intr; /* must be set by by the bus interface layer */ atmegadci_clocks_t *sc_clocks_on; @@ -251,11 +245,10 @@ struct atmegadci_softc { struct usb2_device *sc_devices[ATMEGA_MAX_DEVICES]; struct resource *sc_irq_res; void *sc_intr_hdl; -#if (ATMEGA_HAVE_BUS_SPACE != 0) struct resource *sc_io_res; bus_space_tag_t sc_io_tag; bus_space_handle_t sc_io_hdl; -#endif + uint8_t sc_rt_addr; /* root hub address */ uint8_t sc_dv_addr; /* device address */ uint8_t sc_conf; /* root hub config */ Modified: head/sys/dev/usb/controller/ehci.c ============================================================================== --- head/sys/dev/usb/controller/ehci.c Sun Apr 5 18:20:38 2009 (r190734) +++ head/sys/dev/usb/controller/ehci.c Sun Apr 5 18:20:49 2009 (r190735) @@ -93,17 +93,12 @@ extern struct usb2_pipe_methods ehci_dev extern struct usb2_pipe_methods ehci_device_intr_methods; extern struct usb2_pipe_methods ehci_device_isoc_fs_methods; extern struct usb2_pipe_methods ehci_device_isoc_hs_methods; -extern struct usb2_pipe_methods ehci_root_ctrl_methods; -extern struct usb2_pipe_methods ehci_root_intr_methods; static void ehci_do_poll(struct usb2_bus *bus); -static void ehci_root_ctrl_poll(ehci_softc_t *sc); static void ehci_device_done(struct usb2_xfer *xfer, usb2_error_t error); static uint8_t ehci_check_transfer(struct usb2_xfer *xfer); static void ehci_timeout(void *arg); - -static usb2_sw_transfer_func_t ehci_root_intr_done; -static usb2_sw_transfer_func_t ehci_root_ctrl_done; +static void ehci_root_intr(ehci_softc_t *sc); struct ehci_std_temp { ehci_softc_t *sc; @@ -1415,8 +1410,7 @@ ehci_pcd_enable(ehci_softc_t *sc) /* acknowledge any PCD interrupt */ EOWRITE4(sc, EHCI_USBSTS, EHCI_STS_PCD); - usb2_sw_transfer(&sc->sc_root_intr, - &ehci_root_intr_done); + ehci_root_intr(sc); } static void @@ -1486,8 +1480,7 @@ ehci_interrupt(ehci_softc_t *sc) sc->sc_eintrs &= ~EHCI_STS_PCD; EOWRITE4(sc, EHCI_USBINTR, sc->sc_eintrs); - usb2_sw_transfer(&sc->sc_root_intr, - &ehci_root_intr_done); + ehci_root_intr(sc); /* do not allow RHSC interrupts > 1 per second */ usb2_callout_reset(&sc->sc_tmo_pcd, hz, @@ -1531,7 +1524,6 @@ ehci_do_poll(struct usb2_bus *bus) USB_BUS_LOCK(&sc->sc_bus); ehci_interrupt_poll(sc); - ehci_root_ctrl_poll(sc); USB_BUS_UNLOCK(&sc->sc_bus); } @@ -1979,28 +1971,15 @@ ehci_setup_standard_chain(struct usb2_xf } static void -ehci_root_intr_done(struct usb2_xfer *xfer, - struct usb2_sw_transfer *std) +ehci_root_intr(ehci_softc_t *sc) { - ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus); uint16_t i; uint16_t m; USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); - if (std->state != USB_SW_TR_PRE_DATA) { - if (std->state == USB_SW_TR_PRE_CALLBACK) { - /* transfer transferred */ - ehci_device_done(xfer, std->err); - } - goto done; - } - /* setup buffer */ - std->ptr = sc->sc_hub_idata; - std->len = sizeof(sc->sc_hub_idata); - /* clear any old interrupt data */ - bzero(sc->sc_hub_idata, sizeof(sc->sc_hub_idata)); + memset(sc->sc_hub_idata, 0, sizeof(sc->sc_hub_idata)); /* set bits */ m = (sc->sc_noport + 1); @@ -2014,8 +1993,8 @@ ehci_root_intr_done(struct usb2_xfer *xf DPRINTF("port %d changed\n", i); } } -done: - return; + uhub_root_intr(&sc->sc_bus, sc->sc_hub_idata, + sizeof(sc->sc_hub_idata)); } static void @@ -2932,31 +2911,9 @@ struct usb2_pipe_methods ehci_device_iso /*------------------------------------------------------------------------* * ehci root control support *------------------------------------------------------------------------* - * simulate a hardware hub by handling - * all the necessary requests + * Simulate a hardware hub by handling all the necessary requests. *------------------------------------------------------------------------*/ -static void -ehci_root_ctrl_open(struct usb2_xfer *xfer) -{ - return; -} - -static void -ehci_root_ctrl_close(struct usb2_xfer *xfer) -{ - ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus); - - if (sc->sc_root_ctrl.xfer == xfer) { - sc->sc_root_ctrl.xfer = NULL; - } - ehci_device_done(xfer, USB_ERR_CANCELLED); -} - -/* data structures and routines - * to emulate the root hub: - */ - static const struct usb2_device_descriptor ehci_devd = { @@ -2997,7 +2954,6 @@ static const struct ehci_config_desc ehc .bmAttributes = UC_SELF_POWERED, .bMaxPower = 0 /* max power */ }, - .ifcd = { .bLength = sizeof(struct usb2_interface_descriptor), .bDescriptorType = UDESC_INTERFACE, @@ -3007,7 +2963,6 @@ static const struct ehci_config_desc ehc .bInterfaceProtocol = UIPROTO_HSHUBSTT, 0 }, - .endpd = { .bLength = sizeof(struct usb2_endpoint_descriptor), .bDescriptorType = UDESC_ENDPOINT, @@ -3044,34 +2999,10 @@ ehci_disown(ehci_softc_t *sc, uint16_t i } static void -ehci_root_ctrl_enter(struct usb2_xfer *xfer) -{ - return; -} - -static void -ehci_root_ctrl_start(struct usb2_xfer *xfer) -{ - ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus); - - DPRINTF("\n"); - - sc->sc_root_ctrl.xfer = xfer; - - usb2_bus_roothub_exec(xfer->xroot->bus); -} - -static void -ehci_root_ctrl_task(struct usb2_bus *bus) -{ - ehci_root_ctrl_poll(EHCI_BUS2SC(bus)); -} - -static void -ehci_root_ctrl_done(struct usb2_xfer *xfer, - struct usb2_sw_transfer *std) +ehci_roothub_exec(struct usb2_bus *bus) { - ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus); + ehci_softc_t *sc = EHCI_BUS2SC(bus); + struct usb2_sw_transfer *std = &sc->sc_bus.roothub_req; char *ptr; uint32_t port; uint32_t v; @@ -3082,13 +3013,6 @@ ehci_root_ctrl_done(struct usb2_xfer *xf USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); - if (std->state != USB_SW_TR_SETUP) { - if (std->state == USB_SW_TR_PRE_CALLBACK) { - /* transfer transferred */ - ehci_device_done(xfer, std->err); - } - goto done; - } /* buffer reset */ std->ptr = sc->sc_hub_desc.temp; std->len = 0; @@ -3462,67 +3386,6 @@ done: } static void -ehci_root_ctrl_poll(ehci_softc_t *sc) -{ - usb2_sw_transfer(&sc->sc_root_ctrl, - &ehci_root_ctrl_done); -} - -struct usb2_pipe_methods ehci_root_ctrl_methods = -{ - .open = ehci_root_ctrl_open, - .close = ehci_root_ctrl_close, - .enter = ehci_root_ctrl_enter, - .start = ehci_root_ctrl_start, - .enter_is_cancelable = 1, - .start_is_cancelable = 0, -}; - -/*------------------------------------------------------------------------* - * ehci root interrupt support - *------------------------------------------------------------------------*/ -static void -ehci_root_intr_open(struct usb2_xfer *xfer) -{ - return; -} - -static void -ehci_root_intr_close(struct usb2_xfer *xfer) -{ - ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus); - - if (sc->sc_root_intr.xfer == xfer) { - sc->sc_root_intr.xfer = NULL; - } - ehci_device_done(xfer, USB_ERR_CANCELLED); -} - -static void -ehci_root_intr_enter(struct usb2_xfer *xfer) -{ - return; -} - -static void -ehci_root_intr_start(struct usb2_xfer *xfer) -{ - ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus); - - sc->sc_root_intr.xfer = xfer; -} - -struct usb2_pipe_methods ehci_root_intr_methods = -{ - .open = ehci_root_intr_open, - .close = ehci_root_intr_close, - .enter = ehci_root_intr_enter, - .start = ehci_root_intr_start, - .enter_is_cancelable = 1, - .start_is_cancelable = 1, -}; - -static void ehci_xfer_setup(struct usb2_setup_params *parm) { struct usb2_page_search page_info; @@ -3794,19 +3657,8 @@ ehci_pipe_init(struct usb2_device *udev, /* not supported */ return; } - if (udev->device_index == sc->sc_addr) { - switch (edesc->bEndpointAddress) { - case USB_CONTROL_ENDPOINT: - pipe->methods = &ehci_root_ctrl_methods; - break; - case UE_DIR_IN | EHCI_INTR_ENDPT: - pipe->methods = &ehci_root_intr_methods; - break; - default: - /* do nothing */ - break; - } - } else { + if (udev->device_index != sc->sc_addr) { + if ((udev->speed != USB_SPEED_HIGH) && ((udev->hs_hub_addr == 0) || (udev->hs_port_no == 0) || @@ -3964,5 +3816,5 @@ struct usb2_bus_methods ehci_bus_methods .device_resume = ehci_device_resume, .device_suspend = ehci_device_suspend, .set_hw_power = ehci_set_hw_power, - .roothub_exec = ehci_root_ctrl_task, + .roothub_exec = ehci_roothub_exec, }; Modified: head/sys/dev/usb/controller/ehci.h ============================================================================== --- head/sys/dev/usb/controller/ehci.h Sun Apr 5 18:20:38 2009 (r190734) +++ head/sys/dev/usb/controller/ehci.h Sun Apr 5 18:20:49 2009 (r190735) @@ -457,8 +457,6 @@ typedef struct ehci_softc { struct usb2_bus sc_bus; /* base device */ struct usb2_callout sc_tmo_pcd; union ehci_hub_desc sc_hub_desc; - struct usb2_sw_transfer sc_root_ctrl; - struct usb2_sw_transfer sc_root_intr; struct usb2_device *sc_devices[EHCI_MAX_DEVICES]; struct resource *sc_io_res; Modified: head/sys/dev/usb/controller/musb_otg.c ============================================================================== --- head/sys/dev/usb/controller/musb_otg.c Sun Apr 5 18:20:38 2009 (r190734) +++ head/sys/dev/usb/controller/musb_otg.c Sun Apr 5 18:20:49 2009 (r190735) @@ -80,8 +80,6 @@ struct usb2_pipe_methods musbotg_device_ struct usb2_pipe_methods musbotg_device_ctrl_methods; struct usb2_pipe_methods musbotg_device_intr_methods; struct usb2_pipe_methods musbotg_device_isoc_methods; -struct usb2_pipe_methods musbotg_root_ctrl_methods; -struct usb2_pipe_methods musbotg_root_intr_methods; static musbotg_cmd_t musbotg_setup_rx; static musbotg_cmd_t musbotg_setup_data_rx; @@ -91,12 +89,9 @@ static musbotg_cmd_t musbotg_data_rx; static musbotg_cmd_t musbotg_data_tx; static void musbotg_device_done(struct usb2_xfer *, usb2_error_t); static void musbotg_do_poll(struct usb2_bus *); -static void musbotg_root_ctrl_poll(struct musbotg_softc *); static void musbotg_standard_done(struct usb2_xfer *); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From thompsa at FreeBSD.org Sun Apr 5 11:21:02 2009 From: thompsa at FreeBSD.org (Andrew Thompson) Date: Sun Apr 5 11:22:57 2009 Subject: svn commit: r190736 - head/sys/dev/usb Message-ID: <200904051820.n35IKw12028022@svn.freebsd.org> Author: thompsa Date: Sun Apr 5 18:20:58 2009 New Revision: 190736 URL: http://svn.freebsd.org/changeset/base/190736 Log: MFp4 //depot/projects/usb@159925 Cast variables properly for non-32-bit platforms. Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/usb_endian.h Modified: head/sys/dev/usb/usb_endian.h ============================================================================== --- head/sys/dev/usb/usb_endian.h Sun Apr 5 18:20:49 2009 (r190735) +++ head/sys/dev/usb/usb_endian.h Sun Apr 5 18:20:58 2009 (r190736) @@ -48,19 +48,19 @@ typedef uint8_t uQWord[8]; #define UGETW(w) \ ((w)[0] | \ - ((w)[1] << 8)) + (((uint16_t)((w)[1])) << 8)) #define UGETDW(w) \ ((w)[0] | \ - ((w)[1] << 8) | \ - ((w)[2] << 16) | \ - ((w)[3] << 24)) + (((uint16_t)((w)[1])) << 8) | \ + (((uint32_t)((w)[2])) << 16) | \ + (((uint32_t)((w)[3])) << 24)) #define UGETQW(w) \ ((w)[0] | \ - ((w)[1] << 8) | \ - ((w)[2] << 16) | \ - ((w)[3] << 24) | \ + (((uint16_t)((w)[1])) << 8) | \ + (((uint32_t)((w)[2])) << 16) | \ + (((uint32_t)((w)[3])) << 24) | \ (((uint64_t)((w)[4])) << 32) | \ (((uint64_t)((w)[5])) << 40) | \ (((uint64_t)((w)[6])) << 48) | \ From thompsa at FreeBSD.org Sun Apr 5 11:21:12 2009 From: thompsa at FreeBSD.org (Andrew Thompson) Date: Sun Apr 5 11:23:19 2009 Subject: svn commit: r190737 - head/sys/dev/usb/controller Message-ID: <200904051821.n35IL8UP028065@svn.freebsd.org> Author: thompsa Date: Sun Apr 5 18:21:08 2009 New Revision: 190737 URL: http://svn.freebsd.org/changeset/base/190737 Log: MFp4 //depot/projects/usb@159926 Minor code factorisation in atmegadci.c Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/controller/atmegadci.c Modified: head/sys/dev/usb/controller/atmegadci.c ============================================================================== --- head/sys/dev/usb/controller/atmegadci.c Sun Apr 5 18:20:58 2009 (r190736) +++ head/sys/dev/usb/controller/atmegadci.c Sun Apr 5 18:21:08 2009 (r190737) @@ -77,9 +77,7 @@ SYSCTL_INT(_hw_usb2_atmegadci, OID_AUTO, /* prototypes */ struct usb2_bus_methods atmegadci_bus_methods; -struct usb2_pipe_methods atmegadci_device_bulk_methods; -struct usb2_pipe_methods atmegadci_device_ctrl_methods; -struct usb2_pipe_methods atmegadci_device_intr_methods; +struct usb2_pipe_methods atmegadci_device_non_isoc_methods; struct usb2_pipe_methods atmegadci_device_isoc_fs_methods; static atmegadci_cmd_t atmegadci_setup_rx; @@ -1343,117 +1341,41 @@ atmegadci_do_poll(struct usb2_bus *bus) /*------------------------------------------------------------------------* * at91dci bulk support - *------------------------------------------------------------------------*/ -static void -atmegadci_device_bulk_open(struct usb2_xfer *xfer) -{ - return; -} - -static void -atmegadci_device_bulk_close(struct usb2_xfer *xfer) -{ - atmegadci_device_done(xfer, USB_ERR_CANCELLED); -} - -static void -atmegadci_device_bulk_enter(struct usb2_xfer *xfer) -{ - return; -} - -static void -atmegadci_device_bulk_start(struct usb2_xfer *xfer) -{ - /* setup TDs */ - atmegadci_setup_standard_chain(xfer); - atmegadci_start_standard_chain(xfer); -} - -struct usb2_pipe_methods atmegadci_device_bulk_methods = -{ - .open = atmegadci_device_bulk_open, - .close = atmegadci_device_bulk_close, - .enter = atmegadci_device_bulk_enter, - .start = atmegadci_device_bulk_start, - .enter_is_cancelable = 1, - .start_is_cancelable = 1, -}; - -/*------------------------------------------------------------------------* * at91dci control support - *------------------------------------------------------------------------*/ -static void -atmegadci_device_ctrl_open(struct usb2_xfer *xfer) -{ - return; -} - -static void -atmegadci_device_ctrl_close(struct usb2_xfer *xfer) -{ - atmegadci_device_done(xfer, USB_ERR_CANCELLED); -} - -static void -atmegadci_device_ctrl_enter(struct usb2_xfer *xfer) -{ - return; -} - -static void -atmegadci_device_ctrl_start(struct usb2_xfer *xfer) -{ - /* setup TDs */ - atmegadci_setup_standard_chain(xfer); - atmegadci_start_standard_chain(xfer); -} - -struct usb2_pipe_methods atmegadci_device_ctrl_methods = -{ - .open = atmegadci_device_ctrl_open, - .close = atmegadci_device_ctrl_close, - .enter = atmegadci_device_ctrl_enter, - .start = atmegadci_device_ctrl_start, - .enter_is_cancelable = 1, - .start_is_cancelable = 1, -}; - -/*------------------------------------------------------------------------* * at91dci interrupt support *------------------------------------------------------------------------*/ static void -atmegadci_device_intr_open(struct usb2_xfer *xfer) +atmegadci_device_non_isoc_open(struct usb2_xfer *xfer) { return; } static void -atmegadci_device_intr_close(struct usb2_xfer *xfer) +atmegadci_device_non_isoc_close(struct usb2_xfer *xfer) { atmegadci_device_done(xfer, USB_ERR_CANCELLED); } static void -atmegadci_device_intr_enter(struct usb2_xfer *xfer) +atmegadci_device_non_isoc_enter(struct usb2_xfer *xfer) { return; } static void -atmegadci_device_intr_start(struct usb2_xfer *xfer) +atmegadci_device_non_isoc_start(struct usb2_xfer *xfer) { /* setup TDs */ atmegadci_setup_standard_chain(xfer); atmegadci_start_standard_chain(xfer); } -struct usb2_pipe_methods atmegadci_device_intr_methods = +struct usb2_pipe_methods atmegadci_device_non_isoc_methods = { - .open = atmegadci_device_intr_open, - .close = atmegadci_device_intr_close, - .enter = atmegadci_device_intr_enter, - .start = atmegadci_device_intr_start, + .open = atmegadci_device_non_isoc_open, + .close = atmegadci_device_non_isoc_close, + .enter = atmegadci_device_non_isoc_enter, + .start = atmegadci_device_non_isoc_start, .enter_is_cancelable = 1, .start_is_cancelable = 1, }; @@ -1552,10 +1474,6 @@ struct usb2_pipe_methods atmegadci_devic * Simulate a hardware HUB by handling all the necessary requests. *------------------------------------------------------------------------*/ -/* - * USB descriptors for the virtual Root HUB: - */ - static const struct usb2_device_descriptor atmegadci_devd = { .bLength = sizeof(struct usb2_device_descriptor), .bDescriptorType = UDESC_DEVICE, @@ -2083,34 +2001,21 @@ atmegadci_xfer_setup(struct usb2_setup_p /* * compute maximum number of TDs */ - if (parm->methods == &atmegadci_device_ctrl_methods) { + if ((xfer->pipe->edesc->bmAttributes & UE_XFERTYPE) == UE_CONTROL) { - ntd = xfer->nframes + 1 /* STATUS */ + 1 /* SYNC 1 */ + ntd = xfer->nframes + 1 /* STATUS */ + 1 /* SYNC 1 */ + 1 /* SYNC 2 */ ; - - } else if (parm->methods == &atmegadci_device_bulk_methods) { - - ntd = xfer->nframes + 1 /* SYNC */ ; - - } else if (parm->methods == &atmegadci_device_intr_methods) { - - ntd = xfer->nframes + 1 /* SYNC */ ; - - } else if (parm->methods == &atmegadci_device_isoc_fs_methods) { - - ntd = xfer->nframes + 1 /* SYNC */ ; - } else { - ntd = 0; + ntd = xfer->nframes + 1 /* SYNC */ ; } /* * check if "usb2_transfer_setup_sub" set an error */ - if (parm->err) { + if (parm->err) return; - } + /* * allocate transfer descriptors */ @@ -2119,19 +2024,13 @@ atmegadci_xfer_setup(struct usb2_setup_p /* * get profile stuff */ - if (ntd) { + ep_no = xfer->endpoint & UE_ADDR; + atmegadci_get_hw_ep_profile(parm->udev, &pf, ep_no); - ep_no = xfer->endpoint & UE_ADDR; - atmegadci_get_hw_ep_profile(parm->udev, &pf, ep_no); - - if (pf == NULL) { - /* should not happen */ - parm->err = USB_ERR_INVAL; - return; - } - } else { - ep_no = 0; - pf = NULL; + if (pf == NULL) { + /* should not happen */ + parm->err = USB_ERR_INVAL; + return; } /* align data */ @@ -2188,23 +2087,10 @@ atmegadci_pipe_init(struct usb2_device * /* not supported */ return; } - switch (edesc->bmAttributes & UE_XFERTYPE) { - case UE_CONTROL: - pipe->methods = &atmegadci_device_ctrl_methods; - break; - case UE_INTERRUPT: - pipe->methods = &atmegadci_device_intr_methods; - break; - case UE_ISOCHRONOUS: + if ((edesc->bmAttributes & UE_XFERTYPE) == UE_ISOCHRONOUS) pipe->methods = &atmegadci_device_isoc_fs_methods; - break; - case UE_BULK: - pipe->methods = &atmegadci_device_bulk_methods; - break; - default: - /* do nothing */ - break; - } + else + pipe->methods = &atmegadci_device_non_isoc_methods; } } From thompsa at FreeBSD.org Sun Apr 5 11:21:24 2009 From: thompsa at FreeBSD.org (Andrew Thompson) Date: Sun Apr 5 11:23:20 2009 Subject: svn commit: r190738 - in head/sys/dev/usb: . controller Message-ID: <200904051821.n35ILLK3028108@svn.freebsd.org> Author: thompsa Date: Sun Apr 5 18:21:21 2009 New Revision: 190738 URL: http://svn.freebsd.org/changeset/base/190738 Log: MFp4 //depot/projects/usb@159946 Some cancelable flags are always true. Substitute these away. These cancelable flags were mostly useful with the root HUB which is now handled differently. Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/controller/at91dci.c head/sys/dev/usb/controller/atmegadci.c head/sys/dev/usb/controller/ehci.c head/sys/dev/usb/controller/musb_otg.c head/sys/dev/usb/controller/ohci.c head/sys/dev/usb/controller/uhci.c head/sys/dev/usb/controller/uss820dci.c head/sys/dev/usb/usb_controller.h head/sys/dev/usb/usb_transfer.c Modified: head/sys/dev/usb/controller/at91dci.c ============================================================================== --- head/sys/dev/usb/controller/at91dci.c Sun Apr 5 18:21:08 2009 (r190737) +++ head/sys/dev/usb/controller/at91dci.c Sun Apr 5 18:21:21 2009 (r190738) @@ -1499,8 +1499,6 @@ struct usb2_pipe_methods at91dci_device_ .close = at91dci_device_bulk_close, .enter = at91dci_device_bulk_enter, .start = at91dci_device_bulk_start, - .enter_is_cancelable = 1, - .start_is_cancelable = 1, }; /*------------------------------------------------------------------------* @@ -1538,8 +1536,6 @@ struct usb2_pipe_methods at91dci_device_ .close = at91dci_device_ctrl_close, .enter = at91dci_device_ctrl_enter, .start = at91dci_device_ctrl_start, - .enter_is_cancelable = 1, - .start_is_cancelable = 1, }; /*------------------------------------------------------------------------* @@ -1577,8 +1573,6 @@ struct usb2_pipe_methods at91dci_device_ .close = at91dci_device_intr_close, .enter = at91dci_device_intr_enter, .start = at91dci_device_intr_start, - .enter_is_cancelable = 1, - .start_is_cancelable = 1, }; /*------------------------------------------------------------------------* @@ -1661,8 +1655,6 @@ struct usb2_pipe_methods at91dci_device_ .close = at91dci_device_isoc_fs_close, .enter = at91dci_device_isoc_fs_enter, .start = at91dci_device_isoc_fs_start, - .enter_is_cancelable = 1, - .start_is_cancelable = 1, }; /*------------------------------------------------------------------------* Modified: head/sys/dev/usb/controller/atmegadci.c ============================================================================== --- head/sys/dev/usb/controller/atmegadci.c Sun Apr 5 18:21:08 2009 (r190737) +++ head/sys/dev/usb/controller/atmegadci.c Sun Apr 5 18:21:21 2009 (r190738) @@ -1376,8 +1376,6 @@ struct usb2_pipe_methods atmegadci_devic .close = atmegadci_device_non_isoc_close, .enter = atmegadci_device_non_isoc_enter, .start = atmegadci_device_non_isoc_start, - .enter_is_cancelable = 1, - .start_is_cancelable = 1, }; /*------------------------------------------------------------------------* @@ -1464,8 +1462,6 @@ struct usb2_pipe_methods atmegadci_devic .close = atmegadci_device_isoc_fs_close, .enter = atmegadci_device_isoc_fs_enter, .start = atmegadci_device_isoc_fs_start, - .enter_is_cancelable = 1, - .start_is_cancelable = 1, }; /*------------------------------------------------------------------------* Modified: head/sys/dev/usb/controller/ehci.c ============================================================================== --- head/sys/dev/usb/controller/ehci.c Sun Apr 5 18:21:08 2009 (r190737) +++ head/sys/dev/usb/controller/ehci.c Sun Apr 5 18:21:21 2009 (r190738) @@ -2210,8 +2210,6 @@ struct usb2_pipe_methods ehci_device_bul .close = ehci_device_bulk_close, .enter = ehci_device_bulk_enter, .start = ehci_device_bulk_start, - .enter_is_cancelable = 1, - .start_is_cancelable = 1, }; /*------------------------------------------------------------------------* @@ -2253,8 +2251,6 @@ struct usb2_pipe_methods ehci_device_ctr .close = ehci_device_ctrl_close, .enter = ehci_device_ctrl_enter, .start = ehci_device_ctrl_start, - .enter_is_cancelable = 1, - .start_is_cancelable = 1, }; /*------------------------------------------------------------------------* @@ -2351,8 +2347,6 @@ struct usb2_pipe_methods ehci_device_int .close = ehci_device_intr_close, .enter = ehci_device_intr_enter, .start = ehci_device_intr_start, - .enter_is_cancelable = 1, - .start_is_cancelable = 1, }; /*------------------------------------------------------------------------* @@ -2636,8 +2630,6 @@ struct usb2_pipe_methods ehci_device_iso .close = ehci_device_isoc_fs_close, .enter = ehci_device_isoc_fs_enter, .start = ehci_device_isoc_fs_start, - .enter_is_cancelable = 1, - .start_is_cancelable = 1, }; /*------------------------------------------------------------------------* @@ -2904,8 +2896,6 @@ struct usb2_pipe_methods ehci_device_iso .close = ehci_device_isoc_hs_close, .enter = ehci_device_isoc_hs_enter, .start = ehci_device_isoc_hs_start, - .enter_is_cancelable = 1, - .start_is_cancelable = 1, }; /*------------------------------------------------------------------------* Modified: head/sys/dev/usb/controller/musb_otg.c ============================================================================== --- head/sys/dev/usb/controller/musb_otg.c Sun Apr 5 18:21:08 2009 (r190737) +++ head/sys/dev/usb/controller/musb_otg.c Sun Apr 5 18:21:21 2009 (r190738) @@ -1899,8 +1899,6 @@ struct usb2_pipe_methods musbotg_device_ .close = musbotg_device_bulk_close, .enter = musbotg_device_bulk_enter, .start = musbotg_device_bulk_start, - .enter_is_cancelable = 1, - .start_is_cancelable = 1, }; /*------------------------------------------------------------------------* @@ -1938,8 +1936,6 @@ struct usb2_pipe_methods musbotg_device_ .close = musbotg_device_ctrl_close, .enter = musbotg_device_ctrl_enter, .start = musbotg_device_ctrl_start, - .enter_is_cancelable = 1, - .start_is_cancelable = 1, }; /*------------------------------------------------------------------------* @@ -1977,8 +1973,6 @@ struct usb2_pipe_methods musbotg_device_ .close = musbotg_device_intr_close, .enter = musbotg_device_intr_enter, .start = musbotg_device_intr_start, - .enter_is_cancelable = 1, - .start_is_cancelable = 1, }; /*------------------------------------------------------------------------* @@ -2068,8 +2062,6 @@ struct usb2_pipe_methods musbotg_device_ .close = musbotg_device_isoc_close, .enter = musbotg_device_isoc_enter, .start = musbotg_device_isoc_start, - .enter_is_cancelable = 1, - .start_is_cancelable = 1, }; /*------------------------------------------------------------------------* Modified: head/sys/dev/usb/controller/ohci.c ============================================================================== --- head/sys/dev/usb/controller/ohci.c Sun Apr 5 18:21:08 2009 (r190737) +++ head/sys/dev/usb/controller/ohci.c Sun Apr 5 18:21:21 2009 (r190738) @@ -1720,8 +1720,6 @@ struct usb2_pipe_methods ohci_device_bul .close = ohci_device_bulk_close, .enter = ohci_device_bulk_enter, .start = ohci_device_bulk_start, - .enter_is_cancelable = 1, - .start_is_cancelable = 1, }; /*------------------------------------------------------------------------* @@ -1763,8 +1761,6 @@ struct usb2_pipe_methods ohci_device_ctr .close = ohci_device_ctrl_close, .enter = ohci_device_ctrl_enter, .start = ohci_device_ctrl_start, - .enter_is_cancelable = 1, - .start_is_cancelable = 1, }; /*------------------------------------------------------------------------* @@ -1837,8 +1833,6 @@ struct usb2_pipe_methods ohci_device_int .close = ohci_device_intr_close, .enter = ohci_device_intr_enter, .start = ohci_device_intr_start, - .enter_is_cancelable = 1, - .start_is_cancelable = 1, }; /*------------------------------------------------------------------------* @@ -2047,8 +2041,6 @@ struct usb2_pipe_methods ohci_device_iso .close = ohci_device_isoc_close, .enter = ohci_device_isoc_enter, .start = ohci_device_isoc_start, - .enter_is_cancelable = 1, - .start_is_cancelable = 1, }; /*------------------------------------------------------------------------* Modified: head/sys/dev/usb/controller/uhci.c ============================================================================== --- head/sys/dev/usb/controller/uhci.c Sun Apr 5 18:21:08 2009 (r190737) +++ head/sys/dev/usb/controller/uhci.c Sun Apr 5 18:21:21 2009 (r190738) @@ -1940,8 +1940,6 @@ struct usb2_pipe_methods uhci_device_bul .close = uhci_device_bulk_close, .enter = uhci_device_bulk_enter, .start = uhci_device_bulk_start, - .enter_is_cancelable = 1, - .start_is_cancelable = 1, }; /*------------------------------------------------------------------------* @@ -2004,8 +2002,6 @@ struct usb2_pipe_methods uhci_device_ctr .close = uhci_device_ctrl_close, .enter = uhci_device_ctrl_enter, .start = uhci_device_ctrl_start, - .enter_is_cancelable = 1, - .start_is_cancelable = 1, }; /*------------------------------------------------------------------------* @@ -2095,8 +2091,6 @@ struct usb2_pipe_methods uhci_device_int .close = uhci_device_intr_close, .enter = uhci_device_intr_enter, .start = uhci_device_intr_start, - .enter_is_cancelable = 1, - .start_is_cancelable = 1, }; /*------------------------------------------------------------------------* @@ -2305,8 +2299,6 @@ struct usb2_pipe_methods uhci_device_iso .close = uhci_device_isoc_close, .enter = uhci_device_isoc_enter, .start = uhci_device_isoc_start, - .enter_is_cancelable = 1, - .start_is_cancelable = 1, }; /*------------------------------------------------------------------------* Modified: head/sys/dev/usb/controller/uss820dci.c ============================================================================== --- head/sys/dev/usb/controller/uss820dci.c Sun Apr 5 18:21:08 2009 (r190737) +++ head/sys/dev/usb/controller/uss820dci.c Sun Apr 5 18:21:21 2009 (r190738) @@ -1542,8 +1542,6 @@ struct usb2_pipe_methods uss820dci_devic .close = uss820dci_device_bulk_close, .enter = uss820dci_device_bulk_enter, .start = uss820dci_device_bulk_start, - .enter_is_cancelable = 1, - .start_is_cancelable = 1, }; /*------------------------------------------------------------------------* @@ -1581,8 +1579,6 @@ struct usb2_pipe_methods uss820dci_devic .close = uss820dci_device_ctrl_close, .enter = uss820dci_device_ctrl_enter, .start = uss820dci_device_ctrl_start, - .enter_is_cancelable = 1, - .start_is_cancelable = 1, }; /*------------------------------------------------------------------------* @@ -1620,8 +1616,6 @@ struct usb2_pipe_methods uss820dci_devic .close = uss820dci_device_intr_close, .enter = uss820dci_device_intr_enter, .start = uss820dci_device_intr_start, - .enter_is_cancelable = 1, - .start_is_cancelable = 1, }; /*------------------------------------------------------------------------* @@ -1704,8 +1698,6 @@ struct usb2_pipe_methods uss820dci_devic .close = uss820dci_device_isoc_fs_close, .enter = uss820dci_device_isoc_fs_enter, .start = uss820dci_device_isoc_fs_start, - .enter_is_cancelable = 1, - .start_is_cancelable = 1, }; /*------------------------------------------------------------------------* Modified: head/sys/dev/usb/usb_controller.h ============================================================================== --- head/sys/dev/usb/usb_controller.h Sun Apr 5 18:21:08 2009 (r190737) +++ head/sys/dev/usb/usb_controller.h Sun Apr 5 18:21:21 2009 (r190738) @@ -108,20 +108,15 @@ struct usb2_pipe_methods { /* Mandatory USB Device and Host mode callbacks: */ - void (*open) (struct usb2_xfer *xfer); - void (*close) (struct usb2_xfer *xfer); + usb2_callback_t *open; + usb2_callback_t *close; - void (*enter) (struct usb2_xfer *xfer); - void (*start) (struct usb2_xfer *xfer); + usb2_callback_t *enter; + usb2_callback_t *start; /* Optional */ void *info; - - /* Flags */ - - uint8_t enter_is_cancelable:1; - uint8_t start_is_cancelable:1; }; /* Modified: head/sys/dev/usb/usb_transfer.c ============================================================================== --- head/sys/dev/usb/usb_transfer.c Sun Apr 5 18:21:08 2009 (r190737) +++ head/sys/dev/usb/usb_transfer.c Sun Apr 5 18:21:21 2009 (r190738) @@ -1541,18 +1541,14 @@ usb2_pipe_enter(struct usb2_xfer *xfer) /* enter the transfer */ (pipe->methods->enter) (xfer); - /* check cancelability */ - if (pipe->methods->enter_is_cancelable) { - xfer->flags_int.can_cancel_immed = 1; - /* check for transfer error */ - if (xfer->error) { - /* some error has happened */ - usb2_transfer_done(xfer, 0); - USB_BUS_UNLOCK(xfer->xroot->bus); - return; - } - } else { - xfer->flags_int.can_cancel_immed = 0; + xfer->flags_int.can_cancel_immed = 1; + + /* check for transfer error */ + if (xfer->error) { + /* some error has happened */ + usb2_transfer_done(xfer, 0); + USB_BUS_UNLOCK(xfer->xroot->bus); + return; } /* start the transfer */ @@ -1866,8 +1862,8 @@ usb2_callback_wrapper(struct usb2_xfer_q struct usb2_xfer *xfer = pq->curr; struct usb2_xfer_root *info = xfer->xroot; - USB_BUS_LOCK_ASSERT(xfer->xroot->bus, MA_OWNED); - if (!mtx_owned(xfer->xroot->xfer_mtx)) { + USB_BUS_LOCK_ASSERT(info->bus, MA_OWNED); + if (!mtx_owned(info->xfer_mtx)) { /* * Cases that end up here: * @@ -1898,22 +1894,22 @@ usb2_callback_wrapper(struct usb2_xfer_q /* get next USB transfer in the queue */ info->done_q.curr = NULL; - USB_BUS_UNLOCK(xfer->xroot->bus); - USB_BUS_LOCK_ASSERT(xfer->xroot->bus, MA_NOTOWNED); + USB_BUS_UNLOCK(info->bus); + USB_BUS_LOCK_ASSERT(info->bus, MA_NOTOWNED); /* set correct USB state for callback */ if (!xfer->flags_int.transferring) { xfer->usb2_state = USB_ST_SETUP; if (!xfer->flags_int.started) { /* we got stopped before we even got started */ - USB_BUS_LOCK(xfer->xroot->bus); + USB_BUS_LOCK(info->bus); goto done; } } else { if (usb2_callback_wrapper_sub(xfer)) { /* the callback has been deferred */ - USB_BUS_LOCK(xfer->xroot->bus); + USB_BUS_LOCK(info->bus); goto done; } #if USB_HAVE_POWERD @@ -1941,7 +1937,7 @@ usb2_callback_wrapper(struct usb2_xfer_q (xfer->callback) (xfer); /* pickup the USB mutex again */ - USB_BUS_LOCK(xfer->xroot->bus); + USB_BUS_LOCK(info->bus); /* * Check if we got started after that we got cancelled, but @@ -1963,7 +1959,7 @@ done: (!xfer->flags_int.transferring)) { /* "usb2_transfer_drain()" is waiting for end of transfer */ xfer->flags_int.draining = 0; - usb2_cv_broadcast(&xfer->xroot->cv_drain); + usb2_cv_broadcast(&info->cv_drain); } /* do the next callback, if any */ @@ -2122,15 +2118,12 @@ usb2_transfer_start_cb(void *arg) /* start the transfer */ (pipe->methods->start) (xfer); - /* check cancelability */ - if (pipe->methods->start_is_cancelable) { - xfer->flags_int.can_cancel_immed = 1; - if (xfer->error) { - /* some error has happened */ - usb2_transfer_done(xfer, 0); - } - } else { - xfer->flags_int.can_cancel_immed = 0; + xfer->flags_int.can_cancel_immed = 1; + + /* check for error */ + if (xfer->error) { + /* some error has happened */ + usb2_transfer_done(xfer, 0); } } @@ -2276,15 +2269,12 @@ usb2_pipe_start(struct usb2_xfer_queue * /* start USB transfer */ (pipe->methods->start) (xfer); - /* check cancelability */ - if (pipe->methods->start_is_cancelable) { - xfer->flags_int.can_cancel_immed = 1; - if (xfer->error) { - /* some error has happened */ - usb2_transfer_done(xfer, 0); - } - } else { - xfer->flags_int.can_cancel_immed = 0; + xfer->flags_int.can_cancel_immed = 1; + + /* check for error */ + if (xfer->error) { + /* some error has happened */ + usb2_transfer_done(xfer, 0); } } From thompsa at FreeBSD.org Sun Apr 5 11:21:33 2009 From: thompsa at FreeBSD.org (Andrew Thompson) Date: Sun Apr 5 11:23:34 2009 Subject: svn commit: r190739 - head/sys/dev/usb Message-ID: <200904051821.n35ILVDp028157@svn.freebsd.org> Author: thompsa Date: Sun Apr 5 18:21:31 2009 New Revision: 190739 URL: http://svn.freebsd.org/changeset/base/190739 Log: MFp4 //depot/projects/usb@159948 Add more debugging output on enumeration failures. Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/usb_device.c head/sys/dev/usb/usb_request.c Modified: head/sys/dev/usb/usb_device.c ============================================================================== --- head/sys/dev/usb/usb_device.c Sun Apr 5 18:21:21 2009 (r190738) +++ head/sys/dev/usb/usb_device.c Sun Apr 5 18:21:31 2009 (r190739) @@ -1505,10 +1505,6 @@ usb2_alloc_device(device_t parent_dev, s udev->speed = speed; udev->flags.usb2_mode = usb2_mode; - /* speed combination should be checked by the parent HUB */ - - hub = udev->parent_hub; - /* search for our High Speed USB HUB, if any */ adev = udev; @@ -1564,7 +1560,8 @@ usb2_alloc_device(device_t parent_dev, s */ if (err) { DPRINTFN(0, "set address %d failed " - "(ignored)\n", udev->address); + "(%s, ignored)\n", udev->address, + usb2_errstr(err)); } /* allow device time to set new address */ usb2_pause_mtx(NULL, @@ -1600,7 +1597,8 @@ usb2_alloc_device(device_t parent_dev, s USB_MAX_IPACKET, USB_MAX_IPACKET, 0, UDESC_DEVICE, 0, 0); if (err) { DPRINTFN(0, "getting device descriptor " - "at addr %d failed!\n", udev->address); + "at addr %d failed, %s!\n", udev->address, + usb2_errstr(err)); /* XXX try to re-enumerate the device */ err = usb2_req_re_enumerate(udev, NULL); if (err) { Modified: head/sys/dev/usb/usb_request.c ============================================================================== --- head/sys/dev/usb/usb_request.c Sun Apr 5 18:21:21 2009 (r190738) +++ head/sys/dev/usb/usb_request.c Sun Apr 5 18:21:31 2009 (r190739) @@ -1487,7 +1487,8 @@ usb2_req_re_enumerate(struct usb2_device retry: err = usb2_req_reset_port(parent_hub, mtx, udev->port_no); if (err) { - DPRINTFN(0, "addr=%d, port reset failed\n", old_addr); + DPRINTFN(0, "addr=%d, port reset failed, %s\n", + old_addr, usb2_errstr(err)); goto done; } /* @@ -1505,8 +1506,8 @@ retry: err = usb2_req_set_address(udev, mtx, old_addr); if (err) { /* XXX ignore any errors! */ - DPRINTFN(0, "addr=%d, set address failed! (ignored)\n", - old_addr); + DPRINTFN(0, "addr=%d, set address failed! (%s, ignored)\n", + old_addr, usb2_errstr(err)); } /* restore device address */ udev->address = old_addr; @@ -1519,14 +1520,16 @@ retry: USB_MAX_IPACKET, USB_MAX_IPACKET, 0, UDESC_DEVICE, 0, 0); if (err) { DPRINTFN(0, "getting device descriptor " - "at addr %d failed!\n", udev->address); + "at addr %d failed, %s!\n", udev->address, + usb2_errstr(err)); goto done; } /* get the full device descriptor */ err = usb2_req_get_device_desc(udev, mtx, &udev->ddesc); if (err) { DPRINTFN(0, "addr=%d, getting device " - "descriptor failed!\n", old_addr); + "descriptor failed, %s!\n", old_addr, + usb2_errstr(err)); goto done; } done: From thompsa at FreeBSD.org Sun Apr 5 11:21:41 2009 From: thompsa at FreeBSD.org (Andrew Thompson) Date: Sun Apr 5 11:23:46 2009 Subject: svn commit: r190740 - head/sys/arm/at91 Message-ID: <200904051821.n35ILeig028197@svn.freebsd.org> Author: thompsa Date: Sun Apr 5 18:21:40 2009 New Revision: 190740 URL: http://svn.freebsd.org/changeset/base/190740 Log: MFp4 //depot/projects/usb@159992 at91_udp.c does not exist anymore, it is now replaced by at91dci in src/sys/dev/usb/controller. Also remove the ohci_atmelarm.c because it is also included in src/sys/conf/files Submitted by: Sylvestre Gallon Modified: head/sys/arm/at91/files.at91 Modified: head/sys/arm/at91/files.at91 ============================================================================== --- head/sys/arm/at91/files.at91 Sun Apr 5 18:21:31 2009 (r190739) +++ head/sys/arm/at91/files.at91 Sun Apr 5 18:21:40 2009 (r190740) @@ -13,12 +13,10 @@ arm/at91/at91_spi.c optional at91_spi dependency "spibus_if.h" arm/at91/at91_tc.c optional at91_tc arm/at91/at91_twi.c optional at91_twi -arm/at91/at91_udp.c optional at91_udp arm/at91/if_ate.c optional ate arm/at91/uart_bus_at91usart.c optional uart arm/at91/uart_cpu_at91rm9200usart.c optional uart arm/at91/uart_dev_at91usart.c optional uart -dev/usb/controller/ohci_atmelarm.c optional ohci # # All the boards we support # From thompsa at FreeBSD.org Sun Apr 5 11:21:53 2009 From: thompsa at FreeBSD.org (Andrew Thompson) Date: Sun Apr 5 11:23:56 2009 Subject: svn commit: r190741 - in head/sys/dev/usb: . input Message-ID: <200904051821.n35ILpOj028237@svn.freebsd.org> Author: thompsa Date: Sun Apr 5 18:21:51 2009 New Revision: 190741 URL: http://svn.freebsd.org/changeset/base/190741 Log: MFp4 //depot/projects/usb@159995 - add support for more complicated HID descriptors which can have multiple definitions of the same field. - remove old modulo patch in ums, which I think is due to bad HID parsing, which should be fixed now. Reported by: netchild Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/input/ums.c head/sys/dev/usb/usb_hid.c head/sys/dev/usb/usb_hid.h Modified: head/sys/dev/usb/input/ums.c ============================================================================== --- head/sys/dev/usb/input/ums.c Sun Apr 5 18:21:40 2009 (r190740) +++ head/sys/dev/usb/input/ums.c Sun Apr 5 18:21:51 2009 (r190741) @@ -84,27 +84,20 @@ SYSCTL_INT(_hw_usb2_ums, OID_AUTO, debug #define UMS_IFQ_MAXLEN 50 /* units */ #define UMS_BUTTON_MAX 31 /* exclusive, must be less than 32 */ #define UMS_BUT(i) ((i) < 3 ? (((i) + 2) % 3) : (i)) +#define UMS_INFO_MAX 2 /* maximum number of HID sets */ enum { UMS_INTR_DT, UMS_N_TRANSFER, }; -struct ums_softc { - struct usb2_fifo_sc sc_fifo; - struct mtx sc_mtx; - struct usb2_callout sc_callout; +struct ums_info { struct hid_location sc_loc_w; struct hid_location sc_loc_x; struct hid_location sc_loc_y; struct hid_location sc_loc_z; struct hid_location sc_loc_t; struct hid_location sc_loc_btn[UMS_BUTTON_MAX]; - mousehw_t sc_hw; - mousemode_t sc_mode; - mousestatus_t sc_status; - - struct usb2_xfer *sc_xfer[UMS_N_TRANSFER]; uint32_t sc_flags; #define UMS_FLAG_X_AXIS 0x0001 @@ -115,14 +108,29 @@ struct ums_softc { #define UMS_FLAG_REVZ 0x0020 /* Z-axis is reversed */ #define UMS_FLAG_W_AXIS 0x0040 - uint8_t sc_buttons; - uint8_t sc_iid; uint8_t sc_iid_w; uint8_t sc_iid_x; uint8_t sc_iid_y; uint8_t sc_iid_z; uint8_t sc_iid_t; uint8_t sc_iid_btn[UMS_BUTTON_MAX]; + uint8_t sc_buttons; +}; + +struct ums_softc { + struct usb2_fifo_sc sc_fifo; + struct mtx sc_mtx; + struct usb2_callout sc_callout; + struct ums_info sc_info[UMS_INFO_MAX]; + + mousehw_t sc_hw; + mousemode_t sc_mode; + mousestatus_t sc_status; + + struct usb2_xfer *sc_xfer[UMS_N_TRANSFER]; + + uint8_t sc_buttons; + uint8_t sc_iid; uint8_t sc_temp[64]; }; @@ -165,14 +173,15 @@ static void ums_intr_callback(struct usb2_xfer *xfer) { struct ums_softc *sc = xfer->priv_sc; + struct ums_info *info = &sc->sc_info[0]; uint8_t *buf = sc->sc_temp; uint16_t len = xfer->actlen; int32_t buttons = 0; - int32_t dw; - int32_t dx; - int32_t dy; - int32_t dz; - int32_t dt; + int32_t dw = 0; + int32_t dx = 0; + int32_t dy = 0; + int32_t dz = 0; + int32_t dt = 0; uint8_t i; uint8_t id; @@ -205,49 +214,50 @@ ums_intr_callback(struct usb2_xfer *xfer } else { id = 0; - if (sc->sc_flags & UMS_FLAG_SBU) { + if (sc->sc_info[0].sc_flags & UMS_FLAG_SBU) { if ((*buf == 0x14) || (*buf == 0x15)) { goto tr_setup; } } } - if ((sc->sc_flags & UMS_FLAG_W_AXIS) && (id == sc->sc_iid_w)) - dw = hid_get_data(buf, len, &sc->sc_loc_w); - else - dw = 0; - - if ((sc->sc_flags & UMS_FLAG_X_AXIS) && (id == sc->sc_iid_x)) - dx = hid_get_data(buf, len, &sc->sc_loc_x); - else - dx = 0; - - if ((sc->sc_flags & UMS_FLAG_Y_AXIS) && (id == sc->sc_iid_y)) - dy = -hid_get_data(buf, len, &sc->sc_loc_y); - else - dy = 0; - - if ((sc->sc_flags & UMS_FLAG_Z_AXIS) && (id == sc->sc_iid_z)) - dz = -hid_get_data(buf, len, &sc->sc_loc_z); - else - dz = 0; - - if (sc->sc_flags & UMS_FLAG_REVZ) - dz = -dz; - - if ((sc->sc_flags & UMS_FLAG_T_AXIS) && (id == sc->sc_iid_t)) - dt = -hid_get_data(buf, len, &sc->sc_loc_t); - else - dt = 0; + repeat: + if ((info->sc_flags & UMS_FLAG_W_AXIS) && + (id == info->sc_iid_w)) + dw += hid_get_data(buf, len, &info->sc_loc_w); + + if ((info->sc_flags & UMS_FLAG_X_AXIS) && + (id == info->sc_iid_x)) + dx += hid_get_data(buf, len, &info->sc_loc_x); + + if ((info->sc_flags & UMS_FLAG_Y_AXIS) && + (id == info->sc_iid_y)) + dy = -hid_get_data(buf, len, &info->sc_loc_y); + + if ((info->sc_flags & UMS_FLAG_Z_AXIS) && + (id == info->sc_iid_z)) { + int32_t temp; + temp = hid_get_data(buf, len, &info->sc_loc_z); + if (info->sc_flags & UMS_FLAG_REVZ) + temp = -temp; + dz -= temp; + } + + if ((info->sc_flags & UMS_FLAG_T_AXIS) && + (id == info->sc_iid_t)) + dt -= hid_get_data(buf, len, &info->sc_loc_t); - for (i = 0; i < sc->sc_buttons; i++) { - if (id != sc->sc_iid_btn[i]) + for (i = 0; i < info->sc_buttons; i++) { + if (id != info->sc_iid_btn[i]) continue; - if (hid_get_data(buf, len, &sc->sc_loc_btn[i])) { + if (hid_get_data(buf, len, &info->sc_loc_btn[i])) { buttons |= (1 << UMS_BUT(i)); } } + if (++info != &sc->sc_info[UMS_INFO_MAX]) + goto repeat; + if (dx || dy || dz || dt || dw || (buttons != sc->sc_status.button)) { @@ -273,7 +283,7 @@ ums_intr_callback(struct usb2_xfer *xfer * to the queue. In any other case we delete * the timeout event. */ - if ((sc->sc_flags & UMS_FLAG_SBU) && + if ((sc->sc_info[0].sc_flags & UMS_FLAG_SBU) && (dx == 0) && (dy == 0) && (dz == 0) && (dt == 0) && (dw == 0) && (buttons == 0)) { @@ -357,89 +367,56 @@ ums_probe(device_t dev) return (error); } -static int -ums_attach(device_t dev) +static void +ums_hid_parse(struct ums_softc *sc, device_t dev, const uint8_t *buf, + uint16_t len, uint8_t index) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); - struct ums_softc *sc = device_get_softc(dev); - void *d_ptr = NULL; - int unit = device_get_unit(dev); - int isize; - int isizebits; - int err; + struct ums_info *info = &sc->sc_info[index]; uint32_t flags; - uint16_t d_len; uint8_t i; - DPRINTFN(11, "sc=%p\n", sc); - - device_set_usb2_desc(dev); - - mtx_init(&sc->sc_mtx, "ums lock", NULL, MTX_DEF | MTX_RECURSE); - - usb2_callout_init_mtx(&sc->sc_callout, &sc->sc_mtx, 0); - - /* - * Force the report (non-boot) protocol. - * - * Mice without boot protocol support may choose not to implement - * Set_Protocol at all; Ignore any error. - */ - err = usb2_req_set_protocol(uaa->device, NULL, uaa->info.bIfaceIndex, 1); - - err = usb2_transfer_setup(uaa->device, - &uaa->info.bIfaceIndex, sc->sc_xfer, ums_config, - UMS_N_TRANSFER, sc, &sc->sc_mtx); - - if (err) { - DPRINTF("error=%s\n", usb2_errstr(err)); - goto detach; - } - err = usb2_req_get_hid_desc(uaa->device, NULL, &d_ptr, - &d_len, M_TEMP, uaa->info.bIfaceIndex); - - if (err) { - device_printf(dev, "error reading report description\n"); - goto detach; - } - if (hid_locate(d_ptr, d_len, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_X), - hid_input, &sc->sc_loc_x, &flags, &sc->sc_iid_x)) { + if (hid_locate(buf, len, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_X), + hid_input, index, &info->sc_loc_x, &flags, &info->sc_iid_x)) { if ((flags & MOUSE_FLAGS_MASK) == MOUSE_FLAGS) { - sc->sc_flags |= UMS_FLAG_X_AXIS; + info->sc_flags |= UMS_FLAG_X_AXIS; } } - if (hid_locate(d_ptr, d_len, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_Y), - hid_input, &sc->sc_loc_y, &flags, &sc->sc_iid_y)) { + if (hid_locate(buf, len, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_Y), + hid_input, index, &info->sc_loc_y, &flags, &info->sc_iid_y)) { if ((flags & MOUSE_FLAGS_MASK) == MOUSE_FLAGS) { - sc->sc_flags |= UMS_FLAG_Y_AXIS; + info->sc_flags |= UMS_FLAG_Y_AXIS; } } /* Try the wheel first as the Z activator since it's tradition. */ - if (hid_locate(d_ptr, d_len, HID_USAGE2(HUP_GENERIC_DESKTOP, - HUG_WHEEL), hid_input, &sc->sc_loc_z, &flags, &sc->sc_iid_z) || - hid_locate(d_ptr, d_len, HID_USAGE2(HUP_GENERIC_DESKTOP, - HUG_TWHEEL), hid_input, &sc->sc_loc_z, &flags, &sc->sc_iid_z)) { + if (hid_locate(buf, len, HID_USAGE2(HUP_GENERIC_DESKTOP, + HUG_WHEEL), hid_input, index, &info->sc_loc_z, &flags, + &info->sc_iid_z) || + hid_locate(buf, len, HID_USAGE2(HUP_GENERIC_DESKTOP, + HUG_TWHEEL), hid_input, index, &info->sc_loc_z, &flags, + &info->sc_iid_z)) { if ((flags & MOUSE_FLAGS_MASK) == MOUSE_FLAGS) { - sc->sc_flags |= UMS_FLAG_Z_AXIS; + info->sc_flags |= UMS_FLAG_Z_AXIS; } /* * We might have both a wheel and Z direction, if so put * put the Z on the W coordinate. */ - if (hid_locate(d_ptr, d_len, HID_USAGE2(HUP_GENERIC_DESKTOP, - HUG_Z), hid_input, &sc->sc_loc_w, &flags, &sc->sc_iid_w)) { + if (hid_locate(buf, len, HID_USAGE2(HUP_GENERIC_DESKTOP, + HUG_Z), hid_input, index, &info->sc_loc_w, &flags, + &info->sc_iid_w)) { if ((flags & MOUSE_FLAGS_MASK) == MOUSE_FLAGS) { - sc->sc_flags |= UMS_FLAG_W_AXIS; + info->sc_flags |= UMS_FLAG_W_AXIS; } } - } else if (hid_locate(d_ptr, d_len, HID_USAGE2(HUP_GENERIC_DESKTOP, - HUG_Z), hid_input, &sc->sc_loc_z, &flags, &sc->sc_iid_z)) { + } else if (hid_locate(buf, len, HID_USAGE2(HUP_GENERIC_DESKTOP, + HUG_Z), hid_input, index, &info->sc_loc_z, &flags, + &info->sc_iid_z)) { if ((flags & MOUSE_FLAGS_MASK) == MOUSE_FLAGS) { - sc->sc_flags |= UMS_FLAG_Z_AXIS; + info->sc_flags |= UMS_FLAG_Z_AXIS; } } /* @@ -449,25 +426,89 @@ ums_attach(device_t dev) * There are no other HID axis descriptors other than X,Y and * TWHEEL */ - if (hid_locate(d_ptr, d_len, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_TWHEEL), - hid_input, &sc->sc_loc_t, &flags, &sc->sc_iid_t)) { + if (hid_locate(buf, len, HID_USAGE2(HUP_GENERIC_DESKTOP, + HUG_TWHEEL), hid_input, index, &info->sc_loc_t, + &flags, &info->sc_iid_t)) { - sc->sc_loc_t.pos += 8; + info->sc_loc_t.pos += 8; if ((flags & MOUSE_FLAGS_MASK) == MOUSE_FLAGS) { - sc->sc_flags |= UMS_FLAG_T_AXIS; + info->sc_flags |= UMS_FLAG_T_AXIS; } } /* figure out the number of buttons */ for (i = 0; i < UMS_BUTTON_MAX; i++) { - if (!hid_locate(d_ptr, d_len, HID_USAGE2(HUP_BUTTON, (i + 1)), - hid_input, &sc->sc_loc_btn[i], NULL, &sc->sc_iid_btn[i])) { + if (!hid_locate(buf, len, HID_USAGE2(HUP_BUTTON, (i + 1)), + hid_input, index, &info->sc_loc_btn[i], NULL, + &info->sc_iid_btn[i])) { break; } } + info->sc_buttons = i; + + if (i > sc->sc_buttons) + sc->sc_buttons = i; + + if (info->sc_flags == 0) + return; + + /* announce information about the mouse */ + device_printf(dev, "%d buttons and [%s%s%s%s%s] coordinates ID=%u\n", + (info->sc_buttons), + (info->sc_flags & UMS_FLAG_X_AXIS) ? "X" : "", + (info->sc_flags & UMS_FLAG_Y_AXIS) ? "Y" : "", + (info->sc_flags & UMS_FLAG_Z_AXIS) ? "Z" : "", + (info->sc_flags & UMS_FLAG_T_AXIS) ? "T" : "", + (info->sc_flags & UMS_FLAG_W_AXIS) ? "W" : "", + info->sc_iid_x); +} + +static int +ums_attach(device_t dev) +{ + struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct ums_softc *sc = device_get_softc(dev); + struct ums_info *info; + void *d_ptr = NULL; + int isize; + int err; + uint16_t d_len; + uint8_t i; + uint8_t j; + + DPRINTFN(11, "sc=%p\n", sc); + + device_set_usb2_desc(dev); + + mtx_init(&sc->sc_mtx, "ums lock", NULL, MTX_DEF | MTX_RECURSE); + + usb2_callout_init_mtx(&sc->sc_callout, &sc->sc_mtx, 0); + + /* + * Force the report (non-boot) protocol. + * + * Mice without boot protocol support may choose not to implement + * Set_Protocol at all; Ignore any error. + */ + err = usb2_req_set_protocol(uaa->device, NULL, + uaa->info.bIfaceIndex, 1); + + err = usb2_transfer_setup(uaa->device, + &uaa->info.bIfaceIndex, sc->sc_xfer, ums_config, + UMS_N_TRANSFER, sc, &sc->sc_mtx); + + if (err) { + DPRINTF("error=%s\n", usb2_errstr(err)); + goto detach; + } + err = usb2_req_get_hid_desc(uaa->device, NULL, &d_ptr, + &d_len, M_TEMP, uaa->info.bIfaceIndex); - sc->sc_buttons = i; + if (err) { + device_printf(dev, "error reading report description\n"); + goto detach; + } isize = hid_report_size(d_ptr, d_len, hid_input, &sc->sc_iid); @@ -478,83 +519,66 @@ ums_attach(device_t dev) * it has two addional buttons and a tilt wheel. */ if (usb2_test_quirk(uaa, UQ_MS_BAD_CLASS)) { - sc->sc_flags = (UMS_FLAG_X_AXIS | + info = &sc->sc_info[0]; + info->sc_flags = (UMS_FLAG_X_AXIS | UMS_FLAG_Y_AXIS | UMS_FLAG_Z_AXIS | UMS_FLAG_SBU); - sc->sc_buttons = 3; + info->sc_buttons = 3; isize = 5; - sc->sc_iid = 0; - sc->sc_iid_x = 0; - sc->sc_iid_y = 0; - sc->sc_iid_z = 0; - sc->sc_iid_btn[0] = 0; - sc->sc_iid_btn[1] = 0; - sc->sc_iid_btn[2] = 0; /* 1st byte of descriptor report contains garbage */ - sc->sc_loc_x.pos = 16; - sc->sc_loc_y.pos = 24; - sc->sc_loc_z.pos = 32; - sc->sc_loc_btn[0].pos = 8; - sc->sc_loc_btn[1].pos = 9; - sc->sc_loc_btn[2].pos = 10; - } + info->sc_loc_x.pos = 16; + info->sc_loc_y.pos = 24; + info->sc_loc_z.pos = 32; + info->sc_loc_btn[0].pos = 8; + info->sc_loc_btn[1].pos = 9; + info->sc_loc_btn[2].pos = 10; + + /* Announce device */ + device_printf(dev, "3 buttons and [XYZ] " + "coordinates ID=0\n"); - /* - * Some Microsoft devices have incorrectly high location - * positions. Correct this: - */ - isizebits = isize * 8; - if ((sc->sc_iid != 0) && (isizebits > 8)) { - isizebits -= 8; /* remove size of report ID */ - sc->sc_loc_w.pos %= isizebits; - sc->sc_loc_x.pos %= isizebits; - sc->sc_loc_y.pos %= isizebits; - sc->sc_loc_z.pos %= isizebits; - sc->sc_loc_t.pos %= isizebits; - for (i = 0; i != UMS_BUTTON_MAX; i++) - sc->sc_loc_btn[i].pos %= isizebits; + } else { + /* Search the HID descriptor and announce device */ + for (i = 0; i < UMS_INFO_MAX; i++) { + ums_hid_parse(sc, dev, d_ptr, d_len, i); + } } if (usb2_test_quirk(uaa, UQ_MS_REVZ)) { + info = &sc->sc_info[0]; /* Some wheels need the Z axis reversed. */ - sc->sc_flags |= UMS_FLAG_REVZ; + info->sc_flags |= UMS_FLAG_REVZ; } if (isize > sc->sc_xfer[UMS_INTR_DT]->max_frame_size) { DPRINTF("WARNING: report size, %d bytes, is larger " "than interrupt size, %d bytes!\n", isize, sc->sc_xfer[UMS_INTR_DT]->max_frame_size); } - /* announce information about the mouse */ - - device_printf(dev, "%d buttons and [%s%s%s%s%s] coordinates\n", - (sc->sc_buttons), - (sc->sc_flags & UMS_FLAG_X_AXIS) ? "X" : "", - (sc->sc_flags & UMS_FLAG_Y_AXIS) ? "Y" : "", - (sc->sc_flags & UMS_FLAG_Z_AXIS) ? "Z" : "", - (sc->sc_flags & UMS_FLAG_T_AXIS) ? "T" : "", - (sc->sc_flags & UMS_FLAG_W_AXIS) ? "W" : ""); - free(d_ptr, M_TEMP); d_ptr = NULL; #if USB_DEBUG - DPRINTF("sc=%p\n", sc); - DPRINTF("X\t%d/%d id=%d\n", sc->sc_loc_x.pos, - sc->sc_loc_x.size, sc->sc_iid_x); - DPRINTF("Y\t%d/%d id=%d\n", sc->sc_loc_y.pos, - sc->sc_loc_y.size, sc->sc_iid_y); - DPRINTF("Z\t%d/%d id=%d\n", sc->sc_loc_z.pos, - sc->sc_loc_z.size, sc->sc_iid_z); - DPRINTF("T\t%d/%d id=%d\n", sc->sc_loc_t.pos, - sc->sc_loc_t.size, sc->sc_iid_t); - DPRINTF("W\t%d/%d id=%d\n", sc->sc_loc_w.pos, - sc->sc_loc_w.size, sc->sc_iid_w); - - for (i = 0; i < sc->sc_buttons; i++) { - DPRINTF("B%d\t%d/%d id=%d\n", - i + 1, sc->sc_loc_btn[i].pos, - sc->sc_loc_btn[i].size, sc->sc_iid_btn[i]); + for (j = 0; j < UMS_INFO_MAX; j++) { + info = &sc->sc_info[j]; + + DPRINTF("sc=%p, index=%d\n", sc, j); + DPRINTF("X\t%d/%d id=%d\n", info->sc_loc_x.pos, + info->sc_loc_x.size, info->sc_iid_x); + DPRINTF("Y\t%d/%d id=%d\n", info->sc_loc_y.pos, + info->sc_loc_y.size, info->sc_iid_y); + DPRINTF("Z\t%d/%d id=%d\n", info->sc_loc_z.pos, + info->sc_loc_z.size, info->sc_iid_z); + DPRINTF("T\t%d/%d id=%d\n", info->sc_loc_t.pos, + info->sc_loc_t.size, info->sc_iid_t); + DPRINTF("W\t%d/%d id=%d\n", info->sc_loc_w.pos, + info->sc_loc_w.size, info->sc_iid_w); + + for (i = 0; i < info->sc_buttons; i++) { + DPRINTF("B%d\t%d/%d id=%d\n", + i + 1, info->sc_loc_btn[i].pos, + info->sc_loc_btn[i].size, info->sc_iid_btn[i]); + } } DPRINTF("size=%d, id=%d\n", isize, sc->sc_iid); #endif @@ -578,16 +602,9 @@ ums_attach(device_t dev) sc->sc_mode.syncmask[0] = MOUSE_MSC_SYNCMASK; sc->sc_mode.syncmask[1] = MOUSE_MSC_SYNC; - sc->sc_status.flags = 0; - sc->sc_status.button = 0; - sc->sc_status.obutton = 0; - sc->sc_status.dx = 0; - sc->sc_status.dy = 0; - sc->sc_status.dz = 0; - err = usb2_fifo_attach(uaa->device, sc, &sc->sc_mtx, &ums_fifo_methods, &sc->sc_fifo, - unit, 0 - 1, uaa->info.bIfaceIndex, + device_get_unit(dev), 0 - 1, uaa->info.bIfaceIndex, UID_ROOT, GID_OPERATOR, 0644); if (err) { goto detach; Modified: head/sys/dev/usb/usb_hid.c ============================================================================== --- head/sys/dev/usb/usb_hid.c Sun Apr 5 18:21:40 2009 (r190740) +++ head/sys/dev/usb/usb_hid.c Sun Apr 5 18:21:51 2009 (r190741) @@ -544,13 +544,15 @@ hid_report_size(const void *buf, usb2_si *------------------------------------------------------------------------*/ int hid_locate(const void *desc, usb2_size_t size, uint32_t u, enum hid_kind k, - struct hid_location *loc, uint32_t *flags, uint8_t *id) + uint8_t index, struct hid_location *loc, uint32_t *flags, uint8_t *id) { struct hid_data *d; struct hid_item h; for (d = hid_start_parse(desc, size, 1 << k); hid_get_item(d, &h);) { if (h.kind == k && !(h.flags & HIO_CONST) && h.usage == u) { + if (index--) + continue; if (loc != NULL) *loc = h.loc; if (flags != NULL) Modified: head/sys/dev/usb/usb_hid.h ============================================================================== --- head/sys/dev/usb/usb_hid.h Sun Apr 5 18:21:40 2009 (r190740) +++ head/sys/dev/usb/usb_hid.h Sun Apr 5 18:21:51 2009 (r190741) @@ -80,7 +80,7 @@ int hid_get_item(struct hid_data *s, str int hid_report_size(const void *buf, usb2_size_t len, enum hid_kind k, uint8_t *id); int hid_locate(const void *desc, usb2_size_t size, uint32_t usage, - enum hid_kind kind, struct hid_location *loc, + enum hid_kind kind, uint8_t index, struct hid_location *loc, uint32_t *flags, uint8_t *id); uint32_t hid_get_data(const uint8_t *buf, usb2_size_t len, struct hid_location *loc); From thompsa at FreeBSD.org Sun Apr 5 11:22:04 2009 From: thompsa at FreeBSD.org (Andrew Thompson) Date: Sun Apr 5 11:24:18 2009 Subject: svn commit: r190742 - head/sys/dev/usb/serial Message-ID: <200904051822.n35IM3ti028293@svn.freebsd.org> Author: thompsa Date: Sun Apr 5 18:22:03 2009 New Revision: 190742 URL: http://svn.freebsd.org/changeset/base/190742 Log: MFp4 //depot/projects/usb@160052 Wait until line configuration is complete before starting data transfers. Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/serial/usb_serial.c head/sys/dev/usb/serial/usb_serial.h Modified: head/sys/dev/usb/serial/usb_serial.c ============================================================================== --- head/sys/dev/usb/serial/usb_serial.c Sun Apr 5 18:21:51 2009 (r190741) +++ head/sys/dev/usb/serial/usb_serial.c Sun Apr 5 18:22:03 2009 (r190742) @@ -412,6 +412,12 @@ usb2_com_queue_command(struct usb2_com_s if (fn == usb2_com_cfg_close) usb2_proc_mwait(&ssc->sc_tq, t0, t1); + /* + * In case of multiple configure requests, + * keep track of the last one! + */ + if (fn == usb2_com_cfg_start_transfers) + sc->sc_last_start_xfer = &task->hdr; } static void @@ -458,7 +464,9 @@ usb2_com_cfg_start_transfers(struct usb2 /* TTY device closed */ return; } - sc->sc_flag |= UCOM_FLAG_GP_DATA; + + if (_task == sc->sc_last_start_xfer) + sc->sc_flag |= UCOM_FLAG_GP_DATA; if (sc->sc_callback->usb2_com_start_read) { (sc->sc_callback->usb2_com_start_read) (sc); Modified: head/sys/dev/usb/serial/usb_serial.h ============================================================================== --- head/sys/dev/usb/serial/usb_serial.h Sun Apr 5 18:21:51 2009 (r190741) +++ head/sys/dev/usb/serial/usb_serial.h Sun Apr 5 18:22:03 2009 (r190742) @@ -152,6 +152,8 @@ struct usb2_com_softc { struct usb2_com_cfg_task sc_status_task[2]; struct usb2_com_param_task sc_param_task[2]; struct cv sc_cv; + /* Used to set "UCOM_FLAG_GP_DATA" flag: */ + struct usb2_proc_msg *sc_last_start_xfer; const struct usb2_com_callback *sc_callback; struct usb2_com_super_softc *sc_super; struct tty *sc_tty; From thompsa at FreeBSD.org Sun Apr 5 11:22:17 2009 From: thompsa at FreeBSD.org (Andrew Thompson) Date: Sun Apr 5 11:24:19 2009 Subject: svn commit: r190743 - head/sys/dev/usb Message-ID: <200904051822.n35IMDwc028335@svn.freebsd.org> Author: thompsa Date: Sun Apr 5 18:22:13 2009 New Revision: 190743 URL: http://svn.freebsd.org/changeset/base/190743 Log: MFp4 //depot/projects/usb@160056 Remove code for unused and unlikely quirk, "uq_power_claim" Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/usb_device.c head/sys/dev/usb/usb_device.h Modified: head/sys/dev/usb/usb_device.c ============================================================================== --- head/sys/dev/usb/usb_device.c Sun Apr 5 18:22:03 2009 (r190742) +++ head/sys/dev/usb/usb_device.c Sun Apr 5 18:22:13 2009 (r190743) @@ -431,7 +431,6 @@ usb2_error_t usb2_set_config_index(struct usb2_device *udev, uint8_t index) { struct usb2_status ds; - struct usb2_hub_descriptor hd; struct usb2_config_descriptor *cdp; uint16_t power; uint16_t max_power; @@ -484,38 +483,16 @@ usb2_set_config_index(struct usb2_device /* May be self powered. */ if (cdp->bmAttributes & UC_BUS_POWERED) { /* Must ask device. */ - if (udev->flags.uq_power_claim) { - /* - * HUB claims to be self powered, but isn't. - * It seems that the power status can be - * determined by the HUB characteristics. - */ - err = usb2_req_get_hub_descriptor - (udev, NULL, &hd, 1); - if (err) { - DPRINTFN(0, "could not read " - "HUB descriptor: %s\n", - usb2_errstr(err)); - - } else if (UGETW(hd.wHubCharacteristics) & - UHD_PWR_INDIVIDUAL) { - selfpowered = 1; - } - DPRINTF("characteristics=0x%04x\n", - UGETW(hd.wHubCharacteristics)); - } else { - err = usb2_req_get_device_status - (udev, NULL, &ds); - if (err) { - DPRINTFN(0, "could not read " - "device status: %s\n", - usb2_errstr(err)); - } else if (UGETW(ds.wStatus) & UDS_SELF_POWERED) { - selfpowered = 1; - } - DPRINTF("status=0x%04x \n", - UGETW(ds.wStatus)); + err = usb2_req_get_device_status(udev, NULL, &ds); + if (err) { + DPRINTFN(0, "could not read " + "device status: %s\n", + usb2_errstr(err)); + } else if (UGETW(ds.wStatus) & UDS_SELF_POWERED) { + selfpowered = 1; } + DPRINTF("status=0x%04x \n", + UGETW(ds.wStatus)); } else selfpowered = 1; } @@ -1631,9 +1608,6 @@ usb2_alloc_device(device_t parent_dev, s if (usb2_test_quirk(&uaa, UQ_BUS_POWERED)) { udev->flags.uq_bus_powered = 1; } - if (usb2_test_quirk(&uaa, UQ_POWER_CLAIM)) { - udev->flags.uq_power_claim = 1; - } if (usb2_test_quirk(&uaa, UQ_NO_STRINGS)) { udev->flags.no_strings = 1; } Modified: head/sys/dev/usb/usb_device.h ============================================================================== --- head/sys/dev/usb/usb_device.h Sun Apr 5 18:22:03 2009 (r190742) +++ head/sys/dev/usb/usb_device.h Sun Apr 5 18:22:13 2009 (r190743) @@ -90,7 +90,6 @@ struct usb2_device_flags { * strings */ uint8_t remote_wakeup:1; /* set if remote wakeup is enabled */ uint8_t uq_bus_powered:1; /* set if BUS powered quirk is present */ - uint8_t uq_power_claim:1; /* set if power claim quirk is present */ }; /* From thompsa at FreeBSD.org Sun Apr 5 11:26:21 2009 From: thompsa at FreeBSD.org (Andrew Thompson) Date: Sun Apr 5 11:26:33 2009 Subject: svn commit: r190744 - head/sys/dev/usb/wlan Message-ID: <200904051826.n35IQJ8n028464@svn.freebsd.org> Author: thompsa Date: Sun Apr 5 18:26:19 2009 New Revision: 190744 URL: http://svn.freebsd.org/changeset/base/190744 Log: Catch up with usb2_config struct layout changes. Modified: head/sys/dev/usb/wlan/if_uath.c Modified: head/sys/dev/usb/wlan/if_uath.c ============================================================================== --- head/sys/dev/usb/wlan/if_uath.c Sun Apr 5 18:22:13 2009 (r190743) +++ head/sys/dev/usb/wlan/if_uath.c Sun Apr 5 18:26:19 2009 (r190744) @@ -208,50 +208,50 @@ static const struct usb2_config uath_usb .type = UE_BULK, .endpoint = 0x1, .direction = UE_DIR_IN, - .mh.bufsize = UATH_MAX_CMDSZ, - .mh.flags = { + .bufsize = UATH_MAX_CMDSZ, + .flags = { .pipe_bof = 1, .short_xfer_ok = 1 }, - .mh.callback = uath_intr_rx_callback + .callback = uath_intr_rx_callback }, [UATH_INTR_TX] = { .type = UE_BULK, .endpoint = 0x1, .direction = UE_DIR_OUT, - .mh.bufsize = UATH_MAX_CMDSZ, - .mh.flags = { + .bufsize = UATH_MAX_CMDSZ, + .flags = { .ext_buffer = 1, .force_short_xfer = 1, .pipe_bof = 1, }, - .mh.callback = uath_intr_tx_callback, - .mh.timeout = UATH_CMD_TIMEOUT + .callback = uath_intr_tx_callback, + .timeout = UATH_CMD_TIMEOUT }, [UATH_BULK_RX] = { .type = UE_BULK, .endpoint = 0x2, .direction = UE_DIR_IN, - .mh.bufsize = MCLBYTES, - .mh.flags = { + .bufsize = MCLBYTES, + .flags = { .ext_buffer = 1, .pipe_bof = 1, .short_xfer_ok = 1 }, - .mh.callback = uath_bulk_rx_callback + .callback = uath_bulk_rx_callback }, [UATH_BULK_TX] = { .type = UE_BULK, .endpoint = 0x2, .direction = UE_DIR_OUT, - .mh.bufsize = UATH_MAX_TXBUFSZ, - .mh.flags = { + .bufsize = UATH_MAX_TXBUFSZ, + .flags = { .ext_buffer = 1, .force_short_xfer = 1, .pipe_bof = 1 }, - .mh.callback = uath_bulk_tx_callback, - .mh.timeout = UATH_DATA_TIMEOUT + .callback = uath_bulk_tx_callback, + .timeout = UATH_DATA_TIMEOUT } }; From phk at FreeBSD.org Sun Apr 5 11:28:43 2009 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Sun Apr 5 11:28:50 2009 Subject: svn commit: r190745 - head/sbin/routed Message-ID: <200904051828.n35ISgOY028598@svn.freebsd.org> Author: phk Date: Sun Apr 5 18:28:42 2009 New Revision: 190745 URL: http://svn.freebsd.org/changeset/base/190745 Log: Silence a printf warning Modified: head/sbin/routed/input.c Modified: head/sbin/routed/input.c ============================================================================== --- head/sbin/routed/input.c Sun Apr 5 18:26:19 2009 (r190744) +++ head/sbin/routed/input.c Sun Apr 5 18:28:42 2009 (r190745) @@ -980,7 +980,7 @@ ck_passwd(struct interface *aifp, "unknown MD5 RIPv2 auth len %#x" " instead of %#x from %s", NA->au.a_md5.md5_auth_len, - RIP_AUTH_MD5_HASH_LEN, + (unsigned)RIP_AUTH_MD5_HASH_LEN, naddr_ntoa(from)); if (na2->a_family != RIP_AF_AUTH) msglim(use_authp, from, From thompsa at FreeBSD.org Sun Apr 5 11:30:25 2009 From: thompsa at FreeBSD.org (Andrew Thompson) Date: Sun Apr 5 11:30:39 2009 Subject: svn commit: r190746 - head/lib/libusb Message-ID: <200904051830.n35IUOLZ028681@svn.freebsd.org> Author: thompsa Date: Sun Apr 5 18:30:24 2009 New Revision: 190746 URL: http://svn.freebsd.org/changeset/base/190746 Log: MFp4 //depot/projects/usb@159934 Update libusb function descriptions. Submitted by: Chuck Robey Modified: head/lib/libusb/libusb.3 Modified: head/lib/libusb/libusb.3 ============================================================================== --- head/lib/libusb/libusb.3 Sun Apr 5 18:28:42 2009 (r190745) +++ head/lib/libusb/libusb.3 Sun Apr 5 18:30:24 2009 (r190746) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd Feb 14, 2009 +.Dd April 5, 2009 .Dt LIBUSB 3 .Os .Sh NAME @@ -43,9 +43,165 @@ USB access library (libusb -lusb) . . .Sh SYNOPSIS -. -. .In libusb20.h +.Ft int +.Fn libusb20_tr_close "struct libusb20_transfer *xfer" +.Ft int +.Fn libusb20_tr_open "struct libusb20_transfer *xfer" "uint32_t max_buf_size" "uint32_t max_frame_count" "uint8_t ep_no" +.Ft struct libusb20_transfer* +.Fn libusb20_tr_get_pointer "struct libusb20_device *pdev" "uint16_t tr_index" +.Ft uint16_t +.Fn libusb20_tr_get_time_complete "struct libusb20_transfer *xfer" +.Ft uint32_t +.Fn libusb20_tr_get_actual_frames "struct libusb20_transfer *xfer" +.Ft uint32_t +.Fn libusb20_tr_get_actual_length "struct libusb20_transfer *xfer" +.Ft uint32_t +.Fn libusb20_tr_get_max_frames "struct libusb20_transfer *xfer" +.Ft uint32_t +.Fn libusb20_tr_get_max_packet_length "struct libusb20_transfer *xfer" +.Ft uint32_t +.Fn libusb20_tr_get_max_total_length "struct libusb20_transfer *xfer" +.Ft uint8_t +.Fn libusb20_tr_get_status "struct libusb20_transfer *xfer" +.Ft uint8_t +.Fn libusb20_tr_pending "struct libusb20_transfer *xfer" +.Ft void +.Fn libusb20_tr_callback_wrapper "struct libusb20_transfer *xfer" +.Ft void +.Fn libusb20_tr_clear_stall_sync "struct libusb20_transfer *xfer" +.Ft void +.Fn libusb20_tr_drain "struct libusb20_transfer *xfer" +.Ft void +.Fn libusb20_tr_set_buffer "struct libusb20_transfer *xfer" "void *buffer" "uint16_t fr_index" +.Ft void +.Fn libusb20_tr_set_callback "struct libusb20_transfer *xfer" "libusb20_tr_callback_t *cb" +.Ft void +.Fn libusb20_tr_set_flags "struct libusb20_transfer *xfer" "uint8_t flags" +.Ft void +.Fn libusb20_tr_set_length "struct libusb20_transfer *xfer" "uint32_t length" "uint16_t fr_index" +.Ft void +.Fn libusb20_tr_set_priv_sc0 "struct libusb20_transfer *xfer" "void *sc0" +.Ft void +.Fn libusb20_tr_set_priv_sc1 "struct libusb20_transfer *xfer" "void *sc1" +.Ft void +.Fn libusb20_tr_set_timeout "struct libusb20_transfer *xfer" "uint32_t timeout" +.Ft void +.Fn libusb20_tr_set_total_frames "struct libusb20_transfer *xfer" "uint32_t nframes" +.Ft void +.Fn libusb20_tr_setup_bulk "struct libusb20_transfer *xfer" "void *pbuf" "uint32_t length" "uint32_t timeout" +.Ft void +.Fn libusb20_tr_setup_control "struct libusb20_transfer *xfer" "void *psetup" "void *pbuf" "uint32_t timeout" +.Ft void +.Fn libusb20_tr_setup_intr "struct libusb20_transfer *xfer" "void *pbuf" "uint32_t length" "uint32_t timeout" +.Ft void +.Fn libusb20_tr_setup_isoc "struct libusb20_transfer *xfer" "void *pbuf" "uint32_t length" "uint61_t fr_index" +.Ft void +.Fn libusb20_tr_start "struct libusb20_transfer *xfer" +.Ft void +.Fn libusb20_tr_stop "struct libusb20_transfer *xfer" +.Ft void +.Fn libusb20_tr_submit "struct libusb20_transfer *xfer" +.Ft void * +.Fn libusb20_tr_get_priv_sc0 "struct libusb20_transfer *xfer" +.Ft void * +.Fn libusb20_tr_get_priv_sc1 "struct libusb20_transfer *xfer" +.Ft const char * +.Fn libusb20_dev_get_backend_name "struct libusb20_device *" +.Ft int +.Fn libusb20_dev_get_info "struct libusb20_device *pdev" "struct usb2_device_info *pinfo" +.Ft int +.Fn libusb20_dev_get_iface_desc "struct libusb20_device *pdev" "uint8_t iface_index" "char *buf" "uint8_t len" +.Ft const char * +.Fn libusb20_dev_get_desc "struct libusb20_device *pdev" +.Ft int +.Fn libusb20_dev_claim_interface "struct libusb20_device *pdev" "uint8_t iface_index" +.Ft int +.Fn libusb20_dev_close "struct libusb20_device *pdev" +.Ft int +.Fn libusb20_dev_detach_kernel_driver "struct libusb20_device *pdev" "uint8_t iface_index" +.Ft int +.Fn libusb20_dev_set_config_index "struct libusb20_device *pdev" "uint8_t configIndex" +.Ft int +.Fn libusb20_dev_get_debug "struct libusb20_device *pdev" +.Ft int +.Fn libusb20_dev_get_fd "struct libusb20_device *pdev" +.Ft int +.Fn libusb20_dev_kernel_driver_active "struct libusb20_device *pdev" "uint8_t iface_index" +.Ft int +.Fn libusb20_dev_open "struct libusb20_device *pdev" "uint16_t transfer_max" +.Ft int +.Fn libusb20_dev_process "struct libusb20_device *pdev" +.Ft int +.Fn libusb20_dev_release_interface "struct libusb20_device *pdev" "uint8_t iface_index" +.Ft int +.Fn libusb20_dev_request_sync "struct libusb20_device *pdev" "struct LIBUSB20_CONTROL_SETUP_DECODED *setup" "void *data" "uint16_t *pactlen" "uint32_t timeout" "uint8_t flags" +.Ft int +.Fn libusb20_dev_req_string_sync "struct libusb20_device *pdev" "uint8_t index" "uint16_t langid" "void *ptr" "uint16_t len" +.Ft int +.Fn libusb20_dev_req_string_simple_sync "struct libusb20_device *pdev" "uint8_t index" "void *ptr" "uint16_t len" +.Ft int +.Fn libusb20_dev_reset "struct libusb20_device *pdev" +.Ft int +.Fn libusb20_dev_set_power_mode "struct libusb20_device *pdev" "uint8_t power_mode" +.Ft uint8_t +.Fn libusb20_dev_get_power_mode "struct libusb20_device *pdev" +.Ft int +.Fn libusb20_dev_set_alt_index "struct libusb20_device *pdev" "uint8_t iface_index" "uint8_t alt_index" +.Ft int +.Fn libusb20_dev_get_device_desc "struct libusb20_device *pdev" "uint8_t iface_indexr", "char *buf" "uint8_t len" +.Ft struct libusb20_config * +.Fn libusb20_dev_alloc_config "struct libusb20_device *pdev" "uint8_t config_index" +.Ft struct libusb20_device * +.Fn libusb20_dev_alloc "void" +.Ft uint8_t +.Fn libusb20_dev_get_address "struct libusb20_device *pdev" +.Ft uint8_t +.Fn libusb20_dev_get_bus_number "struct libusb20_device *pdev" +.Ft uint8_t +.Fn libusb20_dev_get_mode "struct libusb20_device *pdev" +.Ft uint8_t +.Fn libusb20_dev_get_speed "struct libusb20_device *pdev" +.Ft uint8_t +.Fn libusb20_dev_get_config_index "struct libusb20_device *pdev" +.Ft void +.Fn libusb20_dev_free "struct libusb20_device *pdev" +.Ft void +.Fn libusb20_dev_set_debug "struct libusb20_device *pdev" "int debug" +.Ft void +.Fn libusb20_dev_wait_process "struct libusb20_device *pdev" "int timeout" +.Ft int +.Fn libusb20_be_get_template "struct libusb20_backend *pbe" "int *ptemp" +.Ft int +.Fn libusb20_be_set_template "struct libusb20_backend *pbe" "int temp" +.Ft int +.Fn libusb20_be_get_dev_quirk "struct libusb20_backend *pber", "uint16_t index" "struct libusb20_quirk *pq" +.Ft int +.Fn libusb20_be_get_quirk_name "struct libusb20_backend *pbe" "uint16_t index" "struct libusb20_quirk *pq" +.Ft int +.Fn libusb20_be_add_dev_quirk "struct libusb20_backend *pbe" "struct libusb20_quirk *pq" +.Ft int +.Fn libusb20_be_remove_dev_quirk "struct libusb20_backend *pbe" "struct libusb20_quirk *pq" +.Ft struct libusb20_backend * +.Fn libusb20_be_alloc_linux "void" +.Ft struct libusb20_device * +.Fn libusb20_be_device_foreach "struct libusb20_backend *pbe" "struct libusb20_device *pdev" +.Ft void +.Fn libusb20_be_dequeue_device "struct libusb20_backend *pbe" "struct libusb20_device *pdev" +.Ft void +.Fn libusb20_be_enqueue_device "struct libusb20_backend *pbe" "struct libusb20_device *pdev" +.Ft void +.Fn libusb20_be_free "struct libusb20_backend *pbe" +.Ft uint8_t +.Fn libusb20_me_get_1 "const struct libusb20_me_struct *me" "uint16_t off" +.Ft uint16_t +.Fn libusb20_me_get_2 "const struct libusb20_me_struct *me" "uint16_t off" +.Ft uint16_t +.Fn libusb20_me_encode "void *pdata" "uint16_t len" "const void *pdecoded" +.Ft uint16_t +.Fn libusb20_me_decode "const void *pdata" "uint16_t len" "void *pdecoded" +.Ft "const uint8_t *" +.Fn libusb20_desc_foreach "const struct libusb20_me_struct *me" "const uint8_t *pdesc" . . .Sh DESCRIPTION @@ -60,9 +216,9 @@ USB through the USB file system interfac . .Pp . -.Fn libusb20_tr_close pxfer -This function will release all kernel resources associated with an USB -.Fa pxfer . +.Fn libusb20_tr_close +will release all kernel resources associated with an USB +.Fa xfer . . This function returns zero upon success. . @@ -70,8 +226,8 @@ Non-zero return values indicate a LIBUSB . .Pp . -.Fn libusb20_tr_open pxfer max_buf_size max_frame_count ep_no -This function will allocate kernel resources like +.Fn libusb20_tr_open +will allocate kernel resources like .Fa max_buf_size and .Fa max_frame_count @@ -86,8 +242,8 @@ Non-zero return values indicate a LIBUSB . .Pp . -.Fn libusb20_tr_get_pointer pdev tr_index -This function will return a pointer to the allocated USB transfer according to the +.Fn libusb20_tr_get_pointer +will return a pointer to the allocated USB transfer according to the .Fa pdev and .Fa tr_index @@ -97,33 +253,33 @@ This function returns NULL in case of fa . .Pp . -.Fn libusb20_tr_get_time_complete pxfer -This function will return the completion time of an USB transfer in +.Fn libusb20_tr_get_time_complete +will return the completion time of an USB transfer in millisecond units. This function is most useful for isochronous USB transfers when doing echo cancelling. . .Pp . -.Fn libusb20_tr_get_actual_frames pxfer -This function will return the actual number of USB frames after an USB +.Fn libusb20_tr_get_actual_frames +will return the actual number of USB frames after an USB transfer completed. A value of zero means that no data was transferred. . .Pp . -.Fn libusb20_tr_get_actual_length pxfer -This function will return the sum of the actual length for all +.Fn libusb20_tr_get_actual_length +will return the sum of the actual length for all transferred USB frames for the given USB transfer. . .Pp . -.Fn libusb20_tr_get_max_frames pxfer -This function will return the maximum number of USB frames that were +.Fn libusb20_tr_get_max_frames +will return the maximum number of USB frames that were allocated when an USB transfer was setup for the given USB transfer. . .Pp . -.Fn libusb20_tr_get_max_packet_length pxfer -This function will return the maximum packet length in bytes +.Fn libusb20_tr_get_max_packet_length +will return the maximum packet length in bytes associated with the given USB transfer. . The packet length can be used round up buffer sizes so that short USB @@ -132,33 +288,33 @@ packets are avoided for proxy buffers. . .Pp . -.Fn libusb20_tr_get_max_total_length pxfer -This function will return the maximum value for the length sum of all +.Fn libusb20_tr_get_max_total_length +function will return the maximum value for the length sum of all USB frames associated with an USB transfer. . .Pp . -.Fn libusb20_tr_get_status pxfer -This function will return the status of an USB transfer. +.Fn libusb20_tr_get_status +will return the status of an USB transfer. . Status values are defined by a set of LIBUSB20_TRANSFER_XXX enums. . .Pp . -.Fn libusb20_tr_pending pxfer -This function will return non-zero if the given USB transfer is +.Fn libusb20_tr_pending +will return non-zero if the given USB transfer is pending for completion. . Else this function returns zero. . .Pp . -.Fn libusb20_tr_callback_wrapper pxfer +.Fn libusb20_tr_callback_wrapper This is an internal function used to wrap asynchronous USB callbacks. . .Pp . -.Fn libusb20_tr_clear_stall_sync pxfer +.Fn libusb20_tr_clear_stall_sync This is an internal function used to synchronously clear the stall on the given USB transfer. . @@ -171,14 +327,14 @@ been called. . .Pp . -.Fn libusb20_tr_drain pxfer -This function will stop the given USB transfer and will not return +.Fn libusb20_tr_drain +will stop the given USB transfer and will not return until the USB transfer has been stopped in hardware. . .Pp . -.Fn libusb20_tr_set_buffer pxfer pbuf fr_index -This function is used to set the +.Fn libusb20_tr_set_buffer +is used to set the .Fa buffer pointer for the given USB transfer and .Fa fr_index . @@ -188,16 +344,16 @@ Typically the frame index is zero. . .Pp . -.Fn libusb20_tr_set_callback pxfer pcallback -This function is used to set the USB callback for asynchronous USB +.Fn libusb20_tr_set_callback +is used to set the USB callback for asynchronous USB transfers. . The callback type is defined by libusb20_tr_callback_t. . .Pp . -.Fn libusb20_tr_set_flags pxfer flags -This function is used to set various USB flags for the given USB transfer. +.Fn libusb20_tr_set_flags +is used to set various USB flags for the given USB transfer. .Bl -tag .It LIBUSB20_TRANSFER_SINGLE_SHORT_NOT_OK Report a short frame as error. @@ -211,23 +367,23 @@ Will do a clear-stall before starting th . .Pp . -.Fn libusb20_tr_set_length pxfer length fr_index -This function sets the length of a given USB transfer and frame index. +.Fn libusb20_tr_set_length +sets the length of a given USB transfer and frame index. . .Pp . -.Fn libusb20_tr_set_priv_sc0 pxfer psc0 -This function sets private driver pointer number zero. +.Fn libusb20_tr_set_priv_sc0 +sets private driver pointer number zero. . .Pp . -.Fn libusb20_tr_set_priv_sc1 pxfer psc1 -This function sets private driver pointer number one. +.Fn libusb20_tr_set_priv_sc1 +sets private driver pointer number one. . .Pp . -.Fn libusb20_tr_set_timeout pxfer timeout -This function sets the timeout for the given USB transfer. +.Fn libusb20_tr_set_timeout +sets the timeout for the given USB transfer. . A timeout value of zero means no timeout. . @@ -235,36 +391,36 @@ The timeout is given in milliseconds. . .Pp . -.Fn libusb20_tr_set_total_frames pxfer nframes -This function sets the total number of frames that should be executed when the USB transfer is submitted. +.Fn libusb20_tr_set_total_frames +sets the total number of frames that should be executed when the USB transfer is submitted. . The total number of USB frames must be less than the maximum number of USB frames associated with the given USB transfer. . .Pp . -.Fn libusb20_tr_setup_bulk pxfer pbuf length timeout -This function is a helper function for setting up a single frame USB BULK transfer. +.Fn libusb20_tr_setup_bulk +is a helper function for setting up a single frame USB BULK transfer. . .Pp . -.Fn libusb20_tr_setup_control pxfer psetup pbuf timeout -This function is a helper function for setting up a single or dual +.Fn libusb20_tr_setup_control +is a helper function for setting up a single or dual frame USB CONTROL transfer depending on the control transfer length. . .Pp . -.Fn libusb20_tr_setup_intr pxfer pbuf length timeout -This function is a helper function for setting up a single frame USB INTERRUPT transfer. +.Fn libusb20_tr_setup_intr +is a helper function for setting up a single frame USB INTERRUPT transfer. . .Pp . -.Fn libusb20_tr_setup_isoc pxfer pbuf length fr_index -This function is a helper function for setting up a multi frame USB ISOCHRONOUS transfer. +.Fn libusb20_tr_setup_isoc +is a helper function for setting up a multi frame USB ISOCHRONOUS transfer. . .Pp . -.Fn libusb20_tr_start pxfer -This function will get the USB transfer started, if not already +.Fn libusb20_tr_start +will get the USB transfer started, if not already started. . This function will not get the transfer queued in hardware. @@ -273,29 +429,29 @@ This function is non-blocking. . .Pp . -.Fn libusb20_tr_stop pxfer -This function will get the USB transfer stopped, if not already stopped. +.Fn libusb20_tr_stop +will get the USB transfer stopped, if not already stopped. . This function is non-blocking, which means that the actual stop can happen after the return of this function. . .Pp . -.Fn libusb20_tr_submit pxfer -This function will get the USB transfer queued in hardware. +.Fn libusb20_tr_submit +will get the USB transfer queued in hardware. . . .Pp . -.Fn libusb20_tr_get_priv_sc0 pxfer -This function returns private driver pointer number zero associated +.Fn libusb20_tr_get_priv_sc0 +returns private driver pointer number zero associated with an USB transfer. . . .Pp . -.Fn libusb20_tr_get_priv_sc1 pxfer -This function returns private driver pointer number one associated +.Fn libusb20_tr_get_priv_sc1 +returns private driver pointer number one associated with an USB transfer. . . @@ -303,13 +459,13 @@ with an USB transfer. . .Pp . -.Fn libusb20_dev_get_backend_name pdev -This function returns a zero terminated string describing the backend used. +.Fn libusb20_dev_get_backend_name +returns a zero terminated string describing the backend used. . .Pp . -.Fn libusb20_dev_get_info pdev pinfo -This function retrives the BSD specific usb2_device_info structure into the memory location given by +.Fn libusb20_dev_get_info +retrives the BSD specific usb2_device_info structure into the memory location given by .Fa pinfo . The USB device given by .Fa pdev @@ -318,8 +474,8 @@ This function returns zero on success el . .Pp . -.Fn libusb20_dev_get_iface_desc pdev iface_index pbuf len -This function retrieves the kernel interface description for the given USB +.Fn libusb20_dev_get_iface_desc +retrieves the kernel interface description for the given USB .Fa iface_index . The format of the USB interface description is: "drivername: " The description string is always zero terminated. @@ -331,13 +487,13 @@ This function returns zero on success el . .Pp . -.Fn libusb20_dev_get_desc pdev -This function returns a zero terminated string describing the given USB device. +.Fn libusb20_dev_get_desc +returns a zero terminated string describing the given USB device. The format of the string is: "drivername: " . .Pp . -.Fn libusb20_dev_claim_interface pdev iface_index +.Fn libusb20_dev_claim_interface This function will try to claim the given USB interface given by .Fa iface_index . This function returns zero on success else a LIBUSB20_ERROR value is @@ -345,16 +501,16 @@ returned. . .Pp . -.Fn libusb20_dev_close pdev -This function will close the given USB device. +.Fn libusb20_dev_close +will close the given USB device. . This function returns zero on success else a LIBUSB20_ERROR value is returned. . .Pp . -.Fn libusb20_dev_detach_kernel_driver pdev iface_index -This function will try to detach the kernel driver for the USB interface given by +.Fn libusb20_dev_detach_kernel_driver +will try to detach the kernel driver for the USB interface given by .Fa iface_index . . This function returns zero on success else a LIBUSB20_ERROR value is @@ -362,8 +518,8 @@ returned. . .Pp . -.Fn libusb20_dev_set_config_index pdev config_index -This function will try to set the configuration index on an USB +.Fn libusb20_dev_set_config_index +will try to set the configuration index on an USB device. . The first configuration index is zero. @@ -374,13 +530,13 @@ This function returns zero on success el . .Pp . -.Fn libusb20_dev_get_debug pdev -This function returns the debug level of an USB device. +.Fn libusb20_dev_get_debug +returns the debug level of an USB device. . .Pp . -.Fn libusb20_dev_get_fd pdev -This function returns the file descriptor of the given USB device. +.Fn libusb20_dev_get_fd +returns the file descriptor of the given USB device. . A negative value is returned when no file descriptor is present. . @@ -388,16 +544,16 @@ The file descriptor can be used for poll . .Pp . -.Fn libusb20_dev_kernel_driver_active pdev iface_index -This function returns a non-zero value if a kernel driver is active on +.Fn libusb20_dev_kernel_driver_active +returns a non-zero value if a kernel driver is active on the given USB interface. . Else zero is returned. . .Pp . -.Fn libusb20_dev_open pdev transfer_max -This function opens an USB device so that setting up USB transfers +.Fn libusb20_dev_open +opens an USB device so that setting up USB transfers becomes possible. . The number of USB transfers can be zero which means only control @@ -411,8 +567,8 @@ opened. . .Pp . -.Fn libusb20_dev_process pdev -This function is called to sync kernel USB transfers with userland USB +.Fn libusb20_dev_process +is called to sync kernel USB transfers with userland USB transfers. . This function returns zero on success else a LIBUSB20_ERROR value is @@ -421,16 +577,16 @@ detached. . .Pp . -.Fn libusb20_dev_release_interface pdev iface_index -This function will try to release a claimed USB interface for the specified USB device. +.Fn libusb20_dev_release_interface +will try to release a claimed USB interface for the specified USB device. . This function returns zero on success else a LIBUSB20_ERROR value is returned. . .Pp . -.Fn libusb20_dev_request_sync pdev psetup pdata pactlen timeout flags -This function will perform a synchronous control request on the given +.Fn libusb20_dev_request_sync +will perform a synchronous control request on the given USB device. . Before this call will succeed the USB device must be opened. @@ -452,8 +608,8 @@ returned. . .Pp . -.Fn libusb20_dev_req_string_sync pdev index lang_id pbuf len -This function will synchronously request an USB string by language ID +.Fn libusb20_dev_req_string_sync +will synchronously request an USB string by language ID and string index into the given buffer limited by a maximum length. . This function returns zero on success else a LIBUSB20_ERROR value is @@ -461,8 +617,8 @@ returned. . .Pp . -.Fn libusb20_dev_req_string_simple_sync pdev index pbuf len -This function will synchronously request an USB string using the +.Fn libusb20_dev_req_string_simple_sync +will synchronously request an USB string using the default language ID and convert the string into ASCII before storing the string into the given buffer limited by a maximum length which includes the terminating zero. @@ -473,8 +629,8 @@ returned. . .Pp . -.Fn libusb20_dev_reset pdev -This function will try to BUS reset the given USB device and restore +.Fn libusb20_dev_reset +will try to BUS reset the given USB device and restore the last set USB configuration. . This function returns zero on success else a LIBUSB20_ERROR value is @@ -482,8 +638,8 @@ returned. . .Pp . -.Fn libusb20_dev_set_power_mode pdev power_mode -This function sets the power mode of the USB device. +.Fn libusb20_dev_set_power_mode +sets the power mode of the USB device. . Valid power modes: .Bl -tag @@ -499,14 +655,14 @@ returned. . .Pp . -.Fn libusb20_dev_get_power_mode pdev -This function returns the currently selected power mode for the given +.Fn libusb20_dev_get_power_mode +returns the currently selected power mode for the given USB device. . .Pp . -.Fn libusb20_dev_set_alt_index pdev iface_index alt_index -This function will try to set the given alternate index for the given +.Fn libusb20_dev_set_alt_index +will try to set the given alternate index for the given USB interface index. . This function returns zero on success else a LIBUSB20_ERROR value is @@ -514,41 +670,41 @@ returned. . .Pp . -.Fn libusb20_dev_get_device_desc pdev -This function returns a pointer to the decoded and host endian version +.Fn libusb20_dev_get_device_desc +returns a pointer to the decoded and host endian version of the device descriptor. . The USB device need not be opened when calling this function. . .Pp . -.Fn libusb20_dev_alloc_config pdev config_index -This function will read out and decode the USB config descriptor for +.Fn libusb20_dev_alloc_config +will read out and decode the USB config descriptor for the given USB device and config index. This function returns a pointer to the decoded configuration which must eventually be passed to free(). NULL is returned in case of failure. . .Pp . -.Fn libusb20_dev_alloc void -This is an internal function to allocate a new USB device. +.Fn libusb20_dev_alloc +is an internal function to allocate a new USB device. . .Pp . -.Fn libusb20_dev_get_address pdev -This function returns the internal and not necessarily the real +.Fn libusb20_dev_get_address +returns the internal and not necessarily the real hardware address of the given USB device. . .Pp . -.Fn libusb20_dev_get_bus_number pdev -This function return the internal bus number which the given USB +.Fn libusb20_dev_get_bus_number +returns the internal bus number which the given USB device belongs to. . .Pp . -.Fn libusb20_dev_get_mode pdev -This function returns the current operation mode of the USB entity. +.Fn libusb20_dev_get_mode +returns the current operation mode of the USB entity. . Valid return values are: .Bl -tag @@ -558,8 +714,8 @@ Valid return values are: . .Pp . -.Fn libusb20_dev_get_speed pdev -This function returns the current speed of the given USB device. +.Fn libusb20_dev_get_speed +returns the current speed of the given USB device. . .Bl -tag .It LIBUSB20_SPEED_UNKNOWN @@ -572,25 +728,25 @@ This function returns the current speed . .Pp . -.Fn libusb20_dev_get_config_index pdev +.Fn libusb20_dev_get_config_index This function returns the currently select config index for the given USB device. . .Pp . -.Fn libusb20_dev_free pdev -This function will free the given USB device and all associated USB +.Fn libusb20_dev_free +will free the given USB device and all associated USB transfers. . .Pp . -.Fn libusb20_dev_set_debug pdev debug_level -This function will set the debug level for the given USB device. +.Fn libusb20_dev_set_debug +will set the debug level for the given USB device. . .Pp . -.Fn libusb20_dev_wait_process pdev timeout -This function will wait until a pending USB transfer has completed on +.Fn libusb20_dev_wait_process +function will wait until a pending USB transfer has completed on the given USB device. . A timeout value can be specified which is passed on to the @@ -599,8 +755,8 @@ function. . .Sh USB BACKEND OPERATIONS . -.Fn libusb20_be_get_template pbackend ptemp -This function will return the currently selected global USB device +.Fn libusb20_be_get_template +will return the currently selected global USB device side mode template into the integer pointer .Fa ptemp . This function returns zero on success else a LIBUSB20_ERROR value is @@ -608,8 +764,8 @@ returned. . .Pp . -.Fn libusb20_be_set_template pbackend temp -This function will set the global USB device side mode template to +.Fn libusb20_be_set_template +will set the global USB device side mode template to .Fa temp . The new template is not activated until after the next USB enumeration. @@ -623,7 +779,7 @@ returned. . .Pp . -.Fn libusb20_be_get_dev_quirk pbackend index pquirk +.Fn libusb20_be_get_dev_quirk This function will return the device quirk according to .Fa index into the libusb20_quirk structure pointed to by @@ -636,8 +792,8 @@ returned. . .Pp . -.Fn libusb20_be_get_quirk_name pbackend index pquirk -This function will return the quirk name according to +.Fn libusb20_be_get_quirk_name +will return the quirk name according to .Fa index into the libusb20_quirk structure pointed to by .Fa pq . @@ -649,8 +805,8 @@ returned. . .Pp . -.Fn libusb20_be_add_dev_quirk pbackend pquirk -This function will add the libusb20_quirk structure pointed to by the +.Fn libusb20_be_add_dev_quirk +will add the libusb20_quirk structure pointed to by the .Fa pq argument into the device quirk list. . @@ -662,8 +818,8 @@ returned. . .Pp . -.Fn libusb20_be_remove_dev_quirk pbackend pquirk -This function will remove the quirk matching the libusb20_quirk structure pointed to by the +.Fn libusb20_be_remove_dev_quirk +will remove the quirk matching the libusb20_quirk structure pointed to by the .Fa pq argument from the device quirk list. . @@ -673,15 +829,15 @@ returned. If the given quirk does not exist LIBUSB20_ERROR_NOT_FOUND is returned. . -.Fn libusb20_be_alloc_linux void +.Fn libusb20_be_alloc_linux These functions are used to allocate a specific USB backend or the operating system default USB backend. Allocating a backend is a way to scan for currently present USB devices. . .Pp . -.Fn libusb20_be_device_foreach pbackend pdev -This function is used to iterate USB devices present in a USB backend. +.Fn libusb20_be_device_foreach +is used to iterate USB devices present in a USB backend. . The starting value of .Fa pdev @@ -693,23 +849,23 @@ If NULL is returned the end of the USB d . .Pp . -.Fn libusb20_be_dequeue_device pbackend pdev -This function will dequeue the given USB device pointer from the +.Fn libusb20_be_dequeue_device +will dequeue the given USB device pointer from the backend USB device list. . Dequeued USB devices will not be freed when the backend is freed. . .Pp . -.Fn libusb20_be_enqueue_device pbackend pdev +.Fn libusb20_be_enqueue_device This function will enqueue the given USB device pointer in the backend USB device list. . Enqueued USB devices will get freed when the backend is freed. . .Pp . -.Fn libusb20_be_free pbackend -This function will free the given backend and all USB devices in its device list. +.Fn libusb20_be_free +will free the given backend and all USB devices in its device list. . . .Sh USB DESCRIPTOR PARSING From nwhitehorn at FreeBSD.org Sun Apr 5 11:40:16 2009 From: nwhitehorn at FreeBSD.org (Nathan Whitehorn) Date: Sun Apr 5 11:40:25 2009 Subject: svn commit: r190747 - in head/sys: conf powerpc/ofw Message-ID: <200904051840.n35IeFBl028892@svn.freebsd.org> Author: nwhitehorn Date: Sun Apr 5 18:40:15 2009 New Revision: 190747 URL: http://svn.freebsd.org/changeset/base/190747 Log: Add an Open Firmware access module for real-mode OF accesses to the PowerPC build. This is required for the IBM Mambo simulator, as well as a variety of non-Apple PowerPC hardware. Added: head/sys/powerpc/ofw/ofw_real.c (contents, props changed) Modified: head/sys/conf/files.powerpc Modified: head/sys/conf/files.powerpc ============================================================================== --- head/sys/conf/files.powerpc Sun Apr 5 18:30:24 2009 (r190746) +++ head/sys/conf/files.powerpc Sun Apr 5 18:40:15 2009 (r190747) @@ -111,6 +111,7 @@ powerpc/mpc85xx/opic.c optional mpc85xx powerpc/mpc85xx/pci_ocp.c optional pci mpc85xx powerpc/ofw/ofw_pcibus.c optional pci aim powerpc/ofw/ofw_pcib_pci.c optional pci aim +powerpc/ofw/ofw_real.c optional aim powerpc/ofw/ofw_syscons.c optional sc aim powerpc/powermac/ata_kauai.c optional powermac ata | powermac atamacio powerpc/powermac/ata_macio.c optional powermac ata | powermac atamacio Added: head/sys/powerpc/ofw/ofw_real.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/powerpc/ofw/ofw_real.c Sun Apr 5 18:40:15 2009 (r190747) @@ -0,0 +1,922 @@ +/* $NetBSD: Locore.c,v 1.7 2000/08/20 07:04:59 tsubai Exp $ */ + +/*- + * Copyright (C) 1995, 1996 Wolfgang Solfrank. + * Copyright (C) 1995, 1996 TooLs GmbH. + * 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by TooLs GmbH. + * 4. The name of TooLs GmbH may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``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 TOOLS GMBH 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. + */ +/*- + * Copyright (C) 2000 Benno Rice. + * 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 Benno Rice ``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 TOOLS GMBH 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include +#include +#include "ofw_if.h" + +static void ofw_real_init(ofw_t, void *openfirm); +static int ofw_real_test(ofw_t, const char *name); +static phandle_t ofw_real_peer(ofw_t, phandle_t node); +static phandle_t ofw_real_child(ofw_t, phandle_t node); +static phandle_t ofw_real_parent(ofw_t, phandle_t node); +static phandle_t ofw_real_instance_to_package(ofw_t, ihandle_t instance); +static ssize_t ofw_real_getproplen(ofw_t, phandle_t package, + const char *propname); +static ssize_t ofw_real_getprop(ofw_t, phandle_t package, const char *propname, + void *buf, size_t buflen); +static int ofw_real_nextprop(ofw_t, phandle_t package, const char *previous, + char *buf, size_t); +static int ofw_real_setprop(ofw_t, phandle_t package, char *propname, + void *buf, size_t len); +static ssize_t ofw_real_canon(ofw_t, const char *device, char *buf, size_t len); +static phandle_t ofw_real_finddevice(ofw_t, const char *device); +static ssize_t ofw_real_instance_to_path(ofw_t, ihandle_t instance, char *buf, + size_t len); +static ssize_t ofw_real_package_to_path(ofw_t, phandle_t package, char *buf, + size_t len); +static int ofw_real_call_method(ofw_t, ihandle_t instance, const char *method, + int nargs, int nreturns, unsigned long *args_and_returns); +static ihandle_t ofw_real_open(ofw_t, const char *device); +static void ofw_real_close(ofw_t, ihandle_t instance); +static ssize_t ofw_real_read(ofw_t, ihandle_t instance, void *addr, size_t len); +static ssize_t ofw_real_write(ofw_t, ihandle_t instance, const void *addr, + size_t len); +static int ofw_real_seek(ofw_t, ihandle_t instance, u_int64_t pos); +static caddr_t ofw_real_claim(ofw_t, void *virt, size_t size, u_int align); +static void ofw_real_release(ofw_t, void *virt, size_t size); +static void ofw_real_enter(ofw_t); +static void ofw_real_exit(ofw_t); + +static ofw_method_t ofw_real_methods[] = { + OFWMETHOD(ofw_init, ofw_real_init), + OFWMETHOD(ofw_peer, ofw_real_peer), + OFWMETHOD(ofw_child, ofw_real_child), + OFWMETHOD(ofw_parent, ofw_real_parent), + OFWMETHOD(ofw_instance_to_package, ofw_real_instance_to_package), + OFWMETHOD(ofw_getproplen, ofw_real_getproplen), + OFWMETHOD(ofw_getprop, ofw_real_getprop), + OFWMETHOD(ofw_nextprop, ofw_real_nextprop), + OFWMETHOD(ofw_setprop, ofw_real_setprop), + OFWMETHOD(ofw_canon, ofw_real_canon), + OFWMETHOD(ofw_finddevice, ofw_real_finddevice), + OFWMETHOD(ofw_instance_to_path, ofw_real_instance_to_path), + OFWMETHOD(ofw_package_to_path, ofw_real_package_to_path), + + OFWMETHOD(ofw_test, ofw_real_test), + OFWMETHOD(ofw_call_method, ofw_real_call_method), + OFWMETHOD(ofw_open, ofw_real_open), + OFWMETHOD(ofw_close, ofw_real_close), + OFWMETHOD(ofw_read, ofw_real_read), + OFWMETHOD(ofw_write, ofw_real_write), + OFWMETHOD(ofw_seek, ofw_real_seek), + OFWMETHOD(ofw_claim, ofw_real_claim), + OFWMETHOD(ofw_release, ofw_real_release), + OFWMETHOD(ofw_enter, ofw_real_enter), + OFWMETHOD(ofw_exit, ofw_real_exit), + + { 0, 0 } +}; + +static ofw_def_t ofw_real = { + OFW_STD_REAL, + ofw_real_methods, + 0 +}; +OFW_DEF(ofw_real); + +MALLOC_DEFINE(M_OFWREAL, "ofwreal", "Open Firmware Real Mode Bounce Page"); + +static int (*openfirmware)(void *); + +static vm_offset_t of_bounce_phys; +static caddr_t of_bounce_virt; +static off_t of_bounce_offset; +static size_t of_bounce_size; +static struct mtx of_bounce_mtx; + +/* + * After the VM is up, allocate a wired, low memory bounce page. + */ + +static void ofw_real_bounce_alloc(void *); + +SYSINIT(ofw_real_bounce_alloc, SI_SUB_VM, SI_ORDER_ANY, + ofw_real_bounce_alloc, NULL); + +static void +ofw_real_start(void) +{ + mtx_lock(&of_bounce_mtx); + of_bounce_offset = 0; +} + +static void +ofw_real_stop(void) +{ + mtx_unlock(&of_bounce_mtx); +} + +static void +ofw_real_bounce_alloc(void *junk) +{ + /* + * Check that ofw_real is actually in use before allocating wads + * of memory. Do this by checking if our mutex has been set up. + */ + if (!mtx_initialized(&of_bounce_mtx)) + return; + + /* + * Allocate a page of contiguous, wired physical memory that can + * fit into a 32-bit address space. + */ + + mtx_lock(&of_bounce_mtx); + + of_bounce_virt = contigmalloc(PAGE_SIZE, M_OFWREAL, 0, + 0, BUS_SPACE_MAXADDR_32BIT, PAGE_SIZE, PAGE_SIZE); + of_bounce_phys = vtophys(of_bounce_virt); + of_bounce_size = PAGE_SIZE; + + mtx_unlock(&of_bounce_mtx); +} + +static cell_t +ofw_real_map(const void *buf, size_t len) +{ + cell_t phys; + + mtx_assert(&of_bounce_mtx, MA_OWNED); + + if (of_bounce_virt == NULL) { + if (!pmap_bootstrapped) + return (cell_t)buf; + + /* + * XXX: It is possible for us to get called before the VM has + * come online, but after the MMU is up. We don't have the + * bounce buffer yet, but can no longer presume a 1:1 mapping. + * Grab the physical address of the buffer, and hope it is + * in range if this happens. + */ + return (cell_t)vtophys(buf); + } + + /* + * Make sure the bounce page offset satisfies any reasonable + * alignment constraint. + */ + of_bounce_offset += of_bounce_offset % sizeof(register_t); + + if (of_bounce_offset + len > of_bounce_size) { + panic("Oversize Open Firmware call!"); + return 0; + } + + memcpy(of_bounce_virt + of_bounce_offset, buf, len); + phys = of_bounce_phys + of_bounce_offset; + + of_bounce_offset += len; + + return phys; +} + +static void +ofw_real_unmap(cell_t physaddr, void *buf, size_t len) +{ + mtx_assert(&of_bounce_mtx, MA_OWNED); + + if (of_bounce_virt == NULL) + return; + + memcpy(buf,of_bounce_virt + (physaddr - of_bounce_phys),len); +} + +/* Initialiser */ + +static void +ofw_real_init(ofw_t ofw, void *openfirm) +{ + openfirmware = (int (*)(void *))openfirm; + + mtx_init(&of_bounce_mtx, "OF Bounce Page", MTX_DEF, 0); + of_bounce_virt = NULL; +} + +/* + * Generic functions + */ + +/* Test to see if a service exists. */ +static int +ofw_real_test(ofw_t ofw, const char *name) +{ + static struct { + cell_t name; + cell_t nargs; + cell_t nreturns; + cell_t service; + cell_t missing; + } args = { + (cell_t)"test", + 1, + 1, + }; + + ofw_real_start(); + + args.service = ofw_real_map(name, strlen(name) + 1); + if (args.service == 0 || openfirmware(&args) == -1) { + ofw_real_stop(); + return (-1); + } + ofw_real_stop(); + return (args.missing); +} + +/* + * Device tree functions + */ + +/* Return the next sibling of this node or 0. */ +static phandle_t +ofw_real_peer(ofw_t ofw, phandle_t node) +{ + static struct { + cell_t name; + cell_t nargs; + cell_t nreturns; + cell_t node; + cell_t next; + } args = { + (cell_t)"peer", + 1, + 1, + }; + + args.node = node; + if (openfirmware(&args) == -1) + return (-1); + return (args.next); +} + +/* Return the first child of this node or 0. */ +static phandle_t +ofw_real_child(ofw_t ofw, phandle_t node) +{ + static struct { + cell_t name; + cell_t nargs; + cell_t nreturns; + cell_t node; + cell_t child; + } args = { + (cell_t)"child", + 1, + 1, + }; + + args.node = node; + if (openfirmware(&args) == -1) + return (-1); + return (args.child); +} + +/* Return the parent of this node or 0. */ +static phandle_t +ofw_real_parent(ofw_t ofw, phandle_t node) +{ + static struct { + cell_t name; + cell_t nargs; + cell_t nreturns; + cell_t node; + cell_t parent; + } args = { + (cell_t)"parent", + 1, + 1, + }; + + args.node = node; + if (openfirmware(&args) == -1) + return (-1); + return (args.parent); +} + +/* Return the package handle that corresponds to an instance handle. */ +static phandle_t +ofw_real_instance_to_package(ofw_t ofw, ihandle_t instance) +{ + static struct { + cell_t name; + cell_t nargs; + cell_t nreturns; + cell_t instance; + cell_t package; + } args = { + (cell_t)"instance-to-package", + 1, + 1, + }; + + args.instance = instance; + if (openfirmware(&args) == -1) + return (-1); + return (args.package); +} + +/* Get the length of a property of a package. */ +static ssize_t +ofw_real_getproplen(ofw_t ofw, phandle_t package, const char *propname) +{ + static struct { + cell_t name; + cell_t nargs; + cell_t nreturns; + cell_t package; + cell_t propname; + cell_t proplen; + } args = { + (cell_t)"getproplen", + 2, + 1, + }; + + ofw_real_start(); + + args.package = package; + args.propname = ofw_real_map(propname, strlen(propname) + 1); + if (args.propname == 0 || openfirmware(&args) == -1) { + ofw_real_stop(); + return (-1); + } + ofw_real_stop(); + return (args.proplen); +} + +/* Get the value of a property of a package. */ +static ssize_t +ofw_real_getprop(ofw_t ofw, phandle_t package, const char *propname, void *buf, + size_t buflen) +{ + static struct { + cell_t name; + cell_t nargs; + cell_t nreturns; + cell_t package; + cell_t propname; + cell_t buf; + cell_t buflen; + cell_t size; + } args = { + (cell_t)"getprop", + 4, + 1, + }; + + ofw_real_start(); + + args.package = package; + args.propname = ofw_real_map(propname, strlen(propname) + 1); + args.buf = ofw_real_map(buf, buflen); + args.buflen = buflen; + if (args.propname == 0 || args.buf == 0 || openfirmware(&args) == -1) { + ofw_real_stop(); + return (-1); + } + ofw_real_unmap(args.buf, buf, buflen); + + ofw_real_stop(); + return (args.size); +} + +/* Get the next property of a package. */ +static int +ofw_real_nextprop(ofw_t ofw, phandle_t package, const char *previous, + char *buf, size_t size) +{ + static struct { + cell_t name; + cell_t nargs; + cell_t nreturns; + cell_t package; + cell_t previous; + cell_t buf; + cell_t flag; + } args = { + (cell_t)"nextprop", + 3, + 1, + }; + + ofw_real_start(); + + args.package = package; + args.previous = ofw_real_map(previous, strlen(previous) + 1); + args.buf = ofw_real_map(buf, size); + if (args.previous == 0 || args.buf == 0 || openfirmware(&args) == -1) { + ofw_real_stop(); + return (-1); + } + ofw_real_unmap(args.buf, buf, size); + + ofw_real_stop(); + return (args.flag); +} + +/* Set the value of a property of a package. */ +/* XXX Has a bug on FirePower */ +static int +ofw_real_setprop(ofw_t ofw, phandle_t package, char *propname, void *buf, + size_t len) +{ + static struct { + cell_t name; + cell_t nargs; + cell_t nreturns; + cell_t package; + cell_t propname; + cell_t buf; + cell_t len; + cell_t size; + } args = { + (cell_t)"setprop", + 4, + 1, + }; + + ofw_real_start(); + + args.package = package; + args.propname = ofw_real_map(propname, strlen(propname) + 1); + args.buf = ofw_real_map(buf, len); + args.len = len; + if (args.propname == 0 || args.buf == 0 || openfirmware(&args) == -1) { + ofw_real_stop(); + return (-1); + } + ofw_real_stop(); + return (args.size); +} + +/* Convert a device specifier to a fully qualified pathname. */ +static ssize_t +ofw_real_canon(ofw_t ofw, const char *device, char *buf, size_t len) +{ + static struct { + cell_t name; + cell_t nargs; + cell_t nreturns; + cell_t device; + cell_t buf; + cell_t len; + cell_t size; + } args = { + (cell_t)"canon", + 3, + 1, + }; + + ofw_real_start(); + + args.device = ofw_real_map(device, strlen(device) + 1); + args.buf = ofw_real_map(buf, len); + args.len = len; + if (args.device == 0 || args.buf == 0 || openfirmware(&args) == -1) { + ofw_real_stop(); + return (-1); + } + ofw_real_unmap(args.buf, buf, len); + + ofw_real_stop(); + return (args.size); +} + +/* Return a package handle for the specified device. */ +static phandle_t +ofw_real_finddevice(ofw_t ofw, const char *device) +{ + static struct { + cell_t name; + cell_t nargs; + cell_t nreturns; + cell_t device; + cell_t package; + } args = { + (cell_t)"finddevice", + 1, + 1, + }; + + ofw_real_start(); + + args.device = ofw_real_map(device, strlen(device) + 1); + if (args.device == 0 || openfirmware(&args) == -1) { + ofw_real_stop(); + return (-1); + } + ofw_real_stop(); + return (args.package); +} + +/* Return the fully qualified pathname corresponding to an instance. */ +static ssize_t +ofw_real_instance_to_path(ofw_t ofw, ihandle_t instance, char *buf, size_t len) +{ + static struct { + cell_t name; + cell_t nargs; + cell_t nreturns; + cell_t instance; + cell_t buf; + cell_t len; + cell_t size; + } args = { + (cell_t)"instance-to-path", + 3, + 1, + }; + + ofw_real_start(); + + args.instance = instance; + args.buf = ofw_real_map(buf, len); + args.len = len; + if (args.buf == 0 || openfirmware(&args) == -1) { + ofw_real_stop(); + return (-1); + } + ofw_real_unmap(args.buf, buf, len); + + ofw_real_stop(); + return (args.size); +} + +/* Return the fully qualified pathname corresponding to a package. */ +static ssize_t +ofw_real_package_to_path(ofw_t ofw, phandle_t package, char *buf, size_t len) +{ + static struct { + cell_t name; + cell_t nargs; + cell_t nreturns; + cell_t package; + cell_t buf; + cell_t len; + cell_t size; + } args = { + (cell_t)"package-to-path", + 3, + 1, + }; + + ofw_real_start(); + + args.package = package; + args.buf = ofw_real_map(buf, len); + args.len = len; + if (args.buf == 0 || openfirmware(&args) == -1) { + ofw_real_stop(); + return (-1); + } + ofw_real_unmap(args.buf, buf, len); + + ofw_real_stop(); + return (args.size); +} + +/* Call the method in the scope of a given instance. */ +static int +ofw_real_call_method(ofw_t ofw, ihandle_t instance, const char *method, + int nargs, int nreturns, unsigned long *args_and_returns) +{ + static struct { + cell_t name; + cell_t nargs; + cell_t nreturns; + cell_t method; + cell_t instance; + cell_t args_n_results[12]; + } args = { + (cell_t)"call-method", + 2, + 1, + }; + cell_t *cp; + unsigned long *ap; + int n; + + if (nargs > 6) + return (-1); + + ofw_real_start(); + args.nargs = nargs + 2; + args.nreturns = nreturns + 1; + args.method = ofw_real_map(method, strlen(method) + 1); + args.instance = instance; + + ap = args_and_returns; + for (cp = args.args_n_results + (n = nargs); --n >= 0;) + *--cp = *(ap++); + if (args.method == 0 || openfirmware(&args) == -1) { + ofw_real_stop(); + return (-1); + } + ofw_real_stop(); + if (args.args_n_results[nargs]) + return (args.args_n_results[nargs]); + for (cp = args.args_n_results + nargs + (n = args.nreturns); --n > 0;) + *(ap++) = *--cp; + return (0); +} + +/* + * Device I/O functions + */ + +/* Open an instance for a device. */ +static ihandle_t +ofw_real_open(ofw_t ofw, const char *device) +{ + static struct { + cell_t name; + cell_t nargs; + cell_t nreturns; + cell_t device; + cell_t instance; + } args = { + (cell_t)"open", + 1, + 1, + }; + + ofw_real_start(); + + args.device = ofw_real_map(device, strlen(device) + 1); + if (args.device == 0 || openfirmware(&args) == -1 + || args.instance == 0) { + ofw_real_stop(); + return (-1); + } + ofw_real_stop(); + return (args.instance); +} + +/* Close an instance. */ +static void +ofw_real_close(ofw_t ofw, ihandle_t instance) +{ + static struct { + cell_t name; + cell_t nargs; + cell_t nreturns; + cell_t instance; + } args = { + (cell_t)"close", + 1, + }; + + args.instance = instance; + openfirmware(&args); +} + +/* Read from an instance. */ +static ssize_t +ofw_real_read(ofw_t ofw, ihandle_t instance, void *addr, size_t len) +{ + static struct { + cell_t name; + cell_t nargs; + cell_t nreturns; + cell_t instance; + cell_t addr; + cell_t len; + cell_t actual; + } args = { + (cell_t)"read", + 3, + 1, + }; + + ofw_real_start(); + + args.instance = instance; + args.addr = ofw_real_map(addr, len); + args.len = len; + if (args.addr == 0 || openfirmware(&args) == -1) { + ofw_real_stop(); + return (-1); + } + ofw_real_unmap(args.addr, addr, len); + + ofw_real_stop(); + return (args.actual); +} + +/* Write to an instance. */ +static ssize_t +ofw_real_write(ofw_t ofw, ihandle_t instance, const void *addr, size_t len) +{ + static struct { + cell_t name; + cell_t nargs; + cell_t nreturns; + cell_t instance; + cell_t addr; + cell_t len; + cell_t actual; + } args = { + (cell_t)"write", + 3, + 1, + }; + + ofw_real_start(); + + args.instance = instance; + args.addr = ofw_real_map(addr, len); + args.len = len; + if (args.addr == 0 || openfirmware(&args) == -1) { + ofw_real_stop(); + return (-1); + } + ofw_real_stop(); + return (args.actual); +} + +/* Seek to a position. */ +static int +ofw_real_seek(ofw_t ofw, ihandle_t instance, u_int64_t pos) +{ + static struct { + cell_t name; + cell_t nargs; + cell_t nreturns; + cell_t instance; + cell_t poshi; + cell_t poslo; + cell_t status; + } args = { + (cell_t)"seek", + 3, + 1, + }; + + args.instance = instance; + args.poshi = pos >> 32; + args.poslo = pos; + if (openfirmware(&args) == -1) + return (-1); + return (args.status); +} + +/* + * Memory functions + */ + +/* Claim an area of memory. */ +static caddr_t +ofw_real_claim(ofw_t ofw, void *virt, size_t size, u_int align) +{ + static struct { + cell_t name; + cell_t nargs; + cell_t nreturns; + cell_t virt; + cell_t size; + cell_t align; + cell_t baseaddr; + } args = { + (cell_t)"claim", + 3, + 1, + }; + + args.virt = (cell_t)virt; + args.size = size; + args.align = align; + if (openfirmware(&args) == -1) + return ((void *)-1); + return ((void *)args.baseaddr); +} + +/* Release an area of memory. */ +static void +ofw_real_release(ofw_t ofw, void *virt, size_t size) +{ + static struct { + cell_t name; + cell_t nargs; + cell_t nreturns; + cell_t virt; + cell_t size; + } args = { + (cell_t)"release", + 2, + }; + + args.virt = (cell_t)virt; + args.size = size; + openfirmware(&args); +} + +/* + * Control transfer functions + */ + +/* Suspend and drop back to the Open Firmware interface. */ +static void +ofw_real_enter(ofw_t ofw) +{ + static struct { + cell_t name; + cell_t nargs; + cell_t nreturns; + } args = { + (cell_t)"enter", + }; + + openfirmware(&args); + /* We may come back. */ +} + +/* Shut down and drop back to the Open Firmware interface. */ +static void +ofw_real_exit(ofw_t ofw) +{ + static struct { + cell_t name; + cell_t nargs; + cell_t nreturns; + } args = { + (cell_t)"exit", + }; + + openfirmware(&args); + for (;;) /* just in case */ + ; +} + From sam at freebsd.org Sun Apr 5 12:09:03 2009 From: sam at freebsd.org (Sam Leffler) Date: Sun Apr 5 12:09:10 2009 Subject: svn commit: r190735 - in head/sys/dev/usb: . controller In-Reply-To: <200904051820.n35IKn23027975@svn.freebsd.org> References: <200904051820.n35IKn23027975@svn.freebsd.org> Message-ID: <49D901CE.8030209@freebsd.org> Andrew Thompson wrote: > Author: thompsa > Date: Sun Apr 5 18:20:49 2009 > New Revision: 190735 > URL: http://svn.freebsd.org/changeset/base/190735 > > Log: > MFp4 //depot/projects/usb@159922 > > Refactor how we interface with the root HUB. This cuts around 1200 lines of > code totally and saves one thread per USB bus. > > Submitted by: Hans Petter Selasky > > > This comment does not describe the new scheme for interfacing with the root HUB. Please include an explanation. Sam From xcllnt at mac.com Sun Apr 5 12:53:06 2009 From: xcllnt at mac.com (Marcel Moolenaar) Date: Sun Apr 5 12:53:13 2009 Subject: svn commit: r190704 - head/sys/powerpc/aim In-Reply-To: <7F1FC303-3EFC-4182-9260-FE35C4BD9909@semihalf.com> References: <200904042223.n34MN3RG082677@svn.freebsd.org> <7F1FC303-3EFC-4182-9260-FE35C4BD9909@semihalf.com> Message-ID: On Apr 5, 2009, at 2:03 AM, Rafal Jaworowski wrote: >> Log: >> Perform a dummy stwcx. when we switch contexts. The context >> being switched out may hold a reservation. The stwcx. will >> clear the reservation. This is architecturally recommended. >> >> The scenario this addresses is as follows: >> 1. Thread 1 performs a lwarx and as such holds a reservation. >> 2. Thread 1 gets switched out (before doing the matching >> stwcx.) and thread 2 is switched in. >> 3. Thread 2 performs a stwcx. to the same reservation granule. >> This will succeed because the processor has the reservation >> even though thread 2 didn't do the lwarx. >> >> Note that on some processors the address given the stwcx. is >> not checked. On these processors the mere condition of having >> a reservation would cause the stwcx. to succeed, irrespective >> of whether the addresses are the same. The dummy stwcx. is >> especially important for those processors. > > Have you seen this false stwcx. actually succeed in some real > scenarios on AIM? Were there any tangible [corruption?] effects > observed without this fix? I think so, but I may be mistaken easily. I've been running with this for a while on my SMP machine and it "felt" more stable. make release for example would always end with sh(1) dumping core. I don't see that anymore. > We're seeing some hang with the dual E500 under very heavy loads, > but only with ULE (or we could only correlate this with ULE so far), > but didn't get to really close investigation of this issue yet. I'm > wondering if it's something of this sort too. It's not impossible. I can only say: try it :-) -- Marcel Moolenaar xcllnt@mac.com From phk at FreeBSD.org Sun Apr 5 13:59:27 2009 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Sun Apr 5 13:59:39 2009 Subject: svn commit: r190748 - head/tools/tools/sysbuild Message-ID: <200904052059.n35KxQD5033677@svn.freebsd.org> Author: phk Date: Sun Apr 5 20:59:26 2009 New Revision: 190748 URL: http://svn.freebsd.org/changeset/base/190748 Log: Remember to clear the ports list before generation for prefetch Modified: head/tools/tools/sysbuild/sysbuild.sh Modified: head/tools/tools/sysbuild/sysbuild.sh ============================================================================== --- head/tools/tools/sysbuild/sysbuild.sh Sun Apr 5 18:40:15 2009 (r190747) +++ head/tools/tools/sysbuild/sysbuild.sh Sun Apr 5 20:59:26 2009 (r190748) @@ -214,6 +214,7 @@ ports_build() ( ports_prefetch() ( ( set +x + true > /tmp/_.plist ports_recurse $PORTS_WE_WANT # Now checksump/fetch them From piso at FreeBSD.org Sun Apr 5 14:24:16 2009 From: piso at FreeBSD.org (Paolo Pisati) Date: Sun Apr 5 14:24:23 2009 Subject: svn commit: r190749 - in head/sys: dev/ata dev/sound/usb dev/usb dev/usb/bluetooth dev/usb/controller dev/usb/input dev/usb/misc dev/usb/net dev/usb/quirk dev/usb/serial dev/usb/storage dev/usb/tem... Message-ID: <200904052124.n35LOF7S034434@svn.freebsd.org> Author: piso Date: Sun Apr 5 21:24:15 2009 New Revision: 190749 URL: http://svn.freebsd.org/changeset/base/190749 Log: Remove pointeless mergeinfo that crept in from r190633. Modified: head/sys/dev/ata/ata-usb.c (props changed) head/sys/dev/sound/usb/uaudio.c (props changed) head/sys/dev/sound/usb/uaudio.h (props changed) head/sys/dev/sound/usb/uaudio_pcm.c (props changed) head/sys/dev/sound/usb/uaudioreg.h (props changed) head/sys/dev/usb/README.TXT (props changed) head/sys/dev/usb/bluetooth/TODO.TXT (props changed) head/sys/dev/usb/bluetooth/ng_ubt.c (props changed) head/sys/dev/usb/bluetooth/ng_ubt_var.h (props changed) head/sys/dev/usb/bluetooth/ubtbcmfw.c (props changed) head/sys/dev/usb/controller/at91dci.c (props changed) head/sys/dev/usb/controller/at91dci.h (props changed) head/sys/dev/usb/controller/at91dci_atmelarm.c (props changed) head/sys/dev/usb/controller/atmegadci.c (props changed) head/sys/dev/usb/controller/atmegadci.h (props changed) head/sys/dev/usb/controller/atmegadci_atmelarm.c (props changed) head/sys/dev/usb/controller/ehci.c (props changed) head/sys/dev/usb/controller/ehci.h (props changed) head/sys/dev/usb/controller/ehci_ixp4xx.c (props changed) head/sys/dev/usb/controller/ehci_mbus.c (props changed) head/sys/dev/usb/controller/ehci_pci.c (props changed) head/sys/dev/usb/controller/musb_otg.c (props changed) head/sys/dev/usb/controller/musb_otg.h (props changed) head/sys/dev/usb/controller/musb_otg_atmelarm.c (props changed) head/sys/dev/usb/controller/ohci.c (props changed) head/sys/dev/usb/controller/ohci.h (props changed) head/sys/dev/usb/controller/ohci_atmelarm.c (props changed) head/sys/dev/usb/controller/ohci_pci.c (props changed) head/sys/dev/usb/controller/uhci.c (props changed) head/sys/dev/usb/controller/uhci.h (props changed) head/sys/dev/usb/controller/uhci_pci.c (props changed) head/sys/dev/usb/controller/usb_controller.c (props changed) head/sys/dev/usb/controller/uss820dci.c (props changed) head/sys/dev/usb/controller/uss820dci.h (props changed) head/sys/dev/usb/controller/uss820dci_atmelarm.c (props changed) head/sys/dev/usb/input/uhid.c (props changed) head/sys/dev/usb/input/ukbd.c (props changed) head/sys/dev/usb/input/ums.c (props changed) head/sys/dev/usb/input/usb_rdesc.h (props changed) head/sys/dev/usb/misc/udbp.c (props changed) head/sys/dev/usb/misc/udbp.h (props changed) head/sys/dev/usb/misc/ufm.c (props changed) head/sys/dev/usb/net/if_aue.c (props changed) head/sys/dev/usb/net/if_auereg.h (props changed) head/sys/dev/usb/net/if_axe.c (props changed) head/sys/dev/usb/net/if_axereg.h (props changed) head/sys/dev/usb/net/if_cdce.c (props changed) head/sys/dev/usb/net/if_cdcereg.h (props changed) head/sys/dev/usb/net/if_cue.c (props changed) head/sys/dev/usb/net/if_cuereg.h (props changed) head/sys/dev/usb/net/if_kue.c (props changed) head/sys/dev/usb/net/if_kuefw.h (props changed) head/sys/dev/usb/net/if_kuereg.h (props changed) head/sys/dev/usb/net/if_rue.c (props changed) head/sys/dev/usb/net/if_ruereg.h (props changed) head/sys/dev/usb/net/if_udav.c (props changed) head/sys/dev/usb/net/if_udavreg.h (props changed) head/sys/dev/usb/net/usb_ethernet.c (props changed) head/sys/dev/usb/net/usb_ethernet.h (props changed) head/sys/dev/usb/quirk/usb_quirk.c (props changed) head/sys/dev/usb/quirk/usb_quirk.h (props changed) head/sys/dev/usb/serial/u3g.c (props changed) head/sys/dev/usb/serial/uark.c (props changed) head/sys/dev/usb/serial/ubsa.c (props changed) head/sys/dev/usb/serial/ubser.c (props changed) head/sys/dev/usb/serial/uchcom.c (props changed) head/sys/dev/usb/serial/ucycom.c (props changed) head/sys/dev/usb/serial/ufoma.c (props changed) head/sys/dev/usb/serial/uftdi.c (props changed) head/sys/dev/usb/serial/uftdi_reg.h (props changed) head/sys/dev/usb/serial/ugensa.c (props changed) head/sys/dev/usb/serial/uipaq.c (props changed) head/sys/dev/usb/serial/ulpt.c (props changed) head/sys/dev/usb/serial/umct.c (props changed) head/sys/dev/usb/serial/umodem.c (props changed) head/sys/dev/usb/serial/umoscom.c (props changed) head/sys/dev/usb/serial/uplcom.c (props changed) head/sys/dev/usb/serial/usb_serial.c (props changed) head/sys/dev/usb/serial/usb_serial.h (props changed) head/sys/dev/usb/serial/uslcom.c (props changed) head/sys/dev/usb/serial/uvisor.c (props changed) head/sys/dev/usb/serial/uvscom.c (props changed) head/sys/dev/usb/storage/rio500_usb.h (props changed) head/sys/dev/usb/storage/umass.c (props changed) head/sys/dev/usb/storage/urio.c (props changed) head/sys/dev/usb/storage/ustorage_fs.c (props changed) head/sys/dev/usb/template/usb_template.c (props changed) head/sys/dev/usb/template/usb_template.h (props changed) head/sys/dev/usb/template/usb_template_cdce.c (props changed) head/sys/dev/usb/template/usb_template_msc.c (props changed) head/sys/dev/usb/template/usb_template_mtp.c (props changed) head/sys/dev/usb/ufm_ioctl.h (props changed) head/sys/dev/usb/usb.h (props changed) head/sys/dev/usb/usb_bus.h (props changed) head/sys/dev/usb/usb_busdma.c (props changed) head/sys/dev/usb/usb_busdma.h (props changed) head/sys/dev/usb/usb_cdc.h (props changed) head/sys/dev/usb/usb_compat_linux.c (props changed) head/sys/dev/usb/usb_compat_linux.h (props changed) head/sys/dev/usb/usb_controller.h (props changed) head/sys/dev/usb/usb_core.c (props changed) head/sys/dev/usb/usb_core.h (props changed) head/sys/dev/usb/usb_debug.c (props changed) head/sys/dev/usb/usb_debug.h (props changed) head/sys/dev/usb/usb_defs.h (props changed) head/sys/dev/usb/usb_dev.c (props changed) head/sys/dev/usb/usb_dev.h (props changed) head/sys/dev/usb/usb_device.c (props changed) head/sys/dev/usb/usb_device.h (props changed) head/sys/dev/usb/usb_dynamic.c (props changed) head/sys/dev/usb/usb_dynamic.h (props changed) head/sys/dev/usb/usb_endian.h (props changed) head/sys/dev/usb/usb_error.c (props changed) head/sys/dev/usb/usb_error.h (props changed) head/sys/dev/usb/usb_generic.c (props changed) head/sys/dev/usb/usb_generic.h (props changed) head/sys/dev/usb/usb_handle_request.c (props changed) head/sys/dev/usb/usb_handle_request.h (props changed) head/sys/dev/usb/usb_hid.c (props changed) head/sys/dev/usb/usb_hid.h (props changed) head/sys/dev/usb/usb_hub.c (props changed) head/sys/dev/usb/usb_hub.h (props changed) head/sys/dev/usb/usb_if.m (props changed) head/sys/dev/usb/usb_ioctl.h (props changed) head/sys/dev/usb/usb_lookup.c (props changed) head/sys/dev/usb/usb_lookup.h (props changed) head/sys/dev/usb/usb_mbuf.c (props changed) head/sys/dev/usb/usb_mbuf.h (props changed) head/sys/dev/usb/usb_mfunc.h (props changed) head/sys/dev/usb/usb_msctest.c (props changed) head/sys/dev/usb/usb_msctest.h (props changed) head/sys/dev/usb/usb_parse.c (props changed) head/sys/dev/usb/usb_parse.h (props changed) head/sys/dev/usb/usb_pci.h (props changed) head/sys/dev/usb/usb_process.c (props changed) head/sys/dev/usb/usb_process.h (props changed) head/sys/dev/usb/usb_request.c (props changed) head/sys/dev/usb/usb_request.h (props changed) head/sys/dev/usb/usb_revision.h (props changed) head/sys/dev/usb/usb_sw_transfer.c (props changed) head/sys/dev/usb/usb_sw_transfer.h (props changed) head/sys/dev/usb/usb_transfer.c (props changed) head/sys/dev/usb/usb_transfer.h (props changed) head/sys/dev/usb/usb_util.c (props changed) head/sys/dev/usb/usb_util.h (props changed) head/sys/dev/usb/usbdevs (props changed) head/sys/dev/usb/usbhid.h (props changed) head/sys/dev/usb/wlan/if_rum.c (props changed) head/sys/dev/usb/wlan/if_rumfw.h (props changed) head/sys/dev/usb/wlan/if_rumreg.h (props changed) head/sys/dev/usb/wlan/if_rumvar.h (props changed) head/sys/dev/usb/wlan/if_ural.c (props changed) head/sys/dev/usb/wlan/if_uralreg.h (props changed) head/sys/dev/usb/wlan/if_uralvar.h (props changed) head/sys/dev/usb/wlan/if_zyd.c (props changed) head/sys/dev/usb/wlan/if_zydfw.h (props changed) head/sys/dev/usb/wlan/if_zydreg.h (props changed) head/sys/dev/usb/wlan/usb_wlan.h (props changed) head/sys/legacy/dev/ata/ata-usb.c (props changed) head/sys/legacy/dev/sound/usb/uaudio.c (props changed) head/sys/legacy/dev/sound/usb/uaudio.h (props changed) head/sys/legacy/dev/sound/usb/uaudio_pcm.c (props changed) head/sys/legacy/dev/sound/usb/uaudioreg.h (props changed) head/sys/legacy/dev/usb/ehci_ixp4xx.c (props changed) head/sys/xen/evtchn.h (props changed) head/sys/xen/hypervisor.h (props changed) head/sys/xen/xen_intr.h (props changed) From nwhitehorn at FreeBSD.org Sun Apr 5 14:52:14 2009 From: nwhitehorn at FreeBSD.org (Nathan Whitehorn) Date: Sun Apr 5 14:52:31 2009 Subject: svn commit: r190750 - head/sys/powerpc/aim Message-ID: <200904052152.n35LqEx7035019@svn.freebsd.org> Author: nwhitehorn Date: Sun Apr 5 21:52:13 2009 New Revision: 190750 URL: http://svn.freebsd.org/changeset/base/190750 Log: Fix the build when KDB is disabled. The second instance of rfi in trap_subr.S that is patched at runtime to rfid on 64-bit systems is inside KDB-specific code, so don't patch it without KDB. Modified: head/sys/powerpc/aim/machdep.c Modified: head/sys/powerpc/aim/machdep.c ============================================================================== --- head/sys/powerpc/aim/machdep.c Sun Apr 5 21:24:15 2009 (r190749) +++ head/sys/powerpc/aim/machdep.c Sun Apr 5 21:52:13 2009 (r190750) @@ -383,7 +383,10 @@ powerpc_init(u_int startkernel, u_int en if (ppc64) { /* Patch the two instances of rfi -> rfid */ bcopy(&rfid_patch,&rfi_patch1,4); + #ifdef KDB + /* rfi_patch2 is at the end of dbleave */ bcopy(&rfid_patch,&rfi_patch2,4); + #endif /* * Copy a code snippet to restore 32-bit bridge mode From ed at FreeBSD.org Sun Apr 5 15:08:19 2009 From: ed at FreeBSD.org (Ed Schouten) Date: Sun Apr 5 15:08:31 2009 Subject: svn commit: r190751 - in head: . rescue/rescue sbin sbin/slattach sbin/startslip share/man/man4 share/mk sys/net tools/build/options usr.sbin usr.sbin/pppd usr.sbin/pppstats usr.sbin/sliplogin Message-ID: <200904052208.n35M8IjT035411@svn.freebsd.org> Author: ed Date: Sun Apr 5 22:08:18 2009 New Revision: 190751 URL: http://svn.freebsd.org/changeset/base/190751 Log: Remove if_ppp(4) and if_sl(4). Not only did these two drivers depend on IFF_NEEDSGIANT, they were broken 7 months ago during the MPSAFE TTY import. if_ppp(4) has been replaced by ppp(8). There is no replacement for if_sl(4). If we see regressions in for example the ports tree, we should just use __FreeBSD_version 800045 to check whether if_ppp(4) and if_sl(4) are present. Version 800045 is used to denote the import of MPSAFE TTY. Discussed with: rwatson, but also rwatson's IFF_NEEDSGIANT emails on the lists. Deleted: head/sbin/slattach/ head/sbin/startslip/ head/share/man/man4/ppp.4 head/share/man/man4/sl.4 head/sys/net/bsd_comp.c head/sys/net/if_ppp.c head/sys/net/if_ppp.h head/sys/net/if_pppvar.h head/sys/net/if_sl.c head/sys/net/if_slvar.h head/sys/net/ppp_comp.h head/sys/net/ppp_deflate.c head/sys/net/ppp_tty.c head/sys/net/slip.h head/tools/build/options/WITHOUT_SLIP head/usr.sbin/pppd/ head/usr.sbin/pppstats/ head/usr.sbin/sliplogin/ Modified: head/ObsoleteFiles.inc head/rescue/rescue/Makefile head/sbin/Makefile head/share/man/man4/Makefile head/share/mk/bsd.own.mk head/usr.sbin/Makefile Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Sun Apr 5 21:52:13 2009 (r190750) +++ head/ObsoleteFiles.inc Sun Apr 5 22:08:18 2009 (r190751) @@ -14,6 +14,26 @@ # The file is partitioned: OLD_FILES first, then OLD_LIBS and OLD_DIRS last. # +# 20090405: removal of if_ppp(4) and if_sl(4) +OLD_FILES+=sbin/slattach +OLD_FILES+=sbin/startslip +OLD_FILES+=usr/include/net/if_ppp.h +OLD_FILES+=usr/include/net/if_pppvar.h +OLD_FILES+=usr/include/net/if_slvar.h +OLD_FILES+=usr/include/net/ppp_comp.h +OLD_FILES+=usr/include/net/slip.h +OLD_FILES+=usr/sbin/sliplogin +OLD_FILES+=usr/sbin/pppd +OLD_FILES+=usr/sbin/pppstats +OLD_FILES+=usr/share/man/man1/startslip.1.gz +OLD_FILES+=usr/share/man/man4/if_ppp.4.gz +OLD_FILES+=usr/share/man/man4/if_sl.4.gz +OLD_FILES+=usr/share/man/man4/ppp.4.gz +OLD_FILES+=usr/share/man/man4/sl.4.gz +OLD_FILES+=usr/share/man/man8/pppd.8.gz +OLD_FILES+=usr/share/man/man8/pppstats.8.gz +OLD_FILES+=usr/share/man/man8/slattach.8.gz +OLD_FILES+=usr/share/man/man8/sliplogin.8.gz # 20090319: uscanner(4) has been removed OLD_FILES+=usr/share/man/man4/uscanner.4.gz # 20090313: k8temp(4) renamed to amdtemp(4) Modified: head/rescue/rescue/Makefile ============================================================================== --- head/rescue/rescue/Makefile Sun Apr 5 21:52:13 2009 (r190750) +++ head/rescue/rescue/Makefile Sun Apr 5 22:08:18 2009 (r190751) @@ -118,7 +118,7 @@ CRUNCH_PROGS_sbin= atacontrol badsect mount_udf mount_unionfs newfs \ newfs_msdos nos-tun ping reboot \ restore rcorder route routed rtquery rtsol savecore \ - slattach spppcontrol startslip swapon sysctl tunefs umount + spppcontrol swapon sysctl tunefs umount .if ${MK_ATM} != "no" CRUNCH_PROGS_sbin+= atmconfig Modified: head/sbin/Makefile ============================================================================== --- head/sbin/Makefile Sun Apr 5 21:52:13 2009 (r190750) +++ head/sbin/Makefile Sun Apr 5 22:08:18 2009 (r190751) @@ -82,9 +82,7 @@ SUBDIR= adjkerntz \ ${_sconfig} \ setkey \ shutdown \ - slattach \ spppcontrol \ - ${_startslip} \ ${_sunlabel} \ swapon \ sysctl \ @@ -130,10 +128,6 @@ _quotacheck= quotacheck _routed= routed .endif -.if ${MK_SLIP} != "no" -_startslip= startslip -.endif - .if ${MACHINE_ARCH} == "i386" .if ${MACHINE} == "i386" _fdisk= fdisk Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Sun Apr 5 21:52:13 2009 (r190750) +++ head/share/man/man4/Makefile Sun Apr 5 22:08:18 2009 (r190751) @@ -289,7 +289,6 @@ MAN= aac.4 \ ppbus.4 \ ppc.4 \ ppi.4 \ - ppp.4 \ psm.4 \ pst.4 \ pt.4 \ @@ -324,7 +323,6 @@ MAN= aac.4 \ sio.4 \ sis.4 \ sk.4 \ - sl.4 \ smb.4 \ smbus.4 \ smp.4 \ @@ -531,7 +529,6 @@ MLINKS+=pccbb.4 cbb.4 MLINKS+=pcm.4 snd.4 \ pcm.4 sound.4 MLINKS+=pcn.4 if_pcn.4 -MLINKS+=ppp.4 if_ppp.4 MLINKS+=ral.4 if_ral.4 MLINKS+=re.4 if_re.4 MLINKS+=rl.4 if_rl.4 @@ -544,7 +541,6 @@ MLINKS+=scsi.4 CAM.4 \ MLINKS+=sf.4 if_sf.4 MLINKS+=sis.4 if_sis.4 MLINKS+=sk.4 if_sk.4 -MLINKS+=sl.4 if_sl.4 MLINKS+=smp.4 SMP.4 MLINKS+=sn.4 if_sn.4 MLINKS+=snd_envy24.4 snd_ak452x.4 Modified: head/share/mk/bsd.own.mk ============================================================================== --- head/share/mk/bsd.own.mk Sun Apr 5 21:52:13 2009 (r190750) +++ head/share/mk/bsd.own.mk Sun Apr 5 22:08:18 2009 (r190751) @@ -372,7 +372,6 @@ WITH_IDEA= SENDMAIL \ SETUID_LOGIN \ SHAREDOCS \ - SLIP \ SSP \ SYSINSTALL \ SYMVER \ Modified: head/usr.sbin/Makefile ============================================================================== --- head/usr.sbin/Makefile Sun Apr 5 21:52:13 2009 (r190750) +++ head/usr.sbin/Makefile Sun Apr 5 22:08:18 2009 (r190751) @@ -129,8 +129,6 @@ SUBDIR= ${_ac} \ powerd \ ${_ppp} \ ${_pppctl} \ - ${_pppd} \ - ${_pppstats} \ ${_praliases} \ ${_praudit} \ procctl \ @@ -166,7 +164,6 @@ SUBDIR= ${_ac} \ setfmac \ setpmac \ ${_sicontrol} \ - ${_sliplogin} \ ${_slstat} \ smbmsg \ snapinfo \ @@ -363,8 +360,6 @@ _portsnap= portsnap .if ${MK_PPP} != "no" _ppp= ppp #_pppctl handled below -_pppd= pppd -_pppstats= pppstats .endif .if ${MK_QUOTAS} != "no" @@ -385,11 +380,6 @@ _praliases= praliases _sendmail= sendmail .endif -.if ${MK_SLIP} != "no" -_sliplogin= sliplogin -_slstat= slstat -.endif - .if ${MK_SYSINSTALL} != "no" .if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386" || \ ${MACHINE_ARCH} == "sparc64" From ed at FreeBSD.org Sun Apr 5 15:15:36 2009 From: ed at FreeBSD.org (Ed Schouten) Date: Sun Apr 5 15:15:48 2009 Subject: svn commit: r190752 - head/share/man/man5 Message-ID: <200904052215.n35MFZlX035650@svn.freebsd.org> Author: ed Date: Sun Apr 5 22:15:35 2009 New Revision: 190752 URL: http://svn.freebsd.org/changeset/base/190752 Log: Regenerate src.conf.5. Modified: head/share/man/man5/src.conf.5 Modified: head/share/man/man5/src.conf.5 ============================================================================== --- head/share/man/man5/src.conf.5 Sun Apr 5 22:08:18 2009 (r190751) +++ head/share/man/man5/src.conf.5 Sun Apr 5 22:15:35 2009 (r190752) @@ -1,7 +1,7 @@ .\" DO NOT EDIT-- this file is automatically generated. -.\" from FreeBSD: head/tools/build/options/makeman 174548 2007-12-12 16:39:32Z ru +.\" from FreeBSD: head/tools/build/options/makeman 188848 2009-02-20 11:09:55Z mtm .\" $FreeBSD$ -.Dd September 23, 2008 +.Dd April 5, 2009 .Dt SRC.CONF 5 .Os .Sh NAME @@ -462,7 +462,7 @@ On amd64, set to not build 32-bit librar .Nm ld-elf32.so.1 runtime linker. .It Va WITHOUT_LIBPTHREAD -.\" from FreeBSD: head/tools/build/options/WITHOUT_LIBPTHREAD 172498 2007-10-09 17:53:33Z obrien +.\" from FreeBSD: head/tools/build/options/WITHOUT_LIBPTHREAD 188848 2009-02-20 11:09:55Z mtm Set to not build the .Nm libpthread providing library, @@ -721,11 +721,6 @@ as a set-user-ID root program. Set to not build the .Bx 4.4 legacy docs. -.It Va WITHOUT_SLIP -.\" from FreeBSD: head/tools/build/options/WITHOUT_SLIP 183242 2008-09-21 22:02:26Z sam -Set to not build -.Xr sliplogin 8 -and related programs. .It Va WITHOUT_SSP .\" from FreeBSD: head/tools/build/options/WITHOUT_SSP 180012 2008-06-25 21:33:28Z ru Set to not build world with propolice stack smashing protection. From kan at FreeBSD.org Sun Apr 5 16:25:07 2009 From: kan at FreeBSD.org (Alexander Kabaev) Date: Sun Apr 5 16:25:14 2009 Subject: svn commit: r190753 - head/sys/netinet Message-ID: <200904052325.n35NP6bo036905@svn.freebsd.org> Author: kan Date: Sun Apr 5 23:25:06 2009 New Revision: 190753 URL: http://svn.freebsd.org/changeset/base/190753 Log: If KTR_SUBSYS is compiled in, it does not necessarily mean that user is interested in being spammed by mcast-related printfs. Use proper check against ktr_mask instead KTR_COMPILE. Modified: head/sys/netinet/in_mcast.c Modified: head/sys/netinet/in_mcast.c ============================================================================== --- head/sys/netinet/in_mcast.c Sun Apr 5 22:15:35 2009 (r190752) +++ head/sys/netinet/in_mcast.c Sun Apr 5 23:25:06 2009 (r190753) @@ -2838,7 +2838,7 @@ inm_print(const struct in_multi *inm) { int t; - if ((KTR_COMPILE & KTR_IGMPV3) == 0) + if ((ktr_mask & KTR_IGMPV3) == 0) return; printf("%s: --- begin inm %p ---\n", __func__, inm); From thompsa at FreeBSD.org Sun Apr 5 17:22:35 2009 From: thompsa at FreeBSD.org (Andrew Thompson) Date: Sun Apr 5 17:22:41 2009 Subject: svn commit: r190749 - in head/sys: dev/ata dev/sound/usb dev/usb dev/usb/bluetooth dev/usb/controller dev/usb/input dev/usb/misc dev/usb/net dev/usb/quirk dev/usb/serial dev/usb/storage dev/usb/tem... In-Reply-To: <200904052124.n35LOF7S034434@svn.freebsd.org> References: <200904052124.n35LOF7S034434@svn.freebsd.org> Message-ID: <20090406002229.GD52408@citylink.fud.org.nz> On Sun, Apr 05, 2009 at 09:24:15PM +0000, Paolo Pisati wrote: > Author: piso > Date: Sun Apr 5 21:24:15 2009 > New Revision: 190749 > URL: http://svn.freebsd.org/changeset/base/190749 > > Log: > Remove pointeless mergeinfo that crept in from r190633. Thanks! I was told this is a result of using 'svn mv' locally, can we get instructions out about how to do this properly. Andrew From thompsa at FreeBSD.org Sun Apr 5 17:22:50 2009 From: thompsa at FreeBSD.org (Andrew Thompson) Date: Sun Apr 5 17:23:03 2009 Subject: svn commit: r190754 - in head/sys/dev/usb: . controller Message-ID: <200904060022.n360MnJr039488@svn.freebsd.org> Author: thompsa Date: Mon Apr 6 00:22:49 2009 New Revision: 190754 URL: http://svn.freebsd.org/changeset/base/190754 Log: Provide a better commit log for r190735, forced by making a whitespace change. Refactor how we interface with the root HUB. This is achieved by making a direct call from usb2_do_request to the host controller for root hub requests, this call will perform the controller specific register read/writes and return the error code. This cuts out a lot of code in the host controller files and saves one thread per USB bus. Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/controller/at91dci.c head/sys/dev/usb/controller/at91dci.h head/sys/dev/usb/controller/atmegadci.c head/sys/dev/usb/controller/atmegadci.h head/sys/dev/usb/controller/ehci.c head/sys/dev/usb/controller/ehci.h head/sys/dev/usb/controller/musb_otg.c head/sys/dev/usb/controller/musb_otg.h head/sys/dev/usb/controller/ohci.c head/sys/dev/usb/controller/ohci.h head/sys/dev/usb/controller/uhci.c head/sys/dev/usb/controller/uhci.h head/sys/dev/usb/controller/usb_controller.c head/sys/dev/usb/controller/uss820dci.c head/sys/dev/usb/usb_bus.h head/sys/dev/usb/usb_controller.h head/sys/dev/usb/usb_core.h head/sys/dev/usb/usb_device.c head/sys/dev/usb/usb_hub.c head/sys/dev/usb/usb_hub.h head/sys/dev/usb/usb_request.c head/sys/dev/usb/usb_transfer.c Modified: head/sys/dev/usb/controller/at91dci.c ============================================================================== --- head/sys/dev/usb/controller/at91dci.c Sun Apr 5 23:25:06 2009 (r190753) +++ head/sys/dev/usb/controller/at91dci.c Mon Apr 6 00:22:49 2009 (r190754) @@ -38,7 +38,7 @@ __FBSDID("$FreeBSD$"); /* * NOTE: The "fifo_bank" is not reset in hardware when the endpoint is - * reset ! + * reset. * * NOTE: When the chip detects BUS-reset it will also reset the * endpoints, Function-address and more. Modified: head/sys/dev/usb/controller/at91dci.h ============================================================================== --- head/sys/dev/usb/controller/at91dci.h Sun Apr 5 23:25:06 2009 (r190753) +++ head/sys/dev/usb/controller/at91dci.h Mon Apr 6 00:22:49 2009 (r190754) @@ -27,8 +27,8 @@ */ /* - * USB Device Port (UDP) register definition, based on - * "AT91RM9200.h" provided by ATMEL. + * USB Device Port (UDP) register definition, based on "AT91RM9200.h" provided + * by ATMEL. */ #ifndef _AT9100_DCI_H_ Modified: head/sys/dev/usb/controller/atmegadci.c ============================================================================== --- head/sys/dev/usb/controller/atmegadci.c Sun Apr 5 23:25:06 2009 (r190753) +++ head/sys/dev/usb/controller/atmegadci.c Mon Apr 6 00:22:49 2009 (r190754) @@ -27,9 +27,8 @@ __FBSDID("$FreeBSD$"); */ /* - * This file contains the driver for the ATMEGA series USB OTG - * Controller. This driver currently only supports the DCI mode of the - * USB hardware. + * This file contains the driver for the ATMEGA series USB OTG Controller. This + * driver currently only supports the DCI mode of the USB hardware. */ /* Modified: head/sys/dev/usb/controller/atmegadci.h ============================================================================== --- head/sys/dev/usb/controller/atmegadci.h Sun Apr 5 23:25:06 2009 (r190753) +++ head/sys/dev/usb/controller/atmegadci.h Mon Apr 6 00:22:49 2009 (r190754) @@ -25,8 +25,8 @@ */ /* - * USB Device Port register definitions, copied from ATMEGA - * documentation provided by ATMEL. + * USB Device Port register definitions, copied from ATMEGA documentation + * provided by ATMEL. */ #ifndef _ATMEGADCI_H_ Modified: head/sys/dev/usb/controller/ehci.c ============================================================================== --- head/sys/dev/usb/controller/ehci.c Sun Apr 5 23:25:06 2009 (r190753) +++ head/sys/dev/usb/controller/ehci.c Mon Apr 6 00:22:49 2009 (r190754) @@ -39,7 +39,7 @@ */ /* - * TODO: + * TODO: * 1) command failures are not recovered correctly */ Modified: head/sys/dev/usb/controller/ehci.h ============================================================================== --- head/sys/dev/usb/controller/ehci.h Sun Apr 5 23:25:06 2009 (r190753) +++ head/sys/dev/usb/controller/ehci.h Mon Apr 6 00:22:49 2009 (r190754) @@ -40,7 +40,7 @@ #define EHCI_MAX_DEVICES MIN(USB_MAX_DEVICES, 128) -/* PCI config registers */ +/* PCI config registers */ #define PCI_CBMEM 0x10 /* configuration base MEM */ #define PCI_INTERFACE_EHCI 0x20 #define PCI_USBREV 0x60 /* RO USB protocol revision */ Modified: head/sys/dev/usb/controller/musb_otg.c ============================================================================== --- head/sys/dev/usb/controller/musb_otg.c Sun Apr 5 23:25:06 2009 (r190753) +++ head/sys/dev/usb/controller/musb_otg.c Mon Apr 6 00:22:49 2009 (r190754) @@ -25,8 +25,8 @@ */ /* - * Thanks to Mentor Graphics for providing a reference driver for this - * USB chip at their homepage. + * Thanks to Mentor Graphics for providing a reference driver for this USB chip + * at their homepage. */ /* Modified: head/sys/dev/usb/controller/musb_otg.h ============================================================================== --- head/sys/dev/usb/controller/musb_otg.h Sun Apr 5 23:25:06 2009 (r190753) +++ head/sys/dev/usb/controller/musb_otg.h Mon Apr 6 00:22:49 2009 (r190754) @@ -25,8 +25,8 @@ */ /* - * This header file defines the registers of the Mentor Graphics - * USB OnTheGo Inventra chip. + * This header file defines the registers of the Mentor Graphics USB OnTheGo + * Inventra chip. */ #ifndef _MUSB2_OTG_H_ Modified: head/sys/dev/usb/controller/ohci.c ============================================================================== --- head/sys/dev/usb/controller/ohci.c Sun Apr 5 23:25:06 2009 (r190753) +++ head/sys/dev/usb/controller/ohci.c Mon Apr 6 00:22:49 2009 (r190754) @@ -32,7 +32,7 @@ __FBSDID("$FreeBSD$"); * USB Open Host Controller driver. * * OHCI spec: http://www.compaq.com/productinfo/development/openhci.html - * USB spec: http://www.usb.org/developers/docs/usbspec.zip + * USB spec: http://www.usb.org/developers/docs/usbspec.zip */ #include Modified: head/sys/dev/usb/controller/ohci.h ============================================================================== --- head/sys/dev/usb/controller/ohci.h Sun Apr 5 23:25:06 2009 (r190753) +++ head/sys/dev/usb/controller/ohci.h Mon Apr 6 00:22:49 2009 (r190754) @@ -41,7 +41,7 @@ #define OHCI_MAX_DEVICES MIN(USB_MAX_DEVICES, 128) -/* PCI config registers */ +/* PCI config registers */ #define PCI_CBMEM 0x10 /* configuration base memory */ #define PCI_INTERFACE_OHCI 0x10 Modified: head/sys/dev/usb/controller/uhci.c ============================================================================== --- head/sys/dev/usb/controller/uhci.c Sun Apr 5 23:25:06 2009 (r190753) +++ head/sys/dev/usb/controller/uhci.c Mon Apr 6 00:22:49 2009 (r190754) @@ -33,7 +33,7 @@ __FBSDID("$FreeBSD$"); * Handles e.g. PIIX3 and PIIX4. * * UHCI spec: http://developer.intel.com/design/USB/UHCI11D.htm - * USB spec: http://www.usb.org/developers/docs/usbspec.zip + * USB spec: http://www.usb.org/developers/docs/usbspec.zip * PIIXn spec: ftp://download.intel.com/design/intarch/datashts/29055002.pdf * ftp://download.intel.com/design/intarch/datashts/29056201.pdf */ Modified: head/sys/dev/usb/controller/uhci.h ============================================================================== --- head/sys/dev/usb/controller/uhci.h Sun Apr 5 23:25:06 2009 (r190753) +++ head/sys/dev/usb/controller/uhci.h Mon Apr 6 00:22:49 2009 (r190754) @@ -41,7 +41,7 @@ #define UHCI_MAX_DEVICES MIN(USB_MAX_DEVICES, 128) -/* PCI config registers */ +/* PCI config registers */ #define PCI_USBREV 0x60 /* USB protocol revision */ #define PCI_USB_REV_MASK 0xff #define PCI_USB_REV_PRE_1_0 0x00 Modified: head/sys/dev/usb/controller/usb_controller.c ============================================================================== --- head/sys/dev/usb/controller/usb_controller.c Sun Apr 5 23:25:06 2009 (r190753) +++ head/sys/dev/usb/controller/usb_controller.c Mon Apr 6 00:22:49 2009 (r190754) @@ -41,7 +41,7 @@ #include #include -/* function prototypes */ +/* function prototypes */ static device_probe_t usb2_probe; static device_attach_t usb2_attach; Modified: head/sys/dev/usb/controller/uss820dci.c ============================================================================== --- head/sys/dev/usb/controller/uss820dci.c Sun Apr 5 23:25:06 2009 (r190753) +++ head/sys/dev/usb/controller/uss820dci.c Mon Apr 6 00:22:49 2009 (r190754) @@ -29,7 +29,7 @@ * This file contains the driver for the USS820 series USB Device * Controller * - * NOTE: The datasheet does not document everything! + * NOTE: The datasheet does not document everything. */ #include Modified: head/sys/dev/usb/usb_bus.h ============================================================================== --- head/sys/dev/usb/usb_bus.h Sun Apr 5 23:25:06 2009 (r190753) +++ head/sys/dev/usb/usb_bus.h Mon Apr 6 00:22:49 2009 (r190754) @@ -28,8 +28,8 @@ #define _USB2_BUS_H_ /* - * The following structure defines the USB explore message sent to the - * USB explore process. + * The following structure defines the USB explore message sent to the USB + * explore process. */ struct usb2_bus_msg { Modified: head/sys/dev/usb/usb_controller.h ============================================================================== --- head/sys/dev/usb/usb_controller.h Sun Apr 5 23:25:06 2009 (r190753) +++ head/sys/dev/usb/usb_controller.h Mon Apr 6 00:22:49 2009 (r190754) @@ -31,7 +31,7 @@ #define USB_BUS_DMA_TAG_MAX 8 -/* structure prototypes */ +/* structure prototypes */ struct usb2_bus; struct usb2_page; Modified: head/sys/dev/usb/usb_core.h ============================================================================== --- head/sys/dev/usb/usb_core.h Sun Apr 5 23:25:06 2009 (r190753) +++ head/sys/dev/usb/usb_core.h Mon Apr 6 00:22:49 2009 (r190754) @@ -25,8 +25,7 @@ */ /* - * Including this file is mandatory for all USB related c-files in the - * kernel. + * Including this file is mandatory for all USB related c-files in the kernel. */ #ifndef _USB2_CORE_H_ Modified: head/sys/dev/usb/usb_device.c ============================================================================== --- head/sys/dev/usb/usb_device.c Sun Apr 5 23:25:06 2009 (r190753) +++ head/sys/dev/usb/usb_device.c Mon Apr 6 00:22:49 2009 (r190754) @@ -55,7 +55,7 @@ #include #include -/* function prototypes */ +/* function prototypes */ static void usb2_init_pipe(struct usb2_device *, uint8_t, struct usb2_endpoint_descriptor *, struct usb2_pipe *); Modified: head/sys/dev/usb/usb_hub.c ============================================================================== --- head/sys/dev/usb/usb_hub.c Sun Apr 5 23:25:06 2009 (r190753) +++ head/sys/dev/usb/usb_hub.c Mon Apr 6 00:22:49 2009 (r190754) @@ -27,7 +27,7 @@ */ /* - * USB spec: http://www.usb.org/developers/docs/usbspec.zip + * USB spec: http://www.usb.org/developers/docs/usbspec.zip */ #include Modified: head/sys/dev/usb/usb_hub.h ============================================================================== --- head/sys/dev/usb/usb_hub.h Sun Apr 5 23:25:06 2009 (r190753) +++ head/sys/dev/usb/usb_hub.h Mon Apr 6 00:22:49 2009 (r190754) @@ -28,7 +28,7 @@ #define _USB2_HUB_H_ /* - * The following structure defines an USB port. + * The following structure defines an USB port. */ struct usb2_port { uint8_t restartcnt; Modified: head/sys/dev/usb/usb_request.c ============================================================================== --- head/sys/dev/usb/usb_request.c Sun Apr 5 23:25:06 2009 (r190753) +++ head/sys/dev/usb/usb_request.c Mon Apr 6 00:22:49 2009 (r190754) @@ -24,7 +24,7 @@ * 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. - */ + */ #include #include Modified: head/sys/dev/usb/usb_transfer.c ============================================================================== --- head/sys/dev/usb/usb_transfer.c Sun Apr 5 23:25:06 2009 (r190753) +++ head/sys/dev/usb/usb_transfer.c Mon Apr 6 00:22:49 2009 (r190754) @@ -22,7 +22,7 @@ * 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. - */ + */ #include #include From thompsa at FreeBSD.org Sun Apr 5 17:25:17 2009 From: thompsa at FreeBSD.org (Andrew Thompson) Date: Sun Apr 5 17:25:25 2009 Subject: svn commit: r190735 - in head/sys/dev/usb: . controller In-Reply-To: <49D901CE.8030209@freebsd.org> References: <200904051820.n35IKn23027975@svn.freebsd.org> <49D901CE.8030209@freebsd.org> Message-ID: <20090406002512.GE52408@citylink.fud.org.nz> On Sun, Apr 05, 2009 at 12:09:02PM -0700, Sam Leffler wrote: > Andrew Thompson wrote: >> Author: thompsa >> Date: Sun Apr 5 18:20:49 2009 >> New Revision: 190735 >> URL: http://svn.freebsd.org/changeset/base/190735 >> >> Log: >> MFp4 //depot/projects/usb@159922 >> Refactor how we interface with the root HUB. This cuts around 1200 >> lines of >> code totally and saves one thread per USB bus. >> Submitted by: Hans Petter Selasky >> >> >> > This comment does not describe the new scheme for interfacing with the root > HUB. Please include an explanation. My bad, this got caught up in the sync. I have forced a new commit log. Andrew From thompsa at FreeBSD.org Sun Apr 5 17:32:59 2009 From: thompsa at FreeBSD.org (Andrew Thompson) Date: Sun Apr 5 17:33:06 2009 Subject: svn commit: r190755 - in head/sys: conf dev/usb dev/usb/controller modules/usb/usb Message-ID: <200904060032.n360WtUJ040033@svn.freebsd.org> Author: thompsa Date: Mon Apr 6 00:32:54 2009 New Revision: 190755 URL: http://svn.freebsd.org/changeset/base/190755 Log: Remove usb_sw_transfer.[ch] which are now empty after r190735. Deleted: head/sys/dev/usb/usb_sw_transfer.c head/sys/dev/usb/usb_sw_transfer.h Modified: head/sys/conf/files head/sys/dev/usb/controller/at91dci.c head/sys/dev/usb/controller/at91dci_atmelarm.c head/sys/dev/usb/controller/atmegadci.c head/sys/dev/usb/controller/atmegadci_atmelarm.c head/sys/dev/usb/controller/ehci.c head/sys/dev/usb/controller/ehci_ixp4xx.c head/sys/dev/usb/controller/ehci_mbus.c head/sys/dev/usb/controller/ehci_pci.c head/sys/dev/usb/controller/musb_otg.c head/sys/dev/usb/controller/musb_otg_atmelarm.c head/sys/dev/usb/controller/ohci.c head/sys/dev/usb/controller/ohci_atmelarm.c head/sys/dev/usb/controller/ohci_pci.c head/sys/dev/usb/controller/uhci.c head/sys/dev/usb/controller/uhci_pci.c head/sys/dev/usb/controller/uss820dci.c head/sys/dev/usb/controller/uss820dci_atmelarm.c head/sys/modules/usb/usb/Makefile Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Mon Apr 6 00:22:49 2009 (r190754) +++ head/sys/conf/files Mon Apr 6 00:32:54 2009 (r190755) @@ -1585,7 +1585,6 @@ dev/usb/usb_msctest.c optional usb dev/usb/usb_parse.c optional usb dev/usb/usb_process.c optional usb dev/usb/usb_request.c optional usb -dev/usb/usb_sw_transfer.c optional usb dev/usb/usb_transfer.c optional usb dev/usb/usb_util.c optional usb # Modified: head/sys/dev/usb/controller/at91dci.c ============================================================================== --- head/sys/dev/usb/controller/at91dci.c Mon Apr 6 00:22:49 2009 (r190754) +++ head/sys/dev/usb/controller/at91dci.c Mon Apr 6 00:32:54 2009 (r190755) @@ -54,7 +54,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include Modified: head/sys/dev/usb/controller/at91dci_atmelarm.c ============================================================================== --- head/sys/dev/usb/controller/at91dci_atmelarm.c Mon Apr 6 00:22:49 2009 (r190754) +++ head/sys/dev/usb/controller/at91dci_atmelarm.c Mon Apr 6 00:32:54 2009 (r190755) @@ -33,7 +33,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: head/sys/dev/usb/controller/atmegadci.c ============================================================================== --- head/sys/dev/usb/controller/atmegadci.c Mon Apr 6 00:22:49 2009 (r190754) +++ head/sys/dev/usb/controller/atmegadci.c Mon Apr 6 00:32:54 2009 (r190755) @@ -46,7 +46,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include Modified: head/sys/dev/usb/controller/atmegadci_atmelarm.c ============================================================================== --- head/sys/dev/usb/controller/atmegadci_atmelarm.c Mon Apr 6 00:22:49 2009 (r190754) +++ head/sys/dev/usb/controller/atmegadci_atmelarm.c Mon Apr 6 00:32:54 2009 (r190755) @@ -31,7 +31,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: head/sys/dev/usb/controller/ehci.c ============================================================================== --- head/sys/dev/usb/controller/ehci.c Mon Apr 6 00:22:49 2009 (r190754) +++ head/sys/dev/usb/controller/ehci.c Mon Apr 6 00:32:54 2009 (r190755) @@ -56,7 +56,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include Modified: head/sys/dev/usb/controller/ehci_ixp4xx.c ============================================================================== --- head/sys/dev/usb/controller/ehci_ixp4xx.c Mon Apr 6 00:22:49 2009 (r190754) +++ head/sys/dev/usb/controller/ehci_ixp4xx.c Mon Apr 6 00:32:54 2009 (r190755) @@ -37,7 +37,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: head/sys/dev/usb/controller/ehci_mbus.c ============================================================================== --- head/sys/dev/usb/controller/ehci_mbus.c Mon Apr 6 00:22:49 2009 (r190754) +++ head/sys/dev/usb/controller/ehci_mbus.c Mon Apr 6 00:32:54 2009 (r190755) @@ -44,7 +44,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: head/sys/dev/usb/controller/ehci_pci.c ============================================================================== --- head/sys/dev/usb/controller/ehci_pci.c Mon Apr 6 00:22:49 2009 (r190754) +++ head/sys/dev/usb/controller/ehci_pci.c Mon Apr 6 00:32:54 2009 (r190755) @@ -58,7 +58,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: head/sys/dev/usb/controller/musb_otg.c ============================================================================== --- head/sys/dev/usb/controller/musb_otg.c Mon Apr 6 00:22:49 2009 (r190754) +++ head/sys/dev/usb/controller/musb_otg.c Mon Apr 6 00:32:54 2009 (r190755) @@ -46,7 +46,6 @@ #include #include #include -#include #include #include #include Modified: head/sys/dev/usb/controller/musb_otg_atmelarm.c ============================================================================== --- head/sys/dev/usb/controller/musb_otg_atmelarm.c Mon Apr 6 00:22:49 2009 (r190754) +++ head/sys/dev/usb/controller/musb_otg_atmelarm.c Mon Apr 6 00:32:54 2009 (r190755) @@ -30,7 +30,6 @@ #include #include #include -#include #include #include Modified: head/sys/dev/usb/controller/ohci.c ============================================================================== --- head/sys/dev/usb/controller/ohci.c Mon Apr 6 00:22:49 2009 (r190754) +++ head/sys/dev/usb/controller/ohci.c Mon Apr 6 00:32:54 2009 (r190755) @@ -45,7 +45,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include Modified: head/sys/dev/usb/controller/ohci_atmelarm.c ============================================================================== --- head/sys/dev/usb/controller/ohci_atmelarm.c Mon Apr 6 00:22:49 2009 (r190754) +++ head/sys/dev/usb/controller/ohci_atmelarm.c Mon Apr 6 00:32:54 2009 (r190755) @@ -31,7 +31,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: head/sys/dev/usb/controller/ohci_pci.c ============================================================================== --- head/sys/dev/usb/controller/ohci_pci.c Mon Apr 6 00:22:49 2009 (r190754) +++ head/sys/dev/usb/controller/ohci_pci.c Mon Apr 6 00:32:54 2009 (r190755) @@ -56,7 +56,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: head/sys/dev/usb/controller/uhci.c ============================================================================== --- head/sys/dev/usb/controller/uhci.c Mon Apr 6 00:22:49 2009 (r190754) +++ head/sys/dev/usb/controller/uhci.c Mon Apr 6 00:32:54 2009 (r190755) @@ -48,7 +48,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include Modified: head/sys/dev/usb/controller/uhci_pci.c ============================================================================== --- head/sys/dev/usb/controller/uhci_pci.c Mon Apr 6 00:22:49 2009 (r190754) +++ head/sys/dev/usb/controller/uhci_pci.c Mon Apr 6 00:32:54 2009 (r190755) @@ -54,7 +54,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: head/sys/dev/usb/controller/uss820dci.c ============================================================================== --- head/sys/dev/usb/controller/uss820dci.c Mon Apr 6 00:22:49 2009 (r190754) +++ head/sys/dev/usb/controller/uss820dci.c Mon Apr 6 00:32:54 2009 (r190755) @@ -43,7 +43,6 @@ #include #include #include -#include #include #include #include Modified: head/sys/dev/usb/controller/uss820dci_atmelarm.c ============================================================================== --- head/sys/dev/usb/controller/uss820dci_atmelarm.c Mon Apr 6 00:22:49 2009 (r190754) +++ head/sys/dev/usb/controller/uss820dci_atmelarm.c Mon Apr 6 00:32:54 2009 (r190755) @@ -33,7 +33,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: head/sys/modules/usb/usb/Makefile ============================================================================== --- head/sys/modules/usb/usb/Makefile Mon Apr 6 00:22:49 2009 (r190754) +++ head/sys/modules/usb/usb/Makefile Mon Apr 6 00:32:54 2009 (r190755) @@ -36,7 +36,7 @@ SRCS= bus_if.h device_if.h usb_if.h usb_ usb_busdma.c usb_controller.c usb_compat_linux.c usb_core.c usb_debug.c \ usb_dev.c usb_device.c usb_dynamic.c usb_error.c usb_generic.c \ usb_handle_request.c usb_hid.c usb_hub.c usb_lookup.c usb_mbuf.c \ - usb_msctest.c usb_parse.c usb_process.c usb_request.c usb_sw_transfer.c \ + usb_msctest.c usb_parse.c usb_process.c usb_request.c \ usb_transfer.c usb_util.c .include From kan at FreeBSD.org Sun Apr 5 19:29:29 2009 From: kan at FreeBSD.org (Alexander Kabaev) Date: Sun Apr 5 19:29:40 2009 Subject: svn commit: r190756 - head/sys/dev/dcons Message-ID: <200904060229.n362TS9v046054@svn.freebsd.org> Author: kan Date: Mon Apr 6 02:29:28 2009 New Revision: 190756 URL: http://svn.freebsd.org/changeset/base/190756 Log: Fix logic in MOD_LOAD handler to call dcons_attach after all successful dcons_drv_init invocations. Testing return value for 0 does not work for cases where dcons_drv_init was called already as part of low level console initialization. Modified: head/sys/dev/dcons/dcons_os.c Modified: head/sys/dev/dcons/dcons_os.c ============================================================================== --- head/sys/dev/dcons/dcons_os.c Mon Apr 6 00:32:54 2009 (r190755) +++ head/sys/dev/dcons/dcons_os.c Mon Apr 6 02:29:28 2009 (r190756) @@ -403,8 +403,9 @@ dcons_modevent(module_t mode, int type, switch (type) { case MOD_LOAD: ret = dcons_drv_init(1); - if (ret == 0) { + if (ret != -1) dcons_attach(); + if (ret == 0) { dcons_cnprobe(&dcons_consdev); dcons_cninit(&dcons_consdev); cnadd(&dcons_consdev); From phk at FreeBSD.org Mon Apr 6 00:13:28 2009 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Mon Apr 6 00:13:38 2009 Subject: svn commit: r190757 - head/sbin/routed Message-ID: <200904060713.n367DRUO059897@svn.freebsd.org> Author: phk Date: Mon Apr 6 07:13:26 2009 New Revision: 190757 URL: http://svn.freebsd.org/changeset/base/190757 Log: Only raise WARNS to 6 on i386 and amd64, strict alignment platforms still barf at some of the gratuitous pointer gymnastics, and I do not see a simple solution. Modified: head/sbin/routed/Makefile Modified: head/sbin/routed/Makefile ============================================================================== --- head/sbin/routed/Makefile Mon Apr 6 02:29:28 2009 (r190756) +++ head/sbin/routed/Makefile Mon Apr 6 07:13:26 2009 (r190757) @@ -7,6 +7,10 @@ MAN= routed.8 SUBDIR= rtquery LDADD= -lmd DPADD= ${LIBMD} +.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64" WARNS?= 6 +.else +WARNS?= 0 +.endif .include From rrs at FreeBSD.org Mon Apr 6 03:09:21 2009 From: rrs at FreeBSD.org (Randall Stewart) Date: Mon Apr 6 03:09:33 2009 Subject: svn commit: r190758 - head/sbin/route Message-ID: <200904061009.n36A9K6l063517@svn.freebsd.org> Author: rrs Date: Mon Apr 6 10:09:20 2009 New Revision: 190758 URL: http://svn.freebsd.org/changeset/base/190758 Log: Class based addressing went out in the early 90's. Basically if a entry is not route add -net xxx/bits then we should use the addr (xxx) to establish the number of bits by looking at the first non-zero bit. So if we enter route add -net 10.1.1.0 10.1.3.5 this is the same as doing route add -net 10.1.1.0/24 Since the 8th bit (zero counting) is set to 1 we set bits to 32-8. Users can of course still use the /x to change this behavior or in cases where the network is in the trailing part of the address, a "netmask" argument can be supplied to override what is established from the interpretation of the address itself. e.g: route add -net 10.1.1.8 -netmask 0xff00ffff should overide and place the proper CIDR mask in place. PR: 131365 MFC after: 1 week Modified: head/sbin/route/route.c Modified: head/sbin/route/route.c ============================================================================== --- head/sbin/route/route.c Mon Apr 6 07:13:26 2009 (r190757) +++ head/sbin/route/route.c Mon Apr 6 10:09:20 2009 (r190758) @@ -713,7 +713,7 @@ newroute(argc, argv) #ifdef INET6 if (af == AF_INET6) { rtm_addrs &= ~RTA_NETMASK; - memset((void *)&so_mask, 0, sizeof(so_mask)); + memset((void *)&so_mask, 0, sizeof(so_mask)); } #endif } @@ -803,21 +803,22 @@ inet_makenetandmask(net, sin, bits) addr = net << IN_CLASSC_NSHIFT; else addr = net; - - if (bits != 0) - mask = 0xffffffff << (32 - bits); - else if (net == 0) - mask = 0; - else if (IN_CLASSA(addr)) - mask = IN_CLASSA_NET; - else if (IN_CLASSB(addr)) - mask = IN_CLASSB_NET; - else if (IN_CLASSC(addr)) - mask = IN_CLASSC_NET; - else if (IN_MULTICAST(addr)) - mask = IN_CLASSD_NET; - else - mask = 0xffffffff; + /* + * If no /xx was specified we must cacluate the + * CIDR address. + */ + if ((bits == 0) && (addr != 0)) { + int i, j; + for(i=0,j=1; i<32; i++) { + if (addr & j) { + break; + } + j <<= 1; + } + /* i holds the first non zero bit */ + bits = 32 - i; + } + mask = 0xffffffff << (32 - bits); sin->sin_addr.s_addr = htonl(addr); sin = &so_mask.sin; From rwatson at FreeBSD.org Mon Apr 6 03:32:41 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Mon Apr 6 03:32:47 2009 Subject: svn commit: r190759 - head/sys/kern Message-ID: <200904061032.n36AWeEr064064@svn.freebsd.org> Author: rwatson Date: Mon Apr 6 10:32:40 2009 New Revision: 190759 URL: http://svn.freebsd.org/changeset/base/190759 Log: Add SDT DTrace probes for namei(): vfs:namei:lookup:entry takes parent directory vnode pointer, path to look up, and lookup flags. vfs:namei:lookup:return takes an error value, and if successful, the returned vnode pointer. MFC after: 1 month Modified: head/sys/kern/vfs_lookup.c Modified: head/sys/kern/vfs_lookup.c ============================================================================== --- head/sys/kern/vfs_lookup.c Mon Apr 6 10:09:20 2009 (r190758) +++ head/sys/kern/vfs_lookup.c Mon Apr 6 10:32:40 2009 (r190759) @@ -37,6 +37,7 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_kdtrace.h" #include "opt_ktrace.h" #include "opt_mac.h" @@ -51,6 +52,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #ifdef KTRACE @@ -65,6 +67,11 @@ __FBSDID("$FreeBSD$"); #define NAMEI_DIAGNOSTIC 1 #undef NAMEI_DIAGNOSTIC +SDT_PROVIDER_DECLARE(vfs); +SDT_PROBE_DEFINE3(vfs, namei, lookup, entry, "struct vnode *", "char *", + "unsigned long"); +SDT_PROBE_DEFINE2(vfs, namei, lookup, return, "int", "struct vnode *"); + /* * Allocation zone for namei */ @@ -181,7 +188,6 @@ namei(struct nameidata *ndp) ktrnamei(cnp->cn_pnbuf); } #endif - /* * Get starting point for the translation. */ @@ -224,6 +230,8 @@ namei(struct nameidata *ndp) VFS_UNLOCK_GIANT(vfslocked); } } + SDT_PROBE(vfs, namei, lookup, entry, dp, cnp->cn_pnbuf, + cnp->cn_flags, 0, 0); vfslocked = VFS_LOCK_GIANT(dp->v_mount); for (;;) { /* @@ -252,6 +260,8 @@ namei(struct nameidata *ndp) cnp->cn_pnbuf = NULL; cnp->cn_nameptr = NULL; #endif + SDT_PROBE(vfs, namei, lookup, return, error, NULL, 0, + 0, 0); return (error); } vfslocked = (ndp->ni_cnd.cn_flags & GIANTHELD) != 0; @@ -273,6 +283,8 @@ namei(struct nameidata *ndp) VFS_UNLOCK_GIANT(vfslocked); } else if (vfslocked) ndp->ni_cnd.cn_flags |= GIANTHELD; + SDT_PROBE(vfs, namei, lookup, return, 0, ndp->ni_vp, + 0, 0, 0); return (0); } if (ndp->ni_loopcnt++ >= MAXSYMLINKS) { @@ -338,6 +350,7 @@ namei(struct nameidata *ndp) ndp->ni_vp = NULL; vrele(ndp->ni_dvp); VFS_UNLOCK_GIANT(vfslocked); + SDT_PROBE(vfs, namei, lookup, return, error, NULL, 0, 0, 0); return (error); } From mav at FreeBSD.org Mon Apr 6 03:39:44 2009 From: mav at FreeBSD.org (Alexander Motin) Date: Mon Apr 6 03:39:56 2009 Subject: svn commit: r190758 - head/sbin/route In-Reply-To: <200904061009.n36A9K6l063517@svn.freebsd.org> References: <200904061009.n36A9K6l063517@svn.freebsd.org> Message-ID: <49D9DBED.6050805@FreeBSD.org> Randall Stewart wrote: > Author: rrs > Date: Mon Apr 6 10:09:20 2009 > New Revision: 190758 > URL: http://svn.freebsd.org/changeset/base/190758 > > Log: > Class based addressing went out in the early 90's. Basically > if a entry is not route add -net xxx/bits then we should use > the addr (xxx) to establish the number of bits by looking at > the first non-zero bit. So if we enter > route add -net 10.1.1.0 10.1.3.5 > this is the same as doing > route add -net 10.1.1.0/24 > Since the 8th bit (zero counting) is set to 1 we set bits > to 32-8. > > Users can of course still use the /x to change this behavior > or in cases where the network is in the trailing part > of the address, a "netmask" argument can be supplied to > override what is established from the interpretation of the > address itself. e.g: > > route add -net 10.1.1.8 -netmask 0xff00ffff > > should overide and place the proper CIDR mask in place. > > PR: 131365 > MFC after: 1 week Are you sure that this is a good idea? Is this behavior described/recommended somewhere? IMHO specifying network without explicitly defined netmask is at least dangerous, if not wrong, in present classless addressing time. Changing existing behavior breaks POLA for some set of users, while benefits are not so obvious to me. With previous code networks 10.0.0.0 and 11.0.0.0 were treated as /8, but with this change it became /7 and /8 respectively. Author of the PR referred here expects network 192.168 to be treated as /16, but with your algorithm it will probably become /13. -- Alexander Motin From rwatson at FreeBSD.org Mon Apr 6 03:39:48 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Mon Apr 6 03:40:13 2009 Subject: svn commit: r190758 - head/sbin/route In-Reply-To: <200904061009.n36A9K6l063517@svn.freebsd.org> References: <200904061009.n36A9K6l063517@svn.freebsd.org> Message-ID: On Mon, 6 Apr 2009, Randall Stewart wrote: > Author: rrs > Date: Mon Apr 6 10:09:20 2009 > New Revision: 190758 > URL: http://svn.freebsd.org/changeset/base/190758 > > Log: > Class based addressing went out in the early 90's. Basically > if a entry is not route add -net xxx/bits then we should use > the addr (xxx) to establish the number of bits by looking at > the first non-zero bit. So if we enter > route add -net 10.1.1.0 10.1.3.5 > this is the same as doing > route add -net 10.1.1.0/24 > Since the 8th bit (zero counting) is set to 1 we set bits > to 32-8. > > Users can of course still use the /x to change this behavior > or in cases where the network is in the trailing part > of the address, a "netmask" argument can be supplied to > override what is established from the interpretation of the > address itself. e.g: > > route add -net 10.1.1.8 -netmask 0xff00ffff > > should overide and place the proper CIDR mask in place. Does this maintain compatibility for people who may still mysteriously be specifying class-based IPs and netmasks in configuration files? If not, this should not be MFC'd... Robert N M Watson Computer Laboratory University of Cambridge > > PR: 131365 > MFC after: 1 week > > Modified: > head/sbin/route/route.c > > Modified: head/sbin/route/route.c > ============================================================================== > --- head/sbin/route/route.c Mon Apr 6 07:13:26 2009 (r190757) > +++ head/sbin/route/route.c Mon Apr 6 10:09:20 2009 (r190758) > @@ -713,7 +713,7 @@ newroute(argc, argv) > #ifdef INET6 > if (af == AF_INET6) { > rtm_addrs &= ~RTA_NETMASK; > - memset((void *)&so_mask, 0, sizeof(so_mask)); > + memset((void *)&so_mask, 0, sizeof(so_mask)); > } > #endif > } > @@ -803,21 +803,22 @@ inet_makenetandmask(net, sin, bits) > addr = net << IN_CLASSC_NSHIFT; > else > addr = net; > - > - if (bits != 0) > - mask = 0xffffffff << (32 - bits); > - else if (net == 0) > - mask = 0; > - else if (IN_CLASSA(addr)) > - mask = IN_CLASSA_NET; > - else if (IN_CLASSB(addr)) > - mask = IN_CLASSB_NET; > - else if (IN_CLASSC(addr)) > - mask = IN_CLASSC_NET; > - else if (IN_MULTICAST(addr)) > - mask = IN_CLASSD_NET; > - else > - mask = 0xffffffff; > + /* > + * If no /xx was specified we must cacluate the > + * CIDR address. > + */ > + if ((bits == 0) && (addr != 0)) { > + int i, j; > + for(i=0,j=1; i<32; i++) { > + if (addr & j) { > + break; > + } > + j <<= 1; > + } > + /* i holds the first non zero bit */ > + bits = 32 - i; > + } > + mask = 0xffffffff << (32 - bits); > > sin->sin_addr.s_addr = htonl(addr); > sin = &so_mask.sin; > From luigi at FreeBSD.org Mon Apr 6 04:08:39 2009 From: luigi at FreeBSD.org (Luigi Rizzo) Date: Mon Apr 6 04:10:18 2009 Subject: svn commit: r190760 - head/release/picobsd/bridge Message-ID: <200904061108.n36B8X2g069364@svn.freebsd.org> Author: luigi Date: Mon Apr 6 11:08:33 2009 New Revision: 190760 URL: http://svn.freebsd.org/changeset/base/190760 Log: add some popular device and comment some potentially useful options Modified: head/release/picobsd/bridge/PICOBSD Modified: head/release/picobsd/bridge/PICOBSD ============================================================================== --- head/release/picobsd/bridge/PICOBSD Mon Apr 6 10:32:40 2009 (r190759) +++ head/release/picobsd/bridge/PICOBSD Mon Apr 6 11:08:33 2009 (r190760) @@ -89,7 +89,10 @@ device uart # device miibus device fxp # Intel EtherExpress PRO/100B (82557, 82558) +device nfe # nVidia nForce MCP on-board Ethernet +#device xl # 3Com device rl # RealTek 8129/8139 +device re # RealTek 8139C+/8169/8169S/8110S device sis # National/SiS device dc # DEC/Intel 21143 and various workalikes device ed @@ -104,6 +107,8 @@ device md # Memory "disks" #device faith 1 # IPv6-to-IPv4 relaying (translation) device tap +#options DEVICE_POLLING + # The `bpf' device enables the Berkeley Packet Filter. # Be aware of the administrative consequences of enabling this! device bpf # Berkeley packet filter From luigi at FreeBSD.org Mon Apr 6 04:15:04 2009 From: luigi at FreeBSD.org (Luigi Rizzo) Date: Mon Apr 6 04:15:12 2009 Subject: svn commit: r190761 - head/release/picobsd/mfs_tree/etc Message-ID: <200904061114.n36BEUB7069517@svn.freebsd.org> Author: luigi Date: Mon Apr 6 11:14:30 2009 New Revision: 190761 URL: http://svn.freebsd.org/changeset/base/190761 Log: provide the absolute path for /etc/rc1 Modified: head/release/picobsd/mfs_tree/etc/rc Modified: head/release/picobsd/mfs_tree/etc/rc ============================================================================== --- head/release/picobsd/mfs_tree/etc/rc Mon Apr 6 11:08:33 2009 (r190760) +++ head/release/picobsd/mfs_tree/etc/rc Mon Apr 6 11:14:30 2009 (r190761) @@ -23,5 +23,5 @@ for i in *; do [ -f $i.gz ] && rm $i done gzip -d *.gz -. rc1 +. /etc/rc1 exit 0 From luigi at FreeBSD.org Mon Apr 6 04:16:18 2009 From: luigi at FreeBSD.org (Luigi Rizzo) Date: Mon Apr 6 04:16:49 2009 Subject: svn commit: r190762 - stable/7/release/picobsd/build Message-ID: <200904061115.n36BFS1R069583@svn.freebsd.org> Author: luigi Date: Mon Apr 6 11:15:28 2009 New Revision: 190762 URL: http://svn.freebsd.org/changeset/base/190762 Log: MFC: bring in recent fixes to the picobsd script Approved by: re (blanket on picobsd) Modified: stable/7/release/picobsd/build/picobsd Modified: stable/7/release/picobsd/build/picobsd ============================================================================== --- stable/7/release/picobsd/build/picobsd Mon Apr 6 11:14:30 2009 (r190761) +++ stable/7/release/picobsd/build/picobsd Mon Apr 6 11:15:28 2009 (r190762) @@ -3,17 +3,17 @@ # $FreeBSD$ # This file requires sysutils/makefs to run # -# The new PicoBSD build script. Invoked as +# The PicoBSD build script. Invoked as # -# picobsd [options] floppy_type site_name +# picobsd [options] image_type [site_name] # -# Where floppy_type is a directory where the picobsd config info -# is held, and ${floppy_type}/floppy.tree.${site_name} contains +# Where image_type is a directory with the picobsd config info, +# and ${image_type}/floppy.tree.${site_name} contains # optional site-specific configuration. # # For Options, see the bottom of the file where the processing is # done. The picobsd(8) manpage might be of some help, but code and docs -# tend to lose sync over time... +# tend to lose sync over time. # # This script depends on the following files: # @@ -33,36 +33,42 @@ # floppy.tree/ local additions to ${PICO_TREE}/mfs_free # floppy.tree.${site}/ same as above, site specific. # mfs_tree/ local additions to the mfs_free -# buildtree.mk optional makefile to build an extension for floppy tree +# buildtree.mk optional Makefile to build an extension for floppy tree # (generated in buildtree/ ) # #--- The main entry point is at the end. # -# There are two set of initialization. The first one (set_defaults) -# is done on entry to the script, and is used to set default values -# for all variables which do not depend on floppy type and source tree. +# There are two initialization functions: # -# The second set is done after command line parsing, e.g. -# to resolve dependencies on the source tree. +# + set_defaults +# is run on entry to the script, and is used to set default values +# for all variables that do not depend on image type and source tree. # -# Naming: +# + set_build_parameters +# is run after command line parsing +# +# VARIABLE NAMES: # + variables that control operation (e.g. verbosity) and are generally # set from the command line have o_ ("option") as a name prefix # -# + variables which contain pathnames and values that should not change +# + variables that contain pathnames and values that should not change # have c_ ("constant") as a name prefix # # + variables exported to Makefiles and subshells are CAPITAL # # + variables local to the script are lowercase, possibly with -# an l_ ("local") prefix +# an l_ ("local") prefix. +# +# There are unfortunately exceptions: +# name, l_usrtree, l_objtree # SRC points to your FreeBSD source tree. # l_usrtree points to the /usr subdir for the source tree. # Normally /usr or ${SRC}/../usr # l_objtree points to the obj tree. Normally ${l_usrtree}/obj-pico +# c_label is either bsdlabel or disklabel # PICO_TREE is where standard picobsd stuff resides. # Normally ${SRC}/release/picobsd # You can set SRC with --src @@ -71,28 +77,27 @@ # MY_TREE (set later) is where this floppy type resides. # BUILDDIR is the build directory -# set some default values for variables. -# needs to be done as the first thing in the script. - # log something on stdout if verbose. o_verbose=0 # this needs to be here! -log() { +log() { # message local foo [ ${o_verbose} -gt 0 ] && printf "\n*** %s\n" "$*" [ ${o_verbose} -gt 1 ] && read -p "=== Press enter to continue" foo return 0 } -logverbose() { +# unconditionally log and wait for input +logverbose() { # message local foo printf "\n*** %s\n" "$*" read -p "=== Press enter to continue" foo return 0 } -set_defaults() { - # no way to use logging in this function, variable not set yet. +# set some default values for variables. +# needs to be done as the first thing in the script. +set_defaults() { # no arguments # EDITOR is the editor you use # fd_size floppy size in KB (default to 1440). You can use 1480, # 1720, 2880, etc. but beware that only 1440 and 1480 will boot @@ -101,15 +106,20 @@ set_defaults() { fd_size=${fd_size:-1440} o_use_loader="yes" # use /boot/loader - o_all_in_mfs="yes" # put all files in mfs so you can boot and run - # the image via diskless boot. - o_clean="" # do not clean + # You should not change it unless you are really short + # of space, and your kernel is small enough that the + # bootblocks manage to load it. + + o_all_in_mfs="yes" # put all files in mfs so you can boot + # and run the image via diskless boot. + o_clean="" # set if you want to clean prev.builds. o_interactive="" # default is interactive o_verbose=0 # verbose level, 0 is silent o_tarv="" # tar verbose flag, "" or "v" - o_init_src="" # non "" if we need to init libs and includes. + o_init_src="" # set to build libs and includes. o_makeopts=${MAKEOPTS:--s} # make options, be silent by default - o_no_devfs=yes # we do not want devfs + o_no_devfs= # default is use devfs. + # You should only set it when building 4.x images o_do_modules="" # do not build modules SRC="/usr/src" # default location for sources @@ -132,13 +142,13 @@ set_defaults() { c_img=picobsd.bin # filename used for the picobsd image generate_iso="NO" # don't generate the iso image - # select the right memory disk name + # select the right disklabel program case `uname -r` in - 7.*|6.*|5.*) - l_label="bsdlabel" + 4.*) + c_label="disklabel" ;; *) - l_label="disklabel" + c_label="bsdlabel" ;; esac @@ -150,8 +160,9 @@ set_defaults() { trap fail 15 } -# use the new build infrastructure -create_includes_and_libraries2() { +# use the new build infrastructure to create libraries +# and also to build a specific target +create_includes_and_libraries2() { # opt_dir opt_target local no log "create_includes_and_libraries2() for ${SRC}" if [ ${OSVERSION} -ge 600000 ] ; then @@ -163,7 +174,11 @@ create_includes_and_libraries2() { export MAKEOBJDIRPREFIX ( cd ${SRC}; # make -DNOCLEAN -DNOPROFILE -DNOGAMES -DNOLIBC_R -DPICOBSD buildworld - make _+_= $no toolchain _includes _libraries + if [ -d "$1" ] ; then + cd $1 ; make $2 # specific target, e.g. ld-elf.so + else + make _+_= $no toolchain _includes _libraries + fi ) } @@ -173,7 +188,7 @@ create_includes_and_libraries() { log "create_includes_and_libraries() for ${SRC}" # Optionally creates include directory and libraries. - mkdir -p ${l_usrtree}/include # the include directory... + mkdir -p ${l_usrtree}/include # the include directory... mkdir -p ${l_usrtree}/share/misc # a few things go here mkdir -p ${l_usrtree}/lib # libraries mkdir -p ${l_usrtree}/sbin # some binaries @@ -210,11 +225,12 @@ create_includes_and_libraries() { log "Libraries done" } -# set_type looks in user or system directories for the floppy type -# specified as first argument, and sets variables according to the config. -# file. Also sets MY_TREE and BUILDDIR and SITE +# set_type [the_site] looks in user or system directories +# for the directory named as the first argument, reads the configuration +# files and sets variables according to the config. +# Also sets MY_TREE and BUILDDIR and SITE -set_type() { +set_type() { # the_type the_site local a i log "set_type() : Type '$1' site '$2'" @@ -242,7 +258,7 @@ set_type() { clean_tree() { log "clean_tree()" - if [ "${name}" = "" ] ; then + if [ -z "${name}" ] ; then echo "---> Wrong floppy type" exit 3 fi @@ -271,7 +287,7 @@ build_iso_image() { # Main build procedure. build_image() { log "build_image() <${name}>" - [ "${name}" != "" ] || fail $? bad_type + [ -n "${name}" ] || fail $? bad_type clear set_msgs printf "${MSG}---> We'll use the sources living in ${SRC}\n\n" @@ -281,12 +297,8 @@ build_image() { # variables. # . ${PICO_TREE}/build/config - if [ -f ${MY_TREE}/config ] ; then - . ${MY_TREE}/config - fi - if [ -f ${o_additional_config} ] ; then - . ${o_additional_config} - fi + [ -f "${MY_TREE}/config" ] && . ${MY_TREE}/config + [ -f "${o_additional_config}" ] && . ${o_additional_config} # location of the object directory PICO_OBJ=${l_objtree}/picobsd/${THETYPE} @@ -312,34 +324,13 @@ build_image() { fill_floppy_image # copies everything into the floppy } -build_package() { - local z msg - - log "build_package()" - rm -rf build.status - echo "##############################################" >>build.status - echo "## `date` ">>build.status - echo "##############################################" >>build.status - for z in bridge dial router net isp ; do - set_type ${z} - echo "---------------------------------------------">>build.status - echo "Building TYPE=${z}, SIZE=${MFS_SIZE}" >>build.status - msg="(ok)" # error message - build_image || msg="** FAILED! **" - echo " ${msg}">>build.status - # where do i put things ? - # clean_tree - done - exit 0 -} - # Set build parameters interactively main_dialog() { local ans i l log "main_dialog()" - while [ true ] ; do + while true ; do set_msgs rm ${c_reply} dialog --menu "PicoBSD build menu -- (29 sep 2001)" 19 70 12 \ @@ -547,7 +538,7 @@ do_copyfiles() { # rootdir varname eval set "\${${2}}" srcs="" for dst in $* ; do - [ x"$srcs" = x ] && srcs=$dst && continue + [ -z "$srcs" ] && srcs=$dst && continue eval srcs="$srcs" # expand wildcard and vars case x"$dst" in */ ) mkdir -p ${root}/${dst} ;; @@ -558,6 +549,80 @@ do_copyfiles() { # rootdir varname done } +# do_links is a helper function to create links between programs +# in stand/ +# This is done reading the names and destination from variable +# links in a config file, in the format +# : dst names + +do_links() { # rootdir varname + local root=$1 + local l i dst + eval l="\${${2}}" + dst="" + log "Create links for ${l}" + (cd ${root}/stand + for i in $l ; do + if [ "$dst" = ":" -o "$i" = ":" ] ; then + dst=$i + elif [ -n "${dst}" ] ; then + ln -s ${dst} ${i} + fi + done + ) +} + +# find_progs is a helper function to locate the named programs +# or libraries in ${o_objdir} or ${_SHLIBDIRPREFIX}, +# and return the full pathnames. +# Sets ${u_progs} to the list of programs, and ${u_libs} +# to the list of shared libraries used. +# +# You can use it e.g. in a local configuration file by writing +# +# do_copyfiles_user() { +# local dst=$1 +# find_progs nvi sed less grep +# cp -p ${u_progs} ${dst}/bin +# cp -p ${u_libs} ${dst}/lib +# mkdir -p ${dst}/libexec +# find_progs ld-elf.so.1 +# cp -p ${u_progs} ${dst}/libexec +# } + +find_progs() { # programs + local i + u_progs="`find_progs_helper $*`" + local o=${o_objdir:-${_SHLIBDIRPREFIX}} + [ -z "${u_progs}" ] && return 1 # not found, error + i="`ldd ${u_progs} | grep -v '^/' | awk '{print $1}' | sort | uniq`" + u_libs="`find_progs_helper $i`" + return 0 +} + +find_progs_helper() { # programs + local progs="$*" + local i o places names + local subdirs="bin sbin usr.bin usr.sbin libexec lib \ + gnu/usr.bin gnu/lib \ + secure/usr.bin secure/usr.sbin secure/libexec secure/lib" + names="" # files to search + o="" + for i in $progs ; do + # plain programs come out verbatim + [ -f "$i" ] && echo $i && continue + names="${names} ${o} -name $i" + o="-o" + done + [ -z "${names}" ] && return 0 + places="" # places to search + o=${o_objdir:-${_SHLIBDIRPREFIX}/..} + for i in $subdirs ; do + [ -d "${o}/${i}" ] && places="${places} ${o}/${i}" + done + find ${places} -type f \( ${names} \) +} + # Populate the memory filesystem with binaries and non-variable # configuration files. # First do an mtree pass, then create directory links and device entries, @@ -647,7 +712,7 @@ populate_mfs_tree() { fi # 4.x compatibility - create device nodes - if [ "${o_no_devfs}" != "" ] ; then + if [ -n "${o_no_devfs}" ] ; then # create device entries using MAKEDEV (cd ${dst}/dev ln -s ${SRC}/etc/MAKEDEV ; chmod 555 MAKEDEV @@ -661,10 +726,21 @@ populate_mfs_tree() { (cd ${dst}; chown -R root . ) fi - if [ -n "${copy_files}" ] ; then - do_copyfiles ${dst} copy_files + # If we are building a shared 'crunch', take the libraries + # and the dynamic loader as well + find_progs ${dst}/stand/crunch + if [ -n "${u_libs}" ] ; then + mkdir -p ${dst}/lib && cp -p ${u_libs} ${dst}/lib + mkdir -p ${dst}/libexec + create_includes_and_libraries2 libexec/rtld-elf + find_progs ld-elf.so.1 && cp -p ${u_progs} ${dst}/libexec fi + [ -n "${copy_files}" ] && do_copyfiles ${dst} copy_files + do_copyfiles_user ${dst} || true + [ -n "${links}" ] && do_links ${dst} links + strip ${dst}/libexec/* ${dst}/lib/* ${dst}/stand/* 2> /dev/null || true + # The 'import_files' mechanism is deprecated, as it requires # root permissions to follow the symlinks, and also does # not let you rename the entries. @@ -829,22 +905,22 @@ fill_floppy_image() { (cd ${BUILDDIR} makefs -t ffs -o bsize=4096 -o fsize=512 \ -s ${blocks}k -f 50 ${c_img} ${dst} - # ${l_label} -f `pwd`/${c_img} - ${l_label} -w -f `pwd`/${c_img} auto # write in a label + + ${c_label} -w -f `pwd`/${c_img} auto # write in a label # copy partition c: into a: with some sed magic - ${l_label} -f `pwd`/${c_img} | sed -e '/ c:/{p;s/c:/a:/;}' | \ - ${l_label} -R -f `pwd`/${c_img} /dev/stdin - ${l_label} -f `pwd`/${c_img} + ${c_label} -f `pwd`/${c_img} | sed -e '/ c:/{p;s/c:/a:/;}' | \ + ${c_label} -R -f `pwd`/${c_img} /dev/stdin + ${c_label} -f `pwd`/${c_img} ls -l ${c_img} - ${l_label} -f `pwd`/${c_img} + ${c_label} -f `pwd`/${c_img} logverbose "after disklabel" ) echo "BUILDDIR ${BUILDDIR}" if [ "${generate_iso}" = "YES" ]; then echo "generate_iso ${generate_iso}" - #build_iso_image() + # build_iso_image # XXX not implemented yet exit 1 fi @@ -872,7 +948,6 @@ fill_floppy_image() { # needs to be done once). set_build_parameters() { - log "set_build_parameters() SRC is ${SRC}" if [ "${SRC}" = "/usr/src" ] ; then l_usrtree=${USR:-/usr} else @@ -899,6 +974,19 @@ set_build_parameters() { CONFIG=${l_usrtree}/sbin/config export CONFIG fi + + # if we have o_objdir, find where bin/ is + if [ ! -z "${o_objdir}" ] ; then + if [ -d ${o_objdir}/bin ] ; then + # fine + elif [ -d "${o_objdir}${SRC}/bin" ] ; then + o_objdir="${o_objdir}${SRC}" + log "Changing objdir to ${o_objdir}" + else + log "Cannot find objdir in ${o_objdir}, sorry" + o_objdir="" + fi + fi } #------------------------------------------------------------------- @@ -907,9 +995,10 @@ set_build_parameters() { set_defaults while [ true ]; do + log "Parsing $1" case $1 in --src) # set the source path instead of /usr/src - SRC=`(cd $2; pwd)` + SRC=`realpath $2` shift ;; --init) @@ -961,6 +1050,12 @@ while [ true ]; do shift ;; + --objdir) # Place with results of a previous buildworld + # useful if you want to copy shared binaries and libs + o_objdir=`realpath $2` + shift + ;; + *) break ;; @@ -968,12 +1063,10 @@ while [ true ]; do esac shift done + set_build_parameters # things that depend on ${SRC} set_type $1 $2 # type and site, respectively -# If $1="package", it creates a neat set of floppies -[ "$1" = "package" ] && build_package - [ "${o_interactive}" != "NO" ] && main_dialog if [ "${o_clean}" = "YES" ] ; then From luigi at FreeBSD.org Mon Apr 6 04:21:41 2009 From: luigi at FreeBSD.org (Luigi Rizzo) Date: Mon Apr 6 04:22:00 2009 Subject: svn commit: r190763 - stable/7/release/picobsd/mfs_tree/etc Message-ID: <200904061121.n36BLE5I069779@svn.freebsd.org> Author: luigi Date: Mon Apr 6 11:21:14 2009 New Revision: 190763 URL: http://svn.freebsd.org/changeset/base/190763 Log: put the absolute path for /etc/rc1 Approved by: re (blanket on picobsd) Modified: stable/7/release/picobsd/mfs_tree/etc/rc Modified: stable/7/release/picobsd/mfs_tree/etc/rc ============================================================================== --- stable/7/release/picobsd/mfs_tree/etc/rc Mon Apr 6 11:15:28 2009 (r190762) +++ stable/7/release/picobsd/mfs_tree/etc/rc Mon Apr 6 11:21:14 2009 (r190763) @@ -23,5 +23,5 @@ for i in *; do [ -f $i.gz ] && rm $i done gzip -d *.gz -. rc1 +. /etc/rc1 exit 0 From luigi at FreeBSD.org Mon Apr 6 04:22:23 2009 From: luigi at FreeBSD.org (Luigi Rizzo) Date: Mon Apr 6 04:22:33 2009 Subject: svn commit: r190764 - stable/7/release/picobsd/floppy.tree/etc Message-ID: <200904061121.n36BLw7k069824@svn.freebsd.org> Author: luigi Date: Mon Apr 6 11:21:58 2009 New Revision: 190764 URL: http://svn.freebsd.org/changeset/base/190764 Log: MFC: remove call to non-existing dev-mkdb Approved by: re (blanket on picobsd) Modified: stable/7/release/picobsd/floppy.tree/etc/rc1 Modified: stable/7/release/picobsd/floppy.tree/etc/rc1 ============================================================================== --- stable/7/release/picobsd/floppy.tree/etc/rc1 Mon Apr 6 11:21:14 2009 (r190763) +++ stable/7/release/picobsd/floppy.tree/etc/rc1 Mon Apr 6 11:21:58 2009 (r190764) @@ -45,7 +45,6 @@ mount -a -t nfs [ -n "$network_pass2_done" ] && network_pass3 pwd_mkdb -p ./master.passwd -dev_mkdb [ -f /etc/syslog.conf -a -f /stand/syslogd ] && \ { echo "Starting syslogd."; syslogd ${syslogd_flags} ; } From luigi at FreeBSD.org Mon Apr 6 04:23:08 2009 From: luigi at FreeBSD.org (Luigi Rizzo) Date: Mon Apr 6 04:23:16 2009 Subject: svn commit: r190765 - stable/7/release/picobsd/bridge Message-ID: <200904061122.n36BMTB5069887@svn.freebsd.org> Author: luigi Date: Mon Apr 6 11:22:29 2009 New Revision: 190765 URL: http://svn.freebsd.org/changeset/base/190765 Log: diff reduction with the version in head Approved by: re (blanket on picobsd) Modified: stable/7/release/picobsd/bridge/PICOBSD Modified: stable/7/release/picobsd/bridge/PICOBSD ============================================================================== --- stable/7/release/picobsd/bridge/PICOBSD Mon Apr 6 11:21:58 2009 (r190764) +++ stable/7/release/picobsd/bridge/PICOBSD Mon Apr 6 11:22:29 2009 (r190765) @@ -3,8 +3,8 @@ # # Line starting with #PicoBSD contains PicoBSD build parameters #marker def_sz init MFS_inodes floppy_inodes -#PicoBSD 5000 init 8192 32768 -options MD_ROOT_SIZE=5000 # same as def_sz +#PicoBSD 8000 init 8192 32768 +options MD_ROOT_SIZE=8000 # same as def_sz hints "PICOBSD.hints" @@ -45,7 +45,7 @@ options DUMMYNET device if_bridge options HZ=1000 -device random # ssh needs /dev/random +device random # used by ssh device pci # Floppy drives @@ -65,7 +65,6 @@ device atkbd device vga # VGA screen # syscons is the default console driver, resembling an SCO console - device sc # Serial (COM) ports @@ -89,16 +88,12 @@ device sio # The following Ethernet NICs are all PCI devices. # device miibus -#device de # DEC/Intel DC21x4x (``Tulip'') -#device lnc device fxp # Intel EtherExpress PRO/100B (82557, 82558) device nfe # nVidia nForce MCP on-board Ethernet #device xl # 3Com device rl # RealTek 8129/8139 device re # RealTek 8139C+/8169/8169S/8110S device sis # National/SiS -#device vx # 3Com 3c590, 3c595 (``Vortex'') -#device wx # Intel Gigabit Ethernet Card (``Wiseman'') device dc # DEC/Intel 21143 and various workalikes device ed From luigi at FreeBSD.org Mon Apr 6 04:24:10 2009 From: luigi at FreeBSD.org (Luigi Rizzo) Date: Mon Apr 6 04:24:42 2009 Subject: svn commit: r190766 - stable/7/release/picobsd/bridge Message-ID: <200904061123.n36BNKK1069939@svn.freebsd.org> Author: luigi Date: Mon Apr 6 11:23:20 2009 New Revision: 190766 URL: http://svn.freebsd.org/changeset/base/190766 Log: bump image size to 4MB and remove references to non-devfs configs Approved by: re (blanket on picobsd) Modified: stable/7/release/picobsd/bridge/config Modified: stable/7/release/picobsd/bridge/config ============================================================================== --- stable/7/release/picobsd/bridge/config Mon Apr 6 11:22:29 2009 (r190765) +++ stable/7/release/picobsd/bridge/config Mon Apr 6 11:23:20 2009 (r190766) @@ -3,5 +3,4 @@ # it should only contain variable definitions -- it is sourced # by the shell much like rc.conf* files -o_no_devfs="" # we have devfs. -fd_size="2880" +fd_size="4096" From luigi at FreeBSD.org Mon Apr 6 04:31:38 2009 From: luigi at FreeBSD.org (Luigi Rizzo) Date: Mon Apr 6 04:31:56 2009 Subject: svn commit: r190767 - stable/7/release/picobsd/bridge Message-ID: <200904061131.n36BVVan070125@svn.freebsd.org> Author: luigi Date: Mon Apr 6 11:31:31 2009 New Revision: 190767 URL: http://svn.freebsd.org/changeset/base/190767 Log: MFC: use shared libraries for the crunched binary, put together the basic binaries so it is easier to replace them with busybox. Approved by: re (blanket on picobsd) Modified: stable/7/release/picobsd/bridge/crunch.conf Modified: stable/7/release/picobsd/bridge/crunch.conf ============================================================================== --- stable/7/release/picobsd/bridge/crunch.conf Mon Apr 6 11:23:20 2009 (r190766) +++ stable/7/release/picobsd/bridge/crunch.conf Mon Apr 6 11:31:31 2009 (r190767) @@ -1,39 +1,55 @@ # # $FreeBSD$ # -# configuration file for "bridge" floppy. -# Depending on your needs, almost surely you will need to -# modify your configuration to add/remove/change programs used in -# the floppy image. Remember that some programs also require -# matching kernel options to enable device drivers etc. -# -# Next to most of the programs i have tried to indicate the approximate -# space consumed, but beware that these values change from release -# to release, and might depend on the presence of other programs which -# share the same libraries. +# Configuration file for "bridge" images.. # -# NOTE: the string "/usr/src" will be automatically replaced with the -# correct value set in 'build' script - you should change it there +# Depending on your needs, you will almost surely need to +# add/remove/change programs according to your needs. +# Remember that some programs require matching kernel options to +# enable device drivers etc. +# +# To figure out how much space is used by each program, do +# +# size build_dir-bridge/crunch/*lo +# +# Remember that programs require libraries, which add up to the +# total size. The final binary is build_dir-bridge/mfs.tree/stand/crunch +# and you can check which libraries it uses with +# +# ldd build_dir-bridge/mfs.tree/stand/crunch -# Default build options. Basically tell the Makefiles which understand -# that to use the most compact possible version of the code. +# crunchgen configuration to build the crunched binary, see "man crunchgen" +# We need to specify generic build options, the places where to look +# for sources, and the list of program and libraries we want to put +# in the crunched binary. # -buildopts -DNO_PAM -DRELEASE_CRUNCH -DPPP_NO_NETGRAPH -DTRACEROUTE_NO_IPSEC -DNO_INET6 +# NOTE: the string "/usr/src" below will be automatically replaced with +# the path set in the 'build' script. + +# Default build options. Basically tell the Makefiles +# that to use the most compact possible version of the code. + +buildopts -DNO_PAM -DRELEASE_CRUNCH -DPPP_NO_NETGRAPH +buildopts -DTRACEROUTE_NO_IPSEC -DNO_INET6 buildopts -DWITHOUT_IPX -# directories where to look for sources of various binaries. +# Directories where to look for sources of various binaries. # @__CWD__@ is a magic keyword in the picobsd's (Makefile.conf) -# which is replaced with the picobsd directory. +# which is replaced with the directory with the picobsd configuration +# corresponding to your image. This way you can have custom sources +# in that directory overriding system programs. + srcdirs @__CWD__@/src -# Some programs are especially written for PicoBSD and reside here -# Make this first in the list so we can override standard programs -# with the picobsd-specific ones. +# Some programs are especially written for PicoBSD and reside in +# release/picobsd/tinyware. +# Put this entry near the head of the list to override standard binaries. + srcdirs /usr/src/release/picobsd/tinyware -# -# standard locations -# +# Other standard locations for sources. +# If a program uses its own source directory, add + srcdirs /usr/src/bin srcdirs /usr/src/sbin/i386 srcdirs /usr/src/sbin @@ -41,51 +57,59 @@ srcdirs /usr/src/usr.bin srcdirs /usr/src/gnu/usr.bin srcdirs /usr/src/usr.sbin srcdirs /usr/src/libexec -# -# And there are others (mostly ports) which reside in their specific -# directories. For them, we use the "special" commands to tell -# crunchgen where to look for sources, objects, which Makefile -# variables contain the list of sources and objects, and so on. -# init is almost always necessary. +# For programs that reside in different places, the best option +# is to use the command "special XXX srcdir YYY" where XXX is the +# program name and YYY is the directory path. +# "special XXX ..." can be used to specify more options, see again +# the crunchgen manpage. + +#--- Basic configuraton +# init is always necessary (unless you have a replacement, oinit) progs init + # fsck is almost always necessary, unless you have everything on the # image and use 'tar' or something similar to read/write raw blocks # from the floppy. + progs fsck -# ifconfig is needed if you want to configure interfaces... + +# ifconfig is needed if you want to configure interfaces. progs ifconfig -# + # You will also need a shell and a bunch of utilities. # The standard shell is not that large, but you need many # external programs. In fact most of them do not take much space -# as they merely issue a system call, and print the result; the -# libraries are already needed anyways, so they end up using almost -# no additional memory. -# There are a few exceptions such as 'less', which in 4.x is -# rather large. +# as they merely issue a system call, and print the result. +# For a more compact version of shell and utilities, you could +# try busybox, however most system management commands in busybox +# will not work as they use linux-specific interfaces. + progs sh ln sh -sh + +# the small utilities, also available in busybox progs echo -progs pwd -progs mkdir rmdir +progs pwd mkdir rmdir progs chmod chown -progs mv ln -progs mount +ln chown chgrp +progs mv ln cp rm ls +progs cat tail tee +progs test +ln test [ +progs du +progs kill progs minigzip ln minigzip gzip -progs cp -progs rm -progs ls -progs kill +progs ee # editor (busybox has 'vi') + +# FreeBSD commands not working in busybox +progs mount progs df progs ps -progs ns +progs ns # this is the picobsd version ln ns netstat progs vm -progs cat -progs test -ln test [ progs hostname progs login progs getty @@ -94,72 +118,57 @@ progs w progs msg ln msg dmesg progs reboot -progs less -ln less more progs sysctl progs swapon progs pwd_mkdb progs umount -progs du -progs tail -progs tee progs passwd progs route -# progs mount_msdosfs -# progs comcontrol -# + # If you want to run natd, remember the alias library #progs natd -#libs -lalias # natd -# +#libs_so -lalias # natd + # ppp is rather large. Note that as of Jan.01, RELEASE_CRUNCH # makes ppp not use libalias, so you cannot have aliasing. #progs ppp -# You need an editor. ee is relatively small, though there are -# smaller ones. vi is much larger. -# The editor also usually need a curses library. -progs ee -libs -lncurses -# progs vi # ?? -# libs -lcurses # for vi - -#progs tcpdump -special tcpdump srcdir /usr/src/usr.sbin/tcpdump/tcpdump - progs arp -progs bsdlabel -progs fdisk -progs mdconfig +# these require libgeom +# progs bsdlabel fdisk mdconfig -progs kldload kldunload kldstat kldxref -#progs grep +progs kldload kldunload kldstat +progs kldxref progs date -#progs mount_nfs -ln mount_nfs nfs progs ping #progs routed progs ipfw progs traceroute progs mdmfs ln mdmfs mount_mfs +# Various filesystem support -- remember to enable the kernel parts +# progs mount_msdosfs +# progs mount_nfs # progs mount_cd9660 -# ln mount_cd9660 cd9660 -progs newfs +ln mount_nfs nfs +ln mount_cd9660 cd9660 +# progs newfs #ln newfs mount_mfs -ln chown chgrp # ln mount_msdosfs msdos # For a small ssh client/server use dropbear -libs -ll # used by sh -libs -lufs # used by mount -### ee uses ncurses instead of curses -libs -ledit -lutil -lmd -lcrypt -lmp -lm -lkvm -libs -lz -lpcap -lwrap -libs -ltermcap -lgnuregex # -lcurses -libs -lgeom -libs -lsbuf -lbsdxml +# Now the libraries +libs_so -lc # the C library +libs_so -ll # used by sh (really ?) +libs_so -lufs # used by mount +### ee uses ncurses but as a dependency +#libs_so -lncurses +libs_so -lm +libs_so -ledit -lutil +libs_so -lcrypt +libs_so -lkvm +libs_so -lz From brueffer at FreeBSD.org Mon Apr 6 05:01:08 2009 From: brueffer at FreeBSD.org (Christian Brueffer) Date: Mon Apr 6 05:01:32 2009 Subject: svn commit: r190768 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb kern Message-ID: <200904061200.n36C0p4e070737@svn.freebsd.org> Author: brueffer Date: Mon Apr 6 12:00:51 2009 New Revision: 190768 URL: http://svn.freebsd.org/changeset/base/190768 Log: MFC: rev. 190557 Fix memory leak in semunload(). Approved by: re (kib) Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/kern/sysv_sem.c Modified: stable/7/sys/kern/sysv_sem.c ============================================================================== --- stable/7/sys/kern/sysv_sem.c Mon Apr 6 11:31:31 2009 (r190767) +++ stable/7/sys/kern/sysv_sem.c Mon Apr 6 12:00:51 2009 (r190768) @@ -285,6 +285,7 @@ semunload(void) free(semu, M_SEM); for (i = 0; i < seminfo.semmni; i++) mtx_destroy(&sema_mtx[i]); + free(sema_mtx, M_SEM); mtx_destroy(&sem_mtx); mtx_destroy(&sem_undo_mtx); return (0); From weongyo at FreeBSD.org Mon Apr 6 05:43:41 2009 From: weongyo at FreeBSD.org (Weongyo Jeong) Date: Mon Apr 6 05:43:53 2009 Subject: svn commit: r190769 - head/sys/modules/usb Message-ID: <200904061243.n36CheC4071587@svn.freebsd.org> Author: weongyo Date: Mon Apr 6 12:43:40 2009 New Revision: 190769 URL: http://svn.freebsd.org/changeset/base/190769 Log: connect uath(4) to the build. uath(4) should work on all architectures. Modified: head/sys/modules/usb/Makefile Modified: head/sys/modules/usb/Makefile ============================================================================== --- head/sys/modules/usb/Makefile Mon Apr 6 12:00:51 2009 (r190768) +++ head/sys/modules/usb/Makefile Mon Apr 6 12:43:40 2009 (r190769) @@ -28,7 +28,7 @@ SUBDIR = usb #SUBDIR += ubt bluetooth_ng ubtfw SUBDIR += ehci musb ohci uhci uss820dci ${_at91dci} ${_atmegadci} -SUBDIR += rum ural zyd +SUBDIR += rum uath ural zyd SUBDIR += uhid ukbd ums udbp ufm SUBDIR += ucom u3g uark ubsa ubser uchcom ucycom ufoma uftdi ugensa uipaq ulpt \ umct umodem umoscom uplcom uslcom uvisor uvscom From weongyo at FreeBSD.org Mon Apr 6 05:47:11 2009 From: weongyo at FreeBSD.org (Weongyo Jeong) Date: Mon Apr 6 05:47:18 2009 Subject: svn commit: r190770 - head/share/man/man4 Message-ID: <200904061247.n36Cl9iI071720@svn.freebsd.org> Author: weongyo Date: Mon Apr 6 12:47:09 2009 New Revision: 190770 URL: http://svn.freebsd.org/changeset/base/190770 Log: connect uath.4 to the build. Modified: head/share/man/man4/Makefile Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Mon Apr 6 12:43:40 2009 (r190769) +++ head/share/man/man4/Makefile Mon Apr 6 12:47:09 2009 (r190770) @@ -388,6 +388,7 @@ MAN= aac.4 \ u3g.4 \ uark.4 \ uart.4 \ + uath.4 \ ubsa.4 \ ubsec.4 \ ubser.4 \ @@ -561,6 +562,7 @@ MLINKS+=tun.4 if_tun.4 MLINKS+=tx.4 if_tx.4 MLINKS+=txp.4 if_txp.4 MLINKS+=u3g.4 u3gstub.4 +MLINKS+=uath.4 if_uath.4 MLINKS+=udav.4 if_udav.4 MLINKS+=upgt.4 if_upgt.4 MLINKS+=ural.4 if_ural.4 From ed at FreeBSD.org Mon Apr 6 06:09:03 2009 From: ed at FreeBSD.org (Ed Schouten) Date: Mon Apr 6 06:09:14 2009 Subject: svn commit: r190771 - head/sys/dev/dcons Message-ID: <200904061309.n36D92so072238@svn.freebsd.org> Author: ed Date: Mon Apr 6 13:09:02 2009 New Revision: 190771 URL: http://svn.freebsd.org/changeset/base/190771 Log: Reduce the dcons polling frequency to 25 Hz. It makes little sense to use 100 Hz polling in dcons. We cannot live without polling, because that's just how dcons works. It polls the buffer filled by the firewire hardware. 25 Hz is probably enough for most use cases. Discussed with: rwatson Tested by: kan Modified: head/sys/dev/dcons/dcons_os.c Modified: head/sys/dev/dcons/dcons_os.c ============================================================================== --- head/sys/dev/dcons/dcons_os.c Mon Apr 6 12:47:09 2009 (r190770) +++ head/sys/dev/dcons/dcons_os.c Mon Apr 6 13:09:02 2009 (r190771) @@ -72,7 +72,7 @@ #ifndef DCONS_POLL_HZ -#define DCONS_POLL_HZ 100 +#define DCONS_POLL_HZ 25 #endif #ifndef DCONS_BUF_SIZE From ru at FreeBSD.org Mon Apr 6 06:14:35 2009 From: ru at FreeBSD.org (Ruslan Ermilov) Date: Mon Apr 6 06:14:47 2009 Subject: svn commit: r190772 - head Message-ID: <200904061314.n36DEZuA072390@svn.freebsd.org> Author: ru Date: Mon Apr 6 13:14:34 2009 New Revision: 190772 URL: http://svn.freebsd.org/changeset/base/190772 Log: - Added libpcap.so.5 to OLD_LIBS. - Added 32-bit versions of libusb20* to OLD_{LIBS,FILES}. - Added 32-bit version of libmp.so.6 to OLD_LIBS. Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Mon Apr 6 13:09:02 2009 (r190771) +++ head/ObsoleteFiles.inc Mon Apr 6 13:14:34 2009 (r190772) @@ -34,6 +34,11 @@ OLD_FILES+=usr/share/man/man8/pppd.8.gz OLD_FILES+=usr/share/man/man8/pppstats.8.gz OLD_FILES+=usr/share/man/man8/slattach.8.gz OLD_FILES+=usr/share/man/man8/sliplogin.8.gz +# 20090321: libpcap upgraded to 1.0.0 +OLD_LIBS+=lib/libpcap.so.5 +.if ${TARGET_ARCH} == "amd64" +OLD_LIBS+=usr/lib32/libpcap.so.5 +.endif # 20090319: uscanner(4) has been removed OLD_FILES+=usr/share/man/man4/uscanner.4.gz # 20090313: k8temp(4) renamed to amdtemp(4) @@ -44,8 +49,17 @@ OLD_FILES+=usr/lib/libusb20.a OLD_FILES+=usr/lib/libusb20.so OLD_FILES+=usr/lib/libusb20_p.a OLD_FILES+=usr/include/libusb20_compat01.h +.if ${TARGET_ARCH} == "amd64" +OLD_LIBS+=usr/lib32/libusb20.so.1 +OLD_FILES+=usr/lib32/libusb20.a +OLD_FILES+=usr/lib32/libusb20.so +OLD_FILES+=usr/lib32/libusb20_p.a +.endif # 20090226: libmp(3) functions renamed OLD_LIBS+=usr/lib/libmp.so.6 +.if ${TARGET_ARCH} == "amd64" +OLD_LIBS+=usr/lib32/libmp.so.6 +.endif # 20090223: changeover of USB stacks OLD_FILES+=usr/include/dev/usb2/include/ufm2_ioctl.h OLD_FILES+=usr/include/dev/usb2/include/urio2_ioctl.h From rrs at lakerest.net Mon Apr 6 06:33:36 2009 From: rrs at lakerest.net (Randall Stewart) Date: Mon Apr 6 06:33:43 2009 Subject: svn commit: r190758 - head/sbin/route In-Reply-To: References: <200904061009.n36A9K6l063517@svn.freebsd.org> Message-ID: Sure it should.. If you do route add -net 10.0.0.0 it will work.. Hmmm I wonder if more is not needed though.. let me think on this. What strange about the whole thing is that the behavior I put in used to work in previous releases... its rather strange actually.. I reviewed several of the past commits and I can't see what broke it. R On Apr 6, 2009, at 6:39 AM, Robert Watson wrote: > > On Mon, 6 Apr 2009, Randall Stewart wrote: > >> Author: rrs >> Date: Mon Apr 6 10:09:20 2009 >> New Revision: 190758 >> URL: http://svn.freebsd.org/changeset/base/190758 >> >> Log: >> Class based addressing went out in the early 90's. Basically >> if a entry is not route add -net xxx/bits then we should use >> the addr (xxx) to establish the number of bits by looking at >> the first non-zero bit. So if we enter >> route add -net 10.1.1.0 10.1.3.5 >> this is the same as doing >> route add -net 10.1.1.0/24 >> Since the 8th bit (zero counting) is set to 1 we set bits >> to 32-8. >> >> Users can of course still use the /x to change this behavior >> or in cases where the network is in the trailing part >> of the address, a "netmask" argument can be supplied to >> override what is established from the interpretation of the >> address itself. e.g: >> >> route add -net 10.1.1.8 -netmask 0xff00ffff >> >> should overide and place the proper CIDR mask in place. > > Does this maintain compatibility for people who may still > mysteriously be specifying class-based IPs and netmasks in > configuration files? If not, this should not be MFC'd... > > Robert N M Watson > Computer Laboratory > University of Cambridge > >> >> PR: 131365 >> MFC after: 1 week >> >> Modified: >> head/sbin/route/route.c >> >> Modified: head/sbin/route/route.c >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- head/sbin/route/route.c Mon Apr 6 07:13:26 2009 (r190757) >> +++ head/sbin/route/route.c Mon Apr 6 10:09:20 2009 (r190758) >> @@ -713,7 +713,7 @@ newroute(argc, argv) >> #ifdef INET6 >> if (af == AF_INET6) { >> rtm_addrs &= ~RTA_NETMASK; >> - memset((void *)&so_mask, 0, sizeof(so_mask)); >> + memset((void *)&so_mask, 0, sizeof(so_mask)); >> } >> #endif >> } >> @@ -803,21 +803,22 @@ inet_makenetandmask(net, sin, bits) >> addr = net << IN_CLASSC_NSHIFT; >> else >> addr = net; >> - >> - if (bits != 0) >> - mask = 0xffffffff << (32 - bits); >> - else if (net == 0) >> - mask = 0; >> - else if (IN_CLASSA(addr)) >> - mask = IN_CLASSA_NET; >> - else if (IN_CLASSB(addr)) >> - mask = IN_CLASSB_NET; >> - else if (IN_CLASSC(addr)) >> - mask = IN_CLASSC_NET; >> - else if (IN_MULTICAST(addr)) >> - mask = IN_CLASSD_NET; >> - else >> - mask = 0xffffffff; >> + /* >> + * If no /xx was specified we must cacluate the >> + * CIDR address. >> + */ >> + if ((bits == 0) && (addr != 0)) { >> + int i, j; >> + for(i=0,j=1; i<32; i++) { >> + if (addr & j) { >> + break; >> + } >> + j <<= 1; >> + } >> + /* i holds the first non zero bit */ >> + bits = 32 - i; >> + } >> + mask = 0xffffffff << (32 - bits); >> >> sin->sin_addr.s_addr = htonl(addr); >> sin = &so_mask.sin; >> > ------------------------------ Randall Stewart 803-317-4952 (cell) 803-345-0391(direct) From rrs at lakerest.net Mon Apr 6 06:35:06 2009 From: rrs at lakerest.net (Randall Stewart) Date: Mon Apr 6 06:35:12 2009 Subject: svn commit: r190758 - head/sbin/route In-Reply-To: <49D9DBED.6050805@FreeBSD.org> References: <200904061009.n36A9K6l063517@svn.freebsd.org> <49D9DBED.6050805@FreeBSD.org> Message-ID: <8ACFDA96-746E-49C9-B562-65DF82CD361B@lakerest.net> Hmm. On Apr 6, 2009, at 6:39 AM, Alexander Motin wrote: > Randall Stewart wrote: >> Author: rrs >> Date: Mon Apr 6 10:09:20 2009 >> New Revision: 190758 >> URL: http://svn.freebsd.org/changeset/base/190758 >> >> Log: >> Class based addressing went out in the early 90's. Basically >> if a entry is not route add -net xxx/bits then we should use >> the addr (xxx) to establish the number of bits by looking at >> the first non-zero bit. So if we enter >> route add -net 10.1.1.0 10.1.3.5 >> this is the same as doing >> route add -net 10.1.1.0/24 >> Since the 8th bit (zero counting) is set to 1 we set bits >> to 32-8. >> >> Users can of course still use the /x to change this behavior >> or in cases where the network is in the trailing part >> of the address, a "netmask" argument can be supplied to >> override what is established from the interpretation of the >> address itself. e.g: >> >> route add -net 10.1.1.8 -netmask 0xff00ffff >> >> should overide and place the proper CIDR mask in place. >> >> PR: 131365 >> MFC after: 1 week > > Are you sure that this is a good idea? Is this behavior > described/recommended somewhere? IMHO specifying network without > explicitly defined netmask is at least dangerous, if not wrong, in > present classless addressing time. Changing existing behavior breaks > POLA for some set of users, while benefits are not so obvious to me. > With previous code networks 10.0.0.0 and 11.0.0.0 were treated as /8, > but with this change it became /7 and /8 respectively. Well it is how CIDR works.. and cidr's been around since before 1997. I can go dig up the RFC's that specifu this if you woudl like > > > Author of the PR referred here expects network 192.168 to be treated > as > /16, but with your algorithm it will probably become /13. Drat... your right.. hmm. I need to go back and see how the old 6.0 stuff used to work properly.. R > > > -- > Alexander Motin > ------------------------------ Randall Stewart 803-317-4952 (cell) 803-345-0391(direct) From das at FreeBSD.org Mon Apr 6 06:50:06 2009 From: das at FreeBSD.org (David Schultz) Date: Mon Apr 6 06:50:20 2009 Subject: svn commit: r190773 - in head: lib/libc/stdio tools/regression/lib/libc/stdio Message-ID: <200904061350.n36Do57l073147@svn.freebsd.org> Author: das Date: Mon Apr 6 13:50:04 2009 New Revision: 190773 URL: http://svn.freebsd.org/changeset/base/190773 Log: Return -1 instead of 0 upon reaching EOF. This is somewhat ill-advised because it means getdelim() returns -1 for both error and EOF, and never returns 0. However, this is what the original GNU implementation does, and POSIX inherited the bug. Reported by: marcus@ Modified: head/lib/libc/stdio/getdelim.c head/lib/libc/stdio/getline.3 head/tools/regression/lib/libc/stdio/test-getdelim.c Modified: head/lib/libc/stdio/getdelim.c ============================================================================== --- head/lib/libc/stdio/getdelim.c Mon Apr 6 13:14:34 2009 (r190772) +++ head/lib/libc/stdio/getdelim.c Mon Apr 6 13:50:04 2009 (r190773) @@ -120,7 +120,6 @@ getdelim(char ** __restrict linep, size_ goto error; } - linelen = 0; if (*linecapp == 0) *linep = NULL; @@ -128,9 +127,12 @@ getdelim(char ** __restrict linep, size_ /* If fp is at EOF already, we just need space for the NUL. */ if (__sferror(fp) || expandtofit(linep, 1, linecapp)) goto error; - goto done; + FUNLOCKFILE(fp); + (*linep)[0] = '\0'; + return (-1); } + linelen = 0; while ((endp = memchr(fp->_p, delim, fp->_r)) == NULL) { if (sappend(linep, &linelen, linecapp, fp->_p, fp->_r)) goto error; Modified: head/lib/libc/stdio/getline.3 ============================================================================== --- head/lib/libc/stdio/getline.3 Mon Apr 6 13:14:34 2009 (r190772) +++ head/lib/libc/stdio/getline.3 Mon Apr 6 13:50:04 2009 (r190773) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 28, 2009 +.Dd March 29, 2009 .Dt GETLINE 3 .Os .Sh NAME @@ -79,7 +79,7 @@ and functions return the number of characters written, excluding the terminating .Dv NUL . -The value \-1 is returned if an error occurs. +The value \-1 is returned if an error occurs, or if end-of-file is reached. .Sh EXAMPLES The following code fragment reads lines from a file and writes them to standard output. Modified: head/tools/regression/lib/libc/stdio/test-getdelim.c ============================================================================== --- head/tools/regression/lib/libc/stdio/test-getdelim.c Mon Apr 6 13:14:34 2009 (r190772) +++ head/tools/regression/lib/libc/stdio/test-getdelim.c Mon Apr 6 13:50:04 2009 (r190773) @@ -100,7 +100,7 @@ main(int argc, char *argv[]) assert(line[0] == '\0' && line[1] == '\0'); /* Third line: EOF */ line[0] = 'X'; - assert(getline(&line, &linecap, fp) == 0); + assert(getline(&line, &linecap, fp) == -1); assert(line[0] == '\0'); free(line); assert(feof(fp)); @@ -139,7 +139,7 @@ main(int argc, char *argv[]) free(line); line = NULL; linecap = 0; - assert(getline(&line, &linecap, fp) == 0); + assert(getline(&line, &linecap, fp) == -1); assert(line[0] == '\0'); assert(linecap > 0); assert(errno == 0); From des at FreeBSD.org Mon Apr 6 07:12:23 2009 From: des at FreeBSD.org (Dag-Erling Smorgrav) Date: Mon Apr 6 07:12:30 2009 Subject: svn commit: r190774 - head/share/timedef Message-ID: <200904061412.n36ECMJb073686@svn.freebsd.org> Author: des Date: Mon Apr 6 14:12:22 2009 New Revision: 190774 URL: http://svn.freebsd.org/changeset/base/190774 Log: Fix ISO8859-15 links for nb_NO / no_NO. Submitted by: ru MFC after: 1 week Modified: head/share/timedef/Makefile Modified: head/share/timedef/Makefile ============================================================================== --- head/share/timedef/Makefile Mon Apr 6 13:50:04 2009 (r190773) +++ head/share/timedef/Makefile Mon Apr 6 14:12:22 2009 (r190774) @@ -126,10 +126,9 @@ GB2312_GBK= zh_CN ISO8859-1_ISO8859-1= ${DE_LINKS} ${FR_LINKS} ${GB_LINKS} ${IT_LINKS} \ ${NL_LINKS} ${NO_LINKS} en_US:af_ZA ISO8859-1_ISO8859-15= ca_ES da_DK de_AT de_DE en_GB en_US es_ES eu_ES \ - fi_FI fr_FR is_IS it_IT la_LN nl_NL nn_NO no_NO pt_PT \ + fi_FI fr_FR is_IS it_IT la_LN nb_NO nl_NL nn_NO no_NO pt_PT \ sv_SE \ - ${DE_LINKS} ${FR_LINKS} ${GB_LINKS} ${IT_LINKS} ${NL_LINKS} \ - ${NO_LINKS} + ${DE_LINKS} ${FR_LINKS} ${GB_LINKS} ${IT_LINKS} ${NL_LINKS} ISO8859-1_US-ASCII= ${GB_LINKS} en_GB en_US la_LN ISO8859-1_ISO8859-2= la_LN ISO8859-1_ISO8859-4= la_LN From rrs at FreeBSD.org Mon Apr 6 07:27:29 2009 From: rrs at FreeBSD.org (Randall Stewart) Date: Mon Apr 6 07:27:40 2009 Subject: svn commit: r190775 - head/sbin/route Message-ID: <200904061427.n36ERTVF074015@svn.freebsd.org> Author: rrs Date: Mon Apr 6 14:27:28 2009 New Revision: 190775 URL: http://svn.freebsd.org/changeset/base/190775 Log: Ok, looking at the solution a bit closer, the level calculation was too agressive. Instead we should only look at each nibble. This makes it so we make 10.2.0.0 become 10.2/16 NOT 10.2/17. Need to explore the non-cidr address issue. The two may not be seperable.. MFC after: 1 week Modified: head/sbin/route/route.c Modified: head/sbin/route/route.c ============================================================================== --- head/sbin/route/route.c Mon Apr 6 14:12:22 2009 (r190774) +++ head/sbin/route/route.c Mon Apr 6 14:27:28 2009 (r190775) @@ -808,15 +808,15 @@ inet_makenetandmask(net, sin, bits) * CIDR address. */ if ((bits == 0) && (addr != 0)) { - int i, j; - for(i=0,j=1; i<32; i++) { + u_long i, j; + for(i=0,j=0xff; i<4; i++) { if (addr & j) { break; } - j <<= 1; + j <<= 8; } /* i holds the first non zero bit */ - bits = 32 - i; + bits = 32 - (i*8); } mask = 0xffffffff << (32 - bits); From cokane at FreeBSD.org Mon Apr 6 08:09:24 2009 From: cokane at FreeBSD.org (Coleman Kane) Date: Mon Apr 6 08:09:30 2009 Subject: svn commit: r190775 - head/sbin/route In-Reply-To: <200904061427.n36ERTVF074015@svn.freebsd.org> References: <200904061427.n36ERTVF074015@svn.freebsd.org> Message-ID: <1239030459.1946.4.camel@localhost> On Mon, 2009-04-06 at 14:27 +0000, Randall Stewart wrote: > Author: rrs > Date: Mon Apr 6 14:27:28 2009 > New Revision: 190775 > URL: http://svn.freebsd.org/changeset/base/190775 > > Log: > Ok, looking at the solution a bit closer, the level > calculation was too agressive. Instead we should only > look at each nibble. This makes it so we make > 10.2.0.0 become 10.2/16 NOT 10.2/17. I presume you meant "NOT 10.2/15" here? Correct me if I'm wrong, but that's what I gathered by the discussion of "the bug" in the previous thread. > > Need to explore the non-cidr address issue. The two > may not be seperable.. > > MFC after: 1 week > > Modified: > head/sbin/route/route.c > > Modified: head/sbin/route/route.c > ============================================================================== > --- head/sbin/route/route.c Mon Apr 6 14:12:22 2009 (r190774) > +++ head/sbin/route/route.c Mon Apr 6 14:27:28 2009 (r190775) > @@ -808,15 +808,15 @@ inet_makenetandmask(net, sin, bits) > * CIDR address. > */ > if ((bits == 0) && (addr != 0)) { > - int i, j; > - for(i=0,j=1; i<32; i++) { > + u_long i, j; > + for(i=0,j=0xff; i<4; i++) { > if (addr & j) { > break; > } > - j <<= 1; > + j <<= 8; > } > /* i holds the first non zero bit */ > - bits = 32 - i; > + bits = 32 - (i*8); > } > mask = 0xffffffff << (32 - bits); > -- Coleman Kane -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 195 bytes Desc: This is a digitally signed message part Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20090406/fdd5df4d/attachment.pgp From cperciva at FreeBSD.org Mon Apr 6 08:45:05 2009 From: cperciva at FreeBSD.org (Colin Percival) Date: Mon Apr 6 08:45:11 2009 Subject: svn commit: r190778 - in stable/7/usr.sbin/portsnap: . phttpget Message-ID: <200904061545.n36Fj3nB075911@svn.freebsd.org> Author: cperciva Date: Mon Apr 6 15:45:03 2009 New Revision: 190778 URL: http://svn.freebsd.org/changeset/base/190778 Log: MFC r190679: Set SO_NOSIGPIPE on sockets in order to avoid having phttpget die when a RST packet arrives. Approved by: re (kib) Modified: stable/7/usr.sbin/portsnap/ (props changed) stable/7/usr.sbin/portsnap/phttpget/phttpget.c Modified: stable/7/usr.sbin/portsnap/phttpget/phttpget.c ============================================================================== --- stable/7/usr.sbin/portsnap/phttpget/phttpget.c Mon Apr 6 15:29:44 2009 (r190777) +++ stable/7/usr.sbin/portsnap/phttpget/phttpget.c Mon Apr 6 15:45:03 2009 (r190778) @@ -317,6 +317,7 @@ main(int argc, char *argv[]) int chunked; /* != if transfer-encoding is chunked */ off_t clen; /* Chunk length */ int firstreq = 0; /* # of first request for this connection */ + int val; /* Value used for setsockopt call */ /* Check that the arguments are sensible */ if (argc < 2) @@ -370,6 +371,11 @@ main(int argc, char *argv[]) setsockopt(sd, SOL_SOCKET, SO_RCVTIMEO, (void *)&timo, (socklen_t)sizeof(timo)); + /* ... disable SIGPIPE generation ... */ + val = 1; + setsockopt(sd, SOL_SOCKET, SO_NOSIGPIPE, + (void *)&val, sizeof(int)); + /* ... and connect to the server. */ if(connect(sd, res->ai_addr, res->ai_addrlen)) { close(sd); From rrs at lakerest.net Mon Apr 6 09:21:33 2009 From: rrs at lakerest.net (Randall Stewart) Date: Mon Apr 6 09:21:40 2009 Subject: svn commit: r190775 - head/sbin/route In-Reply-To: <1239030459.1946.4.camel@localhost> References: <200904061427.n36ERTVF074015@svn.freebsd.org> <1239030459.1946.4.camel@localhost> Message-ID: <5EEC0668-D1C4-45E8-AFC1-959AE3E8715E@lakerest.net> On Apr 6, 2009, at 11:07 AM, Coleman Kane wrote: > On Mon, 2009-04-06 at 14:27 +0000, Randall Stewart wrote: >> Author: rrs >> Date: Mon Apr 6 14:27:28 2009 >> New Revision: 190775 >> URL: http://svn.freebsd.org/changeset/base/190775 >> >> Log: >> Ok, looking at the solution a bit closer, the level >> calculation was too agressive. Instead we should only >> look at each nibble. This makes it so we make >> 10.2.0.0 become 10.2/16 NOT 10.2/17. > > I presume you meant "NOT 10.2/15" here? Correct me if I'm wrong, but > that's what I gathered by the discussion of "the bug" in the previous > thread. > It would have actually done any number of ones... basically looking at the bottom number of 0 bits and that would be the / value. So depending on what number you put with 10.x (for x) you could get a variety of results.. 10.2 would == 10.2/17 10.4 would == 10.2/18 etc. This is not the correct behavior.. even though it might be technically right with regard to CIDR. Now as far as the old class based routings go.. this is a problem since the two schemes are at odds. We have for a long time had doing route add -net 10.2.0.0 be equal to adding 10.2/16 But if you follow the old Class based routing then the upper 4 bits of the address needs to be examined to determine if its a /8, /16 etc. That is incorrect in a CIDR world.. but I don't see a way to make the two schemes work together. And since previous to 7.1 the above worked.. I think this last fix is the right approach.. R >> >> Need to explore the non-cidr address issue. The two >> may not be seperable.. >> >> MFC after: 1 week >> >> Modified: >> head/sbin/route/route.c >> >> Modified: head/sbin/route/route.c >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- head/sbin/route/route.c Mon Apr 6 14:12:22 2009 (r190774) >> +++ head/sbin/route/route.c Mon Apr 6 14:27:28 2009 (r190775) >> @@ -808,15 +808,15 @@ inet_makenetandmask(net, sin, bits) >> * CIDR address. >> */ >> if ((bits == 0) && (addr != 0)) { >> - int i, j; >> - for(i=0,j=1; i<32; i++) { >> + u_long i, j; >> + for(i=0,j=0xff; i<4; i++) { >> if (addr & j) { >> break; >> } >> - j <<= 1; >> + j <<= 8; >> } >> /* i holds the first non zero bit */ >> - bits = 32 - i; >> + bits = 32 - (i*8); >> } >> mask = 0xffffffff << (32 - bits); >> > > -- > Coleman Kane ------------------------------ Randall Stewart 803-317-4952 (cell) 803-345-0391(direct) From cokane at FreeBSD.org Mon Apr 6 09:28:46 2009 From: cokane at FreeBSD.org (Coleman Kane) Date: Mon Apr 6 09:28:53 2009 Subject: svn commit: r190775 - head/sbin/route In-Reply-To: <5EEC0668-D1C4-45E8-AFC1-959AE3E8715E@lakerest.net> References: <200904061427.n36ERTVF074015@svn.freebsd.org> <1239030459.1946.4.camel@localhost> <5EEC0668-D1C4-45E8-AFC1-959AE3E8715E@lakerest.net> Message-ID: <1239035218.1946.12.camel@localhost> On Mon, 2009-04-06 at 12:21 -0400, Randall Stewart wrote: > On Apr 6, 2009, at 11:07 AM, Coleman Kane wrote: > > > On Mon, 2009-04-06 at 14:27 +0000, Randall Stewart wrote: > >> Author: rrs > >> Date: Mon Apr 6 14:27:28 2009 > >> New Revision: 190775 > >> URL: http://svn.freebsd.org/changeset/base/190775 > >> > >> Log: > >> Ok, looking at the solution a bit closer, the level > >> calculation was too agressive. Instead we should only > >> look at each nibble. This makes it so we make > >> 10.2.0.0 become 10.2/16 NOT 10.2/17. > > > > I presume you meant "NOT 10.2/15" here? Correct me if I'm wrong, but > > that's what I gathered by the discussion of "the bug" in the previous > > thread. > > > > It would have actually done any number of ones... basically looking > at the bottom number of 0 bits and that would be the / value. > > So depending on what number you put with > 10.x (for x) you could get a variety of results.. > > 10.2 would == 10.2/17 > 10.4 would == 10.2/18 I was under the impression that the above would sort out to something akin to the following binary sequences: 00001010 00000010 (10.2) produces a 15-bit-long mask (11111111 11111110) 00001010 00000100 (10.4) produces a 14-bit-long mask (11111111 11111100) I would expect 10.2.128 to produce a 17-bit mask, and 10.2.129 to produce an 18-bit mask, according to CIDR. > > etc. > > This is not the correct behavior.. even though it might be > technically right with regard to CIDR. > > Now as far as the old class based routings go.. this is a problem > since the two schemes are at odds. > > We have for a long time had doing > > route add -net 10.2.0.0 be equal to adding 10.2/16 > > But if you follow the old Class based routing then > the upper 4 bits of the address needs to be examined to > determine if its a /8, /16 etc. > > That is incorrect in a CIDR world.. but I don't see a way > to make the two schemes work together. And since previous to 7.1 > the above worked.. I think this last fix is the right approach.. > > R > > >> > >> Need to explore the non-cidr address issue. The two > >> may not be seperable.. > >> > >> MFC after: 1 week > >> > >> Modified: > >> head/sbin/route/route.c > >> > >> Modified: head/sbin/route/route.c > >> = > >> = > >> = > >> = > >> = > >> = > >> = > >> = > >> = > >> ===================================================================== > >> --- head/sbin/route/route.c Mon Apr 6 14:12:22 2009 (r190774) > >> +++ head/sbin/route/route.c Mon Apr 6 14:27:28 2009 (r190775) > >> @@ -808,15 +808,15 @@ inet_makenetandmask(net, sin, bits) > >> * CIDR address. > >> */ > >> if ((bits == 0) && (addr != 0)) { > >> - int i, j; > >> - for(i=0,j=1; i<32; i++) { > >> + u_long i, j; > >> + for(i=0,j=0xff; i<4; i++) { > >> if (addr & j) { > >> break; > >> } > >> - j <<= 1; > >> + j <<= 8; > >> } > >> /* i holds the first non zero bit */ > >> - bits = 32 - i; > >> + bits = 32 - (i*8); > >> } > >> mask = 0xffffffff << (32 - bits); > >> > > > > -- > > Coleman Kane > > ------------------------------ > Randall Stewart > 803-317-4952 (cell) > 803-345-0391(direct) > -- Coleman Kane -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 195 bytes Desc: This is a digitally signed message part Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20090406/7a202bad/attachment.pgp From peter.schuller at infidyne.com Mon Apr 6 09:48:56 2009 From: peter.schuller at infidyne.com (Peter Schuller) Date: Mon Apr 6 09:49:08 2009 Subject: svn commit: r189828 - in head: include sys/sys In-Reply-To: <20090327063251.GA95057@polejan.hw.v5d.org> References: <200903142010.n2EKAESF006945@svn.freebsd.org> <20090320140015.GA17645@hub.freebsd.org> <20090320153405.GA62675@zim.MIT.EDU> <49C3BCD4.4030605@freebsd.org> <1237567495.1993.2.camel@localhost> <20090327063251.GA95057@polejan.hw.v5d.org> Message-ID: <20090406164853.GA75904@hyperion.scode.org> Skipped content of type multipart/mixed-------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 196 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20090406/23e69470/attachment.pgp From trasz at FreeBSD.org Mon Apr 6 10:33:37 2009 From: trasz at FreeBSD.org (Edward Tomasz Napierala) Date: Mon Apr 6 10:33:44 2009 Subject: svn commit: r190782 - in stable/7/sys: . contrib/pf dev/cxgb geom/journal Message-ID: <200904061733.n36HXZD8078312@svn.freebsd.org> Author: trasz Date: Mon Apr 6 17:33:35 2009 New Revision: 190782 URL: http://svn.freebsd.org/changeset/base/190782 Log: MFC r185693: Make it possible to use gjournal for the root filesystem. Previously, an unclean shutdown would make it impossible to mount rootfs at boot. Approved by: re (kib) Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/geom/journal/g_journal.c stable/7/sys/geom/journal/g_journal.h Modified: stable/7/sys/geom/journal/g_journal.c ============================================================================== --- stable/7/sys/geom/journal/g_journal.c Mon Apr 6 17:08:48 2009 (r190781) +++ stable/7/sys/geom/journal/g_journal.c Mon Apr 6 17:33:35 2009 (r190782) @@ -2108,6 +2108,12 @@ g_journal_worker(void *arg) g_topology_unlock(); last_write = time_second; + if (sc->sc_rootmount != NULL) { + GJ_DEBUG(1, "root_mount_rel %p", sc->sc_rootmount); + root_mount_rel(sc->sc_rootmount); + sc->sc_rootmount = NULL; + } + for (;;) { /* Get first request from the queue. */ mtx_lock(&sc->sc_mtx); @@ -2304,6 +2310,9 @@ g_journal_create(struct g_class *mp, str sc->sc_inactive.jj_queue = NULL; sc->sc_active.jj_queue = NULL; + sc->sc_rootmount = root_mount_hold("GJOURNAL"); + GJ_DEBUG(1, "root_mount_hold %p", sc->sc_rootmount); + callout_init(&sc->sc_callout, CALLOUT_MPSAFE); if (md->md_type != GJ_TYPE_COMPLETE) { /* @@ -2434,6 +2443,13 @@ g_journal_destroy(struct g_journal_softc sc->sc_flags |= (GJF_DEVICE_DESTROY | GJF_DEVICE_CLEAN); g_topology_unlock(); + + if (sc->sc_rootmount != NULL) { + GJ_DEBUG(1, "root_mount_rel %p", sc->sc_rootmount); + root_mount_rel(sc->sc_rootmount); + sc->sc_rootmount = NULL; + } + callout_drain(&sc->sc_callout); mtx_lock(&sc->sc_mtx); wakeup(sc); Modified: stable/7/sys/geom/journal/g_journal.h ============================================================================== --- stable/7/sys/geom/journal/g_journal.h Mon Apr 6 17:08:48 2009 (r190781) +++ stable/7/sys/geom/journal/g_journal.h Mon Apr 6 17:33:35 2009 (r190782) @@ -163,6 +163,8 @@ struct g_journal_softc { struct callout sc_callout; struct proc *sc_worker; + + struct root_hold_token *sc_rootmount; }; #define sc_dprovider sc_dconsumer->provider #define sc_jprovider sc_jconsumer->provider From rwatson at FreeBSD.org Mon Apr 6 10:45:30 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Mon Apr 6 10:53:13 2009 Subject: svn commit: r190775 - head/sbin/route In-Reply-To: <5EEC0668-D1C4-45E8-AFC1-959AE3E8715E@lakerest.net> References: <200904061427.n36ERTVF074015@svn.freebsd.org> <1239030459.1946.4.camel@localhost> <5EEC0668-D1C4-45E8-AFC1-959AE3E8715E@lakerest.net> Message-ID: On Mon, 6 Apr 2009, Randall Stewart wrote: >> I presume you meant "NOT 10.2/15" here? Correct me if I'm wrong, but that's >> what I gathered by the discussion of "the bug" in the previous thread. > > It would have actually done any number of ones... basically looking at the > bottom number of 0 bits and that would be the / value. > > So depending on what number you put with 10.x (for x) you could get a > variety of results.. > > 10.2 would == 10.2/17 > 10.4 would == 10.2/18 > > etc. > > This is not the correct behavior.. even though it might be technically right > with regard to CIDR. > > Now as far as the old class based routings go.. this is a problem since the > two schemes are at odds. Perhaps I'm sort of old-fashioned, but I would generally expect: (1) No netmask specified -- use class to determine netmask (2) netmask specified using -net 192.168/20 -- use /20 (3) netmask specified using -netmask -- use the -netmask argument. I guess I just don't administer routers very much anymore, but is using the last set bit a commonly used way to name networks these days, as opposed to explicitly setting the netmask with /whatever? Robert N M Watson Computer Laboratory University of Cambridge > > We have for a long time had doing > > route add -net 10.2.0.0 be equal to adding 10.2/16 > > But if you follow the old Class based routing then > the upper 4 bits of the address needs to be examined to > determine if its a /8, /16 etc. > > That is incorrect in a CIDR world.. but I don't see a way > to make the two schemes work together. And since previous to 7.1 > the above worked.. I think this last fix is the right approach.. > > R > >>> >>> Need to explore the non-cidr address issue. The two >>> may not be seperable.. >>> >>> MFC after: 1 week >>> >>> Modified: >>> head/sbin/route/route.c >>> >>> Modified: head/sbin/route/route.c >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> ===================================================================== >>> --- head/sbin/route/route.c Mon Apr 6 14:12:22 2009 (r190774) >>> +++ head/sbin/route/route.c Mon Apr 6 14:27:28 2009 (r190775) >>> @@ -808,15 +808,15 @@ inet_makenetandmask(net, sin, bits) >>> * CIDR address. >>> */ >>> if ((bits == 0) && (addr != 0)) { >>> - int i, j; >>> - for(i=0,j=1; i<32; i++) { >>> + u_long i, j; >>> + for(i=0,j=0xff; i<4; i++) { >>> if (addr & j) { >>> break; >>> } >>> - j <<= 1; >>> + j <<= 8; >>> } >>> /* i holds the first non zero bit */ >>> - bits = 32 - i; >>> + bits = 32 - (i*8); >>> } >>> mask = 0xffffffff << (32 - bits); >>> >> >> -- >> Coleman Kane > > ------------------------------ > Randall Stewart > 803-317-4952 (cell) > 803-345-0391(direct) > > From das at FreeBSD.ORG Mon Apr 6 11:24:06 2009 From: das at FreeBSD.ORG (David Schultz) Date: Mon Apr 6 11:24:13 2009 Subject: svn commit: r189828 - in head: include sys/sys In-Reply-To: <20090406164853.GA75904@hyperion.scode.org> References: <200903142010.n2EKAESF006945@svn.freebsd.org> <20090320140015.GA17645@hub.freebsd.org> <20090320153405.GA62675@zim.MIT.EDU> <49C3BCD4.4030605@freebsd.org> <1237567495.1993.2.camel@localhost> <20090327063251.GA95057@polejan.hw.v5d.org> <20090406164853.GA75904@hyperion.scode.org> Message-ID: <20090406182419.GA62997@zim.MIT.EDU> On Mon, Apr 06, 2009, Peter Schuller wrote: > [ pthread_kill() in signal.h conflicting with devel/pth's attempts to hide native pthread] > > > 3. /usr/include/signal.h defines pthread_kill() only if __POSIX_VISIBLE > > or __XSI_VISIBLE is defined. Can someone try to inject > > #undef __POSIX_VISIBLE or #undef __XSI_VISIBLE into pth's pthread.h.in > > to see if this fixes the problem and does not cause other problems? > > The attached patch dropped into the port makes devel/pth and > security/gnupg build for me. > > I'll re-build my full set of ports with the patch and see, but I'm not > really set up to do a global build of all ports. More importantly I > guess is that it doesn't break things on older releases. I'll re-build > my ports on a 7.x system too. > > I'm not the most knowledgable about the various POSIX/XSI > compatibility defines and their expected results, but it seems pretty > dangerous to me to flat-out #undef it. Who knows what else depends on > those being set properly in any given application. > > How about only doing it for a new enough OS release to at least avoid > breaking older releases, and then communicate the problem upstream and > hope for a better fix? As I mentioned in an email to vd@ two weeks ago, the problem is that GNU pth *already* has a bunch of insidious kludges to try to prevent systems headers on various operating systems from declaring symbols it wants to clobber. In particular, it defines _PTHREAD_H, which hides pthread_kill() when pthread_kill() is defined in pthread.h, but not when it is defined in signal.h. The options are to either add yet another insidious kludge to GNU pth such as the one you suggest, or to add a kludge to FreeBSD specifically to support GNU pth in all its brokenness. I agreed to try the latter if the former proved to be impractical. From peter.schuller at infidyne.com Mon Apr 6 12:11:45 2009 From: peter.schuller at infidyne.com (Peter Schuller) Date: Mon Apr 6 12:11:52 2009 Subject: svn commit: r189828 - in head: include sys/sys In-Reply-To: <20090406182419.GA62997@zim.MIT.EDU> References: <200903142010.n2EKAESF006945@svn.freebsd.org> <20090320140015.GA17645@hub.freebsd.org> <20090320153405.GA62675@zim.MIT.EDU> <49C3BCD4.4030605@freebsd.org> <1237567495.1993.2.camel@localhost> <20090327063251.GA95057@polejan.hw.v5d.org> <20090406164853.GA75904@hyperion.scode.org> <20090406182419.GA62997@zim.MIT.EDU> Message-ID: <20090406191142.GA79888@hyperion.scode.org> > > I'm not the most knowledgable about the various POSIX/XSI > > compatibility defines and their expected results, but it seems pretty > > dangerous to me to flat-out #undef it. Who knows what else depends on > > those being set properly in any given application. > > > > How about only doing it for a new enough OS release to at least avoid > > breaking older releases, and then communicate the problem upstream and > > hope for a better fix? > > As I mentioned in an email to vd@ two weeks ago, the problem is > that GNU pth *already* has a bunch of insidious kludges to try to > prevent systems headers on various operating systems from > declaring symbols it wants to clobber. In particular, it defines > _PTHREAD_H, which hides pthread_kill() when pthread_kill() is > defined in pthread.h, but not when it is defined in signal.h. > > The options are to either add yet another insidious kludge to GNU > pth such as the one you suggest, or to add a kludge to FreeBSD > specifically to support GNU pth in all its brokenness. I agreed to > try the latter if the former proved to be impractical. To be clear I'm not suggesting the kludge, but tested what vd@ asked for and suggested limiting the potential negative impact by limiting it to >= 8. I understand that it's an ugly solution either way, but I can't suggest one that isn't... Would it make sense to invent a kludge that is at least somewhat general in nature (__PTHREADS_INVISIBLE or something) which could possibly be adopted by other OS:es and decrease OS-specific hacks in pth? -- / Peter Schuller PGP userID: 0xE9758B7D or 'Peter Schuller ' Key retrieval: Send an E-Mail to getpgpkey@scode.org E-Mail: peter.schuller@infidyne.com Web: http://www.scode.org -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 196 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20090406/b5353be7/attachment.pgp From jhb at FreeBSD.org Mon Apr 6 12:12:49 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Mon Apr 6 12:12:59 2009 Subject: svn commit: r190783 - head/sys/nfsclient Message-ID: <200904061912.n36JClwv080363@svn.freebsd.org> Author: jhb Date: Mon Apr 6 19:12:47 2009 New Revision: 190783 URL: http://svn.freebsd.org/changeset/base/190783 Log: Change the default timeout for caching attributes of a directory in the NFS client from 30 seconds to 3 seconds. After the recent changes to add caching of negative name cache lookups, a negative name cache hit will persist until the client notices the parent directory has changed. The higher the attribute cache timeout on directories, the longer that can take, so lower the default timeout for directories to match that of regular files. Suggested by: bde, mohans MFC after: 1 month Modified: head/sys/nfsclient/nfs.h Modified: head/sys/nfsclient/nfs.h ============================================================================== --- head/sys/nfsclient/nfs.h Mon Apr 6 17:33:35 2009 (r190782) +++ head/sys/nfsclient/nfs.h Mon Apr 6 19:12:47 2009 (r190783) @@ -63,7 +63,7 @@ #define NFS_MAXATTRTIMO 60 #endif #ifndef NFS_MINDIRATTRTIMO -#define NFS_MINDIRATTRTIMO 30 /* VDIR attrib cache timeout in sec */ +#define NFS_MINDIRATTRTIMO 3 /* VDIR attrib cache timeout in sec */ #endif #ifndef NFS_MAXDIRATTRTIMO #define NFS_MAXDIRATTRTIMO 60 From jhb at FreeBSD.org Mon Apr 6 13:17:32 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Mon Apr 6 13:17:41 2009 Subject: svn commit: r190784 - head/sys/modules/nfsclient Message-ID: <200904062017.n36KHSEo081644@svn.freebsd.org> Author: jhb Date: Mon Apr 6 20:17:28 2009 New Revision: 190784 URL: http://svn.freebsd.org/changeset/base/190784 Log: Add opt_kdtrace.h to fix standalone module build. Modified: head/sys/modules/nfsclient/Makefile Modified: head/sys/modules/nfsclient/Makefile ============================================================================== --- head/sys/modules/nfsclient/Makefile Mon Apr 6 19:12:47 2009 (r190783) +++ head/sys/modules/nfsclient/Makefile Mon Apr 6 20:17:28 2009 (r190784) @@ -10,7 +10,7 @@ SRCS= vnode_if.h \ opt_inet.h opt_nfs.h opt_bootp.h opt_nfsroot.h SRCS+= nfs4_dev.c nfs4_idmap.c nfs4_socket.c nfs4_subs.c \ nfs4_vfs_subs.c nfs4_vfsops.c nfs4_vn_subs.c nfs4_vnops.c -SRCS+= opt_inet6.h opt_kgssapi.h opt_route.h +SRCS+= opt_inet6.h opt_kdtrace.h opt_kgssapi.h opt_route.h # USE THE RPCCLNT: CFLAGS+= -DRPCCLNT_DEBUG From jhb at FreeBSD.org Mon Apr 6 14:11:10 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Mon Apr 6 14:11:17 2009 Subject: svn commit: r190785 - in head/sys: nfs4client nfsclient Message-ID: <200904062111.n36LB8Eh083543@svn.freebsd.org> Author: jhb Date: Mon Apr 6 21:11:08 2009 New Revision: 190785 URL: http://svn.freebsd.org/changeset/base/190785 Log: When a stale file handle is encountered, purge all cached information about an NFS node including the access and attribute caches. Previously the NFS client only purged any name cache entries associated with the file. PR: kern/123755 Submitted by: Jaakko Heinonen jh of saunalahti fi Reported by: Timo Sirainen tss of iki fi Reviewed by: rwatson, rmacklem MFC after: 1 month Modified: head/sys/nfs4client/nfs4_socket.c head/sys/nfsclient/nfs.h head/sys/nfsclient/nfs_krpc.c head/sys/nfsclient/nfs_socket.c head/sys/nfsclient/nfs_subs.c Modified: head/sys/nfs4client/nfs4_socket.c ============================================================================== --- head/sys/nfs4client/nfs4_socket.c Mon Apr 6 20:17:28 2009 (r190784) +++ head/sys/nfs4client/nfs4_socket.c Mon Apr 6 21:11:08 2009 (r190785) @@ -259,7 +259,7 @@ nfs4_request(struct vnode *vp, struct mb ** lookup cache, just in case. **/ if (error == ESTALE) - cache_purge(vp); + nfs_purgecache(vp); return (error); } Modified: head/sys/nfsclient/nfs.h ============================================================================== --- head/sys/nfsclient/nfs.h Mon Apr 6 20:17:28 2009 (r190784) +++ head/sys/nfsclient/nfs.h Mon Apr 6 21:11:08 2009 (r190785) @@ -322,6 +322,7 @@ void nfs_down(struct nfsreq *, struct nf #endif /* ! NFS4_USE_RPCCLNT */ #endif +void nfs_purgecache(struct vnode *); int nfs_vinvalbuf(struct vnode *, int, struct thread *, int); int nfs_readrpc(struct vnode *, struct uio *, struct ucred *); int nfs_writerpc(struct vnode *, struct uio *, struct ucred *, int *, Modified: head/sys/nfsclient/nfs_krpc.c ============================================================================== --- head/sys/nfsclient/nfs_krpc.c Mon Apr 6 20:17:28 2009 (r190784) +++ head/sys/nfsclient/nfs_krpc.c Mon Apr 6 21:11:08 2009 (r190785) @@ -557,7 +557,7 @@ tryagain: * cache, just in case. */ if (error == ESTALE) - cache_purge(vp); + nfs_purgecache(vp); /* * Skip wcc data on NFS errors for now. NetApp filers * return corrupt postop attrs in the wcc data for NFS Modified: head/sys/nfsclient/nfs_socket.c ============================================================================== --- head/sys/nfsclient/nfs_socket.c Mon Apr 6 20:17:28 2009 (r190784) +++ head/sys/nfsclient/nfs_socket.c Mon Apr 6 21:11:08 2009 (r190785) @@ -1364,7 +1364,7 @@ wait_for_pinned_req: * lookup cache, just in case. */ if (error == ESTALE) - cache_purge(vp); + nfs_purgecache(vp); /* * Skip wcc data on NFS errors for now. NetApp filers return corrupt * postop attrs in the wcc data for NFS err EROFS. Not sure if they Modified: head/sys/nfsclient/nfs_subs.c ============================================================================== --- head/sys/nfsclient/nfs_subs.c Mon Apr 6 20:17:28 2009 (r190784) +++ head/sys/nfsclient/nfs_subs.c Mon Apr 6 21:11:08 2009 (r190785) @@ -865,6 +865,29 @@ nfs_getattrcache(struct vnode *vp, struc return (0); } +/* + * Purge all cached information about an NFS vnode including name + * cache entries, the attribute cache, and the access cache. This is + * called when an NFS request for a node fails with a stale + * filehandle. + */ +void +nfs_purgecache(struct vnode *vp) +{ + struct nfsnode *np; + int i; + + np = VTONFS(vp); + cache_purge(vp); + mtx_lock(&np->n_mtx); + np->n_attrstamp = 0; + KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(vp); + for (i = 0; i < NFS_ACCESSCACHESIZE; i++) + np->n_accesscache[i].stamp = 0; + KDTRACE_NFS_ACCESSCACHE_FLUSH_DONE(vp); + mtx_unlock(&np->n_mtx); +} + static nfsuint64 nfs_nullcookie = { { 0, 0 } }; /* * This function finds the directory cookie that corresponds to the From rwatson at FreeBSD.org Mon Apr 6 14:49:48 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Mon Apr 6 14:49:59 2009 Subject: svn commit: r190784 - head/sys/modules/nfsclient In-Reply-To: <200904062017.n36KHSEo081644@svn.freebsd.org> References: <200904062017.n36KHSEo081644@svn.freebsd.org> Message-ID: On Mon, 6 Apr 2009, John Baldwin wrote: > Author: jhb > Date: Mon Apr 6 20:17:28 2009 > New Revision: 190784 > URL: http://svn.freebsd.org/changeset/base/190784 > > Log: > Add opt_kdtrace.h to fix standalone module build. Thanks! Robert N M Watson Computer Laboratory University of Cambridge > > Modified: > head/sys/modules/nfsclient/Makefile > > Modified: head/sys/modules/nfsclient/Makefile > ============================================================================== > --- head/sys/modules/nfsclient/Makefile Mon Apr 6 19:12:47 2009 (r190783) > +++ head/sys/modules/nfsclient/Makefile Mon Apr 6 20:17:28 2009 (r190784) > @@ -10,7 +10,7 @@ SRCS= vnode_if.h \ > opt_inet.h opt_nfs.h opt_bootp.h opt_nfsroot.h > SRCS+= nfs4_dev.c nfs4_idmap.c nfs4_socket.c nfs4_subs.c \ > nfs4_vfs_subs.c nfs4_vfsops.c nfs4_vn_subs.c nfs4_vnops.c > -SRCS+= opt_inet6.h opt_kgssapi.h opt_route.h > +SRCS+= opt_inet6.h opt_kdtrace.h opt_kgssapi.h opt_route.h > > # USE THE RPCCLNT: > CFLAGS+= -DRPCCLNT_DEBUG > From marcel at FreeBSD.org Mon Apr 6 14:52:11 2009 From: marcel at FreeBSD.org (Marcel Moolenaar) Date: Mon Apr 6 14:52:18 2009 Subject: svn commit: r190786 - head/lib/libkvm Message-ID: <200904062152.n36LqArv084360@svn.freebsd.org> Author: marcel Date: Mon Apr 6 21:52:10 2009 New Revision: 190786 URL: http://svn.freebsd.org/changeset/base/190786 Log: Add support for PowerPC kernel core files. This commit only adds support for virtual core files (aka minidumps). physical core files are not supported. The implementation is cross-tool ready and can be used in a non- powerpc hosted debugger to analyze PowerPC core files. It also accepts core files that still have the dump header, as can be the case within Juniper where TFTP-based kernel core files are supported and savecore is not used to "extract" the core file from some dump device. Obtained from: Juniper Networks, Inc. Modified: head/lib/libkvm/kvm_powerpc.c Modified: head/lib/libkvm/kvm_powerpc.c ============================================================================== --- head/lib/libkvm/kvm_powerpc.c Mon Apr 6 21:11:08 2009 (r190785) +++ head/lib/libkvm/kvm_powerpc.c Mon Apr 6 21:52:10 2009 (r190786) @@ -1,8 +1,5 @@ -/* $NetBSD: kvm_powerpc.c,v 1.4 1998/02/03 06:50:07 mycroft Exp $ */ - /*- - * Copyright (C) 1996 Wolfgang Solfrank. - * Copyright (C) 1996 TooLs GmbH. + * Copyright (c) 2008, Juniper Networks, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -13,91 +10,209 @@ * 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 TooLs GmbH. - * 4. The name of TooLs GmbH may not be used to endorse or promote products - * derived from this software without specific prior written permission. + * 3. Neither the name of the author nor the names of any co-contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR + * 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 TOOLS GMBH 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. - */ - -/* - * PowerPC machine dependent routines for kvm. + * 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. */ #include __FBSDID("$FreeBSD$"); #include +#include +#include +#include #include #include +#include #include #include #include #include "kvm_private.h" -void -_kvm_freevtop(kd) - kvm_t *kd; +struct vmstate { + void *map; + size_t mapsz; + size_t dmphdrsz; + Elf32_Ehdr *eh; + Elf32_Phdr *ph; +}; + +static int +valid_elf_header(Elf32_Ehdr *eh) { - if (kd->vmst != 0) - free(kd->vmst); + + if (!IS_ELF(*eh)) + return (0); + if (eh->e_ident[EI_CLASS] != ELFCLASS32) + return (0); + if (eh->e_ident[EI_DATA] != ELFDATA2MSB) + return (0); + if (eh->e_ident[EI_VERSION] != EV_CURRENT) + return (0); + if (eh->e_ident[EI_OSABI] != ELFOSABI_STANDALONE) + return (0); + if (be16toh(eh->e_type) != ET_CORE) + return (0); + if (be16toh(eh->e_machine) != EM_PPC) + return (0); + /* Can't think of anything else to check... */ + return (1); } -int -_kvm_initvtop(kd) - kvm_t *kd; +static size_t +dump_header_size(struct kerneldumpheader *dh) { - return 0; + + if (strcmp(dh->magic, KERNELDUMPMAGIC) != 0) + return (0); + if (strcmp(dh->architecture, "powerpc") != 0) + return (0); + /* That should do it... */ + return (sizeof(*dh)); } -int -_kvm_kvatop(kd, va, pa) - kvm_t *kd; - u_long va; - off_t *pa; -{ - _kvm_err(kd, 0, "vatop not yet implemented!"); - return 0; -} - -off_t -_kvm_pa2off(kd, pa) - kvm_t *kd; - u_long pa; +/* + * Map the ELF headers into the process' address space. We do this in two + * steps: first the ELF header itself and using that information the whole + * set of headers. + */ +static int +powerpc_maphdrs(kvm_t *kd) { - _kvm_err(kd, 0, "pa2off not yet implemented!"); - return 0; + struct vmstate *vm; + size_t mapsz; + + vm = kd->vmst; + + vm->mapsz = PAGE_SIZE; + vm->map = mmap(NULL, vm->mapsz, PROT_READ, MAP_PRIVATE, kd->pmfd, 0); + if (vm->map == MAP_FAILED) { + _kvm_err(kd, kd->program, "cannot map corefile"); + return (-1); + } + vm->dmphdrsz = 0; + vm->eh = vm->map; + if (!valid_elf_header(vm->eh)) { + /* + * Hmmm, no ELF header. Maybe we still have a dump header. + * This is normal when the core file wasn't created by + * savecore(8), but instead was dumped over TFTP. We can + * easily skip the dump header... + */ + vm->dmphdrsz = dump_header_size(vm->map); + if (vm->dmphdrsz == 0) + goto inval; + vm->eh = (void *)((uintptr_t)vm->map + vm->dmphdrsz); + if (!valid_elf_header(vm->eh)) + goto inval; + } + mapsz = be16toh(vm->eh->e_phentsize) * be16toh(vm->eh->e_phnum) + + be32toh(vm->eh->e_phoff); + munmap(vm->map, vm->mapsz); + + /* Map all headers. */ + vm->mapsz = vm->dmphdrsz + mapsz; + vm->map = mmap(NULL, vm->mapsz, PROT_READ, MAP_PRIVATE, kd->pmfd, 0); + if (vm->map == MAP_FAILED) { + _kvm_err(kd, kd->program, "cannot map corefle headers"); + return (-1); + } + vm->eh = (void *)((uintptr_t)vm->map + vm->dmphdrsz); + vm->ph = (void *)((uintptr_t)vm->eh + be32toh(vm->eh->e_phoff)); + return (0); + + inval: + munmap(vm->map, vm->mapsz); + vm->map = MAP_FAILED; + _kvm_err(kd, kd->program, "invalid corefile"); + return (-1); } /* - * Machine-dependent initialization for ALL open kvm descriptors, - * not just those for a kernel crash dump. Some architectures - * have to deal with these NOT being constants! (i.e. m68k) + * Determine the offset within the corefile corresponding the virtual + * address. Return the number of contiguous bytes in the corefile or + * 0 when the virtual address is invalid. */ +static size_t +powerpc_va2off(kvm_t *kd, u_long va, off_t *ofs) +{ + struct vmstate *vm = kd->vmst; + Elf32_Phdr *ph; + int nph; + + ph = vm->ph; + nph = be16toh(vm->eh->e_phnum); + while (nph && (va < be32toh(ph->p_vaddr) || + va >= be32toh(ph->p_vaddr) + be32toh(ph->p_memsz))) { + nph--; + ph = (void *)((uintptr_t)ph + be16toh(vm->eh->e_phentsize)); + } + if (nph == 0) + return (0); + + /* Segment found. Return file offset and range. */ + *ofs = vm->dmphdrsz + be32toh(ph->p_offset) + + (va - be32toh(ph->p_vaddr)); + return (be32toh(ph->p_memsz) - (va - be32toh(ph->p_vaddr))); +} + +void +_kvm_freevtop(kvm_t *kd) +{ + struct vmstate *vm = kd->vmst; + + if (vm == NULL) + return; + + if (vm->eh != MAP_FAILED) { + munmap(vm->eh, vm->mapsz); + vm->eh = MAP_FAILED; + } + free(vm); + kd->vmst = NULL; +} + +int +_kvm_initvtop(kvm_t *kd) +{ + + kd->vmst = (struct vmstate *)_kvm_malloc(kd, sizeof(*kd->vmst)); + if (kd->vmst == NULL) { + _kvm_err(kd, kd->program, "out of virtual memory"); + return (-1); + } + if (powerpc_maphdrs(kd) == -1) { + free(kd->vmst); + kd->vmst = NULL; + return (-1); + } + return (0); +} + int -_kvm_mdopen(kd) - kvm_t *kd; +_kvm_kvatop(kvm_t *kd, u_long va, off_t *ofs) { + struct vmstate *vm; -#ifdef FBSD_NOT_YET - kd->usrstack = USRSTACK; - kd->min_uva = VM_MIN_ADDRESS; - kd->max_uva = VM_MAXUSER_ADDRESS; -#endif + vm = kd->vmst; + if (vm->ph->p_paddr == ~0U) + return ((int)powerpc_va2off(kd, va, ofs)); + _kvm_err(kd, kd->program, "Raw corefile not supported"); return (0); } From zec at FreeBSD.org Mon Apr 6 15:29:43 2009 From: zec at FreeBSD.org (Marko Zec) Date: Mon Apr 6 15:29:58 2009 Subject: svn commit: r190787 - in head/sys: net netinet netinet6 netipsec sys Message-ID: <200904062229.n36MTfrT085067@svn.freebsd.org> Author: zec Date: Mon Apr 6 22:29:41 2009 New Revision: 190787 URL: http://svn.freebsd.org/changeset/base/190787 Log: First pass at separating per-vnet initializer functions from existing functions for initializing global state. At this stage, the new per-vnet initializer functions are directly called from the existing global initialization code, which should in most cases result in compiler inlining those new functions, hence yielding a near-zero functional change. Modify the existing initializer functions which are invoked via protosw, like ip_init() et. al., to allow them to be invoked multiple times, i.e. per each vnet. Global state, if any, is initialized only if such functions are called within the context of vnet0, which will be determined via the IS_DEFAULT_VNET(curvnet) check (currently always true). While here, V_irtualize a few remaining global UMA zones used by net/netinet/netipsec networking code. While it is not yet clear to me or anybody else whether this is the right thing to do, at this stage this makes the code more readable, and makes it easier to track uncollected UMA-zone-backed objects on vnet removal. In the long run, it's quite possible that some form of shared use of UMA zone pools among multiple vnets should be considered. Bump __FreeBSD_version due to changes in layout of structs vnet_ipfw, vnet_inet and vnet_net. Approved by: julian (mentor) Modified: head/sys/net/if.c head/sys/net/if_gif.c head/sys/net/if_loop.c head/sys/net/route.c head/sys/net/vnet.h head/sys/netinet/if_ether.c head/sys/netinet/ip_fw.h head/sys/netinet/ip_input.c head/sys/netinet/tcp_reass.c head/sys/netinet/tcp_sack.c head/sys/netinet/tcp_subr.c head/sys/netinet/tcp_timewait.c head/sys/netinet/vinet.h head/sys/netinet6/frag6.c head/sys/netinet6/in6_src.c head/sys/netinet6/ip6_input.c head/sys/netinet6/scope6.c head/sys/netipsec/ipsec.c head/sys/netipsec/key.c head/sys/netipsec/xform_ah.c head/sys/netipsec/xform_esp.c head/sys/netipsec/xform_ipcomp.c head/sys/netipsec/xform_ipip.c head/sys/sys/param.h head/sys/sys/vimage.h Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Mon Apr 6 21:52:10 2009 (r190786) +++ head/sys/net/if.c Mon Apr 6 22:29:41 2009 (r190787) @@ -150,6 +150,8 @@ static int if_getgroupmembers(struct ifg extern void nd6_setmtu(struct ifnet *); #endif +static int vnet_net_iattach(const void *); + #ifdef VIMAGE_GLOBALS struct ifnethead ifnet; /* depend on static init XXX */ struct ifgrouphead ifg_head; @@ -391,24 +393,33 @@ filt_netdev(struct knote *kn, long hint) static void if_init(void *dummy __unused) { - INIT_VNET_NET(curvnet); #ifndef VIMAGE_GLOBALS vnet_mod_register(&vnet_net_modinfo); #endif + vnet_net_iattach(NULL); + + IFNET_LOCK_INIT(); + ifdev_setbyindex(0, make_dev(&net_cdevsw, 0, UID_ROOT, GID_WHEEL, + 0600, "network")); + if_clone_init(); +} + +static int +vnet_net_iattach(const void *unused __unused) +{ + INIT_VNET_NET(curvnet); V_if_index = 0; V_ifindex_table = NULL; V_if_indexlim = 8; - IFNET_LOCK_INIT(); TAILQ_INIT(&V_ifnet); TAILQ_INIT(&V_ifg_head); knlist_init(&V_ifklist, NULL, NULL, NULL, NULL); if_grow(); /* create initial table */ - ifdev_setbyindex(0, make_dev(&net_cdevsw, 0, UID_ROOT, GID_WHEEL, - 0600, "network")); - if_clone_init(); + + return (0); } static void Modified: head/sys/net/if_gif.c ============================================================================== --- head/sys/net/if_gif.c Mon Apr 6 21:52:10 2009 (r190786) +++ head/sys/net/if_gif.c Mon Apr 6 22:29:41 2009 (r190787) @@ -121,6 +121,7 @@ void (*ng_gif_detach_p)(struct ifnet *if static void gif_start(struct ifnet *); static int gif_clone_create(struct if_clone *, int, caddr_t); static void gif_clone_destroy(struct ifnet *); +static int vnet_gif_iattach(const void *); IFC_SIMPLE_DECLARE(gif, 0); @@ -251,6 +252,26 @@ gif_clone_destroy(ifp) } static int +vnet_gif_iattach(const void *unused __unused) +{ + INIT_VNET_GIF(curvnet); + + LIST_INIT(&V_gif_softc_list); + V_max_gif_nesting = MAX_GIF_NEST; +#ifdef XBONEHACK + V_parallel_tunnels = 1; +#else + V_parallel_tunnels = 0; +#endif + V_ip_gif_ttl = GIF_TTL; +#ifdef INET6 + V_ip6_gif_hlim = GIF_HLIM; +#endif + + return (0); +} + +static int gifmodevent(mod, type, data) module_t mod; int type; @@ -261,19 +282,7 @@ gifmodevent(mod, type, data) case MOD_LOAD: mtx_init(&gif_mtx, "gif_mtx", NULL, MTX_DEF); - LIST_INIT(&V_gif_softc_list); - V_max_gif_nesting = MAX_GIF_NEST; -#ifdef XBONEHACK - V_parallel_tunnels = 1; -#else - V_parallel_tunnels = 0; -#endif -#ifdef INET - V_ip_gif_ttl = GIF_TTL; -#endif -#ifdef INET6 - V_ip6_gif_hlim = GIF_HLIM; -#endif + vnet_gif_iattach(NULL); if_clone_attach(&gif_cloner); break; @@ -281,7 +290,7 @@ gifmodevent(mod, type, data) if_clone_detach(&gif_cloner); mtx_destroy(&gif_mtx); #ifdef INET6 - V_ip6_gif_hlim = 0; + V_ip6_gif_hlim = 0; /* XXX -> vnet_gif_idetach() */ #endif break; default: Modified: head/sys/net/if_loop.c ============================================================================== --- head/sys/net/if_loop.c Mon Apr 6 21:52:10 2009 (r190786) +++ head/sys/net/if_loop.c Mon Apr 6 22:29:41 2009 (r190787) @@ -105,6 +105,7 @@ int looutput(struct ifnet *ifp, struct struct sockaddr *dst, struct rtentry *rt); static int lo_clone_create(struct if_clone *, int, caddr_t); static void lo_clone_destroy(struct ifnet *); +static int vnet_loif_iattach(const void *); #ifdef VIMAGE_GLOBALS struct ifnet *loif; /* Used externally */ @@ -153,6 +154,15 @@ lo_clone_create(struct if_clone *ifc, in return (0); } +static int vnet_loif_iattach(const void *unused __unused) +{ + INIT_VNET_NET(curvnet); + + V_loif = NULL; + if_clone_attach(&lo_cloner); + return (0); +} + static int loop_modevent(module_t mod, int type, void *data) { @@ -160,8 +170,7 @@ loop_modevent(module_t mod, int type, vo switch (type) { case MOD_LOAD: - V_loif = NULL; - if_clone_attach(&lo_cloner); + vnet_loif_iattach(NULL); break; case MOD_UNLOAD: Modified: head/sys/net/route.c ============================================================================== --- head/sys/net/route.c Mon Apr 6 21:52:10 2009 (r190786) +++ head/sys/net/route.c Mon Apr 6 22:29:41 2009 (r190787) @@ -106,6 +106,7 @@ static int rttrash; /* routes not in ta static void rt_maskedcopy(struct sockaddr *, struct sockaddr *, struct sockaddr *); +static int vnet_route_iattach(const void *); /* compare two sockaddr structures */ #define sa_equal(a1, a2) (bcmp((a1), (a2), (a1)->sa_len) == 0) @@ -122,7 +123,9 @@ static void rt_maskedcopy(struct sockadd */ #define RNTORT(p) ((struct rtentry *)(p)) +#ifdef VIMAGE_GLOBALS static uma_zone_t rtzone; /* Routing table UMA zone. */ +#endif #if 0 /* default fib for tunnels to use */ @@ -150,20 +153,26 @@ SYSCTL_PROC(_net, OID_AUTO, my_fibnum, C static void route_init(void) { - INIT_VNET_INET(curvnet); - int table; - struct domain *dom; - int fam; /* whack the tunable ints into line. */ if (rt_numfibs > RT_MAXFIBS) rt_numfibs = RT_MAXFIBS; if (rt_numfibs == 0) rt_numfibs = 1; - rtzone = uma_zcreate("rtentry", sizeof(struct rtentry), NULL, NULL, - NULL, NULL, UMA_ALIGN_PTR, 0); rn_init(); /* initialize all zeroes, all ones, mask table */ + vnet_route_iattach(NULL); +} + +static int vnet_route_iattach(const void *unused __unused) +{ + INIT_VNET_INET(curvnet); + int table; + struct domain *dom; + int fam; + + V_rtzone = uma_zcreate("rtentry", sizeof(struct rtentry), NULL, NULL, + NULL, NULL, UMA_ALIGN_PTR, 0); for (dom = domains; dom; dom = dom->dom_next) { if (dom->dom_rtattach) { for (table = 0; table < rt_numfibs; table++) { @@ -186,6 +195,8 @@ route_init(void) } } } + + return (0); } #ifndef _SYS_SYSPROTO_H_ @@ -402,7 +413,7 @@ rtfree(struct rtentry *rt) * and the rtentry itself of course */ RT_LOCK_DESTROY(rt); - uma_zfree(rtzone, rt); + uma_zfree(V_rtzone, rt); return; } done: @@ -958,7 +969,7 @@ deldone: if (info->rti_ifa == NULL && (error = rt_getifa_fib(info, fibnum))) senderr(error); ifa = info->rti_ifa; - rt = uma_zalloc(rtzone, M_NOWAIT | M_ZERO); + rt = uma_zalloc(V_rtzone, M_NOWAIT | M_ZERO); if (rt == NULL) senderr(ENOBUFS); RT_LOCK_INIT(rt); @@ -971,7 +982,7 @@ deldone: RT_LOCK(rt); if ((error = rt_setgate(rt, dst, gateway)) != 0) { RT_LOCK_DESTROY(rt); - uma_zfree(rtzone, rt); + uma_zfree(V_rtzone, rt); senderr(error); } @@ -1006,7 +1017,7 @@ deldone: } Free(rt_key(rt)); RT_LOCK_DESTROY(rt); - uma_zfree(rtzone, rt); + uma_zfree(V_rtzone, rt); senderr(EEXIST); } #endif @@ -1022,7 +1033,7 @@ deldone: IFAFREE(rt->rt_ifa); Free(rt_key(rt)); RT_LOCK_DESTROY(rt); - uma_zfree(rtzone, rt); + uma_zfree(V_rtzone, rt); senderr(EEXIST); } Modified: head/sys/net/vnet.h ============================================================================== --- head/sys/net/vnet.h Mon Apr 6 21:52:10 2009 (r190786) +++ head/sys/net/vnet.h Mon Apr 6 22:29:41 2009 (r190787) @@ -47,6 +47,7 @@ struct vnet_net { struct rtstat _rtstat; struct radix_node_head *_rt_tables[RT_MAXFIBS][AF_MAX+1]; int _rttrash; + uma_zone_t _rtzone; struct ifnet *_loif; LIST_HEAD(, lo_softc) _lo_list; @@ -86,5 +87,6 @@ extern struct vnet_net vnet_net_0; #define V_rt_tables VNET_NET(rt_tables) #define V_rtstat VNET_NET(rtstat) #define V_rttrash VNET_NET(rttrash) +#define V_rtzone VNET_NET(rtzone) #endif /* !_NET_VNET_H_ */ Modified: head/sys/netinet/if_ether.c ============================================================================== --- head/sys/netinet/if_ether.c Mon Apr 6 21:52:10 2009 (r190786) +++ head/sys/netinet/if_ether.c Mon Apr 6 22:29:41 2009 (r190787) @@ -111,6 +111,7 @@ SYSCTL_V_INT(V_NET, vnet_inet, _net_link "Enable proxy ARP for all suitable requests"); static void arp_init(void); +static int arp_iattach(const void *); void arprequest(struct ifnet *, struct in_addr *, struct in_addr *, u_char *); static void arpintr(struct mbuf *); @@ -790,8 +791,8 @@ arp_ifinit2(struct ifnet *ifp, struct if ifa->ifa_rtrequest = NULL; } -static void -arp_init(void) +static int +arp_iattach(const void *unused __unused) { INIT_VNET_INET(curvnet); @@ -800,6 +801,15 @@ arp_init(void) V_useloopback = 1; /* use loopback interface for local traffic */ V_arp_proxyall = 0; + return (0); +} + +static void +arp_init(void) +{ + + arp_iattach(NULL); + arpintrq.ifq_maxlen = 50; mtx_init(&arpintrq.ifq_mtx, "arp_inq", NULL, MTX_DEF); netisr_register(NETISR_ARP, arpintr, &arpintrq, 0); Modified: head/sys/netinet/ip_fw.h ============================================================================== --- head/sys/netinet/ip_fw.h Mon Apr 6 21:52:10 2009 (r190786) +++ head/sys/netinet/ip_fw.h Mon Apr 6 22:29:41 2009 (r190787) @@ -698,6 +698,7 @@ struct vnet_ipfw { int _fw_debug; /* actually unused */ int _autoinc_step; ipfw_dyn_rule **_ipfw_dyn_v; + uma_zone_t _ipfw_dyn_rule_zone; struct ip_fw_chain _layer3_chain; u_int32_t _dyn_buckets; u_int32_t _curr_dyn_buckets; @@ -742,6 +743,7 @@ extern struct vnet_ipfw vnet_ipfw_0; #define V_fw_debug VNET_IPFW(fw_debug) #define V_autoinc_step VNET_IPFW(autoinc_step) #define V_ipfw_dyn_v VNET_IPFW(ipfw_dyn_v) +#define V_ipfw_dyn_rule_zone VNET_IPFW(ipfw_dyn_rule_zone) #define V_layer3_chain VNET_IPFW(layer3_chain) #define V_dyn_buckets VNET_IPFW(dyn_buckets) #define V_curr_dyn_buckets VNET_IPFW(curr_dyn_buckets) Modified: head/sys/netinet/ip_input.c ============================================================================== --- head/sys/netinet/ip_input.c Mon Apr 6 21:52:10 2009 (r190786) +++ head/sys/netinet/ip_input.c Mon Apr 6 22:29:41 2009 (r190787) @@ -242,6 +242,7 @@ ip_init(void) V_rsvp_on = 0; V_ip_defttl = IPDEFTTL; V_ip_do_randomid = 0; + V_ip_id = time_second & 0xffff; V_ipforwarding = 0; V_ipstealth = 0; V_nipq = 0; /* Total # of reass queues */ @@ -270,6 +271,20 @@ ip_init(void) TAILQ_INIT(&V_in_ifaddrhead); V_in_ifaddrhashtbl = hashinit(INADDR_NHASH, M_IFADDR, &V_in_ifaddrhmask); + + /* Initialize IP reassembly queue. */ + for (i = 0; i < IPREASS_NHASH; i++) + TAILQ_INIT(&V_ipq[i]); + V_maxnipq = nmbclusters / 32; + V_maxfragsperpacket = 16; + V_ipq_zone = uma_zcreate("ipq", sizeof(struct ipq), NULL, NULL, NULL, + NULL, UMA_ALIGN_PTR, 0); + maxnipq_update(); + + /* Skip initialization of globals for non-default instances. */ + if (!IS_DEFAULT_VNET(curvnet)) + return; + pr = pffindproto(PF_INET, IPPROTO_RAW, SOCK_RAW); if (pr == NULL) panic("ip_init: PF_INET not found"); @@ -297,16 +312,6 @@ ip_init(void) printf("%s: WARNING: unable to register pfil hook, " "error %d\n", __func__, i); - /* Initialize IP reassembly queue. */ - IPQ_LOCK_INIT(); - for (i = 0; i < IPREASS_NHASH; i++) - TAILQ_INIT(&V_ipq[i]); - V_maxnipq = nmbclusters / 32; - V_maxfragsperpacket = 16; - V_ipq_zone = uma_zcreate("ipq", sizeof(struct ipq), NULL, NULL, NULL, - NULL, UMA_ALIGN_PTR, 0); - maxnipq_update(); - /* Start ipport_tick. */ callout_init(&ipport_tick_callout, CALLOUT_MPSAFE); ipport_tick(NULL); @@ -316,7 +321,7 @@ ip_init(void) NULL, EVENTHANDLER_PRI_ANY); /* Initialize various other remaining things. */ - V_ip_id = time_second & 0xffff; + IPQ_LOCK_INIT(); ipintrq.ifq_maxlen = ipqmaxlen; mtx_init(&ipintrq.ifq_mtx, "ip_inq", NULL, MTX_DEF); netisr_register(NETISR_IP, ip_input, &ipintrq, 0); Modified: head/sys/netinet/tcp_reass.c ============================================================================== --- head/sys/netinet/tcp_reass.c Mon Apr 6 21:52:10 2009 (r190786) +++ head/sys/netinet/tcp_reass.c Mon Apr 6 22:29:41 2009 (r190787) @@ -108,10 +108,12 @@ tcp_reass_zone_change(void *tag) INIT_VNET_INET(curvnet); V_tcp_reass_maxseg = nmbclusters / 16; - uma_zone_set_max(tcp_reass_zone, V_tcp_reass_maxseg); + uma_zone_set_max(V_tcp_reass_zone, V_tcp_reass_maxseg); } +#ifdef VIMAGE_GLOBALS uma_zone_t tcp_reass_zone; +#endif void tcp_reass_init(void) @@ -126,9 +128,9 @@ tcp_reass_init(void) V_tcp_reass_maxseg = nmbclusters / 16; TUNABLE_INT_FETCH("net.inet.tcp.reass.maxsegments", &V_tcp_reass_maxseg); - tcp_reass_zone = uma_zcreate("tcpreass", sizeof (struct tseg_qent), + V_tcp_reass_zone = uma_zcreate("tcpreass", sizeof (struct tseg_qent), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); - uma_zone_set_max(tcp_reass_zone, V_tcp_reass_maxseg); + uma_zone_set_max(V_tcp_reass_zone, V_tcp_reass_maxseg); EVENTHANDLER_REGISTER(nmbclusters_change, tcp_reass_zone_change, NULL, EVENTHANDLER_PRI_ANY); } @@ -180,7 +182,7 @@ tcp_reass(struct tcpcb *tp, struct tcphd * Allocate a new queue entry. If we can't, or hit the zone limit * just drop the pkt. */ - te = uma_zalloc(tcp_reass_zone, M_NOWAIT); + te = uma_zalloc(V_tcp_reass_zone, M_NOWAIT); if (te == NULL) { V_tcpstat.tcps_rcvmemdrop++; m_freem(m); @@ -213,7 +215,7 @@ tcp_reass(struct tcpcb *tp, struct tcphd V_tcpstat.tcps_rcvduppack++; V_tcpstat.tcps_rcvdupbyte += *tlenp; m_freem(m); - uma_zfree(tcp_reass_zone, te); + uma_zfree(V_tcp_reass_zone, te); tp->t_segqlen--; V_tcp_reass_qsize--; /* @@ -250,7 +252,7 @@ tcp_reass(struct tcpcb *tp, struct tcphd nq = LIST_NEXT(q, tqe_q); LIST_REMOVE(q, tqe_q); m_freem(q->tqe_m); - uma_zfree(tcp_reass_zone, q); + uma_zfree(V_tcp_reass_zone, q); tp->t_segqlen--; V_tcp_reass_qsize--; q = nq; @@ -287,7 +289,7 @@ present: m_freem(q->tqe_m); else sbappendstream_locked(&so->so_rcv, q->tqe_m); - uma_zfree(tcp_reass_zone, q); + uma_zfree(V_tcp_reass_zone, q); tp->t_segqlen--; V_tcp_reass_qsize--; q = nq; Modified: head/sys/netinet/tcp_sack.c ============================================================================== --- head/sys/netinet/tcp_sack.c Mon Apr 6 21:52:10 2009 (r190786) +++ head/sys/netinet/tcp_sack.c Mon Apr 6 22:29:41 2009 (r190787) @@ -123,9 +123,8 @@ __FBSDID("$FreeBSD$"); #include -extern struct uma_zone *sack_hole_zone; - #ifdef VIMAGE_GLOBALS +extern struct uma_zone *sack_hole_zone; int tcp_do_sack; int tcp_sack_maxholes; int tcp_sack_globalmaxholes; @@ -265,7 +264,7 @@ tcp_sackhole_alloc(struct tcpcb *tp, tcp return NULL; } - hole = (struct sackhole *)uma_zalloc(sack_hole_zone, M_NOWAIT); + hole = (struct sackhole *)uma_zalloc(V_sack_hole_zone, M_NOWAIT); if (hole == NULL) return NULL; @@ -287,7 +286,7 @@ tcp_sackhole_free(struct tcpcb *tp, stru { INIT_VNET_INET(tp->t_vnet); - uma_zfree(sack_hole_zone, hole); + uma_zfree(V_sack_hole_zone, hole); tp->snd_numholes--; V_tcp_sack_globalholes--; Modified: head/sys/netinet/tcp_subr.c ============================================================================== --- head/sys/netinet/tcp_subr.c Mon Apr 6 21:52:10 2009 (r190786) +++ head/sys/netinet/tcp_subr.c Mon Apr 6 22:29:41 2009 (r190787) @@ -243,7 +243,9 @@ SYSCTL_V_INT(V_NET, vnet_inet, _net_inet CTLFLAG_RW, tcp_inflight_stab, 0, "Inflight Algorithm Stabilization 20 = 2 packets"); +#ifdef VIMAGE_GLOBALS uma_zone_t sack_hole_zone; +#endif static struct inpcb *tcp_notify(struct inpcb *, int); static void tcp_isn_tick(void *); @@ -269,7 +271,9 @@ struct tcpcb_mem { struct tcp_timer tt; }; +#ifdef VIMAGE_GLOBALS static uma_zone_t tcpcb_zone; +#endif MALLOC_DEFINE(M_TCPLOG, "tcplog", "TCP address and flags print buffers"); struct callout isn_callout; static struct mtx isn_mtx; @@ -286,7 +290,7 @@ tcp_zone_change(void *tag) { uma_zone_set_max(V_tcbinfo.ipi_zone, maxsockets); - uma_zone_set_max(tcpcb_zone, maxsockets); + uma_zone_set_max(V_tcpcb_zone, maxsockets); tcp_tw_zone_change(); } @@ -348,18 +352,7 @@ tcp_init(void) V_tcp_sack_globalmaxholes = 65536; V_tcp_sack_globalholes = 0; - tcp_delacktime = TCPTV_DELACK; - tcp_keepinit = TCPTV_KEEP_INIT; - tcp_keepidle = TCPTV_KEEP_IDLE; - tcp_keepintvl = TCPTV_KEEPINTVL; - tcp_maxpersistidle = TCPTV_KEEP_IDLE; - tcp_msl = TCPTV_MSL; - tcp_rexmit_min = TCPTV_MIN; - if (tcp_rexmit_min < 1) - tcp_rexmit_min = 1; - tcp_rexmit_slop = TCPTV_CPU_VAR; V_tcp_inflight_rttthresh = TCPTV_INFLIGHT_RTTTHRESH; - tcp_finwait2_timeout = TCPTV_FINWAIT2_TIMEOUT; TUNABLE_INT_FETCH("net.inet.tcp.sack.enable", &V_tcp_do_sack); @@ -372,7 +365,6 @@ tcp_init(void) printf("WARNING: TCB hash size not a power of 2\n"); hashsize = 512; /* safe default */ } - tcp_tcbhashsize = hashsize; V_tcbinfo.ipi_hashbase = hashinit(hashsize, M_PCB, &V_tcbinfo.ipi_hashmask); V_tcbinfo.ipi_porthashbase = hashinit(hashsize, M_PCB, @@ -380,6 +372,37 @@ tcp_init(void) V_tcbinfo.ipi_zone = uma_zcreate("inpcb", sizeof(struct inpcb), NULL, NULL, tcp_inpcb_init, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); uma_zone_set_max(V_tcbinfo.ipi_zone, maxsockets); + /* + * These have to be type stable for the benefit of the timers. + */ + V_tcpcb_zone = uma_zcreate("tcpcb", sizeof(struct tcpcb_mem), + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); + uma_zone_set_max(V_tcpcb_zone, maxsockets); + tcp_tw_init(); + syncache_init(); + tcp_hc_init(); + tcp_reass_init(); + V_sack_hole_zone = uma_zcreate("sackhole", sizeof(struct sackhole), + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); + + /* Skip initialization of globals for non-default instances. */ + if (!IS_DEFAULT_VNET(curvnet)) + return; + + /* XXX virtualize those bellow? */ + tcp_delacktime = TCPTV_DELACK; + tcp_keepinit = TCPTV_KEEP_INIT; + tcp_keepidle = TCPTV_KEEP_IDLE; + tcp_keepintvl = TCPTV_KEEPINTVL; + tcp_maxpersistidle = TCPTV_KEEP_IDLE; + tcp_msl = TCPTV_MSL; + tcp_rexmit_min = TCPTV_MIN; + if (tcp_rexmit_min < 1) + tcp_rexmit_min = 1; + tcp_rexmit_slop = TCPTV_CPU_VAR; + tcp_finwait2_timeout = TCPTV_FINWAIT2_TIMEOUT; + tcp_tcbhashsize = hashsize; + #ifdef INET6 #define TCP_MINPROTOHDR (sizeof(struct ip6_hdr) + sizeof(struct tcphdr)) #else /* INET6 */ @@ -390,23 +413,12 @@ tcp_init(void) if (max_linkhdr + TCP_MINPROTOHDR > MHLEN) panic("tcp_init"); #undef TCP_MINPROTOHDR - /* - * These have to be type stable for the benefit of the timers. - */ - tcpcb_zone = uma_zcreate("tcpcb", sizeof(struct tcpcb_mem), - NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); - uma_zone_set_max(tcpcb_zone, maxsockets); - tcp_tw_init(); - syncache_init(); - tcp_hc_init(); - tcp_reass_init(); + ISN_LOCK_INIT(); callout_init(&isn_callout, CALLOUT_MPSAFE); - tcp_isn_tick(NULL); + callout_reset(&isn_callout, hz/100, tcp_isn_tick, NULL); EVENTHANDLER_REGISTER(shutdown_pre_sync, tcp_fini, NULL, SHUTDOWN_PRI_DEFAULT); - sack_hole_zone = uma_zcreate("sackhole", sizeof(struct sackhole), - NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); EVENTHANDLER_REGISTER(maxsockets_change, tcp_zone_change, NULL, EVENTHANDLER_PRI_ANY); } @@ -686,7 +698,7 @@ tcp_newtcpcb(struct inpcb *inp) int isipv6 = (inp->inp_vflag & INP_IPV6) != 0; #endif /* INET6 */ - tm = uma_zalloc(tcpcb_zone, M_NOWAIT | M_ZERO); + tm = uma_zalloc(V_tcpcb_zone, M_NOWAIT | M_ZERO); if (tm == NULL) return (NULL); tp = &tm->tcb; @@ -846,7 +858,7 @@ tcp_discardcb(struct tcpcb *tp) while ((q = LIST_FIRST(&tp->t_segq)) != NULL) { LIST_REMOVE(q, tqe_q); m_freem(q->tqe_m); - uma_zfree(tcp_reass_zone, q); + uma_zfree(V_tcp_reass_zone, q); tp->t_segqlen--; V_tcp_reass_qsize--; } @@ -856,7 +868,7 @@ tcp_discardcb(struct tcpcb *tp) tcp_free_sackholes(tp); inp->inp_ppcb = NULL; tp->t_inpcb = NULL; - uma_zfree(tcpcb_zone, tp); + uma_zfree(V_tcpcb_zone, tp); } /* @@ -929,7 +941,7 @@ tcp_drain(void) != NULL) { LIST_REMOVE(te, tqe_q); m_freem(te->tqe_m); - uma_zfree(tcp_reass_zone, te); + uma_zfree(V_tcp_reass_zone, te); tcpb->t_segqlen--; V_tcp_reass_qsize--; } @@ -1546,8 +1558,8 @@ tcp_isn_tick(void *xtp) VNET_ITERATOR_DECL(vnet_iter); u_int32_t projected_offset; - ISN_LOCK(); VNET_LIST_RLOCK(); + ISN_LOCK(); VNET_FOREACH(vnet_iter) { CURVNET_SET(vnet_iter); /* XXX appease INVARIANTS */ INIT_VNET_INET(curvnet); @@ -1560,9 +1572,9 @@ tcp_isn_tick(void *xtp) V_isn_offset_old = V_isn_offset; CURVNET_RESTORE(); } + ISN_UNLOCK(); VNET_LIST_RUNLOCK(); callout_reset(&isn_callout, hz/100, tcp_isn_tick, NULL); - ISN_UNLOCK(); } /* Modified: head/sys/netinet/tcp_timewait.c ============================================================================== --- head/sys/netinet/tcp_timewait.c Mon Apr 6 21:52:10 2009 (r190786) +++ head/sys/netinet/tcp_timewait.c Mon Apr 6 22:29:41 2009 (r190787) @@ -94,7 +94,6 @@ __FBSDID("$FreeBSD$"); #include -static uma_zone_t tcptw_zone; static int maxtcptw; /* @@ -104,6 +103,7 @@ static int maxtcptw; * tcbinfo lock, which must be held over queue iteration and modification. */ #ifdef VIMAGE_GLOBALS +static uma_zone_t tcptw_zone; static TAILQ_HEAD(, tcptw) twq_2msl; int nolocaltimewait; #endif @@ -142,7 +142,7 @@ sysctl_maxtcptw(SYSCTL_HANDLER_ARGS) if (error == 0 && req->newptr) if (new >= 32) { maxtcptw = new; - uma_zone_set_max(tcptw_zone, maxtcptw); + uma_zone_set_max(V_tcptw_zone, maxtcptw); } return (error); } @@ -160,7 +160,7 @@ tcp_tw_zone_change(void) { if (maxtcptw == 0) - uma_zone_set_max(tcptw_zone, tcptw_auto_size()); + uma_zone_set_max(V_tcptw_zone, tcptw_auto_size()); } void @@ -168,13 +168,13 @@ tcp_tw_init(void) { INIT_VNET_INET(curvnet); - tcptw_zone = uma_zcreate("tcptw", sizeof(struct tcptw), + V_tcptw_zone = uma_zcreate("tcptw", sizeof(struct tcptw), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); TUNABLE_INT_FETCH("net.inet.tcp.maxtcptw", &maxtcptw); if (maxtcptw == 0) - uma_zone_set_max(tcptw_zone, tcptw_auto_size()); + uma_zone_set_max(V_tcptw_zone, tcptw_auto_size()); else - uma_zone_set_max(tcptw_zone, maxtcptw); + uma_zone_set_max(V_tcptw_zone, maxtcptw); TAILQ_INIT(&V_twq_2msl); } @@ -204,7 +204,7 @@ tcp_twstart(struct tcpcb *tp) return; } - tw = uma_zalloc(tcptw_zone, M_NOWAIT); + tw = uma_zalloc(V_tcptw_zone, M_NOWAIT); if (tw == NULL) { tw = tcp_tw_2msl_scan(1); if (tw == NULL) { @@ -477,7 +477,7 @@ tcp_twclose(struct tcptw *tw, int reuse) tw->tw_cred = NULL; if (reuse) return; - uma_zfree(tcptw_zone, tw); + uma_zfree(V_tcptw_zone, tw); } int Modified: head/sys/netinet/vinet.h ============================================================================== --- head/sys/netinet/vinet.h Mon Apr 6 21:52:10 2009 (r190786) +++ head/sys/netinet/vinet.h Mon Apr 6 22:29:41 2009 (r190787) @@ -86,6 +86,11 @@ struct vnet_inet { struct tcp_hostcache _tcp_hostcache; struct callout _tcp_hc_callout; + uma_zone_t _tcp_reass_zone; + uma_zone_t _tcpcb_zone; + uma_zone_t _tcptw_zone; + uma_zone_t _sack_hole_zone; + struct tcp_syncache _tcp_syncache; int _tcp_syncookies; int _tcp_syncookiesonly; @@ -315,12 +320,15 @@ extern struct vnet_inet vnet_inet_0; #define V_rtq_timeout VNET_INET(rtq_timeout) #define V_rtq_timer VNET_INET(rtq_timer) #define V_rtq_toomany VNET_INET(rtq_toomany) +#define V_sack_hole_zone VNET_INET(sack_hole_zone) #define V_sameprefixcarponly VNET_INET(sameprefixcarponly) #define V_ss_fltsz VNET_INET(ss_fltsz) #define V_ss_fltsz_local VNET_INET(ss_fltsz_local) #define V_subnetsarelocal VNET_INET(subnetsarelocal) #define V_tcb VNET_INET(tcb) #define V_tcbinfo VNET_INET(tcbinfo) +#define V_tcpcb_zone VNET_INET(tcpcb_zone) +#define V_tcptw_zone VNET_INET(tcptw_zone) #define V_tcp_abc_l_var VNET_INET(tcp_abc_l_var) #define V_tcp_autorcvbuf_inc VNET_INET(tcp_autorcvbuf_inc) #define V_tcp_autorcvbuf_max VNET_INET(tcp_autorcvbuf_max) @@ -353,6 +361,7 @@ extern struct vnet_inet vnet_inet_0; #define V_tcp_reass_maxseg VNET_INET(tcp_reass_maxseg) #define V_tcp_reass_overflows VNET_INET(tcp_reass_overflows) #define V_tcp_reass_qsize VNET_INET(tcp_reass_qsize) +#define V_tcp_reass_zone VNET_INET(tcp_reass_zone) #define V_tcp_sack_globalholes VNET_INET(tcp_sack_globalholes) #define V_tcp_sack_globalmaxholes VNET_INET(tcp_sack_globalmaxholes) #define V_tcp_sack_maxholes VNET_INET(tcp_sack_maxholes) Modified: head/sys/netinet6/frag6.c ============================================================================== --- head/sys/netinet6/frag6.c Mon Apr 6 21:52:10 2009 (r190786) +++ head/sys/netinet6/frag6.c Mon Apr 6 22:29:41 2009 (r190787) @@ -109,14 +109,16 @@ frag6_init(void) { INIT_VNET_INET6(curvnet); + V_ip6q.ip6q_next = V_ip6q.ip6q_prev = &V_ip6q; V_ip6_maxfragpackets = nmbclusters / 4; V_ip6_maxfrags = nmbclusters / 4; - EVENTHANDLER_REGISTER(nmbclusters_change, - frag6_change, NULL, EVENTHANDLER_PRI_ANY); - IP6Q_LOCK_INIT(); + if (!IS_DEFAULT_VNET(curvnet)) + return; - V_ip6q.ip6q_next = V_ip6q.ip6q_prev = &V_ip6q; + IP6Q_LOCK_INIT(); + EVENTHANDLER_REGISTER(nmbclusters_change, + frag6_change, NULL, EVENTHANDLER_PRI_ANY); } /* Modified: head/sys/netinet6/in6_src.c ============================================================================== --- head/sys/netinet6/in6_src.c Mon Apr 6 21:52:10 2009 (r190786) +++ head/sys/netinet6/in6_src.c Mon Apr 6 22:29:41 2009 (r190787) @@ -920,8 +920,6 @@ in6_pcbsetport(struct in6_addr *laddr, s void addrsel_policy_init(void) { - ADDRSEL_LOCK_INIT(); - ADDRSEL_SXLOCK_INIT(); INIT_VNET_INET6(curvnet); V_ip6_prefer_tempaddr = 0; @@ -931,6 +929,12 @@ addrsel_policy_init(void) /* initialize the "last resort" policy */ bzero(&V_defaultaddrpolicy, sizeof(V_defaultaddrpolicy)); V_defaultaddrpolicy.label = ADDR_LABEL_NOTAPP; + + if (!IS_DEFAULT_VNET(curvnet)) + return; + + ADDRSEL_LOCK_INIT(); + ADDRSEL_SXLOCK_INIT(); } static struct in6_addrpolicy * Modified: head/sys/netinet6/ip6_input.c ============================================================================== --- head/sys/netinet6/ip6_input.c Mon Apr 6 21:52:10 2009 (r190786) +++ head/sys/netinet6/ip6_input.c Mon Apr 6 22:29:41 2009 (r190787) @@ -234,6 +234,17 @@ ip6_init(void) /* 40 1K datagrams */ V_dad_init = 0; + scope6_init(); + addrsel_policy_init(); + nd6_init(); + frag6_init(); + + V_ip6_desync_factor = arc4random() % MAX_TEMP_DESYNC_FACTOR; + + /* Skip global initialization stuff for non-default instances. */ + if (!IS_DEFAULT_VNET(curvnet)) + return; + #ifdef DIAGNOSTIC if (sizeof(struct protosw) != sizeof(struct ip6protosw)) panic("sizeof(protosw) != sizeof(ip6protosw)"); @@ -265,18 +276,13 @@ ip6_init(void) printf("%s: WARNING: unable to register pfil hook, " "error %d\n", __func__, i); - ip6intrq.ifq_maxlen = V_ip6qmaxlen; + ip6intrq.ifq_maxlen = V_ip6qmaxlen; /* XXX */ mtx_init(&ip6intrq.ifq_mtx, "ip6_inq", NULL, MTX_DEF); netisr_register(NETISR_IPV6, ip6_input, &ip6intrq, 0); - scope6_init(); - addrsel_policy_init(); - nd6_init(); - frag6_init(); - V_ip6_desync_factor = arc4random() % MAX_TEMP_DESYNC_FACTOR; } -static void -ip6_init2(void *dummy) +static int +ip6_init2_vnet(const void *unused __unused) { INIT_VNET_INET6(curvnet); @@ -290,6 +296,15 @@ ip6_init2(void *dummy) (V_ip6_temp_preferred_lifetime - V_ip6_desync_factor - V_ip6_temp_regen_advance) * hz, in6_tmpaddrtimer, NULL); + + return (0); +} + +static void +ip6_init2(void *dummy) +{ + + ip6_init2_vnet(NULL); } /* cheat */ Modified: head/sys/netinet6/scope6.c ============================================================================== --- head/sys/netinet6/scope6.c Mon Apr 6 21:52:10 2009 (r190786) +++ head/sys/netinet6/scope6.c Mon Apr 6 22:29:41 2009 (r190787) @@ -83,8 +83,12 @@ scope6_init(void) #else V_ip6_use_defzone = 0; #endif - SCOPE6_LOCK_INIT(); bzero(&V_sid_default, sizeof(V_sid_default)); + + if (!IS_DEFAULT_VNET(curvnet)) + return; + + SCOPE6_LOCK_INIT(); } struct scope6_id * Modified: head/sys/netipsec/ipsec.c ============================================================================== --- head/sys/netipsec/ipsec.c Mon Apr 6 21:52:10 2009 (r190786) +++ head/sys/netipsec/ipsec.c Mon Apr 6 22:29:41 2009 (r190787) @@ -103,6 +103,8 @@ struct vnet_ipsec vnet_ipsec_0; #endif #endif +static int ipsec_iattach(const void *); + #ifdef VIMAGE_GLOBALS /* NB: name changed so netstat doesn't use it. */ struct ipsecstat ipsec4stat; @@ -1758,8 +1760,18 @@ static void ipsec_attach(void) { + ipsec_iattach(NULL); +} + +static int +ipsec_iattach(const void *unused __unused) +{ + INIT_VNET_IPSEC(curvnet); + SECPOLICY_LOCK_INIT(&V_ip4_def_policy); V_ip4_def_policy.refcnt = 1; /* NB: disallow free. */ + + return (0); } SYSINIT(ipsec, SI_SUB_PROTO_DOMAIN, SI_ORDER_FIRST, ipsec_attach, NULL); Modified: head/sys/netipsec/key.c ============================================================================== --- head/sys/netipsec/key.c Mon Apr 6 21:52:10 2009 (r190786) +++ head/sys/netipsec/key.c Mon Apr 6 22:29:41 2009 (r190787) @@ -7171,12 +7171,6 @@ key_init(void) V_ipsec_esp_auth = 0; V_ipsec_ah_keymin = 128; - SPTREE_LOCK_INIT(); - REGTREE_LOCK_INIT(); - SAHTREE_LOCK_INIT(); - ACQ_LOCK_INIT(); - SPACQ_LOCK_INIT(); - for (i = 0; i < IPSEC_DIR_MAX; i++) LIST_INIT(&V_sptree[i]); @@ -7192,6 +7186,15 @@ key_init(void) V_ip4_def_policy.policy = IPSEC_POLICY_NONE; V_ip4_def_policy.refcnt++; /*never reclaim this*/ + if (!IS_DEFAULT_VNET(curvnet)) + return; + + SPTREE_LOCK_INIT(); + REGTREE_LOCK_INIT(); + SAHTREE_LOCK_INIT(); + ACQ_LOCK_INIT(); + SPACQ_LOCK_INIT(); + #ifndef IPSEC_DEBUG2 timeout((void *)key_timehandler, (void *)0, hz); #endif /*IPSEC_DEBUG2*/ Modified: head/sys/netipsec/xform_ah.c ============================================================================== --- head/sys/netipsec/xform_ah.c Mon Apr 6 21:52:10 2009 (r190786) +++ head/sys/netipsec/xform_ah.c Mon Apr 6 22:29:41 2009 (r190787) @@ -73,6 +73,8 @@ #include +static int ah_iattach(const void *); + /* * Return header size in bytes. The old protocol did not support * the replay counter; the new protocol always includes the counter. @@ -1220,9 +1222,18 @@ static void ah_attach(void) { + xform_register(&ah_xformsw); + ah_iattach(NULL); +} + +static int +ah_iattach(const void *unused __unused) +{ + INIT_VNET_IPSEC(curvnet); + V_ah_enable = 1; /* control flow of packets with AH */ V_ah_cleartos = 1; /* clear ip_tos when doing AH calc */ - xform_register(&ah_xformsw); + return (0); } SYSINIT(ah_xform_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_MIDDLE, ah_attach, NULL); Modified: head/sys/netipsec/xform_esp.c ============================================================================== --- head/sys/netipsec/xform_esp.c Mon Apr 6 21:52:10 2009 (r190786) +++ head/sys/netipsec/xform_esp.c Mon Apr 6 22:29:41 2009 (r190787) @@ -90,6 +90,7 @@ SYSCTL_V_STRUCT(V_NET, vnet_ipsec, _net_ static int esp_input_cb(struct cryptop *op); static int esp_output_cb(struct cryptop *crp); +static int esp_iattach(const void *); /* * NB: this is public for use by the PF_KEY support. @@ -990,9 +991,19 @@ static struct xformsw esp_xformsw = { static void esp_attach(void) { + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From emaste at FreeBSD.org Mon Apr 6 18:13:46 2009 From: emaste at FreeBSD.org (Ed Maste) Date: Mon Apr 6 18:13:55 2009 Subject: svn commit: r190788 - in vendor/gdb/dist: . contrib gdb gdb/cli gdb/config gdb/config/alpha gdb/config/arm gdb/config/i386 gdb/config/ia64 gdb/config/mips gdb/config/powerpc gdb/config/rs6000 gdb/c... Message-ID: <200904070113.n371DjCD088316@svn.freebsd.org> Author: emaste Date: Tue Apr 7 01:13:44 2009 New Revision: 190788 URL: http://svn.freebsd.org/changeset/base/190788 Log: Flatten the dist tree. Added: vendor/gdb/dist/COPYING (props changed) - copied unchanged from r190776, vendor/gdb/dist/contrib/gdb/COPYING vendor/gdb/dist/COPYING.LIB (props changed) - copied unchanged from r190776, vendor/gdb/dist/contrib/gdb/COPYING.LIB vendor/gdb/dist/FREEBSD-diffs (props changed) - copied unchanged from r190776, vendor/gdb/dist/contrib/gdb/FREEBSD-diffs vendor/gdb/dist/README (props changed) - copied unchanged from r190776, vendor/gdb/dist/contrib/gdb/README vendor/gdb/dist/config-ml.in (props changed) - copied unchanged from r190776, vendor/gdb/dist/contrib/gdb/config-ml.in vendor/gdb/dist/djunpack.bat (props changed) - copied unchanged from r190776, vendor/gdb/dist/contrib/gdb/djunpack.bat vendor/gdb/dist/gdb/ - copied from r190776, vendor/gdb/dist/contrib/gdb/gdb/ vendor/gdb/dist/gettext.m4 (props changed) - copied unchanged from r190776, vendor/gdb/dist/contrib/gdb/gettext.m4 vendor/gdb/dist/include/ - copied from r190776, vendor/gdb/dist/contrib/gdb/include/ vendor/gdb/dist/install-sh (props changed) - copied unchanged from r190776, vendor/gdb/dist/contrib/gdb/install-sh vendor/gdb/dist/libtool.m4 (props changed) - copied unchanged from r190776, vendor/gdb/dist/contrib/gdb/libtool.m4 vendor/gdb/dist/ltcf-c.sh (props changed) - copied unchanged from r190776, vendor/gdb/dist/contrib/gdb/ltcf-c.sh vendor/gdb/dist/ltcf-cxx.sh (props changed) - copied unchanged from r190776, vendor/gdb/dist/contrib/gdb/ltcf-cxx.sh vendor/gdb/dist/ltcf-gcj.sh (props changed) - copied unchanged from r190776, vendor/gdb/dist/contrib/gdb/ltcf-gcj.sh vendor/gdb/dist/ltconfig (props changed) - copied unchanged from r190776, vendor/gdb/dist/contrib/gdb/ltconfig vendor/gdb/dist/ltmain.sh (props changed) - copied unchanged from r190776, vendor/gdb/dist/contrib/gdb/ltmain.sh vendor/gdb/dist/md5.sum (props changed) - copied unchanged from r190776, vendor/gdb/dist/contrib/gdb/md5.sum vendor/gdb/dist/missing (props changed) - copied unchanged from r190776, vendor/gdb/dist/contrib/gdb/missing vendor/gdb/dist/mkinstalldirs (props changed) - copied unchanged from r190776, vendor/gdb/dist/contrib/gdb/mkinstalldirs vendor/gdb/dist/move-if-change (props changed) - copied unchanged from r190776, vendor/gdb/dist/contrib/gdb/move-if-change vendor/gdb/dist/src-release (props changed) - copied unchanged from r190776, vendor/gdb/dist/contrib/gdb/src-release vendor/gdb/dist/symlink-tree (props changed) - copied unchanged from r190776, vendor/gdb/dist/contrib/gdb/symlink-tree vendor/gdb/dist/ylwrap (props changed) - copied unchanged from r190776, vendor/gdb/dist/contrib/gdb/ylwrap Deleted: vendor/gdb/dist/contrib/ Modified: vendor/gdb/dist/gdb/CONTRIBUTE (props changed) vendor/gdb/dist/gdb/COPYING (props changed) vendor/gdb/dist/gdb/MAINTAINERS (props changed) vendor/gdb/dist/gdb/NEWS (props changed) vendor/gdb/dist/gdb/PROBLEMS (props changed) vendor/gdb/dist/gdb/README (props changed) vendor/gdb/dist/gdb/TODO (props changed) vendor/gdb/dist/gdb/abug-rom.c (props changed) vendor/gdb/dist/gdb/acinclude.m4 (props changed) vendor/gdb/dist/gdb/aclocal.m4 (props changed) vendor/gdb/dist/gdb/ada-exp.c (props changed) vendor/gdb/dist/gdb/ada-exp.y (props changed) vendor/gdb/dist/gdb/ada-lang.c (props changed) vendor/gdb/dist/gdb/ada-lang.h (props changed) vendor/gdb/dist/gdb/ada-lex.l (props changed) vendor/gdb/dist/gdb/ada-tasks.c (props changed) vendor/gdb/dist/gdb/ada-typeprint.c (props changed) vendor/gdb/dist/gdb/ada-valprint.c (props changed) vendor/gdb/dist/gdb/alpha-mdebug-tdep.c (props changed) vendor/gdb/dist/gdb/alpha-nat.c (props changed) vendor/gdb/dist/gdb/alpha-tdep.c (props changed) vendor/gdb/dist/gdb/alpha-tdep.h (props changed) vendor/gdb/dist/gdb/alphabsd-nat.c (props changed) vendor/gdb/dist/gdb/alphabsd-tdep.c (props changed) vendor/gdb/dist/gdb/alphabsd-tdep.h (props changed) vendor/gdb/dist/gdb/alphafbsd-tdep.c (props changed) vendor/gdb/dist/gdb/alphanbsd-tdep.c (props changed) vendor/gdb/dist/gdb/amd64-nat.c (props changed) vendor/gdb/dist/gdb/amd64-nat.h (props changed) vendor/gdb/dist/gdb/amd64-tdep.c (props changed) vendor/gdb/dist/gdb/amd64-tdep.h (props changed) vendor/gdb/dist/gdb/amd64bsd-nat.c (props changed) vendor/gdb/dist/gdb/amd64fbsd-nat.c (props changed) vendor/gdb/dist/gdb/amd64fbsd-tdep.c (props changed) vendor/gdb/dist/gdb/amd64nbsd-nat.c (props changed) vendor/gdb/dist/gdb/amd64nbsd-tdep.c (props changed) vendor/gdb/dist/gdb/amd64obsd-nat.c (props changed) vendor/gdb/dist/gdb/amd64obsd-tdep.c (props changed) vendor/gdb/dist/gdb/annotate.c (props changed) vendor/gdb/dist/gdb/annotate.h (props changed) vendor/gdb/dist/gdb/arch-utils.c (props changed) vendor/gdb/dist/gdb/arch-utils.h (props changed) vendor/gdb/dist/gdb/arm-tdep.c (props changed) vendor/gdb/dist/gdb/arm-tdep.h (props changed) vendor/gdb/dist/gdb/armnbsd-nat.c (props changed) vendor/gdb/dist/gdb/armnbsd-tdep.c (props changed) vendor/gdb/dist/gdb/auxv.c (props changed) vendor/gdb/dist/gdb/auxv.h (props changed) vendor/gdb/dist/gdb/ax-gdb.c (props changed) vendor/gdb/dist/gdb/ax-gdb.h (props changed) vendor/gdb/dist/gdb/ax-general.c (props changed) vendor/gdb/dist/gdb/ax.h (props changed) vendor/gdb/dist/gdb/bcache.c (props changed) vendor/gdb/dist/gdb/bcache.h (props changed) vendor/gdb/dist/gdb/bfd-target.c (props changed) vendor/gdb/dist/gdb/bfd-target.h (props changed) vendor/gdb/dist/gdb/block.c (props changed) vendor/gdb/dist/gdb/block.h (props changed) vendor/gdb/dist/gdb/blockframe.c (props changed) vendor/gdb/dist/gdb/breakpoint.c (props changed) vendor/gdb/dist/gdb/breakpoint.h (props changed) vendor/gdb/dist/gdb/buildsym.c (props changed) vendor/gdb/dist/gdb/buildsym.h (props changed) vendor/gdb/dist/gdb/c-exp.c (props changed) vendor/gdb/dist/gdb/c-exp.y (props changed) vendor/gdb/dist/gdb/c-lang.c (props changed) vendor/gdb/dist/gdb/c-lang.h (props changed) vendor/gdb/dist/gdb/c-typeprint.c (props changed) vendor/gdb/dist/gdb/c-valprint.c (props changed) vendor/gdb/dist/gdb/call-cmds.h (props changed) vendor/gdb/dist/gdb/charset.c (props changed) vendor/gdb/dist/gdb/charset.h (props changed) vendor/gdb/dist/gdb/cli-out.c (props changed) vendor/gdb/dist/gdb/cli-out.h (props changed) vendor/gdb/dist/gdb/cli/cli-cmds.c (props changed) vendor/gdb/dist/gdb/cli/cli-cmds.h (props changed) vendor/gdb/dist/gdb/cli/cli-decode.c (props changed) vendor/gdb/dist/gdb/cli/cli-decode.h (props changed) vendor/gdb/dist/gdb/cli/cli-dump.c (props changed) vendor/gdb/dist/gdb/cli/cli-dump.h (props changed) vendor/gdb/dist/gdb/cli/cli-interp.c (props changed) vendor/gdb/dist/gdb/cli/cli-logging.c (props changed) vendor/gdb/dist/gdb/cli/cli-script.c (props changed) vendor/gdb/dist/gdb/cli/cli-script.h (props changed) vendor/gdb/dist/gdb/cli/cli-setshow.c (props changed) vendor/gdb/dist/gdb/cli/cli-setshow.h (props changed) vendor/gdb/dist/gdb/cli/cli-utils.c (props changed) vendor/gdb/dist/gdb/cli/cli-utils.h (props changed) vendor/gdb/dist/gdb/coff-pe-read.c (props changed) vendor/gdb/dist/gdb/coff-pe-read.h (props changed) vendor/gdb/dist/gdb/coff-solib.c (props changed) vendor/gdb/dist/gdb/coff-solib.h (props changed) vendor/gdb/dist/gdb/coffread.c (props changed) vendor/gdb/dist/gdb/command.h (props changed) vendor/gdb/dist/gdb/complaints.c (props changed) vendor/gdb/dist/gdb/complaints.h (props changed) vendor/gdb/dist/gdb/completer.c (props changed) vendor/gdb/dist/gdb/completer.h (props changed) vendor/gdb/dist/gdb/config/alpha/alpha-osf2.mh (props changed) vendor/gdb/dist/gdb/config/alpha/alpha-osf3.mh (props changed) vendor/gdb/dist/gdb/config/alpha/alpha.mt (props changed) vendor/gdb/dist/gdb/config/alpha/fbsd.mh (props changed) vendor/gdb/dist/gdb/config/alpha/fbsd.mt (props changed) vendor/gdb/dist/gdb/config/alpha/nbsd.mh (props changed) vendor/gdb/dist/gdb/config/alpha/nbsd.mt (props changed) vendor/gdb/dist/gdb/config/alpha/nm-fbsd.h (props changed) vendor/gdb/dist/gdb/config/alpha/nm-nbsd.h (props changed) vendor/gdb/dist/gdb/config/alpha/nm-osf.h (props changed) vendor/gdb/dist/gdb/config/alpha/nm-osf2.h (props changed) vendor/gdb/dist/gdb/config/alpha/nm-osf3.h (props changed) vendor/gdb/dist/gdb/config/alpha/tm-alpha.h (props changed) vendor/gdb/dist/gdb/config/alpha/tm-fbsd.h (props changed) vendor/gdb/dist/gdb/config/alpha/tm-nbsd.h (props changed) vendor/gdb/dist/gdb/config/alpha/xm-alphaosf.h (props changed) vendor/gdb/dist/gdb/config/arm/embed.mt (props changed) vendor/gdb/dist/gdb/config/arm/nbsd.mt (props changed) vendor/gdb/dist/gdb/config/arm/nbsdaout.mh (props changed) vendor/gdb/dist/gdb/config/arm/nbsdelf.mh (props changed) vendor/gdb/dist/gdb/config/arm/nm-nbsd.h (props changed) vendor/gdb/dist/gdb/config/arm/nm-nbsdaout.h (props changed) vendor/gdb/dist/gdb/config/arm/tm-arm.h (props changed) vendor/gdb/dist/gdb/config/arm/tm-embed.h (props changed) vendor/gdb/dist/gdb/config/arm/tm-nbsd.h (props changed) vendor/gdb/dist/gdb/config/arm/tm-wince.h (props changed) vendor/gdb/dist/gdb/config/arm/wince.mt (props changed) vendor/gdb/dist/gdb/config/arm/xm-nbsd.h (props changed) vendor/gdb/dist/gdb/config/i386/embed.mt (props changed) vendor/gdb/dist/gdb/config/i386/fbsd.mh (props changed) vendor/gdb/dist/gdb/config/i386/fbsd.mt (props changed) vendor/gdb/dist/gdb/config/i386/fbsd64.mh (props changed) vendor/gdb/dist/gdb/config/i386/fbsd64.mt (props changed) vendor/gdb/dist/gdb/config/i386/go32.mh (props changed) vendor/gdb/dist/gdb/config/i386/go32.mt (props changed) vendor/gdb/dist/gdb/config/i386/i386aout.mt (props changed) vendor/gdb/dist/gdb/config/i386/i386gnu.mh (props changed) vendor/gdb/dist/gdb/config/i386/i386gnu.mt (props changed) vendor/gdb/dist/gdb/config/i386/i386lynx.mh (props changed) vendor/gdb/dist/gdb/config/i386/i386lynx.mt (props changed) vendor/gdb/dist/gdb/config/i386/i386nw.mt (props changed) vendor/gdb/dist/gdb/config/i386/i386sco.mh (props changed) vendor/gdb/dist/gdb/config/i386/i386sco4.mh (props changed) vendor/gdb/dist/gdb/config/i386/i386sco5.mh (props changed) vendor/gdb/dist/gdb/config/i386/i386sol2.mh (props changed) vendor/gdb/dist/gdb/config/i386/i386sol2.mt (props changed) vendor/gdb/dist/gdb/config/i386/i386v.mh (props changed) vendor/gdb/dist/gdb/config/i386/i386v.mt (props changed) vendor/gdb/dist/gdb/config/i386/i386v4.mh (props changed) vendor/gdb/dist/gdb/config/i386/i386v42mp.mh (props changed) vendor/gdb/dist/gdb/config/i386/nbsd.mt (props changed) vendor/gdb/dist/gdb/config/i386/nbsd64.mh (props changed) vendor/gdb/dist/gdb/config/i386/nbsd64.mt (props changed) vendor/gdb/dist/gdb/config/i386/nbsdaout.mh (props changed) vendor/gdb/dist/gdb/config/i386/nbsdelf.mh (props changed) vendor/gdb/dist/gdb/config/i386/ncr3000.mh (props changed) vendor/gdb/dist/gdb/config/i386/ncr3000.mt (props changed) vendor/gdb/dist/gdb/config/i386/nm-fbsd.h (props changed) vendor/gdb/dist/gdb/config/i386/nm-fbsd64.h (props changed) vendor/gdb/dist/gdb/config/i386/nm-go32.h (props changed) vendor/gdb/dist/gdb/config/i386/nm-i386.h (props changed) vendor/gdb/dist/gdb/config/i386/nm-i386gnu.h (props changed) vendor/gdb/dist/gdb/config/i386/nm-i386lynx.h (props changed) vendor/gdb/dist/gdb/config/i386/nm-i386sco.h (props changed) vendor/gdb/dist/gdb/config/i386/nm-i386sco4.h (props changed) vendor/gdb/dist/gdb/config/i386/nm-i386sco5.h (props changed) vendor/gdb/dist/gdb/config/i386/nm-i386sol2.h (props changed) vendor/gdb/dist/gdb/config/i386/nm-i386v.h (props changed) vendor/gdb/dist/gdb/config/i386/nm-i386v4.h (props changed) vendor/gdb/dist/gdb/config/i386/nm-i386v42mp.h (props changed) vendor/gdb/dist/gdb/config/i386/nm-nbsd.h (props changed) vendor/gdb/dist/gdb/config/i386/nm-nbsdaout.h (props changed) vendor/gdb/dist/gdb/config/i386/nm-nto.h (props changed) vendor/gdb/dist/gdb/config/i386/nm-obsd.h (props changed) vendor/gdb/dist/gdb/config/i386/nto.mh (props changed) vendor/gdb/dist/gdb/config/i386/nto.mt (props changed) vendor/gdb/dist/gdb/config/i386/obsd.mh (props changed) vendor/gdb/dist/gdb/config/i386/obsd.mt (props changed) vendor/gdb/dist/gdb/config/i386/obsd64.mh (props changed) vendor/gdb/dist/gdb/config/i386/obsd64.mt (props changed) vendor/gdb/dist/gdb/config/i386/obsdaout.mh (props changed) vendor/gdb/dist/gdb/config/i386/tm-fbsd.h (props changed) vendor/gdb/dist/gdb/config/i386/tm-go32.h (props changed) vendor/gdb/dist/gdb/config/i386/tm-i386.h (props changed) vendor/gdb/dist/gdb/config/i386/tm-i386lynx.h (props changed) vendor/gdb/dist/gdb/config/i386/tm-i386sol2.h (props changed) vendor/gdb/dist/gdb/config/i386/tm-nbsd.h (props changed) vendor/gdb/dist/gdb/config/i386/tm-nto.h (props changed) vendor/gdb/dist/gdb/config/i386/tm-vxworks.h (props changed) vendor/gdb/dist/gdb/config/i386/vxworks.mt (props changed) vendor/gdb/dist/gdb/config/i386/xm-go32.h (props changed) vendor/gdb/dist/gdb/config/i386/xm-i386.h (props changed) vendor/gdb/dist/gdb/config/i386/xm-i386sco.h (props changed) vendor/gdb/dist/gdb/config/i386/xm-i386v.h (props changed) vendor/gdb/dist/gdb/config/i386/xm-i386v4.h (props changed) vendor/gdb/dist/gdb/config/i386/xm-nbsd.h (props changed) vendor/gdb/dist/gdb/config/ia64/fbsd.mh (props changed) vendor/gdb/dist/gdb/config/ia64/fbsd.mt (props changed) vendor/gdb/dist/gdb/config/ia64/ia64.mt (props changed) vendor/gdb/dist/gdb/config/ia64/nm-fbsd.h (props changed) vendor/gdb/dist/gdb/config/ia64/tm-fbsd.h (props changed) vendor/gdb/dist/gdb/config/ia64/tm-ia64.h (props changed) vendor/gdb/dist/gdb/config/mips/decstation.mh (props changed) vendor/gdb/dist/gdb/config/mips/embed.mt (props changed) vendor/gdb/dist/gdb/config/mips/littlemips.mh (props changed) vendor/gdb/dist/gdb/config/mips/mipsv4.mh (props changed) vendor/gdb/dist/gdb/config/mips/mipsv4.mt (props changed) vendor/gdb/dist/gdb/config/mips/nbsd.mh (props changed) vendor/gdb/dist/gdb/config/mips/nbsd.mt (props changed) vendor/gdb/dist/gdb/config/mips/news-mips.mh (props changed) vendor/gdb/dist/gdb/config/mips/nm-mips.h (props changed) vendor/gdb/dist/gdb/config/mips/nm-nbsd.h (props changed) vendor/gdb/dist/gdb/config/mips/nm-news-mips.h (props changed) vendor/gdb/dist/gdb/config/mips/nm-riscos.h (props changed) vendor/gdb/dist/gdb/config/mips/riscos.mh (props changed) vendor/gdb/dist/gdb/config/mips/tm-mips.h (props changed) vendor/gdb/dist/gdb/config/mips/tm-mipsv4.h (props changed) vendor/gdb/dist/gdb/config/mips/tm-nbsd.h (props changed) vendor/gdb/dist/gdb/config/mips/tm-vxmips.h (props changed) vendor/gdb/dist/gdb/config/mips/tm-wince.h (props changed) vendor/gdb/dist/gdb/config/mips/vxmips.mt (props changed) vendor/gdb/dist/gdb/config/mips/wince.mt (props changed) vendor/gdb/dist/gdb/config/mips/xm-mips.h (props changed) vendor/gdb/dist/gdb/config/mips/xm-mipsv4.h (props changed) vendor/gdb/dist/gdb/config/mips/xm-riscos.h (props changed) vendor/gdb/dist/gdb/config/nm-gnu.h (props changed) vendor/gdb/dist/gdb/config/nm-lynx.h (props changed) vendor/gdb/dist/gdb/config/nm-nbsd.h (props changed) vendor/gdb/dist/gdb/config/nm-nbsdaout.h (props changed) vendor/gdb/dist/gdb/config/nm-sysv4.h (props changed) vendor/gdb/dist/gdb/config/powerpc/fbsd.mh (props changed) vendor/gdb/dist/gdb/config/powerpc/fbsd.mt (props changed) vendor/gdb/dist/gdb/config/powerpc/nbsd.mh (props changed) vendor/gdb/dist/gdb/config/powerpc/nbsd.mt (props changed) vendor/gdb/dist/gdb/config/powerpc/nm-fbsd.h (props changed) vendor/gdb/dist/gdb/config/powerpc/nm-nbsd.h (props changed) vendor/gdb/dist/gdb/config/powerpc/ppc-eabi.mt (props changed) vendor/gdb/dist/gdb/config/powerpc/ppc-sim.mt (props changed) vendor/gdb/dist/gdb/config/powerpc/tm-nbsd.h (props changed) vendor/gdb/dist/gdb/config/powerpc/tm-ppc-eabi.h (props changed) vendor/gdb/dist/gdb/config/powerpc/tm-ppcle-eabi.h (props changed) vendor/gdb/dist/gdb/config/powerpc/tm-ppcle-sim.h (props changed) vendor/gdb/dist/gdb/config/powerpc/tm-vxworks.h (props changed) vendor/gdb/dist/gdb/config/powerpc/vxworks.mt (props changed) vendor/gdb/dist/gdb/config/rs6000/nm-rs6000.h (props changed) vendor/gdb/dist/gdb/config/rs6000/nm-rs6000ly.h (props changed) vendor/gdb/dist/gdb/config/rs6000/rs6000.mh (props changed) vendor/gdb/dist/gdb/config/rs6000/rs6000.mt (props changed) vendor/gdb/dist/gdb/config/rs6000/rs6000lynx.mh (props changed) vendor/gdb/dist/gdb/config/rs6000/rs6000lynx.mt (props changed) vendor/gdb/dist/gdb/config/rs6000/tm-rs6000.h (props changed) vendor/gdb/dist/gdb/config/rs6000/tm-rs6000ly.h (props changed) vendor/gdb/dist/gdb/config/rs6000/xm-rs6000.h (props changed) vendor/gdb/dist/gdb/config/s390/s390.mh (props changed) vendor/gdb/dist/gdb/config/s390/s390.mt (props changed) vendor/gdb/dist/gdb/config/sparc/fbsd.mh (props changed) vendor/gdb/dist/gdb/config/sparc/fbsd.mt (props changed) vendor/gdb/dist/gdb/config/sparc/nbsd.mt (props changed) vendor/gdb/dist/gdb/config/sparc/nbsd64.mh (props changed) vendor/gdb/dist/gdb/config/sparc/nbsd64.mt (props changed) vendor/gdb/dist/gdb/config/sparc/nbsdaout.mh (props changed) vendor/gdb/dist/gdb/config/sparc/nbsdelf.mh (props changed) vendor/gdb/dist/gdb/config/sparc/nm-fbsd.h (props changed) vendor/gdb/dist/gdb/config/sparc/nm-nbsd.h (props changed) vendor/gdb/dist/gdb/config/sparc/nm-nbsdaout.h (props changed) vendor/gdb/dist/gdb/config/sparc/nm-sol2.h (props changed) vendor/gdb/dist/gdb/config/sparc/obsd.mt (props changed) vendor/gdb/dist/gdb/config/sparc/obsd64.mt (props changed) vendor/gdb/dist/gdb/config/sparc/sol2-64.mt (props changed) vendor/gdb/dist/gdb/config/sparc/sol2.mh (props changed) vendor/gdb/dist/gdb/config/sparc/sol2.mt (props changed) vendor/gdb/dist/gdb/config/sparc/sparc.mt (props changed) vendor/gdb/dist/gdb/config/sparc/sparc64.mt (props changed) vendor/gdb/dist/gdb/config/sparc/tm-fbsd.h (props changed) vendor/gdb/dist/gdb/config/sparc/tm-nbsd.h (props changed) vendor/gdb/dist/gdb/config/sparc/tm-nbsd64.h (props changed) vendor/gdb/dist/gdb/config/sparc/tm-sol2.h (props changed) vendor/gdb/dist/gdb/config/sparc/tm-vxworks.h (props changed) vendor/gdb/dist/gdb/config/sparc/vxworks.mt (props changed) vendor/gdb/dist/gdb/config/tm-lynx.h (props changed) vendor/gdb/dist/gdb/config/tm-nto.h (props changed) vendor/gdb/dist/gdb/config/tm-sunos.h (props changed) vendor/gdb/dist/gdb/config/tm-sysv4.h (props changed) vendor/gdb/dist/gdb/config/tm-vxworks.h (props changed) vendor/gdb/dist/gdb/config/xm-nbsd.h (props changed) vendor/gdb/dist/gdb/config/xm-sysv4.h (props changed) vendor/gdb/dist/gdb/copying.awk (props changed) vendor/gdb/dist/gdb/copying.c (props changed) vendor/gdb/dist/gdb/core-aout.c (props changed) vendor/gdb/dist/gdb/core-regset.c (props changed) vendor/gdb/dist/gdb/corefile.c (props changed) vendor/gdb/dist/gdb/corelow.c (props changed) vendor/gdb/dist/gdb/cp-abi.c (props changed) vendor/gdb/dist/gdb/cp-abi.h (props changed) vendor/gdb/dist/gdb/cp-namespace.c (props changed) vendor/gdb/dist/gdb/cp-support.c (props changed) vendor/gdb/dist/gdb/cp-support.h (props changed) vendor/gdb/dist/gdb/cp-valprint.c (props changed) vendor/gdb/dist/gdb/cpu32bug-rom.c (props changed) vendor/gdb/dist/gdb/dbug-rom.c (props changed) vendor/gdb/dist/gdb/dbxread.c (props changed) vendor/gdb/dist/gdb/dcache.c (props changed) vendor/gdb/dist/gdb/dcache.h (props changed) vendor/gdb/dist/gdb/defs.h (props changed) vendor/gdb/dist/gdb/delta68-nat.c (props changed) vendor/gdb/dist/gdb/demangle.c (props changed) vendor/gdb/dist/gdb/dictionary.c (props changed) vendor/gdb/dist/gdb/dictionary.h (props changed) vendor/gdb/dist/gdb/dink32-rom.c (props changed) vendor/gdb/dist/gdb/disasm.c (props changed) vendor/gdb/dist/gdb/disasm.h (props changed) vendor/gdb/dist/gdb/doc/GDBvn.texi (props changed) vendor/gdb/dist/gdb/doc/LRS (props changed) vendor/gdb/dist/gdb/doc/a4rc.sed (props changed) vendor/gdb/dist/gdb/doc/agentexpr.texi (props changed) vendor/gdb/dist/gdb/doc/all-cfg.texi (props changed) vendor/gdb/dist/gdb/doc/annotate.texinfo (props changed) vendor/gdb/dist/gdb/doc/fdl.texi (props changed) vendor/gdb/dist/gdb/doc/gdb.info-1 (props changed) vendor/gdb/dist/gdb/doc/gdb.info-2 (props changed) vendor/gdb/dist/gdb/doc/gdb.info-3 (props changed) vendor/gdb/dist/gdb/doc/gdb.texinfo (props changed) vendor/gdb/dist/gdb/doc/gdbint.texinfo (props changed) vendor/gdb/dist/gdb/doc/gpl.texi (props changed) vendor/gdb/dist/gdb/doc/lpsrc.sed (props changed) vendor/gdb/dist/gdb/doc/observer.texi (props changed) vendor/gdb/dist/gdb/doc/psrc.sed (props changed) vendor/gdb/dist/gdb/doc/refcard.tex (props changed) vendor/gdb/dist/gdb/doc/stabs.texinfo (props changed) vendor/gdb/dist/gdb/doublest.c (props changed) vendor/gdb/dist/gdb/doublest.h (props changed) vendor/gdb/dist/gdb/dpx2-nat.c (props changed) vendor/gdb/dist/gdb/dsrec.c (props changed) vendor/gdb/dist/gdb/dummy-frame.c (props changed) vendor/gdb/dist/gdb/dummy-frame.h (props changed) vendor/gdb/dist/gdb/dve3900-rom.c (props changed) vendor/gdb/dist/gdb/dwarf2-frame.c (props changed) vendor/gdb/dist/gdb/dwarf2-frame.h (props changed) vendor/gdb/dist/gdb/dwarf2expr.c (props changed) vendor/gdb/dist/gdb/dwarf2expr.h (props changed) vendor/gdb/dist/gdb/dwarf2loc.c (props changed) vendor/gdb/dist/gdb/dwarf2loc.h (props changed) vendor/gdb/dist/gdb/dwarf2read.c (props changed) vendor/gdb/dist/gdb/dwarfread.c (props changed) vendor/gdb/dist/gdb/elfread.c (props changed) vendor/gdb/dist/gdb/environ.c (props changed) vendor/gdb/dist/gdb/environ.h (props changed) vendor/gdb/dist/gdb/eval.c (props changed) vendor/gdb/dist/gdb/event-loop.c (props changed) vendor/gdb/dist/gdb/event-loop.h (props changed) vendor/gdb/dist/gdb/event-top.c (props changed) vendor/gdb/dist/gdb/event-top.h (props changed) vendor/gdb/dist/gdb/exc_request.defs (props changed) vendor/gdb/dist/gdb/exec.c (props changed) vendor/gdb/dist/gdb/exec.h (props changed) vendor/gdb/dist/gdb/expprint.c (props changed) vendor/gdb/dist/gdb/expression.h (props changed) vendor/gdb/dist/gdb/f-exp.c (props changed) vendor/gdb/dist/gdb/f-exp.y (props changed) vendor/gdb/dist/gdb/f-lang.c (props changed) vendor/gdb/dist/gdb/f-lang.h (props changed) vendor/gdb/dist/gdb/f-typeprint.c (props changed) vendor/gdb/dist/gdb/f-valprint.c (props changed) vendor/gdb/dist/gdb/fbsd-proc.c (props changed) vendor/gdb/dist/gdb/findvar.c (props changed) vendor/gdb/dist/gdb/fork-child.c (props changed) vendor/gdb/dist/gdb/frame-base.c (props changed) vendor/gdb/dist/gdb/frame-base.h (props changed) vendor/gdb/dist/gdb/frame-unwind.c (props changed) vendor/gdb/dist/gdb/frame-unwind.h (props changed) vendor/gdb/dist/gdb/frame.c (props changed) vendor/gdb/dist/gdb/frame.h (props changed) vendor/gdb/dist/gdb/gcore.c (props changed) vendor/gdb/dist/gdb/gdb-events.c (props changed) vendor/gdb/dist/gdb/gdb-events.h (props changed) vendor/gdb/dist/gdb/gdb-events.sh (props changed) vendor/gdb/dist/gdb/gdb-stabs.h (props changed) vendor/gdb/dist/gdb/gdb.1 (props changed) vendor/gdb/dist/gdb/gdb.c (props changed) vendor/gdb/dist/gdb/gdb.gdb (props changed) vendor/gdb/dist/gdb/gdb.h (props changed) vendor/gdb/dist/gdb/gdb_assert.h (props changed) vendor/gdb/dist/gdb/gdb_curses.h (props changed) vendor/gdb/dist/gdb/gdb_dirent.h (props changed) vendor/gdb/dist/gdb/gdb_gcore.sh (props changed) vendor/gdb/dist/gdb/gdb_indent.sh (props changed) vendor/gdb/dist/gdb/gdb_locale.h (props changed) vendor/gdb/dist/gdb/gdb_mbuild.sh (props changed) vendor/gdb/dist/gdb/gdb_obstack.h (props changed) vendor/gdb/dist/gdb/gdb_proc_service.h (props changed) vendor/gdb/dist/gdb/gdb_regex.h (props changed) vendor/gdb/dist/gdb/gdb_stat.h (props changed) vendor/gdb/dist/gdb/gdb_string.h (props changed) vendor/gdb/dist/gdb/gdb_thread_db.h (props changed) vendor/gdb/dist/gdb/gdb_vfork.h (props changed) vendor/gdb/dist/gdb/gdb_wait.h (props changed) vendor/gdb/dist/gdb/gdbarch.c (props changed) vendor/gdb/dist/gdb/gdbarch.h (props changed) vendor/gdb/dist/gdb/gdbarch.sh (props changed) vendor/gdb/dist/gdb/gdbcmd.h (props changed) vendor/gdb/dist/gdb/gdbcore.h (props changed) vendor/gdb/dist/gdb/gdbinit.in (props changed) vendor/gdb/dist/gdb/gdbserver/README (props changed) vendor/gdb/dist/gdb/gdbserver/acinclude.m4 (props changed) vendor/gdb/dist/gdb/gdbserver/aclocal.m4 (props changed) vendor/gdb/dist/gdb/gdbserver/gdbreplay.c (props changed) vendor/gdb/dist/gdb/gdbserver/gdbserver.1 (props changed) vendor/gdb/dist/gdb/gdbserver/i387-fp.c (props changed) vendor/gdb/dist/gdb/gdbserver/i387-fp.h (props changed) vendor/gdb/dist/gdb/gdbserver/inferiors.c (props changed) vendor/gdb/dist/gdb/gdbserver/mem-break.c (props changed) vendor/gdb/dist/gdb/gdbserver/mem-break.h (props changed) vendor/gdb/dist/gdb/gdbserver/proc-service.c (props changed) vendor/gdb/dist/gdb/gdbserver/regcache.c (props changed) vendor/gdb/dist/gdb/gdbserver/regcache.h (props changed) vendor/gdb/dist/gdb/gdbserver/remote-utils.c (props changed) vendor/gdb/dist/gdb/gdbserver/server.c (props changed) vendor/gdb/dist/gdb/gdbserver/server.h (props changed) vendor/gdb/dist/gdb/gdbserver/target.c (props changed) vendor/gdb/dist/gdb/gdbserver/target.h (props changed) vendor/gdb/dist/gdb/gdbserver/terminal.h (props changed) vendor/gdb/dist/gdb/gdbserver/thread-db.c (props changed) vendor/gdb/dist/gdb/gdbserver/utils.c (props changed) vendor/gdb/dist/gdb/gdbthread.h (props changed) vendor/gdb/dist/gdb/gdbtypes.c (props changed) vendor/gdb/dist/gdb/gdbtypes.h (props changed) vendor/gdb/dist/gdb/glibc-tdep.c (props changed) vendor/gdb/dist/gdb/glibc-tdep.h (props changed) vendor/gdb/dist/gdb/gnu-nat.c (props changed) vendor/gdb/dist/gdb/gnu-nat.h (props changed) vendor/gdb/dist/gdb/gnu-v2-abi.c (props changed) vendor/gdb/dist/gdb/gnu-v3-abi.c (props changed) vendor/gdb/dist/gdb/go32-nat.c (props changed) vendor/gdb/dist/gdb/gregset.h (props changed) vendor/gdb/dist/gdb/hpacc-abi.c (props changed) vendor/gdb/dist/gdb/hpread.c (props changed) vendor/gdb/dist/gdb/i386-nat.c (props changed) vendor/gdb/dist/gdb/i386-nto-tdep.c (props changed) vendor/gdb/dist/gdb/i386-sol2-tdep.c (props changed) vendor/gdb/dist/gdb/i386-stub.c (props changed) vendor/gdb/dist/gdb/i386-tdep.c (props changed) vendor/gdb/dist/gdb/i386-tdep.h (props changed) vendor/gdb/dist/gdb/i386bsd-nat.c (props changed) vendor/gdb/dist/gdb/i386bsd-tdep.c (props changed) vendor/gdb/dist/gdb/i386fbsd-nat.c (props changed) vendor/gdb/dist/gdb/i386fbsd-tdep.c (props changed) vendor/gdb/dist/gdb/i386gnu-nat.c (props changed) vendor/gdb/dist/gdb/i386gnu-tdep.c (props changed) vendor/gdb/dist/gdb/i386ly-tdep.c (props changed) vendor/gdb/dist/gdb/i386nbsd-tdep.c (props changed) vendor/gdb/dist/gdb/i386obsd-nat.c (props changed) vendor/gdb/dist/gdb/i386obsd-tdep.c (props changed) vendor/gdb/dist/gdb/i386v-nat.c (props changed) vendor/gdb/dist/gdb/i386v4-nat.c (props changed) vendor/gdb/dist/gdb/i387-tdep.c (props changed) vendor/gdb/dist/gdb/i387-tdep.h (props changed) vendor/gdb/dist/gdb/ia64-fbsd-nat.c (props changed) vendor/gdb/dist/gdb/ia64-fbsd-tdep.c (props changed) vendor/gdb/dist/gdb/ia64-tdep.c (props changed) vendor/gdb/dist/gdb/ia64-tdep.h (props changed) vendor/gdb/dist/gdb/inf-loop.c (props changed) vendor/gdb/dist/gdb/inf-loop.h (props changed) vendor/gdb/dist/gdb/infcall.c (props changed) vendor/gdb/dist/gdb/infcall.h (props changed) vendor/gdb/dist/gdb/infcmd.c (props changed) vendor/gdb/dist/gdb/inferior.h (props changed) vendor/gdb/dist/gdb/inflow.c (props changed) vendor/gdb/dist/gdb/inflow.h (props changed) vendor/gdb/dist/gdb/infptrace.c (props changed) vendor/gdb/dist/gdb/infrun.c (props changed) vendor/gdb/dist/gdb/inftarg.c (props changed) vendor/gdb/dist/gdb/infttrace.c (props changed) vendor/gdb/dist/gdb/infttrace.h (props changed) vendor/gdb/dist/gdb/interps.c (props changed) vendor/gdb/dist/gdb/interps.h (props changed) vendor/gdb/dist/gdb/jv-exp.c (props changed) vendor/gdb/dist/gdb/jv-exp.y (props changed) vendor/gdb/dist/gdb/jv-lang.c (props changed) vendor/gdb/dist/gdb/jv-lang.h (props changed) vendor/gdb/dist/gdb/jv-typeprint.c (props changed) vendor/gdb/dist/gdb/jv-valprint.c (props changed) vendor/gdb/dist/gdb/kod-cisco.c (props changed) vendor/gdb/dist/gdb/kod.c (props changed) vendor/gdb/dist/gdb/kod.h (props changed) vendor/gdb/dist/gdb/language.c (props changed) vendor/gdb/dist/gdb/language.h (props changed) vendor/gdb/dist/gdb/libunwind-frame.c (props changed) vendor/gdb/dist/gdb/libunwind-frame.h (props changed) vendor/gdb/dist/gdb/lin-lwp.c (props changed) vendor/gdb/dist/gdb/linespec.c (props changed) vendor/gdb/dist/gdb/linespec.h (props changed) vendor/gdb/dist/gdb/lynx-nat.c (props changed) vendor/gdb/dist/gdb/m2-exp.c (props changed) vendor/gdb/dist/gdb/m2-exp.y (props changed) vendor/gdb/dist/gdb/m2-lang.c (props changed) vendor/gdb/dist/gdb/m2-lang.h (props changed) vendor/gdb/dist/gdb/m2-typeprint.c (props changed) vendor/gdb/dist/gdb/m2-valprint.c (props changed) vendor/gdb/dist/gdb/macrocmd.c (props changed) vendor/gdb/dist/gdb/macroexp.c (props changed) vendor/gdb/dist/gdb/macroexp.h (props changed) vendor/gdb/dist/gdb/macroscope.c (props changed) vendor/gdb/dist/gdb/macroscope.h (props changed) vendor/gdb/dist/gdb/macrotab.c (props changed) vendor/gdb/dist/gdb/macrotab.h (props changed) vendor/gdb/dist/gdb/main.c (props changed) vendor/gdb/dist/gdb/main.h (props changed) vendor/gdb/dist/gdb/maint.c (props changed) vendor/gdb/dist/gdb/mdebugread.c (props changed) vendor/gdb/dist/gdb/mem-break.c (props changed) vendor/gdb/dist/gdb/memattr.c (props changed) vendor/gdb/dist/gdb/memattr.h (props changed) vendor/gdb/dist/gdb/mi/mi-cmd-break.c (props changed) vendor/gdb/dist/gdb/mi/mi-cmd-disas.c (props changed) vendor/gdb/dist/gdb/mi/mi-cmd-env.c (props changed) vendor/gdb/dist/gdb/mi/mi-cmd-file.c (props changed) vendor/gdb/dist/gdb/mi/mi-cmd-stack.c (props changed) vendor/gdb/dist/gdb/mi/mi-cmd-var.c (props changed) vendor/gdb/dist/gdb/mi/mi-cmds.c (props changed) vendor/gdb/dist/gdb/mi/mi-cmds.h (props changed) vendor/gdb/dist/gdb/mi/mi-console.c (props changed) vendor/gdb/dist/gdb/mi/mi-console.h (props changed) vendor/gdb/dist/gdb/mi/mi-getopt.c (props changed) vendor/gdb/dist/gdb/mi/mi-getopt.h (props changed) vendor/gdb/dist/gdb/mi/mi-interp.c (props changed) vendor/gdb/dist/gdb/mi/mi-main.c (props changed) vendor/gdb/dist/gdb/mi/mi-main.h (props changed) vendor/gdb/dist/gdb/mi/mi-out.c (props changed) vendor/gdb/dist/gdb/mi/mi-out.h (props changed) vendor/gdb/dist/gdb/mi/mi-parse.c (props changed) vendor/gdb/dist/gdb/mi/mi-parse.h (props changed) vendor/gdb/dist/gdb/mi/mi-symbol-cmds.c (props changed) vendor/gdb/dist/gdb/minimon.h (props changed) vendor/gdb/dist/gdb/minsyms.c (props changed) vendor/gdb/dist/gdb/mips-nat.c (props changed) vendor/gdb/dist/gdb/mips-tdep.c (props changed) vendor/gdb/dist/gdb/mips-tdep.h (props changed) vendor/gdb/dist/gdb/mipsnbsd-nat.c (props changed) vendor/gdb/dist/gdb/mipsnbsd-tdep.c (props changed) vendor/gdb/dist/gdb/mipsnbsd-tdep.h (props changed) vendor/gdb/dist/gdb/mipsread.c (props changed) vendor/gdb/dist/gdb/mipsv4-nat.c (props changed) vendor/gdb/dist/gdb/monitor.c (props changed) vendor/gdb/dist/gdb/monitor.h (props changed) vendor/gdb/dist/gdb/msg.defs (props changed) vendor/gdb/dist/gdb/msg_reply.defs (props changed) vendor/gdb/dist/gdb/nbsd-tdep.c (props changed) vendor/gdb/dist/gdb/nbsd-tdep.h (props changed) vendor/gdb/dist/gdb/nlmread.c (props changed) vendor/gdb/dist/gdb/notify.defs (props changed) vendor/gdb/dist/gdb/nto-procfs.c (props changed) vendor/gdb/dist/gdb/nto-tdep.c (props changed) vendor/gdb/dist/gdb/nto-tdep.h (props changed) vendor/gdb/dist/gdb/objc-exp.c (props changed) vendor/gdb/dist/gdb/objc-exp.y (props changed) vendor/gdb/dist/gdb/objc-lang.c (props changed) vendor/gdb/dist/gdb/objc-lang.h (props changed) vendor/gdb/dist/gdb/objfiles.c (props changed) vendor/gdb/dist/gdb/objfiles.h (props changed) vendor/gdb/dist/gdb/observer.c (props changed) vendor/gdb/dist/gdb/observer.h (props changed) vendor/gdb/dist/gdb/ocd.c (props changed) vendor/gdb/dist/gdb/ocd.h (props changed) vendor/gdb/dist/gdb/osabi.c (props changed) vendor/gdb/dist/gdb/osabi.h (props changed) vendor/gdb/dist/gdb/p-exp.c (props changed) vendor/gdb/dist/gdb/p-exp.y (props changed) vendor/gdb/dist/gdb/p-lang.c (props changed) vendor/gdb/dist/gdb/p-lang.h (props changed) vendor/gdb/dist/gdb/p-typeprint.c (props changed) vendor/gdb/dist/gdb/p-valprint.c (props changed) vendor/gdb/dist/gdb/pa64solib.c (props changed) vendor/gdb/dist/gdb/pa64solib.h (props changed) vendor/gdb/dist/gdb/parse.c (props changed) vendor/gdb/dist/gdb/parser-defs.h (props changed) vendor/gdb/dist/gdb/ppc-bdm.c (props changed) vendor/gdb/dist/gdb/ppc-sysv-tdep.c (props changed) vendor/gdb/dist/gdb/ppc-tdep.h (props changed) vendor/gdb/dist/gdb/ppcbug-rom.c (props changed) vendor/gdb/dist/gdb/ppcfbsd-nat.c (props changed) vendor/gdb/dist/gdb/ppcfbsd-tdep.c (props changed) vendor/gdb/dist/gdb/ppcfbsd-tdep.h (props changed) vendor/gdb/dist/gdb/ppcnbsd-nat.c (props changed) vendor/gdb/dist/gdb/ppcnbsd-tdep.c (props changed) vendor/gdb/dist/gdb/ppcnbsd-tdep.h (props changed) vendor/gdb/dist/gdb/printcmd.c (props changed) vendor/gdb/dist/gdb/proc-api.c (props changed) vendor/gdb/dist/gdb/proc-events.c (props changed) vendor/gdb/dist/gdb/proc-flags.c (props changed) vendor/gdb/dist/gdb/proc-service.c (props changed) vendor/gdb/dist/gdb/proc-utils.h (props changed) vendor/gdb/dist/gdb/proc-why.c (props changed) vendor/gdb/dist/gdb/process_reply.defs (props changed) vendor/gdb/dist/gdb/procfs.c (props changed) vendor/gdb/dist/gdb/regcache.c (props changed) vendor/gdb/dist/gdb/regcache.h (props changed) vendor/gdb/dist/gdb/regformats/reg-arm.dat (props changed) vendor/gdb/dist/gdb/regformats/reg-i386.dat (props changed) vendor/gdb/dist/gdb/regformats/reg-ia64.dat (props changed) vendor/gdb/dist/gdb/regformats/reg-m68k.dat (props changed) vendor/gdb/dist/gdb/regformats/reg-mips.dat (props changed) vendor/gdb/dist/gdb/regformats/reg-ppc.dat (props changed) vendor/gdb/dist/gdb/regformats/reg-s390.dat (props changed) vendor/gdb/dist/gdb/regformats/reg-s390x.dat (props changed) vendor/gdb/dist/gdb/regformats/reg-sh.dat (props changed) vendor/gdb/dist/gdb/regformats/reg-x86-64.dat (props changed) vendor/gdb/dist/gdb/regformats/regdat.sh (props changed) vendor/gdb/dist/gdb/regformats/regdef.h (props changed) vendor/gdb/dist/gdb/reggroups.c (props changed) vendor/gdb/dist/gdb/reggroups.h (props changed) vendor/gdb/dist/gdb/regset.h (props changed) vendor/gdb/dist/gdb/remote-e7000.c (props changed) vendor/gdb/dist/gdb/remote-est.c (props changed) vendor/gdb/dist/gdb/remote-fileio.c (props changed) vendor/gdb/dist/gdb/remote-fileio.h (props changed) vendor/gdb/dist/gdb/remote-hms.c (props changed) vendor/gdb/dist/gdb/remote-mips.c (props changed) vendor/gdb/dist/gdb/remote-rdi.c (props changed) vendor/gdb/dist/gdb/remote-rdp.c (props changed) vendor/gdb/dist/gdb/remote-sds.c (props changed) vendor/gdb/dist/gdb/remote-sim.c (props changed) vendor/gdb/dist/gdb/remote-st.c (props changed) vendor/gdb/dist/gdb/remote-utils.c (props changed) vendor/gdb/dist/gdb/remote-utils.h (props changed) vendor/gdb/dist/gdb/remote-vx.c (props changed) vendor/gdb/dist/gdb/remote-vx68.c (props changed) vendor/gdb/dist/gdb/remote-vxmips.c (props changed) vendor/gdb/dist/gdb/remote-vxsparc.c (props changed) vendor/gdb/dist/gdb/remote.c (props changed) vendor/gdb/dist/gdb/remote.h (props changed) vendor/gdb/dist/gdb/reply_mig_hack.awk (props changed) vendor/gdb/dist/gdb/rom68k-rom.c (props changed) vendor/gdb/dist/gdb/rs6000-nat.c (props changed) vendor/gdb/dist/gdb/rs6000-tdep.c (props changed) vendor/gdb/dist/gdb/s390-nat.c (props changed) vendor/gdb/dist/gdb/s390-tdep.c (props changed) vendor/gdb/dist/gdb/s390-tdep.h (props changed) vendor/gdb/dist/gdb/scm-exp.c (props changed) vendor/gdb/dist/gdb/scm-lang.c (props changed) vendor/gdb/dist/gdb/scm-lang.h (props changed) vendor/gdb/dist/gdb/scm-tags.h (props changed) vendor/gdb/dist/gdb/scm-valprint.c (props changed) vendor/gdb/dist/gdb/sentinel-frame.c (props changed) vendor/gdb/dist/gdb/sentinel-frame.h (props changed) vendor/gdb/dist/gdb/ser-e7kpc.c (props changed) vendor/gdb/dist/gdb/ser-go32.c (props changed) vendor/gdb/dist/gdb/ser-pipe.c (props changed) vendor/gdb/dist/gdb/ser-tcp.c (props changed) vendor/gdb/dist/gdb/ser-unix.c (props changed) vendor/gdb/dist/gdb/ser-unix.h (props changed) vendor/gdb/dist/gdb/serial.c (props changed) vendor/gdb/dist/gdb/serial.h (props changed) vendor/gdb/dist/gdb/signals/signals.c (props changed) vendor/gdb/dist/gdb/sim-regno.h (props changed) vendor/gdb/dist/gdb/sol-thread.c (props changed) vendor/gdb/dist/gdb/solib-legacy.c (props changed) vendor/gdb/dist/gdb/solib-osf.c (props changed) vendor/gdb/dist/gdb/solib-sunos.c (props changed) vendor/gdb/dist/gdb/solib-svr4.c (props changed) vendor/gdb/dist/gdb/solib-svr4.h (props changed) vendor/gdb/dist/gdb/solib.c (props changed) vendor/gdb/dist/gdb/solib.h (props changed) vendor/gdb/dist/gdb/solist.h (props changed) vendor/gdb/dist/gdb/somread.c (props changed) vendor/gdb/dist/gdb/somsolib.c (props changed) vendor/gdb/dist/gdb/somsolib.h (props changed) vendor/gdb/dist/gdb/source.c (props changed) vendor/gdb/dist/gdb/source.h (props changed) vendor/gdb/dist/gdb/sparc-nat.c (props changed) vendor/gdb/dist/gdb/sparc-nat.h (props changed) vendor/gdb/dist/gdb/sparc-sol2-nat.c (props changed) vendor/gdb/dist/gdb/sparc-sol2-tdep.c (props changed) vendor/gdb/dist/gdb/sparc-stub.c (props changed) vendor/gdb/dist/gdb/sparc-tdep.c (props changed) vendor/gdb/dist/gdb/sparc-tdep.h (props changed) vendor/gdb/dist/gdb/sparc64-nat.c (props changed) vendor/gdb/dist/gdb/sparc64-sol2-tdep.c (props changed) vendor/gdb/dist/gdb/sparc64-tdep.c (props changed) vendor/gdb/dist/gdb/sparc64-tdep.h (props changed) vendor/gdb/dist/gdb/sparc64fbsd-nat.c (props changed) vendor/gdb/dist/gdb/sparc64fbsd-tdep.c (props changed) vendor/gdb/dist/gdb/sparc64nbsd-nat.c (props changed) vendor/gdb/dist/gdb/sparc64nbsd-tdep.c (props changed) vendor/gdb/dist/gdb/sparc64obsd-tdep.c (props changed) vendor/gdb/dist/gdb/sparcnbsd-nat.c (props changed) vendor/gdb/dist/gdb/sparcnbsd-tdep.c (props changed) vendor/gdb/dist/gdb/sparcobsd-tdep.c (props changed) vendor/gdb/dist/gdb/srec.h (props changed) vendor/gdb/dist/gdb/stabsread.c (props changed) vendor/gdb/dist/gdb/stabsread.h (props changed) vendor/gdb/dist/gdb/stack.c (props changed) vendor/gdb/dist/gdb/stack.h (props changed) vendor/gdb/dist/gdb/standalone.c (props changed) vendor/gdb/dist/gdb/std-regs.c (props changed) vendor/gdb/dist/gdb/stop-gdb.c (props changed) vendor/gdb/dist/gdb/sun3-nat.c (props changed) vendor/gdb/dist/gdb/symfile.c (props changed) vendor/gdb/dist/gdb/symfile.h (props changed) vendor/gdb/dist/gdb/symmisc.c (props changed) vendor/gdb/dist/gdb/symtab.c (props changed) vendor/gdb/dist/gdb/symtab.h (props changed) vendor/gdb/dist/gdb/target.c (props changed) vendor/gdb/dist/gdb/target.h (props changed) vendor/gdb/dist/gdb/terminal.h (props changed) vendor/gdb/dist/gdb/thread-db.c (props changed) vendor/gdb/dist/gdb/thread.c (props changed) vendor/gdb/dist/gdb/top.c (props changed) vendor/gdb/dist/gdb/top.h (props changed) vendor/gdb/dist/gdb/tracepoint.c (props changed) vendor/gdb/dist/gdb/tracepoint.h (props changed) vendor/gdb/dist/gdb/trad-frame.c (props changed) vendor/gdb/dist/gdb/trad-frame.h (props changed) vendor/gdb/dist/gdb/tui/tui-command.c (props changed) vendor/gdb/dist/gdb/tui/tui-command.h (props changed) vendor/gdb/dist/gdb/tui/tui-data.c (props changed) vendor/gdb/dist/gdb/tui/tui-data.h (props changed) vendor/gdb/dist/gdb/tui/tui-disasm.c (props changed) vendor/gdb/dist/gdb/tui/tui-disasm.h (props changed) vendor/gdb/dist/gdb/tui/tui-file.c (props changed) vendor/gdb/dist/gdb/tui/tui-file.h (props changed) vendor/gdb/dist/gdb/tui/tui-hooks.c (props changed) vendor/gdb/dist/gdb/tui/tui-hooks.h (props changed) vendor/gdb/dist/gdb/tui/tui-interp.c (props changed) vendor/gdb/dist/gdb/tui/tui-io.c (props changed) vendor/gdb/dist/gdb/tui/tui-io.h (props changed) vendor/gdb/dist/gdb/tui/tui-layout.c (props changed) vendor/gdb/dist/gdb/tui/tui-layout.h (props changed) vendor/gdb/dist/gdb/tui/tui-main.c (props changed) vendor/gdb/dist/gdb/tui/tui-out.c (props changed) vendor/gdb/dist/gdb/tui/tui-regs.c (props changed) vendor/gdb/dist/gdb/tui/tui-regs.h (props changed) vendor/gdb/dist/gdb/tui/tui-source.c (props changed) vendor/gdb/dist/gdb/tui/tui-source.h (props changed) vendor/gdb/dist/gdb/tui/tui-stack.c (props changed) vendor/gdb/dist/gdb/tui/tui-stack.h (props changed) vendor/gdb/dist/gdb/tui/tui-win.c (props changed) vendor/gdb/dist/gdb/tui/tui-win.h (props changed) vendor/gdb/dist/gdb/tui/tui-windata.c (props changed) vendor/gdb/dist/gdb/tui/tui-windata.h (props changed) vendor/gdb/dist/gdb/tui/tui-wingeneral.c (props changed) vendor/gdb/dist/gdb/tui/tui-wingeneral.h (props changed) vendor/gdb/dist/gdb/tui/tui-winsource.c (props changed) vendor/gdb/dist/gdb/tui/tui-winsource.h (props changed) vendor/gdb/dist/gdb/tui/tui.c (props changed) vendor/gdb/dist/gdb/tui/tui.h (props changed) vendor/gdb/dist/gdb/typeprint.c (props changed) vendor/gdb/dist/gdb/typeprint.h (props changed) vendor/gdb/dist/gdb/ui-file.c (props changed) vendor/gdb/dist/gdb/ui-file.h (props changed) vendor/gdb/dist/gdb/ui-out.c (props changed) vendor/gdb/dist/gdb/ui-out.h (props changed) vendor/gdb/dist/gdb/user-regs.c (props changed) vendor/gdb/dist/gdb/user-regs.h (props changed) vendor/gdb/dist/gdb/utils.c (props changed) vendor/gdb/dist/gdb/uw-thread.c (props changed) vendor/gdb/dist/gdb/valarith.c (props changed) vendor/gdb/dist/gdb/valops.c (props changed) vendor/gdb/dist/gdb/valprint.c (props changed) vendor/gdb/dist/gdb/valprint.h (props changed) vendor/gdb/dist/gdb/value.h (props changed) vendor/gdb/dist/gdb/values.c (props changed) vendor/gdb/dist/gdb/varobj.c (props changed) vendor/gdb/dist/gdb/varobj.h (props changed) vendor/gdb/dist/gdb/version.h (props changed) vendor/gdb/dist/gdb/version.in (props changed) vendor/gdb/dist/gdb/win32-nat.c (props changed) vendor/gdb/dist/gdb/wince-stub.c (props changed) vendor/gdb/dist/gdb/wince-stub.h (props changed) vendor/gdb/dist/gdb/wince.c (props changed) vendor/gdb/dist/gdb/wrapper.c (props changed) vendor/gdb/dist/gdb/wrapper.h (props changed) vendor/gdb/dist/gdb/xcoffread.c (props changed) vendor/gdb/dist/gdb/xcoffsolib.c (props changed) vendor/gdb/dist/gdb/xcoffsolib.h (props changed) vendor/gdb/dist/gdb/xmodem.c (props changed) vendor/gdb/dist/gdb/xmodem.h (props changed) vendor/gdb/dist/include/COPYING (props changed) vendor/gdb/dist/include/MAINTAINERS (props changed) vendor/gdb/dist/include/alloca-conf.h (props changed) vendor/gdb/dist/include/ansidecl.h (props changed) vendor/gdb/dist/include/bfdlink.h (props changed) vendor/gdb/dist/include/bin-bugs.h (props changed) vendor/gdb/dist/include/bout.h (props changed) vendor/gdb/dist/include/demangle.h (props changed) vendor/gdb/dist/include/dis-asm.h (props changed) vendor/gdb/dist/include/dyn-string.h (props changed) vendor/gdb/dist/include/fibheap.h (props changed) vendor/gdb/dist/include/filenames.h (props changed) vendor/gdb/dist/include/floatformat.h (props changed) vendor/gdb/dist/include/fnmatch.h (props changed) vendor/gdb/dist/include/fopen-bin.h (props changed) vendor/gdb/dist/include/fopen-same.h (props changed) vendor/gdb/dist/include/fopen-vms.h (props changed) vendor/gdb/dist/include/gdb/callback.h (props changed) vendor/gdb/dist/include/gdb/fileio.h (props changed) vendor/gdb/dist/include/gdb/remote-sim.h (props changed) vendor/gdb/dist/include/gdb/signals.h (props changed) vendor/gdb/dist/include/gdb/sim-arm.h (props changed) vendor/gdb/dist/include/gdb/sim-d10v.h (props changed) vendor/gdb/dist/include/gdb/sim-frv.h (props changed) vendor/gdb/dist/include/gdb/sim-h8300.h (props changed) vendor/gdb/dist/include/gdb/sim-sh.h (props changed) vendor/gdb/dist/include/gdbm.h (props changed) vendor/gdb/dist/include/getopt.h (props changed) vendor/gdb/dist/include/hashtab.h (props changed) vendor/gdb/dist/include/hp-symtab.h (props changed) vendor/gdb/dist/include/ieee.h (props changed) vendor/gdb/dist/include/libiberty.h (props changed) vendor/gdb/dist/include/md5.h (props changed) vendor/gdb/dist/include/oasys.h (props changed) vendor/gdb/dist/include/objalloc.h (props changed) vendor/gdb/dist/include/obstack.h (props changed) vendor/gdb/dist/include/os9k.h (props changed) vendor/gdb/dist/include/partition.h (props changed) vendor/gdb/dist/include/progress.h (props changed) vendor/gdb/dist/include/safe-ctype.h (props changed) vendor/gdb/dist/include/sort.h (props changed) vendor/gdb/dist/include/splay-tree.h (props changed) vendor/gdb/dist/include/symcat.h (props changed) vendor/gdb/dist/include/ternary.h (props changed) vendor/gdb/dist/include/xregex.h (props changed) vendor/gdb/dist/include/xregex2.h (props changed) vendor/gdb/dist/include/xtensa-isa-internal.h (props changed) vendor/gdb/dist/include/xtensa-isa.h (props changed) Copied: vendor/gdb/dist/COPYING (from r190776, vendor/gdb/dist/contrib/gdb/COPYING) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/gdb/dist/COPYING Tue Apr 7 01:13:44 2009 (r190788, copy of r190776, vendor/gdb/dist/contrib/gdb/COPYING) @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) 19yy + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. Copied: vendor/gdb/dist/COPYING.LIB (from r190776, vendor/gdb/dist/contrib/gdb/COPYING.LIB) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/gdb/dist/COPYING.LIB Tue Apr 7 01:13:44 2009 (r190788, copy of r190776, vendor/gdb/dist/contrib/gdb/COPYING.LIB) @@ -0,0 +1,482 @@ + GNU LIBRARY GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1991 Free Software Foundation, Inc. + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the library GPL. It is + numbered 2 because it goes with version 2 of the ordinary GPL.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Library General Public License, applies to some +specially designated Free Software Foundation software, and to any +other libraries whose authors decide to use it. You can use it for +your libraries, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if +you distribute copies of the library, or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link a program with the library, you must provide +complete object files to the recipients so that they can relink them +with the library, after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + Our method of protecting your rights has two steps: (1) copyright +the library, and (2) offer you this license which gives you legal +permission to copy, distribute and/or modify the library. + + Also, for each distributor's protection, we want to make certain +that everyone understands that there is no warranty for this free +library. If the library is modified by someone else and passed on, we +want its recipients to know that what they have is not the original +version, so that any problems introduced by others will not reflect on +the original authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that companies distributing free +software will individually obtain patent licenses, thus in effect +transforming the program into proprietary software. To prevent this, +we have made it clear that any patent must be licensed for everyone's +free use or not licensed at all. + + Most GNU software, including some libraries, is covered by the ordinary +GNU General Public License, which was designed for utility programs. This +license, the GNU Library General Public License, applies to certain +designated libraries. This license is quite different from the ordinary +one; be sure to read it in full, and don't assume that anything in it is +the same as in the ordinary license. + + The reason we have a separate public license for some libraries is that +they blur the distinction we usually make between modifying or adding to a +program and simply using it. Linking a program with a library, without +changing the library, is in some sense simply using the library, and is +analogous to running a utility program or application program. However, in +a textual and legal sense, the linked executable is a combined work, a +derivative of the original library, and the ordinary General Public License +treats it as such. + + Because of this blurred distinction, using the ordinary General +Public License for libraries did not effectively promote software +sharing, because most developers did not use the libraries. We +concluded that weaker conditions might promote sharing better. + + However, unrestricted linking of non-free programs would deprive the +users of those programs of all benefit from the free status of the +libraries themselves. This Library General Public License is intended to +permit developers of non-free programs to use free libraries, while +preserving your freedom as a user of such programs to change the free +libraries that are incorporated in them. (We have not seen how to achieve +this as regards changes in header files, but we have achieved it as regards +changes in the actual functions of the Library.) The hope is that this +will lead to faster development of free libraries. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, while the latter only +works together with the library. + + Note that it is possible for a library to be covered by the ordinary +General Public License rather than by this special one. + + GNU LIBRARY GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library which +contains a notice placed by the copyright holder or other authorized +party saying it may be distributed under the terms of this Library +General Public License (also called "this License"). Each licensee is +addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distributio