PERFORCE change 111126 for review
Matt Jacob
mjacob at FreeBSD.org
Mon Dec 4 23:54:23 PST 2006
http://perforce.freebsd.org/chv.cgi?CH=111126
Change 111126 by mjacob at newisp on 2006/12/05 07:53:48
IFC
Affected files ...
.. //depot/projects/newisp/amd64/conf/GENERIC#6 integrate
.. //depot/projects/newisp/amd64/isa/clock.c#3 integrate
.. //depot/projects/newisp/amd64/linux32/linux32_sysvec.c#4 integrate
.. //depot/projects/newisp/arm/arm/cpufunc.c#5 integrate
.. //depot/projects/newisp/arm/arm/pmap.c#4 integrate
.. //depot/projects/newisp/arm/include/cpuconf.h#3 integrate
.. //depot/projects/newisp/arm/xscale/i80321/i80321_space.c#3 integrate
.. //depot/projects/newisp/cam/cam_ccb.h#5 integrate
.. //depot/projects/newisp/cam/cam_xpt.c#13 integrate
.. //depot/projects/newisp/cam/scsi/scsi_all.h#4 integrate
.. //depot/projects/newisp/compat/linsysfs/linsysfs.c#2 integrate
.. //depot/projects/newisp/compat/linux/linux_misc.c#10 integrate
.. //depot/projects/newisp/compat/linux/linux_stats.c#4 integrate
.. //depot/projects/newisp/dev/ath/if_ath_pci.c#2 integrate
.. //depot/projects/newisp/dev/bge/if_bge.c#12 integrate
.. //depot/projects/newisp/dev/bge/if_bgereg.h#6 integrate
.. //depot/projects/newisp/dev/ep/if_ep.c#2 integrate
.. //depot/projects/newisp/dev/fxp/if_fxp.c#6 integrate
.. //depot/projects/newisp/dev/hme/if_hme.c#2 integrate
.. //depot/projects/newisp/dev/iicbus/iicbb.c#3 integrate
.. //depot/projects/newisp/dev/iicbus/iicbus_if.m#2 integrate
.. //depot/projects/newisp/dev/iicbus/iiconf.c#2 integrate
.. //depot/projects/newisp/dev/iicbus/iiconf.h#3 integrate
.. //depot/projects/newisp/dev/isp/isp_freebsd.c#31 integrate
.. //depot/projects/newisp/dev/mii/acphy.c#2 integrate
.. //depot/projects/newisp/dev/mii/amphy.c#2 integrate
.. //depot/projects/newisp/dev/mii/bmtphy.c#3 integrate
.. //depot/projects/newisp/dev/mii/brgphy.c#3 integrate
.. //depot/projects/newisp/dev/mii/ciphy.c#3 integrate
.. //depot/projects/newisp/dev/mii/inphy.c#2 integrate
.. //depot/projects/newisp/dev/mii/ip1000phy.c#2 integrate
.. //depot/projects/newisp/dev/mii/lxtphy.c#3 integrate
.. //depot/projects/newisp/dev/mii/mii_physubr.c#3 integrate
.. //depot/projects/newisp/dev/mii/miidevs#3 integrate
.. //depot/projects/newisp/dev/mii/miivar.h#3 integrate
.. //depot/projects/newisp/dev/mii/mlphy.c#2 integrate
.. //depot/projects/newisp/dev/mii/nsgphy.c#3 integrate
.. //depot/projects/newisp/dev/mii/nsphy.c#3 integrate
.. //depot/projects/newisp/dev/mii/pnaphy.c#2 integrate
.. //depot/projects/newisp/dev/mii/qsphy.c#3 integrate
.. //depot/projects/newisp/dev/mii/rgephy.c#2 integrate
.. //depot/projects/newisp/dev/mii/rlphy.c#3 integrate
.. //depot/projects/newisp/dev/mii/tdkphy.c#2 integrate
.. //depot/projects/newisp/dev/mii/tlphy.c#2 integrate
.. //depot/projects/newisp/dev/mii/xmphy.c#2 integrate
.. //depot/projects/newisp/dev/mpt/mpt.c#5 integrate
.. //depot/projects/newisp/dev/mpt/mpt.h#7 integrate
.. //depot/projects/newisp/dev/mpt/mpt_cam.c#17 integrate
.. //depot/projects/newisp/dev/mpt/mpt_raid.c#5 integrate
.. //depot/projects/newisp/dev/sound/pci/hda/hdac.c#5 integrate
.. //depot/projects/newisp/dev/sound/pci/ich.c#3 integrate
.. //depot/projects/newisp/fs/msdosfs/msdosfs_vnops.c#4 integrate
.. //depot/projects/newisp/fs/unionfs/union.h#2 integrate
.. //depot/projects/newisp/fs/unionfs/union_subr.c#2 integrate
.. //depot/projects/newisp/fs/unionfs/union_vfsops.c#3 integrate
.. //depot/projects/newisp/fs/unionfs/union_vnops.c#2 integrate
.. //depot/projects/newisp/geom/journal/g_journal.c#3 integrate
.. //depot/projects/newisp/i386/isa/clock.c#3 integrate
.. //depot/projects/newisp/kern/kern_thr.c#6 integrate
.. //depot/projects/newisp/kern/kern_umtx.c#11 integrate
.. //depot/projects/newisp/kern/subr_lock.c#3 integrate
.. //depot/projects/newisp/kern/subr_rman.c#3 integrate
.. //depot/projects/newisp/modules/Makefile#7 integrate
.. //depot/projects/newisp/net/bridgestp.c#7 integrate
.. //depot/projects/newisp/net/bridgestp.h#5 integrate
.. //depot/projects/newisp/net/ethernet.h#3 integrate
.. //depot/projects/newisp/net/if_atmsubr.c#3 integrate
.. //depot/projects/newisp/net/if_bridge.c#9 integrate
.. //depot/projects/newisp/net/if_bridgevar.h#5 integrate
.. //depot/projects/newisp/net/if_llc.h#2 integrate
.. //depot/projects/newisp/net80211/ieee80211.h#2 integrate
.. //depot/projects/newisp/net80211/ieee80211_input.c#3 integrate
.. //depot/projects/newisp/net80211/ieee80211_output.c#3 integrate
.. //depot/projects/newisp/netgraph/ng_nat.c#3 integrate
.. //depot/projects/newisp/netinet/igmp.c#3 integrate
.. //depot/projects/newisp/netinet/ip_carp.h#2 integrate
.. //depot/projects/newisp/netinet/libalias/alias.c#3 integrate
.. //depot/projects/newisp/netinet/libalias/alias.h#3 integrate
.. //depot/projects/newisp/pci/if_rl.c#3 integrate
.. //depot/projects/newisp/pci/if_rlreg.h#3 integrate
.. //depot/projects/newisp/powerpc/include/pmap.h#2 integrate
.. //depot/projects/newisp/powerpc/powerpc/mmu_if.m#2 integrate
.. //depot/projects/newisp/powerpc/powerpc/mmu_oea.c#4 integrate
.. //depot/projects/newisp/powerpc/powerpc/pmap_dispatch.c#3 integrate
.. //depot/projects/newisp/powerpc/powerpc/uio_machdep.c#2 integrate
.. //depot/projects/newisp/sun4v/conf/GENERIC#4 integrate
.. //depot/projects/newisp/sun4v/include/tsb.h#3 integrate
.. //depot/projects/newisp/sun4v/sun4v/pmap.c#6 integrate
.. //depot/projects/newisp/sun4v/sun4v/tsb.c#3 integrate
.. //depot/projects/newisp/sys/proc.h#5 integrate
.. //depot/projects/newisp/sys/umtx.h#6 integrate
Differences ...
==== //depot/projects/newisp/amd64/conf/GENERIC#6 (text+ko) ====
@@ -16,7 +16,7 @@
# If you are in doubt as to the purpose or necessity of a line, check first
# in NOTES.
#
-# $FreeBSD: src/sys/amd64/conf/GENERIC,v 1.469 2006/11/22 10:34:12 ru Exp $
+# $FreeBSD: src/sys/amd64/conf/GENERIC,v 1.470 2006/12/03 21:02:09 netchild Exp $
cpu HAMMER
ident GENERIC
@@ -71,11 +71,6 @@
# Make an SMP-capable kernel by default
options SMP # Symmetric MultiProcessor Kernel
-# Linux 32-bit ABI support
-options COMPAT_LINUX32 # Compatible with i386 linux binaries
-options LINPROCFS
-options LINSYSFS
-
# Bus support.
device acpi
device pci
==== //depot/projects/newisp/amd64/isa/clock.c#3 (text+ko) ====
@@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/isa/clock.c,v 1.227 2006/10/02 18:23:36 phk Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/isa/clock.c,v 1.228 2006/12/03 03:49:28 bde Exp $");
/*
* Routines to handle clock hardware.
@@ -115,6 +115,7 @@
static int (*i8254_pending)(struct intsrc *);
static int i8254_ticked;
static int using_lapic_timer;
+static int rtc_reg = -1;
static u_char rtc_statusa = RTCSA_DIVIDER | RTCSA_NOPROF;
static u_char rtc_statusb = RTCSB_24HR;
@@ -421,24 +422,30 @@
u_char val;
RTC_LOCK;
- outb(IO_RTC, reg);
- inb(0x84);
+ if (rtc_reg != reg) {
+ inb(0x84);
+ outb(IO_RTC, reg);
+ rtc_reg = reg;
+ inb(0x84);
+ }
val = inb(IO_RTC + 1);
- inb(0x84);
RTC_UNLOCK;
return (val);
}
-static __inline void
-writertc(u_char reg, u_char val)
+static void
+writertc(int reg, u_char val)
{
RTC_LOCK;
- inb(0x84);
- outb(IO_RTC, reg);
+ if (rtc_reg != reg) {
+ inb(0x84);
+ outb(IO_RTC, reg);
+ rtc_reg = reg;
+ inb(0x84);
+ }
+ outb(IO_RTC + 1, val);
inb(0x84);
- outb(IO_RTC + 1, val);
- inb(0x84); /* XXX work around wrong order in rtcin() */
RTC_UNLOCK;
}
==== //depot/projects/newisp/amd64/linux32/linux32_sysvec.c#4 (text+ko) ====
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/linux32/linux32_sysvec.c,v 1.25 2006/10/31 17:53:02 kib Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/linux32/linux32_sysvec.c,v 1.26 2006/12/03 21:06:07 netchild Exp $");
#include "opt_compat.h"
#ifndef COMPAT_IA32
@@ -1120,7 +1120,7 @@
printf("Could not deinstall ELF interpreter entry\n");
break;
default:
- break;
+ return EOPNOTSUPP;
}
return error;
}
==== //depot/projects/newisp/arm/arm/cpufunc.c#5 (text+ko) ====
@@ -45,7 +45,7 @@
* Created : 30/01/97
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/arm/arm/cpufunc.c,v 1.14 2006/11/19 23:55:23 sam Exp $");
+__FBSDID("$FreeBSD: src/sys/arm/arm/cpufunc.c,v 1.15 2006/11/30 23:34:07 cognet Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -1885,7 +1885,9 @@
xscale_setup(args)
char *args;
{
+#ifndef CPU_XSCALE_CORE3
uint32_t auxctl;
+#endif
int cpuctrl, cpuctrlmask;
/*
@@ -1931,6 +1933,7 @@
/* cpu_control(cpuctrlmask, cpuctrl);*/
cpu_control(0xffffffff, cpuctrl);
+#ifndef CPU_XSCALE_CORE3
/* Make sure write coalescing is turned on */
__asm __volatile("mrc p15, 0, %0, c1, c0, 1"
: "=r" (auxctl));
@@ -1941,6 +1944,7 @@
#endif
__asm __volatile("mcr p15, 0, %0, c1, c0, 1"
: : "r" (auxctl));
+#endif
}
#endif /* CPU_XSCALE_80200 || CPU_XSCALE_80321 || CPU_XSCALE_PXA2X0 || CPU_XSCALE_IXP425
CPU_XSCALE_80219 */
==== //depot/projects/newisp/arm/arm/pmap.c#4 (text+ko) ====
@@ -147,7 +147,7 @@
#include "opt_vm.h"
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/arm/arm/pmap.c,v 1.73 2006/11/12 21:48:32 alc Exp $");
+__FBSDID("$FreeBSD: src/sys/arm/arm/pmap.c,v 1.77 2006/12/04 12:55:00 cognet Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
@@ -585,7 +585,7 @@
#endif /* ARM_MMU_SA1 == 1*/
#if ARM_MMU_XSCALE == 1
-#if (ARM_NMMUS > 1)
+#if (ARM_NMMUS > 1) || defined (CPU_XSCALE_CORE3)
static u_int xscale_use_minidata;
#endif
@@ -614,9 +614,11 @@
* is significantly faster than the traditional, write-through
* behavior of this case.
*/
+#ifndef CPU_XSCALE_CORE3
pte_l1_s_cache_mode |= L1_S_XSCALE_TEX(TEX_XSCALE_X);
pte_l2_l_cache_mode |= L2_XSCALE_L_TEX(TEX_XSCALE_X);
pte_l2_s_cache_mode |= L2_XSCALE_T_TEX(TEX_XSCALE_X);
+#endif
#endif /* XSCALE_CACHE_READ_WRITE_ALLOCATE */
#ifdef XSCALE_CACHE_WRITE_THROUGH
/*
@@ -673,8 +675,16 @@
pte_l1_c_proto = L1_C_PROTO_xscale;
pte_l2_s_proto = L2_S_PROTO_xscale;
+#ifdef CPU_XSCALE_CORE3
+ pmap_copy_page_func = pmap_copy_page_generic;
+ pmap_zero_page_func = pmap_zero_page_generic;
+ xscale_use_minidata = 0;
+ pte_l1_s_cache_mode_pt = pte_l2_l_cache_mode_pt =
+ pte_l2_s_cache_mode_pt = 0;
+#else
pmap_copy_page_func = pmap_copy_page_xscale;
pmap_zero_page_func = pmap_zero_page_xscale;
+#endif
/*
* Disable ECC protection of page table access, for now.
@@ -2797,6 +2807,7 @@
if (TAILQ_EMPTY(&m->md.pv_list))
vm_page_flag_clear(m, PG_WRITEABLE);
pmap_free_pv_entry(pv);
+ pmap_free_l2_bucket(pmap, l2b, 1);
}
vm_page_unlock_queues();
cpu_idcache_wbinv_all();
@@ -3136,6 +3147,7 @@
if (TAILQ_EMPTY(&m->md.pv_list))
return;
+ mtx_assert(&vm_page_queue_mtx, MA_OWNED);
curpm = vmspace_pmap(curproc->p_vmspace);
while ((pv = TAILQ_FIRST(&m->md.pv_list)) != NULL) {
if (flush == FALSE && (pv->pv_pmap == curpm ||
@@ -3437,7 +3449,8 @@
else if (!pve &&
!(m->flags & (PG_UNMANAGED | PG_FICTITIOUS)))
pve = pmap_get_pv_entry();
- KASSERT(pve != NULL, ("No pv"));
+ KASSERT(pve != NULL || m->flags & (PG_UNMANAGED |
+ PG_FICTITIOUS), ("No pv"));
oflags = pve->pv_flags;
/*
@@ -4005,7 +4018,7 @@
* StrongARM accesses to non-cached pages are non-burst making writing
* _any_ bulk data very slow.
*/
-#if (ARM_MMU_GENERIC + ARM_MMU_SA1) != 0
+#if (ARM_MMU_GENERIC + ARM_MMU_SA1) != 0 || defined(CPU_XSCALE_CORE3)
void
pmap_zero_page_generic(vm_paddr_t phys, int off, int size)
{
@@ -4094,7 +4107,7 @@
pt_entry_t *ptep, *sptep, pte;
vm_offset_t next_bucket, eva;
-#if (ARM_NMMUS > 1)
+#if (ARM_NMMUS > 1) || defined(CPU_XSCALE_CORE3)
if (xscale_use_minidata == 0)
return;
#endif
@@ -4267,7 +4280,7 @@
* hook points. The same comment regarding cachability as in
* pmap_zero_page also applies here.
*/
-#if (ARM_MMU_GENERIC + ARM_MMU_SA1) != 0
+#if (ARM_MMU_GENERIC + ARM_MMU_SA1) != 0 || defined (CPU_XSCALE_CORE3)
void
pmap_copy_page_generic(vm_paddr_t src, vm_paddr_t dst)
{
@@ -4430,6 +4443,9 @@
int
pmap_ts_referenced(vm_page_t m)
{
+
+ if (m->flags & PG_FICTITIOUS)
+ return (0);
return (pmap_clearbit(m, PVF_REF));
}
==== //depot/projects/newisp/arm/include/cpuconf.h#3 (text+ko) ====
@@ -34,7 +34,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- * $FreeBSD: src/sys/arm/include/cpuconf.h,v 1.9 2006/11/07 22:36:56 cognet Exp $
+ * $FreeBSD: src/sys/arm/include/cpuconf.h,v 1.10 2006/11/30 23:30:40 cognet Exp $
*
*/
@@ -139,4 +139,7 @@
#define ARM_XSCALE_PMU 0
#endif
+#if defined(CPU_XSCALE_81342)
+#define CPU_XSCALE_CORE3
+#endif
#endif /* _MACHINE_CPUCONF_H_ */
==== //depot/projects/newisp/arm/xscale/i80321/i80321_space.c#3 (text+ko) ====
@@ -40,7 +40,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/arm/xscale/i80321/i80321_space.c,v 1.6 2006/11/20 13:21:02 kevlo Exp $");
+__FBSDID("$FreeBSD: src/sys/arm/xscale/i80321/i80321_space.c,v 1.7 2006/12/02 13:37:29 cognet Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -139,6 +139,42 @@
generic_armv4_bs_c_2,
NULL,
NULL,
+
+ /* read (single) stream */
+ generic_bs_r_1,
+ generic_armv4_bs_r_2,
+ generic_bs_r_4,
+ NULL,
+
+ /* read multiple stream */
+ generic_bs_rm_1,
+ generic_armv4_bs_rm_2,
+ generic_bs_rm_4,
+ NULL,
+
+ /* read region stream */
+ generic_bs_rr_1,
+ generic_armv4_bs_rr_2,
+ generic_bs_rr_4,
+ NULL,
+
+ /* write (single) stream */
+ generic_bs_w_1,
+ generic_armv4_bs_w_2,
+ generic_bs_w_4,
+ NULL,
+
+ /* write multiple stream */
+ generic_bs_wm_1,
+ generic_armv4_bs_wm_2,
+ generic_bs_wm_4,
+ NULL,
+
+ /* write region stream */
+ NULL,
+ generic_armv4_bs_wr_2,
+ generic_bs_wr_4,
+ NULL,
};
void
==== //depot/projects/newisp/cam/cam_ccb.h#5 (text+ko) ====
@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/sys/cam/cam_ccb.h,v 1.33 2006/11/02 00:54:32 mjacob Exp $
+ * $FreeBSD: src/sys/cam/cam_ccb.h,v 1.34 2006/12/03 07:19:28 mjacob Exp $
*/
#ifndef _CAM_CAM_CCB_H
==== //depot/projects/newisp/cam/cam_xpt.c#13 (text+ko) ====
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/cam/cam_xpt.c,v 1.168 2006/11/07 23:06:00 mjacob Exp $");
+__FBSDID("$FreeBSD: src/sys/cam/cam_xpt.c,v 1.169 2006/12/04 23:04:13 mjacob Exp $");
#include <sys/param.h>
#include <sys/bus.h>
==== //depot/projects/newisp/cam/scsi/scsi_all.h#4 (text+ko) ====
@@ -14,7 +14,7 @@
*
* Ported to run under 386BSD by Julian Elischer (julian at tfs.com) Sept 1992
*
- * $FreeBSD: src/sys/cam/scsi/scsi_all.h,v 1.27 2006/11/03 05:42:15 njl Exp $
+ * $FreeBSD: src/sys/cam/scsi/scsi_all.h,v 1.28 2006/12/04 23:04:13 mjacob Exp $
*/
/*
==== //depot/projects/newisp/compat/linsysfs/linsysfs.c#2 (text) ====
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/linsysfs/linsysfs.c,v 1.2 2006/05/11 15:27:58 ambrisko Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/linsysfs/linsysfs.c,v 1.3 2006/12/03 21:00:31 netchild Exp $");
#include <sys/param.h>
#include <sys/queue.h>
@@ -268,9 +268,10 @@
static int
linsysfs_uninit(PFS_INIT_ARGS)
{
- struct scsi_host_queue *scsi_host;
+ struct scsi_host_queue *scsi_host, *scsi_host_tmp;
- TAILQ_FOREACH(scsi_host, &scsi_host_q, scsi_host_next) {
+ TAILQ_FOREACH_SAFE(scsi_host, &scsi_host_q, scsi_host_next,
+ scsi_host_tmp) {
TAILQ_REMOVE(&scsi_host_q, scsi_host, scsi_host_next);
free(scsi_host->path, M_TEMP);
free(scsi_host, M_TEMP);
==== //depot/projects/newisp/compat/linux/linux_misc.c#10 (text+ko) ====
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/linux/linux_misc.c,v 1.197 2006/11/18 14:37:54 kib Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/linux/linux_misc.c,v 1.199 2006/12/04 22:46:09 jkim Exp $");
#include "opt_compat.h"
#include "opt_mac.h"
@@ -890,11 +890,34 @@
printf(ARGS(mknod, "%s, %d, %d"), path, args->mode, args->dev);
#endif
- if (S_ISFIFO(args->mode))
+ switch (args->mode & S_IFMT) {
+ case S_IFIFO:
+ case S_IFSOCK:
error = kern_mkfifo(td, path, UIO_SYSSPACE, args->mode);
- else
+ break;
+
+ case S_IFCHR:
+ case S_IFBLK:
error = kern_mknod(td, path, UIO_SYSSPACE, args->mode,
args->dev);
+ break;
+
+ case S_IFDIR:
+ error = EPERM;
+ break;
+
+ case 0:
+ args->mode |= S_IFREG;
+ /* fall through */
+ case S_IFREG:
+ error = kern_open(td, path, UIO_SYSSPACE,
+ O_WRONLY | O_CREAT | O_TRUNC, args->mode);
+ break;
+
+ default:
+ error = EINVAL;
+ break;
+ }
LFREEPATH(path);
return (error);
}
@@ -1588,7 +1611,7 @@
int
linux_prctl(struct thread *td, struct linux_prctl_args *args)
{
- int error = 0;
+ int error = 0, max_size;
struct proc *p = td->td_proc;
char comm[LINUX_MAX_COMM_LEN];
struct linux_emuldata *em;
@@ -1615,16 +1638,41 @@
EMUL_UNLOCK(&emul_lock);
break;
case LINUX_PR_SET_NAME:
- comm[LINUX_MAX_COMM_LEN-1] = 0;
- error = copyin(comm, (void *)(register_t) args->arg2, LINUX_MAX_COMM_LEN-1);
+ /*
+ * To be on the safe side we need to make sure to not
+ * overflow the size a linux program expects. We already
+ * do this here in the copyin, so that we don't need to
+ * check on copyout.
+ */
+ max_size = MIN(sizeof(comm), sizeof(p->p_comm));
+ error = copyinstr((void *)(register_t) args->arg2, comm,
+ max_size, NULL);
+
+ /* Linux silently truncates the name if it is too long. */
+ if (error == ENAMETOOLONG) {
+ /*
+ * XXX: copyinstr() isn't documented to populate the
+ * array completely, so do a copyin() to be on the
+ * safe side. This should be changed in case
+ * copyinstr() is changed to guarantee this.
+ */
+ error = copyin((void *)(register_t)args->arg2, comm,
+ max_size - 1);
+ comm[max_size - 1] = '\0';
+ }
if (error)
return (error);
+
PROC_LOCK(p);
- strcpy(p->p_comm, comm);
+ strlcpy(p->p_comm, comm, sizeof(p->p_comm));
PROC_UNLOCK(p);
break;
case LINUX_PR_GET_NAME:
- error = copyout(&p->p_comm, (void *)(register_t) args->arg2, MAXCOMLEN+1);
+ PROC_LOCK(p);
+ strlcpy(comm, p->p_comm, sizeof(comm));
+ PROC_UNLOCK(p);
+ error = copyout(comm, (void *)(register_t) args->arg2,
+ strlen(comm)+1);
break;
default:
error = EINVAL;
==== //depot/projects/newisp/compat/linux/linux_stats.c#4 (text+ko) ====
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/linux/linux_stats.c,v 1.85 2006/10/22 11:52:11 rwatson Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/linux/linux_stats.c,v 1.86 2006/12/04 22:38:52 jkim Exp $");
#include "opt_compat.h"
#include "opt_mac.h"
@@ -100,23 +100,16 @@
translate_fd_major_minor(struct thread *td, int fd, struct stat *buf)
{
struct file *fp;
- int error;
int major, minor;
- if ((error = fget(td, fd, &fp)) != 0)
+ if ((!S_ISCHR(buf->st_mode) && !S_ISBLK(buf->st_mode)) ||
+ fget(td, fd, &fp) != 0)
return;
- if (fp->f_vnode) {
- if (fp->f_vnode->v_type == VCHR
- || fp->f_vnode->v_type == VBLK) {
- if (fp->f_vnode->v_un.vu_cdev) {
- if (linux_driver_get_major_minor(
- fp->f_vnode->v_un.vu_cdev->si_name,
- &major, &minor) == 0) {
- buf->st_rdev = (major << 8 | minor);
- }
- }
- }
- }
+ if (fp->f_vnode != NULL &&
+ fp->f_vnode->v_un.vu_cdev != NULL &&
+ linux_driver_get_major_minor(fp->f_vnode->v_un.vu_cdev->si_name,
+ &major, &minor) == 0)
+ buf->st_rdev = (major << 8 | minor);
fdrop(fp, td);
}
@@ -129,6 +122,8 @@
int fd;
int temp;
+ if (!S_ISCHR(buf->st_mode) && !S_ISBLK(buf->st_mode))
+ return;
temp = td->td_retval[0];
if (kern_open(td, path, UIO_SYSSPACE, O_RDONLY, 0) != 0)
return;
@@ -179,18 +174,19 @@
#endif
error = kern_stat(td, path, UIO_SYSSPACE, &buf);
- if (!error && strlen(path) > strlen("/dev/pts/") &&
- !strncmp(path, "/dev/pts/", strlen("/dev/pts/"))
- && path[9] >= '0' && path[9] <= '9') {
- /*
- * Linux checks major and minors of the slave device to make
- * sure it's a pty device, so let's make him believe it is.
- */
- buf.st_rdev = (136 << 8);
- }
-
- translate_path_major_minor(td, path, &buf);
-
+ if (!error) {
+ if (strlen(path) > strlen("/dev/pts/") &&
+ !strncmp(path, "/dev/pts/", strlen("/dev/pts/")) &&
+ path[9] >= '0' && path[9] <= '9') {
+ /*
+ * Linux checks major and minors of the slave device
+ * to make sure it's a pty device, so let's make him
+ * believe it is.
+ */
+ buf.st_rdev = (136 << 8);
+ } else
+ translate_path_major_minor(td, path, &buf);
+ }
LFREEPATH(path);
if (error)
return (error);
@@ -212,7 +208,8 @@
#endif
error = kern_lstat(td, path, UIO_SYSSPACE, &sb);
- translate_path_major_minor(td, path, &sb);
+ if (!error)
+ translate_path_major_minor(td, path, &sb);
LFREEPATH(path);
if (error)
return (error);
@@ -524,18 +521,19 @@
#endif
error = kern_stat(td, filename, UIO_SYSSPACE, &buf);
- if (!error && strlen(filename) > strlen("/dev/pts/") &&
- !strncmp(filename, "/dev/pts/", strlen("/dev/pts/"))
- && filename[9] >= '0' && filename[9] <= '9') {
- /*
- * Linux checks major and minors of the slave device to make
- * sure it's a pty deivce, so let's make him believe it is.
- */
- buf.st_rdev = (136 << 8);
+ if (!error) {
+ if (strlen(filename) > strlen("/dev/pts/") &&
+ !strncmp(filename, "/dev/pts/", strlen("/dev/pts/")) &&
+ filename[9] >= '0' && filename[9] <= '9') {
+ /*
+ * Linux checks major and minors of the slave device
+ * to make sure it's a pty deivce, so let's make him
+ * believe it is.
+ */
+ buf.st_rdev = (136 << 8);
+ } else
+ translate_path_major_minor(td, filename, &buf);
}
-
- translate_path_major_minor(td, filename, &buf);
-
LFREEPATH(filename);
if (error)
return (error);
@@ -557,7 +555,8 @@
#endif
error = kern_lstat(td, filename, UIO_SYSSPACE, &sb);
- translate_path_major_minor(td, filename, &sb);
+ if (!error)
+ translate_path_major_minor(td, filename, &sb);
LFREEPATH(filename);
if (error)
return (error);
==== //depot/projects/newisp/dev/ath/if_ath_pci.c#2 (text+ko) ====
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/ath/if_ath_pci.c,v 1.15 2006/06/07 20:37:14 sam Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/ath/if_ath_pci.c,v 1.16 2006/12/01 16:03:39 sam Exp $");
/*
* PCI/Cardbus front-end for the Atheros Wireless LAN controller driver.
@@ -196,8 +196,8 @@
ATH_LOCK_INIT(sc);
error = ath_attach(pci_get_device(dev), sc);
- if (error == 0)
- return error;
+ if (error == 0) /* success */
+ return 0;
ATH_LOCK_DESTROY(sc);
bus_dma_tag_destroy(sc->sc_dmat);
==== //depot/projects/newisp/dev/bge/if_bge.c#12 (text+ko) ====
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/bge/if_bge.c,v 1.152 2006/11/30 13:40:39 glebius Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/bge/if_bge.c,v 1.157 2006/12/04 22:12:21 jkim Exp $");
/*
* Broadcom BCM570x family gigabit ethernet driver for FreeBSD.
@@ -281,36 +281,12 @@
{ 0, NULL }
};
-#define BGE_IS_5705_OR_BEYOND(sc) \
- ((sc)->bge_asicrev == BGE_ASICREV_BCM5705 || \
- (sc)->bge_asicrev == BGE_ASICREV_BCM5750 || \
- (sc)->bge_asicrev == BGE_ASICREV_BCM5714_A0 || \
- (sc)->bge_asicrev == BGE_ASICREV_BCM5780 || \
- (sc)->bge_asicrev == BGE_ASICREV_BCM5714 || \
- (sc)->bge_asicrev == BGE_ASICREV_BCM5752 || \
- (sc)->bge_asicrev == BGE_ASICREV_BCM5755 || \
- (sc)->bge_asicrev == BGE_ASICREV_BCM5787)
-
-#define BGE_IS_575X_PLUS(sc) \
- ((sc)->bge_asicrev == BGE_ASICREV_BCM5750 || \
- (sc)->bge_asicrev == BGE_ASICREV_BCM5714_A0 || \
- (sc)->bge_asicrev == BGE_ASICREV_BCM5780 || \
- (sc)->bge_asicrev == BGE_ASICREV_BCM5714 || \
- (sc)->bge_asicrev == BGE_ASICREV_BCM5752 || \
- (sc)->bge_asicrev == BGE_ASICREV_BCM5755 || \
- (sc)->bge_asicrev == BGE_ASICREV_BCM5787)
+#define BGE_IS_JUMBO_CAPABLE(sc) ((sc)->bge_flags & BGE_FLAG_JUMBO)
+#define BGE_IS_5700_FAMILY(sc) ((sc)->bge_flags & BGE_FLAG_5700_FAMILY)
+#define BGE_IS_5705_PLUS(sc) ((sc)->bge_flags & BGE_FLAG_5705_PLUS)
+#define BGE_IS_5714_FAMILY(sc) ((sc)->bge_flags & BGE_FLAG_5714_FAMILY)
+#define BGE_IS_575X_PLUS(sc) ((sc)->bge_flags & BGE_FLAG_575X_PLUS)
-#define BGE_IS_5714_FAMILY(sc) \
- ((sc)->bge_asicrev == BGE_ASICREV_BCM5714_A0 || \
- (sc)->bge_asicrev == BGE_ASICREV_BCM5780 || \
- (sc)->bge_asicrev == BGE_ASICREV_BCM5714)
-
-#define BGE_IS_JUMBO_CAPABLE(sc) \
- ((sc)->bge_asicrev == BGE_ASICREV_BCM5700 || \
- (sc)->bge_asicrev == BGE_ASICREV_BCM5701 || \
- (sc)->bge_asicrev == BGE_ASICREV_BCM5703 || \
- (sc)->bge_asicrev == BGE_ASICREV_BCM5704)
-
const struct bge_revision * bge_lookup_rev(uint32_t);
const struct bge_vendor * bge_lookup_vendor(uint16_t);
static int bge_probe(device_t);
@@ -1229,23 +1205,13 @@
/* Note: the BCM5704 has a smaller mbuf space than other chips. */
- if (!(BGE_IS_5705_OR_BEYOND(sc))) {
+ if (!(BGE_IS_5705_PLUS(sc))) {
/* Configure mbuf memory pool */
- if (sc->bge_flags & BGE_FLAG_EXTRAM) {
- CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_BASEADDR,
- BGE_EXT_SSRAM);
- if (sc->bge_asicrev == BGE_ASICREV_BCM5704)
- CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_LEN, 0x10000);
- else
- CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_LEN, 0x18000);
- } else {
- CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_BASEADDR,
- BGE_BUFFPOOL_1);
- if (sc->bge_asicrev == BGE_ASICREV_BCM5704)
- CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_LEN, 0x10000);
- else
- CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_LEN, 0x18000);
- }
+ CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_BASEADDR, BGE_BUFFPOOL_1);
+ if (sc->bge_asicrev == BGE_ASICREV_BCM5704)
+ CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_LEN, 0x10000);
+ else
+ CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_LEN, 0x18000);
/* Configure DMA resource pool */
CSR_WRITE_4(sc, BGE_BMAN_DMA_DESCPOOL_BASEADDR,
@@ -1254,7 +1220,7 @@
}
/* Configure mbuf pool watermarks */
- if (!(BGE_IS_5705_OR_BEYOND(sc))) {
+ if (!(BGE_IS_5705_PLUS(sc))) {
CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_READDMA_LOWAT, 0x0);
CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_MACRX_LOWAT, 0x10);
} else {
@@ -1268,7 +1234,7 @@
CSR_WRITE_4(sc, BGE_BMAN_DMA_DESCPOOL_HIWAT, 10);
/* Enable buffer manager */
- if (!(BGE_IS_5705_OR_BEYOND(sc))) {
+ if (!(BGE_IS_5705_PLUS(sc))) {
CSR_WRITE_4(sc, BGE_BMAN_MODE,
BGE_BMANMODE_ENABLE|BGE_BMANMODE_LOMBUF_ATTN);
@@ -1310,15 +1276,12 @@
BGE_ADDR_HI(sc->bge_ldata.bge_rx_std_ring_paddr);
bus_dmamap_sync(sc->bge_cdata.bge_rx_std_ring_tag,
sc->bge_cdata.bge_rx_std_ring_map, BUS_DMASYNC_PREREAD);
- if (BGE_IS_5705_OR_BEYOND(sc))
+ if (BGE_IS_5705_PLUS(sc))
rcb->bge_maxlen_flags = BGE_RCB_MAXLEN_FLAGS(512, 0);
else
rcb->bge_maxlen_flags =
BGE_RCB_MAXLEN_FLAGS(BGE_MAX_FRAMELEN, 0);
- if (sc->bge_flags & BGE_FLAG_EXTRAM)
- rcb->bge_nicaddr = BGE_EXT_STD_RX_RINGS;
- else
- rcb->bge_nicaddr = BGE_STD_RX_RINGS;
+ rcb->bge_nicaddr = BGE_STD_RX_RINGS;
CSR_WRITE_4(sc, BGE_RX_STD_RCB_HADDR_HI, rcb->bge_hostaddr.bge_addr_hi);
CSR_WRITE_4(sc, BGE_RX_STD_RCB_HADDR_LO, rcb->bge_hostaddr.bge_addr_lo);
@@ -1344,10 +1307,7 @@
BUS_DMASYNC_PREREAD);
rcb->bge_maxlen_flags = BGE_RCB_MAXLEN_FLAGS(0,
BGE_RCB_FLAG_USE_EXT_RX_BD|BGE_RCB_FLAG_RING_DISABLED);
- if (sc->bge_flags & BGE_FLAG_EXTRAM)
- rcb->bge_nicaddr = BGE_EXT_JUMBO_RX_RINGS;
- else
- rcb->bge_nicaddr = BGE_JUMBO_RX_RINGS;
+ rcb->bge_nicaddr = BGE_JUMBO_RX_RINGS;
CSR_WRITE_4(sc, BGE_RX_JUMBO_RCB_HADDR_HI,
rcb->bge_hostaddr.bge_addr_hi);
CSR_WRITE_4(sc, BGE_RX_JUMBO_RCB_HADDR_LO,
@@ -1393,7 +1353,7 @@
RCB_WRITE_4(sc, vrcb, bge_hostaddr.bge_addr_lo, taddr.bge_addr_lo);
RCB_WRITE_4(sc, vrcb, bge_nicaddr,
BGE_NIC_TXRING_ADDR(0, BGE_TX_RING_CNT));
- if (!(BGE_IS_5705_OR_BEYOND(sc)))
+ if (!(BGE_IS_5705_PLUS(sc)))
RCB_WRITE_4(sc, vrcb, bge_maxlen_flags,
BGE_RCB_MAXLEN_FLAGS(BGE_TX_RING_CNT, 0));
@@ -1477,7 +1437,7 @@
CSR_WRITE_4(sc, BGE_HCC_TX_COAL_TICKS, sc->bge_tx_coal_ticks);
CSR_WRITE_4(sc, BGE_HCC_RX_MAX_COAL_BDS, sc->bge_rx_max_coal_bds);
CSR_WRITE_4(sc, BGE_HCC_TX_MAX_COAL_BDS, sc->bge_tx_max_coal_bds);
- if (!(BGE_IS_5705_OR_BEYOND(sc))) {
+ if (!(BGE_IS_5705_PLUS(sc))) {
CSR_WRITE_4(sc, BGE_HCC_RX_COAL_TICKS_INT, 0);
CSR_WRITE_4(sc, BGE_HCC_TX_COAL_TICKS_INT, 0);
}
@@ -1485,7 +1445,7 @@
CSR_WRITE_4(sc, BGE_HCC_TX_MAX_COAL_BDS_INT, 0);
/* Set up address of statistics block */
- if (!(BGE_IS_5705_OR_BEYOND(sc))) {
+ if (!(BGE_IS_5705_PLUS(sc))) {
CSR_WRITE_4(sc, BGE_HCC_STATS_ADDR_HI,
BGE_ADDR_HI(sc->bge_ldata.bge_stats_paddr));
CSR_WRITE_4(sc, BGE_HCC_STATS_ADDR_LO,
@@ -1514,7 +1474,7 @@
CSR_WRITE_4(sc, BGE_RXLP_MODE, BGE_RXLPMODE_ENABLE);
/* Turn on RX list selector state machine. */
- if (!(BGE_IS_5705_OR_BEYOND(sc)))
+ if (!(BGE_IS_5705_PLUS(sc)))
CSR_WRITE_4(sc, BGE_RXLS_MODE, BGE_RXLSMODE_ENABLE);
/* Turn on DMA, clear stats */
@@ -1537,7 +1497,7 @@
#endif
/* Turn on DMA completion state machine */
- if (!(BGE_IS_5705_OR_BEYOND(sc)))
+ if (!(BGE_IS_5705_PLUS(sc)))
CSR_WRITE_4(sc, BGE_DMAC_MODE, BGE_DMACMODE_ENABLE);
/* Turn on write DMA state machine */
@@ -1558,7 +1518,7 @@
CSR_WRITE_4(sc, BGE_RDBDI_MODE, BGE_RDBDIMODE_ENABLE);
/* Turn on Mbuf cluster free state machine */
- if (!(BGE_IS_5705_OR_BEYOND(sc)))
+ if (!(BGE_IS_5705_PLUS(sc)))
CSR_WRITE_4(sc, BGE_MBCF_MODE, BGE_MBCFMODE_ENABLE);
/* Turn on send BD completion state machine */
@@ -2156,11 +2116,38 @@
sc->bge_asicrev = BGE_ASICREV(sc->bge_chipid);
sc->bge_chiprev = BGE_CHIPREV(sc->bge_chipid);
+ /* Save chipset family. */
+ switch (sc->bge_asicrev) {
+ case BGE_ASICREV_BCM5700:
+ case BGE_ASICREV_BCM5701:
+ case BGE_ASICREV_BCM5703:
+ case BGE_ASICREV_BCM5704:
+ sc->bge_flags |= BGE_FLAG_5700_FAMILY | BGE_FLAG_JUMBO;
+ break;
+
+ case BGE_ASICREV_BCM5714_A0:
+ case BGE_ASICREV_BCM5780:
+ case BGE_ASICREV_BCM5714:
+ sc->bge_flags |= BGE_FLAG_5714_FAMILY /* | BGE_FLAG_JUMBO */;
+ /* Fall through */
+
+ case BGE_ASICREV_BCM5750:
+ case BGE_ASICREV_BCM5752:
+ case BGE_ASICREV_BCM5755:
+ case BGE_ASICREV_BCM5787:
+ sc->bge_flags |= BGE_FLAG_575X_PLUS;
+ /* Fall through */
+
+ case BGE_ASICREV_BCM5705:
+ sc->bge_flags |= BGE_FLAG_5705_PLUS;
+ break;
+ }
+
/*
* XXX: Broadcom Linux driver. Not in specs or eratta.
* PCI-Express?
*/
- if (BGE_IS_5705_OR_BEYOND(sc)) {
+ if (BGE_IS_5705_PLUS(sc)) {
uint32_t v;
v = pci_read_config(dev, BGE_PCI_MSI_CAPID, 4);
@@ -2240,7 +2227,7 @@
}
/* 5705 limits RX return ring to 512 entries. */
- if (BGE_IS_5705_OR_BEYOND(sc))
+ if (BGE_IS_5705_PLUS(sc))
sc->bge_return_ring_cnt = BGE_RETURN_RING_CNT_5705;
else
sc->bge_return_ring_cnt = BGE_RETURN_RING_CNT;
@@ -2943,7 +2930,7 @@
BGE_LOCK_ASSERT(sc);
- if (BGE_IS_5705_OR_BEYOND(sc))
+ if (BGE_IS_5705_PLUS(sc))
bge_stats_update_regs(sc);
else
bge_stats_update(sc);
@@ -2978,27 +2965,19 @@
static void
bge_stats_update_regs(struct bge_softc *sc)
>>> TRUNCATED FOR MAIL (1000 lines) <<<
More information about the p4-projects
mailing list