svn commit: r244564 - in projects/mtree: bin/date contrib/gdb/gdb contrib/mknod contrib/mtree etc etc/periodic/daily lib/libnetbsd lib/libnetgraph lib/libstand/amd64 sbin/hastd sbin/ifconfig share/...
Brooks Davis
brooks at FreeBSD.org
Fri Dec 21 21:26:41 UTC 2012
Author: brooks
Date: Fri Dec 21 21:26:36 2012
New Revision: 244564
URL: http://svnweb.freebsd.org/changeset/base/244564
Log:
MFH at r244563 looping back the commit of libnetbsd and NetBSD's mtree.
Added:
projects/mtree/lib/libstand/amd64/
- copied from r244563, head/lib/libstand/amd64/
projects/mtree/sys/arm/arm/cpufunc_asm_arm11x6.S
- copied unchanged from r244563, head/sys/arm/arm/cpufunc_asm_arm11x6.S
projects/mtree/sys/boot/ficl64/
- copied from r244563, head/sys/boot/ficl64/
projects/mtree/sys/kern/subr_busdma_bufalloc.c
- copied unchanged from r244563, head/sys/kern/subr_busdma_bufalloc.c
projects/mtree/sys/sys/busdma_bufalloc.h
- copied unchanged from r244563, head/sys/sys/busdma_bufalloc.h
projects/mtree/tools/regression/usr.bin/printf/regress.zero.out
- copied unchanged from r244563, head/tools/regression/usr.bin/printf/regress.zero.out
Replaced:
projects/mtree/contrib/mknod/
- copied from r244563, head/contrib/mknod/
projects/mtree/contrib/mtree/
- copied from r244563, head/contrib/mtree/
projects/mtree/lib/libnetbsd/
- copied from r244563, head/lib/libnetbsd/
projects/mtree/usr.sbin/nmtree/
- copied from r244563, head/usr.sbin/nmtree/
Deleted:
projects/mtree/sys/boot/userboot/libstand/amd64/
Modified:
projects/mtree/bin/date/netdate.c
projects/mtree/contrib/gdb/gdb/dwarf2read.c
projects/mtree/contrib/gdb/gdb/gdbtypes.c
projects/mtree/contrib/gdb/gdb/gdbtypes.h
projects/mtree/contrib/gdb/gdb/hpread.c
projects/mtree/contrib/gdb/gdb/parse.c
projects/mtree/contrib/gdb/gdb/stabsread.c
projects/mtree/etc/newsyslog.conf
projects/mtree/etc/periodic/daily/Makefile
projects/mtree/lib/libnetgraph/sock.c
projects/mtree/sbin/hastd/parse.y
projects/mtree/sbin/ifconfig/af_nd6.c
projects/mtree/sbin/ifconfig/ifconfig.c
projects/mtree/share/man/man4/arcmsr.4
projects/mtree/share/misc/committers-src.dot
projects/mtree/share/mk/bsd.lib.mk
projects/mtree/share/mk/bsd.own.mk
projects/mtree/sys/arm/arm/busdma_machdep-v6.c
projects/mtree/sys/arm/arm/busdma_machdep.c
projects/mtree/sys/arm/arm/cpufunc.c
projects/mtree/sys/arm/arm/elf_trampoline.c
projects/mtree/sys/arm/arm/identcpu.c
projects/mtree/sys/arm/arm/locore.S
projects/mtree/sys/arm/arm/pmap-v6.c
projects/mtree/sys/arm/arm/pmap.c
projects/mtree/sys/arm/broadcom/bcm2835/bcm2835_gpio.c
projects/mtree/sys/arm/broadcom/bcm2835/files.bcm2835
projects/mtree/sys/arm/conf/PANDABOARD
projects/mtree/sys/arm/conf/RPI-B
projects/mtree/sys/arm/conf/VERSATILEPB
projects/mtree/sys/arm/include/armreg.h
projects/mtree/sys/arm/include/cpuconf.h
projects/mtree/sys/arm/include/cpufunc.h
projects/mtree/sys/arm/include/intr.h
projects/mtree/sys/arm/include/pmap.h
projects/mtree/sys/arm/include/vm.h
projects/mtree/sys/arm/versatile/files.versatile
projects/mtree/sys/boot/ficl/Makefile
projects/mtree/sys/boot/userboot/libstand/Makefile
projects/mtree/sys/cam/scsi/scsi_enc_ses.c
projects/mtree/sys/conf/files
projects/mtree/sys/conf/files.arm
projects/mtree/sys/conf/options.arm
projects/mtree/sys/dev/arcmsr/arcmsr.c
projects/mtree/sys/dev/arcmsr/arcmsr.h
projects/mtree/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c
projects/mtree/sys/dev/atkbdc/psm.c
projects/mtree/sys/dev/cxgbe/t4_l2t.c
projects/mtree/sys/dev/ixgbe/ixgbe.c
projects/mtree/sys/dev/ixgbe/ixgbe.h
projects/mtree/sys/dev/mii/brgphy.c
projects/mtree/sys/dev/mii/miidevs
projects/mtree/sys/dev/netmap/ixgbe_netmap.h
projects/mtree/sys/dev/nvme/nvme.c
projects/mtree/sys/dev/nvme/nvme_ctrlr.c
projects/mtree/sys/dev/nvme/nvme_private.h
projects/mtree/sys/dev/nvme/nvme_test.c
projects/mtree/sys/dev/usb/serial/usb_serial.c
projects/mtree/sys/dev/usb/serial/usb_serial.h
projects/mtree/sys/dev/usb/storage/umass.c
projects/mtree/sys/dev/usb/storage/ustorage_fs.c
projects/mtree/sys/dev/usb/usb_busdma.c
projects/mtree/sys/dev/usb/usb_msctest.c
projects/mtree/sys/dev/usb/usb_transfer.c
projects/mtree/sys/dev/usb/usbdi.h
projects/mtree/sys/dev/usb/wlan/if_uath.c
projects/mtree/sys/dev/usb/wlan/if_uathvar.h
projects/mtree/sys/dev/usb/wlan/if_upgt.c
projects/mtree/sys/dev/usb/wlan/if_upgtvar.h
projects/mtree/sys/dev/usb/wlan/if_urtw.c
projects/mtree/sys/dev/usb/wlan/if_urtwvar.h
projects/mtree/sys/fs/ext2fs/ext2_dinode.h
projects/mtree/sys/fs/ext2fs/ext2_inode_cnv.c
projects/mtree/sys/fs/ext2fs/ext2_vfsops.c
projects/mtree/sys/fs/ext2fs/ext2fs.h
projects/mtree/sys/kern/kern_descrip.c
projects/mtree/sys/kern/kern_jail.c
projects/mtree/sys/kern/kern_sig.c
projects/mtree/sys/kern/subr_smp.c
projects/mtree/sys/kern/subr_syscall.c
projects/mtree/sys/kern/vfs_bio.c
projects/mtree/sys/kern/vfs_mount.c
projects/mtree/sys/kern/vfs_subr.c
projects/mtree/sys/mips/include/param.h
projects/mtree/sys/netinet6/ip6_output.c
projects/mtree/sys/sys/ktr.h
projects/mtree/sys/tools/vnode_if.awk
projects/mtree/sys/ufs/ffs/ffs_softdep.c
projects/mtree/sys/vm/uma_int.h
projects/mtree/tools/build/mk/OptionalObsoleteFiles.inc
projects/mtree/tools/regression/usr.bin/printf/regress.sh
projects/mtree/usr.bin/grep/grep.c
projects/mtree/usr.bin/grep/grep.h
projects/mtree/usr.bin/grep/util.c
projects/mtree/usr.bin/printf/printf.c
projects/mtree/usr.bin/sort/sort.c
projects/mtree/usr.sbin/acpi/acpidump/acpi.c
projects/mtree/usr.sbin/acpi/acpidump/acpidump.8
projects/mtree/usr.sbin/bsdconfig/bsdconfig
projects/mtree/usr.sbin/bsdconfig/console/saver
projects/mtree/usr.sbin/bsdconfig/examples/bsdconfigrc
projects/mtree/usr.sbin/bsdconfig/mouse/flags
projects/mtree/usr.sbin/bsdconfig/networking/share/device.subr
projects/mtree/usr.sbin/bsdconfig/networking/share/hostname.subr
projects/mtree/usr.sbin/bsdconfig/networking/share/ipaddr.subr
projects/mtree/usr.sbin/bsdconfig/networking/share/media.subr
projects/mtree/usr.sbin/bsdconfig/networking/share/netmask.subr
projects/mtree/usr.sbin/bsdconfig/networking/share/resolv.subr
projects/mtree/usr.sbin/bsdconfig/networking/share/routing.subr
projects/mtree/usr.sbin/bsdconfig/share/common.subr
projects/mtree/usr.sbin/bsdconfig/share/dialog.subr
projects/mtree/usr.sbin/bsdconfig/share/mustberoot.subr
projects/mtree/usr.sbin/bsdconfig/startup/misc
projects/mtree/usr.sbin/bsdconfig/startup/share/rcconf.subr
projects/mtree/usr.sbin/bsdconfig/startup/share/rcedit.subr
projects/mtree/usr.sbin/bsdconfig/usermgmt/groupdel
projects/mtree/usr.sbin/bsdconfig/usermgmt/groupedit
projects/mtree/usr.sbin/bsdconfig/usermgmt/groupinput
projects/mtree/usr.sbin/bsdconfig/usermgmt/share/group_input.subr
projects/mtree/usr.sbin/bsdconfig/usermgmt/share/user_input.subr
projects/mtree/usr.sbin/bsdconfig/usermgmt/userdel
projects/mtree/usr.sbin/bsdconfig/usermgmt/useredit
projects/mtree/usr.sbin/bsdconfig/usermgmt/userinput
projects/mtree/usr.sbin/bsdconfig/usermgmt/usermgmt
projects/mtree/usr.sbin/mountd/mountd.c
projects/mtree/usr.sbin/mptable/mptable.c
projects/mtree/usr.sbin/mtest/mtest.c
projects/mtree/usr.sbin/nfsd/nfsd.c
projects/mtree/usr.sbin/pkg/pkg.c
projects/mtree/usr.sbin/rpcbind/rpcbind.c
projects/mtree/usr.sbin/syslogd/syslogd.c
projects/mtree/usr.sbin/ypserv/yp_main.c
Directory Properties:
projects/mtree/ (props changed)
projects/mtree/contrib/gdb/ (props changed)
projects/mtree/sbin/ (props changed)
projects/mtree/share/man/man4/ (props changed)
projects/mtree/sys/ (props changed)
projects/mtree/sys/boot/ (props changed)
projects/mtree/sys/conf/ (props changed)
Modified: projects/mtree/bin/date/netdate.c
==============================================================================
--- projects/mtree/bin/date/netdate.c Fri Dec 21 21:03:34 2012 (r244563)
+++ projects/mtree/bin/date/netdate.c Fri Dec 21 21:26:36 2012 (r244564)
@@ -85,7 +85,7 @@ netsettime(time_t tval)
dest.sin_addr.s_addr = htonl((u_long)INADDR_ANY);
s = socket(AF_INET, SOCK_DGRAM, 0);
if (s < 0) {
- if (errno != EPROTONOSUPPORT)
+ if (errno != EAFNOSUPPORT)
warn("timed");
return (retval = 2);
}
Modified: projects/mtree/contrib/gdb/gdb/dwarf2read.c
==============================================================================
--- projects/mtree/contrib/gdb/gdb/dwarf2read.c Fri Dec 21 21:03:34 2012 (r244563)
+++ projects/mtree/contrib/gdb/gdb/dwarf2read.c Fri Dec 21 21:26:36 2012 (r244564)
@@ -834,6 +834,8 @@ static void read_tag_const_type (struct
static void read_tag_volatile_type (struct die_info *, struct dwarf2_cu *);
+static void read_tag_restrict_type (struct die_info *, struct dwarf2_cu *);
+
static void read_tag_string_type (struct die_info *, struct dwarf2_cu *);
static void read_subroutine_type (struct die_info *, struct dwarf2_cu *);
@@ -3729,7 +3731,8 @@ read_tag_const_type (struct die_info *di
}
base_type = die_type (die, cu);
- die->type = make_cv_type (1, TYPE_VOLATILE (base_type), base_type, 0);
+ die->type = make_cvr_type (1, TYPE_VOLATILE (base_type),
+ TYPE_RESTRICT (base_type), base_type, 0);
}
static void
@@ -3743,7 +3746,23 @@ read_tag_volatile_type (struct die_info
}
base_type = die_type (die, cu);
- die->type = make_cv_type (TYPE_CONST (base_type), 1, base_type, 0);
+ die->type = make_cvr_type (TYPE_CONST (base_type), 1,
+ TYPE_RESTRICT (base_type), base_type, 0);
+}
+
+static void
+read_tag_restrict_type (struct die_info *die, struct dwarf2_cu *cu)
+{
+ struct type *base_type;
+
+ if (die->type)
+ {
+ return;
+ }
+
+ base_type = die_type (die, cu);
+ die->type = make_cvr_type (TYPE_CONST (base_type), TYPE_VOLATILE (base_type),
+ 1, base_type, 0);
}
/* Extract all information from a DW_TAG_string_type DIE and add to
@@ -6086,6 +6105,9 @@ read_type_die (struct die_info *die, str
case DW_TAG_volatile_type:
read_tag_volatile_type (die, cu);
break;
+ case DW_TAG_restrict_type:
+ read_tag_restrict_type (die, cu);
+ break;
case DW_TAG_string_type:
read_tag_string_type (die, cu);
break;
Modified: projects/mtree/contrib/gdb/gdb/gdbtypes.c
==============================================================================
--- projects/mtree/contrib/gdb/gdb/gdbtypes.c Fri Dec 21 21:03:34 2012 (r244563)
+++ projects/mtree/contrib/gdb/gdb/gdbtypes.c Fri Dec 21 21:26:36 2012 (r244564)
@@ -502,7 +502,8 @@ make_type_with_address_space (struct typ
We allocate new memory if needed. */
struct type *
-make_cv_type (int cnst, int voltl, struct type *type, struct type **typeptr)
+make_cvr_type (int cnst, int voltl, int restrct, struct type *type,
+ struct type **typeptr)
{
struct type *ntype; /* New type */
struct type *tmp_type = type; /* tmp type */
@@ -517,6 +518,9 @@ make_cv_type (int cnst, int voltl, struc
if (voltl)
new_flags |= TYPE_FLAG_VOLATILE;
+ if (restrct)
+ new_flags |= TYPE_FLAG_RESTRICT;
+
if (typeptr && *typeptr != NULL)
{
/* Objfile is per-core-type. This const-qualified type had best
@@ -1371,7 +1375,7 @@ struct type *
check_typedef (struct type *type)
{
struct type *orig_type = type;
- int is_const, is_volatile;
+ int is_const, is_volatile, is_restrict;
while (TYPE_CODE (type) == TYPE_CODE_TYPEDEF)
{
@@ -1407,6 +1411,7 @@ check_typedef (struct type *type)
is_const = TYPE_CONST (type);
is_volatile = TYPE_VOLATILE (type);
+ is_restrict = TYPE_RESTRICT (type);
/* If this is a struct/class/union with no fields, then check whether a
full definition exists somewhere else. This is for systems where a
@@ -1424,7 +1429,7 @@ check_typedef (struct type *type)
}
newtype = lookup_transparent_type (name);
if (newtype)
- make_cv_type (is_const, is_volatile, newtype, &type);
+ make_cvr_type (is_const, is_volatile, is_restrict, newtype, &type);
}
/* Otherwise, rely on the stub flag being set for opaque/stubbed types */
else if (TYPE_STUB (type) && !currently_reading_symtab)
@@ -1442,7 +1447,8 @@ check_typedef (struct type *type)
}
sym = lookup_symbol (name, 0, STRUCT_DOMAIN, 0, (struct symtab **) NULL);
if (sym)
- make_cv_type (is_const, is_volatile, SYMBOL_TYPE (sym), &type);
+ make_cvr_type (is_const, is_volatile, is_restrict, SYMBOL_TYPE (sym),
+ &type);
}
if (TYPE_TARGET_STUB (type))
Modified: projects/mtree/contrib/gdb/gdb/gdbtypes.h
==============================================================================
--- projects/mtree/contrib/gdb/gdb/gdbtypes.h Fri Dec 21 21:03:34 2012 (r244563)
+++ projects/mtree/contrib/gdb/gdb/gdbtypes.h Fri Dec 21 21:26:36 2012 (r244564)
@@ -273,6 +273,13 @@ enum type_code
#define TYPE_ADDRESS_CLASS_ALL(t) (TYPE_INSTANCE_FLAGS(t) \
& TYPE_FLAG_ADDRESS_CLASS_ALL)
+/* Restrict type. If this is set, the corresponding type has a
+ * restrict modifier.
+ */
+
+#define TYPE_FLAG_RESTRICT (1 << 17)
+#define TYPE_RESTRICT(t) (TYPE_INSTANCE_FLAGS (t) & TYPE_FLAG_RESTRICT)
+
/* Array bound type. */
enum array_bound_type
{
@@ -1099,7 +1106,8 @@ extern struct type *lookup_reference_typ
extern struct type *make_reference_type (struct type *, struct type **);
-extern struct type *make_cv_type (int, int, struct type *, struct type **);
+extern struct type *make_cvr_type (int, int, int, struct type *,
+ struct type **);
extern void replace_type (struct type *, struct type *);
Modified: projects/mtree/contrib/gdb/gdb/hpread.c
==============================================================================
--- projects/mtree/contrib/gdb/gdb/hpread.c Fri Dec 21 21:03:34 2012 (r244563)
+++ projects/mtree/contrib/gdb/gdb/hpread.c Fri Dec 21 21:26:36 2012 (r244564)
@@ -4939,8 +4939,9 @@ hpread_type_lookup (dnttpointer hp_type,
* "m_void" modifiers? Is static_flag really needed here?
* (m_static used for methods of classes, elsewhere).
*/
- tmp_type = make_cv_type (dn_bufp->dmodifier.m_const,
+ tmp_type = make_cvr_type (dn_bufp->dmodifier.m_const,
dn_bufp->dmodifier.m_volatile,
+ 0,
hpread_type_lookup (dn_bufp->dmodifier.type, objfile),
0);
return tmp_type;
Modified: projects/mtree/contrib/gdb/gdb/parse.c
==============================================================================
--- projects/mtree/contrib/gdb/gdb/parse.c Fri Dec 21 21:03:34 2012 (r244563)
+++ projects/mtree/contrib/gdb/gdb/parse.c Fri Dec 21 21:26:36 2012 (r244564)
@@ -1167,13 +1167,15 @@ follow_types (struct type *follow_type)
case tp_end:
done = 1;
if (make_const)
- follow_type = make_cv_type (make_const,
- TYPE_VOLATILE (follow_type),
- follow_type, 0);
+ follow_type = make_cvr_type (make_const,
+ TYPE_VOLATILE (follow_type),
+ TYPE_RESTRICT (follow_type),
+ follow_type, 0);
if (make_volatile)
- follow_type = make_cv_type (TYPE_CONST (follow_type),
- make_volatile,
- follow_type, 0);
+ follow_type = make_cvr_type (TYPE_CONST (follow_type),
+ make_volatile,
+ TYPE_RESTRICT (follow_type),
+ follow_type, 0);
if (make_addr_space)
follow_type = make_type_with_address_space (follow_type,
make_addr_space);
@@ -1192,13 +1194,15 @@ follow_types (struct type *follow_type)
case tp_pointer:
follow_type = lookup_pointer_type (follow_type);
if (make_const)
- follow_type = make_cv_type (make_const,
- TYPE_VOLATILE (follow_type),
- follow_type, 0);
+ follow_type = make_cvr_type (make_const,
+ TYPE_VOLATILE (follow_type),
+ TYPE_RESTRICT (follow_type),
+ follow_type, 0);
if (make_volatile)
- follow_type = make_cv_type (TYPE_CONST (follow_type),
- make_volatile,
- follow_type, 0);
+ follow_type = make_cvr_type (TYPE_CONST (follow_type),
+ make_volatile,
+ TYPE_RESTRICT (follow_type),
+ follow_type, 0);
if (make_addr_space)
follow_type = make_type_with_address_space (follow_type,
make_addr_space);
@@ -1208,13 +1212,15 @@ follow_types (struct type *follow_type)
case tp_reference:
follow_type = lookup_reference_type (follow_type);
if (make_const)
- follow_type = make_cv_type (make_const,
- TYPE_VOLATILE (follow_type),
- follow_type, 0);
+ follow_type = make_cvr_type (make_const,
+ TYPE_VOLATILE (follow_type),
+ TYPE_RESTRICT (follow_type),
+ follow_type, 0);
if (make_volatile)
- follow_type = make_cv_type (TYPE_CONST (follow_type),
- make_volatile,
- follow_type, 0);
+ follow_type = make_cvr_type (TYPE_CONST (follow_type),
+ make_volatile,
+ TYPE_RESTRICT (follow_type),
+ follow_type, 0);
if (make_addr_space)
follow_type = make_type_with_address_space (follow_type,
make_addr_space);
Modified: projects/mtree/contrib/gdb/gdb/stabsread.c
==============================================================================
--- projects/mtree/contrib/gdb/gdb/stabsread.c Fri Dec 21 21:03:34 2012 (r244563)
+++ projects/mtree/contrib/gdb/gdb/stabsread.c Fri Dec 21 21:26:36 2012 (r244564)
@@ -1750,13 +1750,13 @@ again:
case 'k': /* Const qualifier on some type (Sun) */
type = read_type (pp, objfile);
- type = make_cv_type (1, TYPE_VOLATILE (type), type,
+ type = make_cvr_type (1, TYPE_VOLATILE (type), TYPE_RESTRICT(type), type,
dbx_lookup_type (typenums));
break;
case 'B': /* Volatile qual on some type (Sun) */
type = read_type (pp, objfile);
- type = make_cv_type (TYPE_CONST (type), 1, type,
+ type = make_cvr_type (TYPE_CONST (type), 1, TYPE_RESTRICT(type), type,
dbx_lookup_type (typenums));
break;
Modified: projects/mtree/etc/newsyslog.conf
==============================================================================
--- projects/mtree/etc/newsyslog.conf Fri Dec 21 21:03:34 2012 (r244563)
+++ projects/mtree/etc/newsyslog.conf Fri Dec 21 21:26:36 2012 (r244564)
@@ -33,7 +33,7 @@
/var/log/pflog 600 3 100 * JB /var/run/pflogd.pid
/var/log/ppp.log root:network 640 3 100 * JC
/var/log/security 600 10 100 * JC
-/var/log/sendmail.st 640 10 * 168 B
+/var/log/sendmail.st 640 10 * 168 BN
/var/log/utx.log 644 3 * @01T05 B
/var/log/weekly.log 640 5 * $W6D0 JN
/var/log/xferlog 600 7 100 * JC
Modified: projects/mtree/etc/periodic/daily/Makefile
==============================================================================
--- projects/mtree/etc/periodic/daily/Makefile Fri Dec 21 21:03:34 2012 (r244563)
+++ projects/mtree/etc/periodic/daily/Makefile Fri Dec 21 21:26:36 2012 (r244564)
@@ -6,7 +6,6 @@ FILES= 100.clean-disks \
110.clean-tmps \
120.clean-preserve \
200.backup-passwd \
- 220.backup-pkgdb \
330.news \
400.status-disks \
405.status-ata-raid \
@@ -41,7 +40,8 @@ FILES+= 480.status-ntpd
.endif
.if ${MK_PKGTOOLS} != "no"
-FILES+= 490.status-pkg-changes
+FILES+= 220.backup-pkgdb \
+ 490.status-pkg-changes
.endif
.if ${MK_RCMDS} != "no"
Modified: projects/mtree/lib/libnetgraph/sock.c
==============================================================================
--- projects/mtree/lib/libnetgraph/sock.c Fri Dec 21 21:03:34 2012 (r244563)
+++ projects/mtree/lib/libnetgraph/sock.c Fri Dec 21 21:26:36 2012 (r244564)
@@ -71,10 +71,10 @@ NgMkSockNode(const char *name, int *csp,
name = NULL;
/* Create control socket; this also creates the netgraph node.
- If we get an EPROTONOSUPPORT then the socket node type is
+ If we get an EAFNOSUPPORT then the socket node type is
not loaded, so load it and try again. */
if ((cs = socket(AF_NETGRAPH, SOCK_DGRAM, NG_CONTROL)) < 0) {
- if (errno == EPROTONOSUPPORT) {
+ if (errno == EAFNOSUPPORT) {
if (kldload(NG_SOCKET_KLD) < 0) {
errnosv = errno;
if (_gNgDebugLevel >= 1)
Modified: projects/mtree/sbin/hastd/parse.y
==============================================================================
--- projects/mtree/sbin/hastd/parse.y Fri Dec 21 21:03:34 2012 (r244563)
+++ projects/mtree/sbin/hastd/parse.y Fri Dec 21 21:26:36 2012 (r244564)
@@ -769,7 +769,7 @@ family_supported(int family)
int sock;
sock = socket(family, SOCK_STREAM, 0);
- if (sock == -1 && errno == EPROTONOSUPPORT)
+ if (sock == -1 && errno == EAFNOSUPPORT)
return (false);
if (sock >= 0)
(void)close(sock);
Modified: projects/mtree/sbin/ifconfig/af_nd6.c
==============================================================================
--- projects/mtree/sbin/ifconfig/af_nd6.c Fri Dec 21 21:03:34 2012 (r244563)
+++ projects/mtree/sbin/ifconfig/af_nd6.c Fri Dec 21 21:26:36 2012 (r244564)
@@ -148,7 +148,7 @@ nd6_status(int s)
memset(&nd, 0, sizeof(nd));
strncpy(nd.ifname, ifr.ifr_name, sizeof(nd.ifname));
if ((s6 = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) {
- if (errno != EPROTONOSUPPORT)
+ if (errno != EAFNOSUPPORT)
warn("socket(AF_INET6, SOCK_DGRAM)");
return;
}
Modified: projects/mtree/sbin/ifconfig/ifconfig.c
==============================================================================
--- projects/mtree/sbin/ifconfig/ifconfig.c Fri Dec 21 21:03:34 2012 (r244563)
+++ projects/mtree/sbin/ifconfig/ifconfig.c Fri Dec 21 21:26:36 2012 (r244564)
@@ -520,7 +520,7 @@ top:
AF_LOCAL : afp->af_af;
if ((s = socket(ifr.ifr_addr.sa_family, SOCK_DGRAM, 0)) < 0 &&
- (uafp != NULL || errno != EPROTONOSUPPORT ||
+ (uafp != NULL || errno != EAFNOSUPPORT ||
(s = socket(AF_LOCAL, SOCK_DGRAM, 0)) < 0))
err(1, "socket(family %u,SOCK_DGRAM", ifr.ifr_addr.sa_family);
Modified: projects/mtree/share/man/man4/arcmsr.4
==============================================================================
--- projects/mtree/share/man/man4/arcmsr.4 Fri Dec 21 21:03:34 2012 (r244563)
+++ projects/mtree/share/man/man4/arcmsr.4 Fri Dec 21 21:26:36 2012 (r244564)
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd September 3, 2012
+.Dd December 18, 2012
.Dt ARCMSR 4
.Os
.Sh NAME
@@ -100,6 +100,8 @@ ARC-1212
.It
ARC-1213
.It
+ARC-1214
+.It
ARC-1220
.It
ARC-1222
Modified: projects/mtree/share/misc/committers-src.dot
==============================================================================
--- projects/mtree/share/misc/committers-src.dot Fri Dec 21 21:03:34 2012 (r244563)
+++ projects/mtree/share/misc/committers-src.dot Fri Dec 21 21:26:36 2012 (r244564)
@@ -194,6 +194,7 @@ le [label="Lukas Ertl\nle at FreeBSD.org\n2
lstewart [label="Lawrence Stewart\nlstewart at FreeBSD.org\n2008/10/06"]
marcel [label="Marcel Moolenaar\nmarcel at FreeBSD.org\n1999/07/03"]
marius [label="Marius Strobl\nmarius at FreeBSD.org\n2004/04/17"]
+markj [label="Mark Johnston\nmarkj at FreeBSD.org\n2012/12/18"]
markm [label="Mark Murray\nmarkm at FreeBSD.org\n199?/??/??"]
markus [label="Markus Brueffer\nmarkus at FreeBSD.org\n2006/06/01"]
matteo [label="Matteo Riondato\nmatteo at FreeBSD.org\n2006/01/18"]
@@ -378,6 +379,7 @@ eivind -> rwatson
emaste -> rstone
emaste -> dteske
+emaste -> markj
emax -> markus
@@ -573,6 +575,8 @@ rrs -> brucec
rrs -> jchandra
rrs -> tuexen
+rstone -> markj
+
ru -> ceri
ru -> cjc
ru -> eik
Modified: projects/mtree/share/mk/bsd.lib.mk
==============================================================================
--- projects/mtree/share/mk/bsd.lib.mk Fri Dec 21 21:03:34 2012 (r244563)
+++ projects/mtree/share/mk/bsd.lib.mk Fri Dec 21 21:26:36 2012 (r244564)
@@ -282,7 +282,7 @@ _libinstall:
${SHLIB_NAME} ${DESTDIR}${SHLIBDIR}
.if defined(DEBUG_FLAGS)
${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
- ${_INSTALLFLAGS} ${_SHLINSTALLFLAGS} \
+ ${_INSTALLFLAGS} \
${SHLIB_NAME}.symbols ${DESTDIR}${SHLIBDIR}
.endif
.if defined(SHLIB_LINK)
Modified: projects/mtree/share/mk/bsd.own.mk
==============================================================================
--- projects/mtree/share/mk/bsd.own.mk Fri Dec 21 21:03:34 2012 (r244563)
+++ projects/mtree/share/mk/bsd.own.mk Fri Dec 21 21:26:36 2012 (r244564)
@@ -322,9 +322,6 @@ __DEFAULT_YES_OPTIONS = \
BOOT \
BSD_CPIO \
BSNMP \
- SOURCELESS \
- SOURCELESS_HOST \
- SOURCELESS_UCODE \
BZIP2 \
CALENDAR \
CAPSICUM \
@@ -401,10 +398,13 @@ __DEFAULT_YES_OPTIONS = \
SENDMAIL \
SETUID_LOGIN \
SHAREDOCS \
+ SOURCELESS \
+ SOURCELESS_HOST \
+ SOURCELESS_UCODE \
SSP \
- SYSINSTALL \
SYMVER \
SYSCONS \
+ SYSINSTALL \
TCSH \
TELNET \
TEXTPROC \
@@ -417,14 +417,14 @@ __DEFAULT_YES_OPTIONS = \
ZONEINFO
__DEFAULT_NO_OPTIONS = \
- BMAKE \
- BSD_GREP \
BIND_IDN \
BIND_LARGE_FILE \
BIND_LIBS \
BIND_SIGCHASE \
BIND_XML \
+ BMAKE \
BSDCONFIG \
+ BSD_GREP \
CLANG_EXTRAS \
CTF \
HESIOD \
Modified: projects/mtree/sys/arm/arm/busdma_machdep-v6.c
==============================================================================
--- projects/mtree/sys/arm/arm/busdma_machdep-v6.c Fri Dec 21 21:03:34 2012 (r244563)
+++ projects/mtree/sys/arm/arm/busdma_machdep-v6.c Fri Dec 21 21:26:36 2012 (r244564)
@@ -1,4 +1,5 @@
/*-
+ * Copyright (c) 2012 Ian Lepore
* Copyright (c) 2010 Mark Tinguely
* Copyright (c) 2004 Olivier Houchard
* Copyright (c) 2002 Peter Grehan
@@ -40,6 +41,7 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#include <sys/malloc.h>
#include <sys/bus.h>
+#include <sys/busdma_bufalloc.h>
#include <sys/interrupt.h>
#include <sys/kernel.h>
#include <sys/ktr.h>
@@ -53,6 +55,8 @@ __FBSDID("$FreeBSD$");
#include <vm/vm.h>
#include <vm/vm_page.h>
#include <vm/vm_map.h>
+#include <vm/vm_extern.h>
+#include <vm/vm_kern.h>
#include <machine/atomic.h>
#include <machine/bus.h>
@@ -83,7 +87,6 @@ struct bus_dma_tag {
int map_count;
bus_dma_lock_t *lockfunc;
void *lockfuncarg;
- bus_dma_segment_t *segments;
struct bounce_zone *bounce_zone;
/*
* DMA range for this tag. If the page doesn't fall within
@@ -93,6 +96,14 @@ struct bus_dma_tag {
*/
struct arm32_dma_range *ranges;
int _nranges;
+ /*
+ * Most tags need one or two segments, and can use the local tagsegs
+ * array. For tags with a larger limit, we'll allocate a bigger array
+ * on first use.
+ */
+ bus_dma_segment_t *segments;
+ bus_dma_segment_t tagsegs[2];
+
};
@@ -150,6 +161,8 @@ struct bus_dmamap {
pmap_t pmap;
bus_dmamap_callback_t *callback;
void *callback_arg;
+ int flags;
+#define DMAMAP_COHERENT (1 << 0)
STAILQ_ENTRY(bus_dmamap) links;
STAILQ_HEAD(,sync_list) slist;
};
@@ -169,6 +182,38 @@ int run_filter(bus_dma_tag_t dmat, bus_a
static int _bus_dmamap_count_pages(bus_dma_tag_t dmat, bus_dmamap_t map,
void *buf, bus_size_t buflen, int flags);
+static busdma_bufalloc_t coherent_allocator; /* Cache of coherent buffers */
+static busdma_bufalloc_t standard_allocator; /* Cache of standard buffers */
+static void
+busdma_init(void *dummy)
+{
+
+ /* Create a cache of buffers in standard (cacheable) memory. */
+ standard_allocator = busdma_bufalloc_create("buffer",
+ arm_dcache_align, /* minimum_alignment */
+ NULL, /* uma_alloc func */
+ NULL, /* uma_free func */
+ 0); /* uma_zcreate_flags */
+
+ /*
+ * Create a cache of buffers in uncacheable memory, to implement the
+ * BUS_DMA_COHERENT (and potentially BUS_DMA_NOCACHE) flag.
+ */
+ coherent_allocator = busdma_bufalloc_create("coherent",
+ arm_dcache_align, /* minimum_alignment */
+ busdma_bufalloc_alloc_uncacheable,
+ busdma_bufalloc_free_uncacheable,
+ 0); /* uma_zcreate_flags */
+}
+
+/*
+ * This init historically used SI_SUB_VM, but now the init code requires
+ * malloc(9) using M_DEVBUF memory, which is set up later than SI_SUB_VM, by
+ * SI_SUB_KMEM and SI_ORDER_SECOND, so we'll go right after that by using
+ * SI_SUB_KMEM and SI_ORDER_THIRD.
+ */
+SYSINIT(busdma, SI_SUB_KMEM, SI_ORDER_THIRD, busdma_init, NULL);
+
static __inline int
_bus_dma_can_bounce(vm_offset_t lowaddr, vm_offset_t highaddr)
{
@@ -322,7 +367,18 @@ bus_dma_tag_create(bus_dma_tag_t parent,
newtag->lockfunc = dflt_lock;
newtag->lockfuncarg = NULL;
}
- newtag->segments = NULL;
+ /*
+ * If all the segments we need fit into the local tagsegs array, set the
+ * pointer now. Otherwise NULL the pointer and an array of segments
+ * will be allocated later, on first use. We don't pre-allocate now
+ * because some tags exist just to pass contraints to children in the
+ * device hierarchy, and they tend to use BUS_SPACE_UNRESTRICTED and we
+ * sure don't want to try to allocate an array for that.
+ */
+ if (newtag->nsegments <= nitems(newtag->tagsegs))
+ newtag->segments = newtag->tagsegs;
+ else
+ newtag->segments = NULL;
/* Take into account any restrictions imposed by our parent tag */
if (parent != NULL) {
@@ -411,7 +467,8 @@ bus_dma_tag_destroy(bus_dma_tag_t dmat)
parent = dmat->parent;
atomic_subtract_int(&dmat->ref_count, 1);
if (dmat->ref_count == 0) {
- if (dmat->segments != NULL)
+ if (dmat->segments != NULL &&
+ dmat->segments != dmat->tagsegs)
free(dmat->segments, M_DEVBUF);
free(dmat, M_DEVBUF);
/*
@@ -545,7 +602,10 @@ int
bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags,
bus_dmamap_t *mapp)
{
- int mflags, len;
+ busdma_bufalloc_t ba;
+ struct busdma_bufzone *bufzone;
+ vm_memattr_t memattr;
+ int mflags;
if (flags & BUS_DMA_NOWAIT)
mflags = M_NOWAIT;
@@ -579,34 +639,54 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi
if (flags & BUS_DMA_ZERO)
mflags |= M_ZERO;
+ if (flags & BUS_DMA_COHERENT) {
+ memattr = VM_MEMATTR_UNCACHEABLE;
+ ba = coherent_allocator;
+ (*mapp)->flags |= DMAMAP_COHERENT;
+ } else {
+ memattr = VM_MEMATTR_DEFAULT;
+ ba = standard_allocator;
+ (*mapp)->flags = 0;
+ }
+#ifdef notyet
+ /* All buffers we allocate are cache-aligned. */
+ map->flags |= DMAMAP_CACHE_ALIGNED;
+#endif
- /*
- * XXX:
- * (dmat->alignment < dmat->maxsize) is just a quick hack; the exact
- * alignment guarantees of malloc need to be nailed down, and the
- * code below should be rewritten to take that into account.
- *
- * In the meantime, we'll warn the user if malloc gets it wrong.
- *
- * allocate at least a cache line. This should help avoid cache
- * corruption.
+ /*
+ * Try to find a bufzone in the allocator that holds a cache of buffers
+ * of the right size for this request. If the buffer is too big to be
+ * held in the allocator cache, this returns NULL.
+ */
+ bufzone = busdma_bufalloc_findzone(ba, dmat->maxsize);
+
+ /*
+ * Allocate the buffer from the uma(9) allocator if...
+ * - It's small enough to be in the allocator (bufzone not NULL).
+ * - The alignment constraint isn't larger than the allocation size
+ * (the allocator aligns buffers to their size boundaries).
+ * - There's no need to handle lowaddr/highaddr exclusion zones.
+ * else allocate non-contiguous pages if...
+ * - The page count that could get allocated doesn't exceed nsegments.
+ * - The alignment constraint isn't larger than a page boundary.
+ * - There are no boundary-crossing constraints.
+ * else allocate a block of contiguous pages because one or more of the
+ * constraints is something that only the contig allocator can fulfill.
*/
- len = max(dmat->maxsize, arm_dcache_align);
- if (len <= PAGE_SIZE &&
- (dmat->alignment < len) &&
- !_bus_dma_can_bounce(dmat->lowaddr, dmat->highaddr)) {
- *vaddr = malloc(len, M_DEVBUF, mflags);
+ if (bufzone != NULL && dmat->alignment <= bufzone->size &&
+ !_bus_dma_can_bounce(dmat->lowaddr, dmat->highaddr)) {
+ *vaddr = uma_zalloc(bufzone->umazone, mflags);
+ } else if (dmat->nsegments >= btoc(dmat->maxsize) &&
+ dmat->alignment <= PAGE_SIZE && dmat->boundary == 0) {
+ *vaddr = (void *)kmem_alloc_attr(kernel_map, dmat->maxsize,
+ mflags, 0, dmat->lowaddr, memattr);
} else {
- /*
- * XXX Use Contigmalloc until it is merged into this facility
- * and handles multi-seg allocations. Nobody is doing
- * multi-seg allocations yet though.
- * XXX Certain AGP hardware does.
- */
- *vaddr = contigmalloc(len, M_DEVBUF, mflags,
- 0ul, dmat->lowaddr, dmat->alignment? dmat->alignment : 1ul,
- dmat->boundary);
+ *vaddr = (void *)kmem_alloc_contig(kernel_map, dmat->maxsize,
+ mflags, 0, dmat->lowaddr, dmat->alignment, dmat->boundary,
+ memattr);
}
+
+
if (*vaddr == NULL) {
CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d",
__func__, dmat, dmat->flags, ENOMEM);
@@ -630,19 +710,24 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi
void
bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map)
{
- int len;
+ struct busdma_bufzone *bufzone;
+ busdma_bufalloc_t ba;
+
+ if (map->flags & DMAMAP_COHERENT)
+ ba = coherent_allocator;
+ else
+ ba = standard_allocator;
+
+ /* Be careful not to access map from here on. */
+
+ bufzone = busdma_bufalloc_findzone(ba, dmat->maxsize);
+
+ if (bufzone != NULL && dmat->alignment <= bufzone->size &&
+ !_bus_dma_can_bounce(dmat->lowaddr, dmat->highaddr))
+ uma_zfree(bufzone->umazone, vaddr);
+ else
+ kmem_free(kernel_map, (vm_offset_t)vaddr, dmat->maxsize);
-#ifdef mftnotyet
- pmap_change_attr((vm_offset_t)vaddr, dmat->maxsize, ARM_WRITE_BACK);
-#endif
- len = max(dmat->maxsize, arm_dcache_align);
- if (len <= PAGE_SIZE &&
- (dmat->alignment < len) &&
- !_bus_dma_can_bounce(dmat->lowaddr, dmat->highaddr))
- free(vaddr, M_DEVBUF);
- else {
- contigfree(vaddr, len, M_DEVBUF);
- }
dmat->map_count--;
free(map, M_DEVBUF);
CTR3(KTR_BUSDMA, "%s: tag %p flags 0x%x", __func__, dmat, dmat->flags);
@@ -1177,6 +1262,8 @@ _bus_dmamap_sync(bus_dma_tag_t dmat, bus
dmat->bounce_zone->total_bounced++;
}
}
+ if (map->flags & DMAMAP_COHERENT)
+ return;
sl = STAILQ_FIRST(&map->slist);
while (sl) {
Modified: projects/mtree/sys/arm/arm/busdma_machdep.c
==============================================================================
--- projects/mtree/sys/arm/arm/busdma_machdep.c Fri Dec 21 21:03:34 2012 (r244563)
+++ projects/mtree/sys/arm/arm/busdma_machdep.c Fri Dec 21 21:26:36 2012 (r244564)
@@ -1,4 +1,5 @@
/*-
+ * Copyright (c) 2012 Ian Lepore
* Copyright (c) 2004 Olivier Houchard
* Copyright (c) 2002 Peter Grehan
* Copyright (c) 1997, 1998 Justin T. Gibbs.
@@ -32,7 +33,23 @@
__FBSDID("$FreeBSD$");
/*
- * ARM bus dma support routines
+ * ARM bus dma support routines.
+ *
+ * XXX Things to investigate / fix some day...
+ * - What is the earliest that this API can be called? Could there be any
+ * fallout from changing the SYSINIT() order from SI_SUB_VM to SI_SUB_KMEM?
+ * - The manpage mentions the BUS_DMA_NOWAIT flag only in the context of the
+ * bus_dmamap_load() function. This code has historically (and still does)
+ * honor it in bus_dmamem_alloc(). If we got rid of that we could lose some
+ * error checking because some resource management calls would become WAITOK
+ * and thus "cannot fail."
+ * - The decisions made by _bus_dma_can_bounce() should be made once, at tag
+ * creation time, and the result stored in the tag.
+ * - It should be possible to take some shortcuts when mapping a buffer we know
+ * came from the uma(9) allocators based on what we know about such buffers
+ * (aligned, contiguous, etc).
+ * - The allocation of bounce pages could probably be cleaned up, then we could
+ * retire arm_remap_nocache().
*/
#define _ARM32_BUS_DMA_PRIVATE
@@ -40,6 +57,7 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#include <sys/malloc.h>
#include <sys/bus.h>
+#include <sys/busdma_bufalloc.h>
#include <sys/interrupt.h>
#include <sys/lock.h>
#include <sys/proc.h>
@@ -50,7 +68,10 @@ __FBSDID("$FreeBSD$");
#include <sys/kernel.h>
#include <sys/sysctl.h>
+#include <vm/uma.h>
#include <vm/vm.h>
+#include <vm/vm_extern.h>
+#include <vm/vm_kern.h>
#include <vm/vm_page.h>
#include <vm/vm_map.h>
@@ -81,7 +102,6 @@ struct bus_dma_tag {
int map_count;
bus_dma_lock_t *lockfunc;
void *lockfuncarg;
- bus_dma_segment_t *segments;
/*
* DMA range for this tag. If the page doesn't fall within
* one of these ranges, an error is returned. The caller
@@ -91,6 +111,13 @@ struct bus_dma_tag {
struct arm32_dma_range *ranges;
int _nranges;
struct bounce_zone *bounce_zone;
+ /*
+ * Most tags need one or two segments, and can use the local tagsegs
+ * array. For tags with a larger limit, we'll allocate a bigger array
+ * on first use.
+ */
+ bus_dma_segment_t *segments;
+ bus_dma_segment_t tagsegs[2];
};
struct bounce_page {
@@ -134,7 +161,7 @@ SYSCTL_INT(_hw_busdma, OID_AUTO, total_b
#define DMAMAP_LINEAR 0x1
#define DMAMAP_MBUF 0x2
#define DMAMAP_UIO 0x4
-#define DMAMAP_ALLOCATED 0x10
+#define DMAMAP_CACHE_ALIGNED 0x10
#define DMAMAP_TYPE_MASK (DMAMAP_LINEAR|DMAMAP_MBUF|DMAMAP_UIO)
#define DMAMAP_COHERENT 0x8
struct bus_dmamap {
@@ -144,9 +171,6 @@ struct bus_dmamap {
bus_dma_tag_t dmat;
int flags;
void *buffer;
- void *origbuffer;
- void *allocbuffer;
- TAILQ_ENTRY(bus_dmamap) freelist;
int len;
STAILQ_ENTRY(bus_dmamap) links;
bus_dmamap_callback_t *callback;
@@ -157,12 +181,6 @@ struct bus_dmamap {
static STAILQ_HEAD(, bus_dmamap) bounce_map_waitinglist;
static STAILQ_HEAD(, bus_dmamap) bounce_map_callbacklist;
-static TAILQ_HEAD(,bus_dmamap) dmamap_freelist =
- TAILQ_HEAD_INITIALIZER(dmamap_freelist);
-
-#define BUSDMA_STATIC_MAPS 500
-static struct bus_dmamap map_pool[BUSDMA_STATIC_MAPS];
-
static struct mtx busdma_mtx;
MTX_SYSINIT(busdma_mtx, &busdma_mtx, "busdma lock", MTX_DEF);
@@ -180,6 +198,91 @@ static void free_bounce_page(bus_dma_tag
bus_dma_tag_t arm_root_dma_tag;
/*
+ * ----------------------------------------------------------------------------
+ * Begin block of code useful to transplant to other implementations.
+ */
+
+static uma_zone_t dmamap_zone; /* Cache of struct bus_dmamap items */
+
+static busdma_bufalloc_t coherent_allocator; /* Cache of coherent buffers */
+static busdma_bufalloc_t standard_allocator; /* Cache of standard buffers */
+
+/*
+ * This is the ctor function passed to uma_zcreate() for the pool of dma maps.
+ * It'll need platform-specific changes if this code is copied.
+ */
+static int
+dmamap_ctor(void *mem, int size, void *arg, int flags)
+{
+ bus_dmamap_t map;
+ bus_dma_tag_t dmat;
+
+ map = (bus_dmamap_t)mem;
+ dmat = (bus_dma_tag_t)arg;
+
+ dmat->map_count++;
+
+ map->dmat = dmat;
+ map->flags = 0;
+ STAILQ_INIT(&map->bpages);
+
+ return (0);
+}
+
+/*
+ * This is the dtor function passed to uma_zcreate() for the pool of dma maps.
+ * It may need platform-specific changes if this code is copied .
+ */
+static void
+dmamap_dtor(void *mem, int size, void *arg)
+{
+ bus_dmamap_t map;
+
+ map = (bus_dmamap_t)mem;
+
+ map->dmat->map_count--;
+}
+
+static void
+busdma_init(void *dummy)
+{
+
+ /* Create a cache of maps for bus_dmamap_create(). */
+ dmamap_zone = uma_zcreate("dma maps", sizeof(struct bus_dmamap),
+ dmamap_ctor, dmamap_dtor, NULL, NULL, UMA_ALIGN_PTR, 0);
+
+ /* Create a cache of buffers in standard (cacheable) memory. */
+ standard_allocator = busdma_bufalloc_create("buffer",
+ arm_dcache_align, /* minimum_alignment */
+ NULL, /* uma_alloc func */
+ NULL, /* uma_free func */
+ 0); /* uma_zcreate_flags */
+
+ /*
+ * Create a cache of buffers in uncacheable memory, to implement the
+ * BUS_DMA_COHERENT (and potentially BUS_DMA_NOCACHE) flag.
+ */
+ coherent_allocator = busdma_bufalloc_create("coherent",
+ arm_dcache_align, /* minimum_alignment */
+ busdma_bufalloc_alloc_uncacheable,
+ busdma_bufalloc_free_uncacheable,
+ 0); /* uma_zcreate_flags */
+}
+
+/*
+ * This init historically used SI_SUB_VM, but now the init code requires
+ * malloc(9) using M_DEVBUF memory, which is set up later than SI_SUB_VM, by
+ * SI_SUB_KMEM and SI_ORDER_SECOND, so we'll go right after that by using
+ * SI_SUB_KMEM and SI_ORDER_THIRD.
+ */
+SYSINIT(busdma, SI_SUB_KMEM, SI_ORDER_THIRD, busdma_init, NULL);
+
+/*
+ * End block of code useful to transplant to other implementations.
+ * ----------------------------------------------------------------------------
+ */
+
+/*
* Return true if a match is made.
*
* To find a match walk the chain of bus_dma_tag_t's looking for 'paddr'.
@@ -206,30 +309,26 @@ run_filter(bus_dma_tag_t dmat, bus_addr_
return (retval);
}
-static void
-arm_dmamap_freelist_init(void *dummy)
-{
- int i;
-
- for (i = 0; i < BUSDMA_STATIC_MAPS; i++)
- TAILQ_INSERT_HEAD(&dmamap_freelist, &map_pool[i], freelist);
-}
-
-SYSINIT(busdma, SI_SUB_VM, SI_ORDER_ANY, arm_dmamap_freelist_init, NULL);
-
/*
- * Check to see if the specified page is in an allowed DMA range.
+ * This routine checks the exclusion zone constraints from a tag against the
+ * physical RAM available on the machine. If a tag specifies an exclusion zone
+ * but there's no RAM in that zone, then we avoid allocating resources to bounce
+ * a request, and we can use any memory allocator (as opposed to needing
+ * kmem_alloc_contig() just because it can allocate pages in an address range).
+ *
+ * Most tags have BUS_SPACE_MAXADDR or BUS_SPACE_MAXADDR_32BIT (they are the
+ * same value on 32-bit architectures) as their lowaddr constraint, and we can't
+ * possibly have RAM at an address higher than the highest address we can
+ * express, so we take a fast out.
*/
-
-static __inline int
-bus_dmamap_load_buffer(bus_dma_tag_t dmat, bus_dma_segment_t *segs,
- bus_dmamap_t map, void *buf, bus_size_t buflen, struct pmap *pmap,
- int flags, vm_offset_t *lastaddrp, int *segp);
-
static __inline int
_bus_dma_can_bounce(vm_offset_t lowaddr, vm_offset_t highaddr)
{
int i;
+
+ if (lowaddr >= BUS_SPACE_MAXADDR)
+ return (0);
+
for (i = 0; phys_avail[i] && phys_avail[i + 1]; i += 2) {
if ((lowaddr >= phys_avail[i] && lowaddr <= phys_avail[i + 1])
|| (lowaddr < phys_avail[i] &&
@@ -294,38 +393,6 @@ dflt_lock(void *arg, bus_dma_lock_op_t o
#endif
}
-static __inline bus_dmamap_t
-_busdma_alloc_dmamap(void)
-{
- bus_dmamap_t map;
-
- mtx_lock(&busdma_mtx);
- map = TAILQ_FIRST(&dmamap_freelist);
- if (map)
- TAILQ_REMOVE(&dmamap_freelist, map, freelist);
- mtx_unlock(&busdma_mtx);
- if (!map) {
- map = malloc(sizeof(*map), M_DEVBUF, M_NOWAIT | M_ZERO);
- if (map)
- map->flags = DMAMAP_ALLOCATED;
- } else
- map->flags = 0;
- STAILQ_INIT(&map->bpages);
- return (map);
-}
-
-static __inline void
-_busdma_free_dmamap(bus_dmamap_t map)
-{
- if (map->flags & DMAMAP_ALLOCATED)
- free(map, M_DEVBUF);
- else {
- mtx_lock(&busdma_mtx);
- TAILQ_INSERT_HEAD(&dmamap_freelist, map, freelist);
- mtx_unlock(&busdma_mtx);
- }
-}
-
/*
* Allocate a device specific dma_tag.
*/
@@ -354,7 +421,7 @@ bus_dma_tag_create(bus_dma_tag_t parent,
}
newtag->parent = parent;
- newtag->alignment = alignment;
+ newtag->alignment = alignment ? alignment : 1;
newtag->boundary = boundary;
newtag->lowaddr = trunc_page((vm_offset_t)lowaddr) + (PAGE_SIZE - 1);
newtag->highaddr = trunc_page((vm_offset_t)highaddr) + (PAGE_SIZE - 1);
@@ -375,9 +442,19 @@ bus_dma_tag_create(bus_dma_tag_t parent,
newtag->lockfunc = dflt_lock;
newtag->lockfuncarg = NULL;
}
- newtag->segments = NULL;
-
- /*
+ /*
+ * If all the segments we need fit into the local tagsegs array, set the
+ * pointer now. Otherwise NULL the pointer and an array of segments
+ * will be allocated later, on first use. We don't pre-allocate now
+ * because some tags exist just to pass contraints to children in the
+ * device hierarchy, and they tend to use BUS_SPACE_UNRESTRICTED and we
+ * sure don't want to try to allocate an array for that.
+ */
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-projects
mailing list