Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 6 Feb 2013 11:59:32 +0000 (UTC)
From:      Attilio Rao <attilio@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r246399 - in user/attilio/vmc-playground: bin/sh etc/mtree etc/rc.d games/fortune/datfiles include lib/libcompiler_rt lib/libstand sbin/devd share/mk sys/amd64/amd64 sys/amd64/include s...
Message-ID:  <201302061159.r16BxW1r002283@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: attilio
Date: Wed Feb  6 11:59:32 2013
New Revision: 246399
URL: http://svnweb.freebsd.org/changeset/base/246399

Log:
  Merge from vmcontention

Added:
  user/attilio/vmc-playground/sys/arm/allwinner/a10_gpio.c
     - copied unchanged from r246398, user/attilio/vmcontention/sys/arm/allwinner/a10_gpio.c
Modified:
  user/attilio/vmc-playground/bin/sh/mksyntax.c
  user/attilio/vmc-playground/etc/mtree/BSD.include.dist
  user/attilio/vmc-playground/etc/rc.d/pfsync
  user/attilio/vmc-playground/games/fortune/datfiles/fortunes-o.real
  user/attilio/vmc-playground/include/Makefile
  user/attilio/vmc-playground/lib/libcompiler_rt/Makefile
  user/attilio/vmc-playground/lib/libstand/Makefile
  user/attilio/vmc-playground/sbin/devd/devd.8
  user/attilio/vmc-playground/share/mk/bsd.own.mk
  user/attilio/vmc-playground/sys/amd64/amd64/minidump_machdep.c
  user/attilio/vmc-playground/sys/amd64/amd64/pmap.c
  user/attilio/vmc-playground/sys/amd64/include/pmap.h
  user/attilio/vmc-playground/sys/arm/allwinner/a10_clk.c
  user/attilio/vmc-playground/sys/arm/allwinner/a10_ehci.c
  user/attilio/vmc-playground/sys/arm/allwinner/files.a10
  user/attilio/vmc-playground/sys/arm/conf/CUBIEBOARD
  user/attilio/vmc-playground/sys/boot/arm/uboot/Makefile
  user/attilio/vmc-playground/sys/boot/fdt/dts/cubieboard.dts
  user/attilio/vmc-playground/sys/boot/usb/Makefile
  user/attilio/vmc-playground/sys/boot/usb/bsd_global.h
  user/attilio/vmc-playground/sys/boot/usb/bsd_kernel.c
  user/attilio/vmc-playground/sys/boot/usb/bsd_kernel.h
  user/attilio/vmc-playground/sys/dev/age/if_age.c
  user/attilio/vmc-playground/sys/dev/age/if_agevar.h
  user/attilio/vmc-playground/sys/dev/cxgbe/common/t4_hw.c
  user/attilio/vmc-playground/sys/dev/syscons/syscons.c
  user/attilio/vmc-playground/sys/dev/usb/controller/usb_controller.c
  user/attilio/vmc-playground/sys/dev/usb/controller/xhci.c
  user/attilio/vmc-playground/sys/dev/usb/controller/xhci.h
  user/attilio/vmc-playground/sys/dev/usb/usb_bus.h
  user/attilio/vmc-playground/sys/dev/usb/usb_device.c
  user/attilio/vmc-playground/sys/dev/usb/usb_dynamic.c
  user/attilio/vmc-playground/sys/dev/usb/usb_freebsd.h
  user/attilio/vmc-playground/sys/dev/usb/usb_freebsd_loader.h
  user/attilio/vmc-playground/sys/dev/usb/usb_hub.c
  user/attilio/vmc-playground/sys/dev/usb/usb_msctest.c
  user/attilio/vmc-playground/sys/dev/usb/usb_process.c
  user/attilio/vmc-playground/sys/dev/usb/usb_request.c
  user/attilio/vmc-playground/sys/dev/usb/usb_transfer.c
  user/attilio/vmc-playground/sys/fs/ext2fs/ext2_lookup.c
  user/attilio/vmc-playground/sys/fs/ext2fs/ext2_mount.h
  user/attilio/vmc-playground/sys/fs/ext2fs/ext2_vnops.c
  user/attilio/vmc-playground/sys/kern/subr_blist.c
  user/attilio/vmc-playground/sys/sys/queue.h
  user/attilio/vmc-playground/usr.sbin/bhyve/Makefile
  user/attilio/vmc-playground/usr.sbin/crunch/crunchgen/crunchgen.c
  user/attilio/vmc-playground/usr.sbin/pciconf/Makefile
Directory Properties:
  user/attilio/vmc-playground/   (props changed)
  user/attilio/vmc-playground/sbin/   (props changed)
  user/attilio/vmc-playground/sys/   (props changed)
  user/attilio/vmc-playground/sys/boot/   (props changed)
  user/attilio/vmc-playground/usr.sbin/bhyve/   (props changed)

Modified: user/attilio/vmc-playground/bin/sh/mksyntax.c
==============================================================================
--- user/attilio/vmc-playground/bin/sh/mksyntax.c	Wed Feb  6 11:49:43 2013	(r246398)
+++ user/attilio/vmc-playground/bin/sh/mksyntax.c	Wed Feb  6 11:59:32 2013	(r246399)
@@ -107,14 +107,12 @@ static const char *syntax[513];
 static int base;
 static int size;	/* number of values which a char variable can have */
 static int nbits;	/* number of bits in a character */
-static int digit_contig;/* true if digits are contiguous */
 
 static void filltable(const char *);
 static void init(void);
 static void add(const char *, const char *);
 static void print(const char *);
 static void output_type_macros(void);
-static void digit_convert(void);
 
 int
 main(int argc __unused, char **argv __unused)
@@ -125,7 +123,6 @@ main(int argc __unused, char **argv __un
 	int i;
 	char buf[80];
 	int pos;
-	static char digit[] = "0123456789";
 
 	/* Create output files */
 	if ((cfile = fopen("syntax.c", "w")) == NULL) {
@@ -158,11 +155,6 @@ main(int argc __unused, char **argv __un
 	base = 1;
 	if (sign)
 		base += 1 << (nbits - 1);
-	digit_contig = 1;
-	for (i = 0 ; i < 10 ; i++) {
-		if (digit[i] != '0' + i)
-			digit_contig = 0;
-	}
 
 	fputs("#include <sys/cdefs.h>\n", hfile);
 
@@ -248,8 +240,6 @@ main(int argc __unused, char **argv __un
 	add("_", "ISUNDER");
 	add("#?$!-*@", "ISSPECL");
 	print("is_type");
-	if (! digit_contig)
-		digit_convert();
 	exit(0);
 }
 
@@ -341,12 +331,13 @@ print(const char *name)
  */
 
 static const char *macro[] = {
-	"#define is_digit(c)\t((is_type+SYNBASE)[(int)c] & ISDIGIT)",
+	"#define is_digit(c)\t((unsigned int)((c) - '0') <= 9)",
 	"#define is_eof(c)\t((c) == PEOF)",
 	"#define is_alpha(c)\t((is_type+SYNBASE)[(int)c] & (ISUPPER|ISLOWER))",
 	"#define is_name(c)\t((is_type+SYNBASE)[(int)c] & (ISUPPER|ISLOWER|ISUNDER))",
 	"#define is_in_name(c)\t((is_type+SYNBASE)[(int)c] & (ISUPPER|ISLOWER|ISUNDER|ISDIGIT))",
 	"#define is_special(c)\t((is_type+SYNBASE)[(int)c] & (ISSPECL|ISDIGIT))",
+	"#define digit_val(c)\t((c) - '0')",
 	NULL
 };
 
@@ -355,41 +346,6 @@ output_type_macros(void)
 {
 	const char **pp;
 
-	if (digit_contig)
-		macro[0] = "#define is_digit(c)\t((unsigned int)((c) - '0') <= 9)";
 	for (pp = macro ; *pp ; pp++)
 		fprintf(hfile, "%s\n", *pp);
-	if (digit_contig)
-		fputs("#define digit_val(c)\t((c) - '0')\n", hfile);
-	else
-		fputs("#define digit_val(c)\t(digit_value[c])\n", hfile);
-}
-
-
-
-/*
- * Output digit conversion table (if digits are not contiguous).
- */
-
-static void
-digit_convert(void)
-{
-	int maxdigit;
-	static char digit[] = "0123456789";
-	char *p;
-	int i;
-
-	maxdigit = 0;
-	for (p = digit ; *p ; p++)
-		if (*p > maxdigit)
-			maxdigit = *p;
-	fputs("extern const char digit_value[];\n", hfile);
-	fputs("\n\nconst char digit_value[] = {\n", cfile);
-	for (i = 0 ; i <= maxdigit ; i++) {
-		for (p = digit ; *p && *p != i ; p++);
-		if (*p == '\0')
-			p = digit;
-		fprintf(cfile, "      %d,\n", (int)(p - digit));
-	}
-	fputs("};\n", cfile);
 }

Modified: user/attilio/vmc-playground/etc/mtree/BSD.include.dist
==============================================================================
--- user/attilio/vmc-playground/etc/mtree/BSD.include.dist	Wed Feb  6 11:49:43 2013	(r246398)
+++ user/attilio/vmc-playground/etc/mtree/BSD.include.dist	Wed Feb  6 11:59:32 2013	(r246399)
@@ -100,6 +100,8 @@
     dev
         acpica
         ..
+        agp
+        ..
         an
         ..
         bktr
@@ -136,6 +138,8 @@
         ..
         pbio
         ..
+        pci
+        ..
         powermac_nvram
         ..
         ppbus

Modified: user/attilio/vmc-playground/etc/rc.d/pfsync
==============================================================================
--- user/attilio/vmc-playground/etc/rc.d/pfsync	Wed Feb  6 11:49:43 2013	(r246398)
+++ user/attilio/vmc-playground/etc/rc.d/pfsync	Wed Feb  6 11:59:32 2013	(r246399)
@@ -35,6 +35,7 @@ pfsync_start()
 	if [ -n "${pfsync_syncpeer}" ]; then
 		_syncpeer="syncpeer ${pfsync_syncpeer}"
 	fi
+	load_kld pfsync
 	ifconfig pfsync0 $_syncpeer syncdev $pfsync_syncdev $pfsync_ifconfig up
 }
 

Modified: user/attilio/vmc-playground/games/fortune/datfiles/fortunes-o.real
==============================================================================
--- user/attilio/vmc-playground/games/fortune/datfiles/fortunes-o.real	Wed Feb  6 11:49:43 2013	(r246398)
+++ user/attilio/vmc-playground/games/fortune/datfiles/fortunes-o.real	Wed Feb  6 11:59:32 2013	(r246399)
@@ -11437,233 +11437,6 @@ two new uses for sheep.  Meat and wool.
 %
 Runners do it alone.
 %
-Rush Limbaugh's 35 Undeniable Truths of Life:
-
-(1) The greatest threat to the human spirit is liberalism.
-
-	-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
-%
-Rush Limbaugh's 35 Undeniable Truths of Life:
-
-(10) Liberalism poisons the soul.
-
-	-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
-%
-Rush Limbaugh's 35 Undeniable Truths of Life:
-
-(11) Neither the United States, nor anyone else, "imposes" freedom on
-     the people of other nations. Freedom is not an imposition.
-
-	-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
-%
-Rush Limbaugh's 35 Undeniable Truths of Life:
-
-(12) Freedom is God-given.
-
-	-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
-%
-Rush Limbaugh's 35 Undeniable Truths of Life:
-
-(13) To dictatorships, peace means the absence of opposition.
-
-	-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
-%
-Rush Limbaugh's 35 Undeniable Truths of Life:
-
-(14) To free people, peace means the absence of threat.
-
-	-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
-%
-Rush Limbaugh's 35 Undeniable Truths of Life:
-
-(15) The Peace Movement in the United States was, whether by accident or
-     design, pro-communist.
-
-	-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
-%
-Rush Limbaugh's 35 Undeniable Truths of Life:
-
-(16) The collective knowledge and wisdom of seasoned citizens is the
-     most valuable, yet untapped, resource our young people have.
-
-	-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
-%
-Rush Limbaugh's 35 Undeniable Truths of Life:
-
-(17) The greatest football team in the history of civilization was the
-     Pittsburgh Steelers of 1975 through 1980.
-
-	-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
-%
-Rush Limbaugh's 35 Undeniable Truths of Life:
-
-(18) There is no such thing as "war atrocities." War is an atrocity.
-
-	-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
-%
-Rush Limbaugh's 35 Undeniable Truths of Life:
-
-(19) Regardless of the pain in our memories, nostalgia only reminds us
-     of the good times in our past.
-
-	-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
-%
-Rush Limbaugh's 35 Undeniable Truths of Life:
-
-(2) The single greatest threat to the free people of the world is posed
-    by the heinous idea of centralized government control.
-
-	-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
-%
-Rush Limbaugh's 35 Undeniable Truths of Life:
-
-(20) There is a God.
-
-	-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
-%
-Rush Limbaugh's 35 Undeniable Truths of Life:
-
-(21) Abortion is wrong.
-
-	-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
-%
-Rush Limbaugh's 35 Undeniable Truths of Life:
-
-(22) Morality is not defined by individual choice.
-
-	-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
-%
-Rush Limbaugh's 35 Undeniable Truths of Life:
-
-(23) Evolution cannot explain creation.
-
-	-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
-%
-Rush Limbaugh's 35 Undeniable Truths of Life:
-
-(24) Feminism was established so that unattractive women could have
-     easier access to the mainstream of society.
-
-	-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
-%
-Rush Limbaugh's 35 Undeniable Truths of Life:
-
-(25) Love is the only human emotion which cannot be controlled. You
-     either do or you don't. You can't fake it. (Except women, and
-     thank God they can.)
-
-	-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
-%
-Rush Limbaugh's 35 Undeniable Truths of Life:
-
-(26) The only difference between Mikhail Gorbachev and previous Soviet
-     leaders is that he is alive.
-
-	-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
-%
-Rush Limbaugh's 35 Undeniable Truths of Life:
-
-(27) Soviet leaders were actually left-wing dictators.
-
-	-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
-%
-Rush Limbaugh's 35 Undeniable Truths of Life:
-
-(28) Abraham Lincoln saved this nation.
-
-	-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
-%
-Rush Limbaugh's 35 Undeniable Truths of Life:
-
-(29) The Los Angeles Raiders will never be the team they were when they
-     called Oakland home.
-
-	-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
-%
-Rush Limbaugh's 35 Undeniable Truths of Life:
-
-(3) Peace does not mean the elimination of nuclear weapons.
-
-	-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
-%
-Rush Limbaugh's 35 Undeniable Truths of Life:
-
-(30) The United States will again go to war.
-
-	-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
-%
-Rush Limbaugh's 35 Undeniable Truths of Life:
-
-(31) To more and more American intellectuals, a victorious United States
-     is a sinful United States.
-
-	-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
-%
-Rush Limbaugh's 35 Undeniable Truths of Life:
-
-(32) The fact that American intellectuals rue a victorious United States
-     is frightening and ominous.
-
-	-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
-%
-Rush Limbaugh's 35 Undeniable Truths of Life:
-
-(33) There will always be poor people.
-
-	-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
-%
-Rush Limbaugh's 35 Undeniable Truths of Life:
-
-(34) The fact that there will always be poor people is not the fault of
-     the rich.
-
-	-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
-%
-Rush Limbaugh's 35 Undeniable Truths of Life:
-
-(35) Rather than feel guilty as some do, you should thank God for making
-     you an American.
-
-	-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
-%
-Rush Limbaugh's 35 Undeniable Truths of Life:
-
-(4) Peace does not mean the absence of war.
-
-	-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
-%
-Rush Limbaugh's 35 Undeniable Truths of Life:
-
-(5) War is not obsolete.
-
-	-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
-%
-Rush Limbaugh's 35 Undeniable Truths of Life:
-
-(6) Ours is a world governed by the aggressive use of force.
-
-	-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
-%
-Rush Limbaugh's 35 Undeniable Truths of Life:
-
-(7) There is only one way to eliminate nuclear weapons. Use them.
-
-	-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
-%
-Rush Limbaugh's 35 Undeniable Truths of Life:
-
-(8) Peace cannot be achieved merely by developing an "understanding"
-    among peoples.
-
-	-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
-%
-Rush Limbaugh's 35 Undeniable Truths of Life:
-
-(9) Americans opposing America is not always sacred nor courageous ...
-    it is sometimes dangerous.
-
-	-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
-%
 Said a dainty young whore named Ms. Meggs,
 "The men like to spread my two legs,
 	Then slip in between,

Modified: user/attilio/vmc-playground/include/Makefile
==============================================================================
--- user/attilio/vmc-playground/include/Makefile	Wed Feb  6 11:49:43 2013	(r246398)
+++ user/attilio/vmc-playground/include/Makefile	Wed Feb  6 11:59:32 2013	(r246399)
@@ -42,9 +42,10 @@ LDIRS=	bsm cam geom net net80211 netatal
 	sys vm
 
 LSUBDIRS=	cam/ata cam/scsi \
-	dev/acpica dev/an dev/bktr dev/ciss dev/filemon dev/firewire dev/hwpmc \
+	dev/acpica dev/agp dev/an dev/bktr dev/ciss dev/filemon dev/firewire \
+	dev/hwpmc \
 	dev/ic dev/iicbus ${_dev_ieee488} dev/io dev/lmc dev/mfi dev/nvme \
-	dev/ofw dev/pbio ${_dev_powermac_nvram} dev/ppbus dev/smbus \
+	dev/ofw dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus dev/smbus \
 	dev/speaker dev/usb dev/utopia dev/vkbd dev/wi \
 	fs/devfs fs/fdescfs fs/msdosfs fs/nandfs fs/nfs fs/nullfs \
 	fs/procfs fs/udf fs/unionfs \
@@ -154,7 +155,7 @@ copies:
 	done
 .endif
 .endfor
-.for i in ${LDIRS} ${LSUBDIRS:Ndev/acpica:Ndev/bktr:Ndev/nand} ${LSUBSUBDIRS}
+.for i in ${LDIRS} ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/nand:Ndev/pci} ${LSUBSUBDIRS}
 	cd ${.CURDIR}/../sys; \
 	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
 	    ${DESTDIR}${INCLUDEDIR}/$i
@@ -162,6 +163,9 @@ copies:
 	cd ${.CURDIR}/../sys/dev/acpica; \
 	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpiio.h \
 	    ${DESTDIR}${INCLUDEDIR}/dev/acpica
+	cd ${.CURDIR}/../sys/dev/agp; \
+	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 agpreg.h \
+	    ${DESTDIR}${INCLUDEDIR}/dev/agp
 	cd ${.CURDIR}/../sys/dev/bktr; \
 	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ioctl_*.h \
 	    ${DESTDIR}${INCLUDEDIR}/dev/bktr
@@ -172,6 +176,9 @@ copies:
 	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 nand_dev.h \
 	    ${DESTDIR}${INCLUDEDIR}/dev/nand
 .endif
+	cd ${.CURDIR}/../sys/dev/pci; \
+	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 pcireg.h \
+	    ${DESTDIR}${INCLUDEDIR}/dev/pci
 	cd ${.CURDIR}/../sys/contrib/altq/altq; \
 	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
 	    ${DESTDIR}${INCLUDEDIR}/altq
@@ -225,7 +232,7 @@ symlinks:
 		ln -fs ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
 	done
 .endfor
-.for i in ${LSUBDIRS:Ndev/acpica:Ndev/bktr:Ndev/nand}
+.for i in ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/nand:Ndev/pci}
 	cd ${.CURDIR}/../sys/$i; \
 	for h in *.h; do \
 		ln -fs ../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
@@ -236,6 +243,11 @@ symlinks:
 		ln -fs ../../../../sys/dev/acpica/$$h \
 		    ${DESTDIR}${INCLUDEDIR}/dev/acpica; \
 	done
+	cd ${.CURDIR}/../sys/dev/agp; \
+	for h in agpreg.h; do \
+		ln -fs ../../../../sys/dev/agp/$$h \
+		    ${DESTDIR}${INCLUDEDIR}/dev/agp; \
+	done
 	cd ${.CURDIR}/../sys/dev/bktr; \
 	for h in ioctl_*.h; do \
 		ln -fs ../../../../sys/dev/bktr/$$h \
@@ -248,6 +260,11 @@ symlinks:
 		    ${DESTDIR}${INCLUDEDIR}/dev/nand; \
 	done
 .endif
+	cd ${.CURDIR}/../sys/dev/pci; \
+	for h in pcireg.h; do \
+		ln -fs ../../../../sys/dev/pci/$$h \
+		    ${DESTDIR}${INCLUDEDIR}/dev/pci; \
+	done
 .for i in ${LSUBSUBDIRS}
 	cd ${.CURDIR}/../sys/$i; \
 	for h in *.h; do \

Modified: user/attilio/vmc-playground/lib/libcompiler_rt/Makefile
==============================================================================
--- user/attilio/vmc-playground/lib/libcompiler_rt/Makefile	Wed Feb  6 11:49:43 2013	(r246398)
+++ user/attilio/vmc-playground/lib/libcompiler_rt/Makefile	Wed Feb  6 11:59:32 2013	(r246399)
@@ -188,6 +188,10 @@ SRCS+=	${file}.c
 .if ${MACHINE_CPUARCH} == "arm" && ${MK_ARM_EABI} != "no"
 SRCS+=	aeabi_idivmod.S \
 	aeabi_ldivmod.S \
+	aeabi_memcmp.S \
+	aeabi_memcpy.S \
+	aeabi_memmove.S \
+	aeabi_memset.S \
 	aeabi_uidivmod.S \
 	aeabi_uldivmod.S
 .endif

Modified: user/attilio/vmc-playground/lib/libstand/Makefile
==============================================================================
--- user/attilio/vmc-playground/lib/libstand/Makefile	Wed Feb  6 11:49:43 2013	(r246398)
+++ user/attilio/vmc-playground/lib/libstand/Makefile	Wed Feb  6 11:59:32 2013	(r246399)
@@ -61,7 +61,20 @@ SRCS+=	bcmp.c bcopy.c bzero.c ffs.c memc
 .endif
 .if ${MACHINE_CPUARCH} == "arm"
 .PATH: ${.CURDIR}/../libc/arm/gen
+
+.if ${MK_ARM_EABI} == "no"
 SRCS+= divsi3.S
+.else
+# Compiler support functions
+.PATH: ${.CURDIR}/../../contrib/compiler-rt/lib/
+SRCS+=	 divmoddi4.c  divmodsi4.c  divdi3.c  divsi3.c  moddi3.c  modsi3.c
+SRCS+=	udivmoddi4.c udivmodsi4.c udivdi3.c udivsi3.c umoddi3.c umodsi3.c
+
+.PATH: ${.CURDIR}/../../contrib/compiler-rt/lib/arm/
+SRCS+=	aeabi_idivmod.S aeabi_ldivmod.S aeabi_uidivmod.S aeabi_uldivmod.S
+SRCS+=	aeabi_memcmp.S aeabi_memcpy.S aeabi_memmove.S aeabi_memset.S
+.endif
+
 .endif
 .if ${MACHINE_CPUARCH} == "ia64"
 .PATH: ${.CURDIR}/../libc/ia64/string

Modified: user/attilio/vmc-playground/sbin/devd/devd.8
==============================================================================
--- user/attilio/vmc-playground/sbin/devd/devd.8	Wed Feb  6 11:49:43 2013	(r246398)
+++ user/attilio/vmc-playground/sbin/devd/devd.8	Wed Feb  6 11:59:32 2013	(r246399)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 24, 2005
+.Dd January 30, 2013
 .Dt DEVD 8
 .Os
 .Sh NAME

Modified: user/attilio/vmc-playground/share/mk/bsd.own.mk
==============================================================================
--- user/attilio/vmc-playground/share/mk/bsd.own.mk	Wed Feb  6 11:49:43 2013	(r246398)
+++ user/attilio/vmc-playground/share/mk/bsd.own.mk	Wed Feb  6 11:59:32 2013	(r246399)
@@ -389,9 +389,13 @@ __T=${TARGET_ARCH}
 .else
 __T=${MACHINE_ARCH}
 .endif
-# Clang is only for x86 and powerpc right now, by default.
+# Clang is only for x86, powerpc and little-endian arm right now, by default.
 .if ${__T} == "amd64" || ${__T} == "i386" || ${__T:Mpowerpc*}
 __DEFAULT_YES_OPTIONS+=CLANG CLANG_FULL
+.elif ${__T} == "arm" || ${__T} == "armv6"
+__DEFAULT_YES_OPTIONS+=CLANG
+# GCC is unable to build the full clang on arm, disable it by default.
+__DEFAULT_NO_OPTIONS+=CLANG_FULL
 .else
 __DEFAULT_NO_OPTIONS+=CLANG CLANG_FULL
 .endif

Modified: user/attilio/vmc-playground/sys/amd64/amd64/minidump_machdep.c
==============================================================================
--- user/attilio/vmc-playground/sys/amd64/amd64/minidump_machdep.c	Wed Feb  6 11:49:43 2013	(r246398)
+++ user/attilio/vmc-playground/sys/amd64/amd64/minidump_machdep.c	Wed Feb  6 11:59:32 2013	(r246399)
@@ -232,7 +232,7 @@ minidumpsys(struct dumperinfo *di)
 	/* Walk page table pages, set bits in vm_page_dump */
 	pmapsize = 0;
 	pdp = (uint64_t *)PHYS_TO_DMAP(KPDPphys);
-	for (va = VM_MIN_KERNEL_ADDRESS; va < MAX(KERNBASE + NKPT * NBPDR,
+	for (va = VM_MIN_KERNEL_ADDRESS; va < MAX(KERNBASE + nkpt * NBPDR,
 	    kernel_vm_end); ) {
 		/*
 		 * We always write a page, even if it is zero. Each
@@ -364,7 +364,7 @@ minidumpsys(struct dumperinfo *di)
 	/* Dump kernel page directory pages */
 	bzero(fakepd, sizeof(fakepd));
 	pdp = (uint64_t *)PHYS_TO_DMAP(KPDPphys);
-	for (va = VM_MIN_KERNEL_ADDRESS; va < MAX(KERNBASE + NKPT * NBPDR,
+	for (va = VM_MIN_KERNEL_ADDRESS; va < MAX(KERNBASE + nkpt * NBPDR,
 	    kernel_vm_end); va += NBPDP) {
 		i = (va >> PDPSHIFT) & ((1ul << NPDPEPGSHIFT) - 1);
 

Modified: user/attilio/vmc-playground/sys/amd64/amd64/pmap.c
==============================================================================
--- user/attilio/vmc-playground/sys/amd64/amd64/pmap.c	Wed Feb  6 11:49:43 2013	(r246398)
+++ user/attilio/vmc-playground/sys/amd64/amd64/pmap.c	Wed Feb  6 11:59:32 2013	(r246399)
@@ -202,6 +202,10 @@ struct pmap kernel_pmap_store;
 vm_offset_t virtual_avail;	/* VA of first avail page (after kernel bss) */
 vm_offset_t virtual_end;	/* VA of last avail page (end of kernel AS) */
 
+int nkpt;
+SYSCTL_INT(_machdep, OID_AUTO, nkpt, CTLFLAG_RD, &nkpt, 0,
+    "Number of kernel page table pages allocated on bootup");
+
 static int ndmpdp;
 static vm_paddr_t dmaplimit;
 vm_offset_t kernel_vm_end = VM_MIN_KERNEL_ADDRESS;
@@ -496,17 +500,42 @@ allocpages(vm_paddr_t *firstaddr, int n)
 
 CTASSERT(powerof2(NDMPML4E));
 
+/* number of kernel PDP slots */
+#define	NKPDPE(ptpgs)		howmany((ptpgs), NPDEPG)
+
 static void
-create_pagetables(vm_paddr_t *firstaddr)
+nkpt_init(vm_paddr_t addr)
 {
-	int i, j, ndm1g;
+	int pt_pages;
+	
+#ifdef NKPT
+	pt_pages = NKPT;
+#else
+	pt_pages = howmany(addr, 1 << PDRSHIFT);
+	pt_pages += NKPDPE(pt_pages);
 
-	/* Allocate pages */
-	KPTphys = allocpages(firstaddr, NKPT);
-	KPML4phys = allocpages(firstaddr, 1);
-	KPDPphys = allocpages(firstaddr, NKPML4E);
-	KPDphys = allocpages(firstaddr, NKPDPE);
+	/*
+	 * Add some slop beyond the bare minimum required for bootstrapping
+	 * the kernel.
+	 *
+	 * This is quite important when allocating KVA for kernel modules.
+	 * The modules are required to be linked in the negative 2GB of
+	 * the address space.  If we run out of KVA in this region then
+	 * pmap_growkernel() will need to allocate page table pages to map
+	 * the entire 512GB of KVA space which is an unnecessary tax on
+	 * physical memory.
+	 */
+	pt_pages += 8;		/* 16MB additional slop for kernel modules */
+#endif
+	nkpt = pt_pages;
+}
 
+static void
+create_pagetables(vm_paddr_t *firstaddr)
+{
+	int i, j, ndm1g, nkpdpe;
+
+	/* Allocate page table pages for the direct map */
 	ndmpdp = (ptoa(Maxmem) + NBPDP - 1) >> PDPSHIFT;
 	if (ndmpdp < 4)		/* Minimum 4GB of dirmap */
 		ndmpdp = 4;
@@ -518,6 +547,22 @@ create_pagetables(vm_paddr_t *firstaddr)
 		DMPDphys = allocpages(firstaddr, ndmpdp - ndm1g);
 	dmaplimit = (vm_paddr_t)ndmpdp << PDPSHIFT;
 
+	/* Allocate pages */
+	KPML4phys = allocpages(firstaddr, 1);
+	KPDPphys = allocpages(firstaddr, NKPML4E);
+
+	/*
+	 * Allocate the initial number of kernel page table pages required to
+	 * bootstrap.  We defer this until after all memory-size dependent
+	 * allocations are done (e.g. direct map), so that we don't have to
+	 * build in too much slop in our estimate.
+	 */
+	nkpt_init(*firstaddr);
+	nkpdpe = NKPDPE(nkpt);
+
+	KPTphys = allocpages(firstaddr, nkpt);
+	KPDphys = allocpages(firstaddr, nkpdpe);
+
 	/* Fill in the underlying page table pages */
 	/* Read-only from zero to physfree */
 	/* XXX not fully used, underneath 2M pages */
@@ -527,7 +572,7 @@ create_pagetables(vm_paddr_t *firstaddr)
 	}
 
 	/* Now map the page tables at their location within PTmap */
-	for (i = 0; i < NKPT; i++) {
+	for (i = 0; i < nkpt; i++) {
 		((pd_entry_t *)KPDphys)[i] = KPTphys + (i << PAGE_SHIFT);
 		((pd_entry_t *)KPDphys)[i] |= PG_RW | PG_V;
 	}
@@ -540,7 +585,7 @@ create_pagetables(vm_paddr_t *firstaddr)
 	}
 
 	/* And connect up the PD to the PDP */
-	for (i = 0; i < NKPDPE; i++) {
+	for (i = 0; i < nkpdpe; i++) {
 		((pdp_entry_t *)KPDPphys)[i + KPDPI] = KPDphys +
 		    (i << PAGE_SHIFT);
 		((pdp_entry_t *)KPDPphys)[i + KPDPI] |= PG_RW | PG_V | PG_U;
@@ -769,7 +814,7 @@ pmap_init(void)
 	 * Initialize the vm page array entries for the kernel pmap's
 	 * page table pages.
 	 */ 
-	for (i = 0; i < NKPT; i++) {
+	for (i = 0; i < nkpt; i++) {
 		mpte = PHYS_TO_VM_PAGE(KPTphys + (i << PAGE_SHIFT));
 		KASSERT(mpte >= vm_page_array &&
 		    mpte < &vm_page_array[vm_page_array_size],
@@ -2058,7 +2103,7 @@ pmap_growkernel(vm_offset_t addr)
 	 * any new kernel page table pages between "kernel_vm_end" and
 	 * "KERNBASE".
 	 */
-	if (KERNBASE < addr && addr <= KERNBASE + NKPT * NBPDR)
+	if (KERNBASE < addr && addr <= KERNBASE + nkpt * NBPDR)
 		return;
 
 	addr = roundup2(addr, NBPDR);

Modified: user/attilio/vmc-playground/sys/amd64/include/pmap.h
==============================================================================
--- user/attilio/vmc-playground/sys/amd64/include/pmap.h	Wed Feb  6 11:49:43 2013	(r246398)
+++ user/attilio/vmc-playground/sys/amd64/include/pmap.h	Wed Feb  6 11:59:32 2013	(r246399)
@@ -113,13 +113,7 @@
 	((unsigned long)(l2) << PDRSHIFT) | \
 	((unsigned long)(l1) << PAGE_SHIFT))
 
-/* Initial number of kernel page tables. */
-#ifndef NKPT
-#define	NKPT		32
-#endif
-
 #define NKPML4E		1		/* number of kernel PML4 slots */
-#define NKPDPE		howmany(NKPT, NPDEPG)/* number of kernel PDP slots */
 
 #define	NUPML4E		(NPML4EPG/2)	/* number of userland PML4 pages */
 #define	NUPDPE		(NUPML4E*NPDPEPG)/* number of userland PDP pages */
@@ -181,6 +175,7 @@ typedef u_int64_t pml4_entry_t;
 #define	PML4map		((pd_entry_t *)(addr_PML4map))
 #define	PML4pml4e	((pd_entry_t *)(addr_PML4pml4e))
 
+extern int nkpt;		/* Initial number of kernel page tables */
 extern u_int64_t KPDPphys;	/* physical address of kernel level 3 */
 extern u_int64_t KPML4phys;	/* physical address of kernel level 4 */
 

Modified: user/attilio/vmc-playground/sys/arm/allwinner/a10_clk.c
==============================================================================
--- user/attilio/vmc-playground/sys/arm/allwinner/a10_clk.c	Wed Feb  6 11:49:43 2013	(r246398)
+++ user/attilio/vmc-playground/sys/arm/allwinner/a10_clk.c	Wed Feb  6 11:59:32 2013	(r246399)
@@ -62,10 +62,10 @@ struct a10_ccm_softc {
 
 static struct a10_ccm_softc *a10_ccm_sc = NULL;
 
-#define ccm_read_4(reg)			\
-	bus_space_read_4(a10_ccm_sc->bst, a10_ccm_sc->bsh, reg)
-#define ccm_write_4(reg, val)		\
-	bus_space_write_4(a10_ccm_sc->bst, a10_ccm_sc->bsh, reg, val)
+#define ccm_read_4(sc, reg)		\
+	bus_space_read_4((sc)->bst, (sc)->bsh, (reg))
+#define ccm_write_4(sc, reg, val)	\
+	bus_space_write_4((sc)->bst, (sc)->bsh, (reg), (val))
 
 static int
 a10_ccm_probe(device_t dev)
@@ -121,24 +121,24 @@ int
 a10_clk_usb_activate(void)
 {
 	struct a10_ccm_softc *sc = a10_ccm_sc;
-	uint32_t reg_value = 0;
+	uint32_t reg_value;
 
 	if (sc == NULL)
 		return ENXIO;
 
 	/* Gating AHB clock for USB */
-	reg_value = ccm_read_4(CCM_AHB_GATING0);
+	reg_value = ccm_read_4(sc, CCM_AHB_GATING0);
 	reg_value |= CCM_AHB_GATING_USB0; /* AHB clock gate usb0 */
 	reg_value |= CCM_AHB_GATING_EHCI1; /* AHB clock gate ehci1 */
-	ccm_write_4(CCM_AHB_GATING0, reg_value);
+	ccm_write_4(sc, CCM_AHB_GATING0, reg_value);
 
 	/* Enable clock for USB */
-	reg_value = ccm_read_4(CCM_USB_CLK);
+	reg_value = ccm_read_4(sc, CCM_USB_CLK);
 	reg_value |= CCM_USB_PHY; /* USBPHY */
 	reg_value |= CCM_USB0_RESET; /* disable reset for USB0 */
 	reg_value |= CCM_USB1_RESET; /* disable reset for USB1 */
 	reg_value |= CCM_USB2_RESET; /* disable reset for USB2 */
-	ccm_write_4(CCM_USB_CLK, reg_value);
+	ccm_write_4(sc, CCM_USB_CLK, reg_value);
 
 	return (0);
 }
@@ -147,24 +147,24 @@ int
 a10_clk_usb_deactivate(void)
 {
 	struct a10_ccm_softc *sc = a10_ccm_sc;
-	uint32_t reg_value = 0;
+	uint32_t reg_value;
 
 	if (sc == NULL)
 		return ENXIO;
 
 	/* Disable clock for USB */
-	reg_value = ccm_read_4(CCM_USB_CLK);
+	reg_value = ccm_read_4(sc, CCM_USB_CLK);
 	reg_value &= ~CCM_USB_PHY; /* USBPHY */
 	reg_value &= ~CCM_USB0_RESET; /* reset for USB0 */
 	reg_value &= ~CCM_USB1_RESET; /* reset for USB1 */
 	reg_value &= ~CCM_USB2_RESET; /* reset for USB2 */
-	ccm_write_4(CCM_USB_CLK, reg_value);
+	ccm_write_4(sc, CCM_USB_CLK, reg_value);
 
 	/* Disable gating AHB clock for USB */
-	reg_value = ccm_read_4(CCM_AHB_GATING0);
+	reg_value = ccm_read_4(sc, CCM_AHB_GATING0);
 	reg_value &= ~CCM_AHB_GATING_USB0; /* disable AHB clock gate usb0 */
 	reg_value &= ~CCM_AHB_GATING_EHCI1; /* disable AHB clock gate ehci1 */
-	ccm_write_4(CCM_AHB_GATING0, reg_value);
+	ccm_write_4(sc, CCM_AHB_GATING0, reg_value);
 
 	return (0);
 }

Modified: user/attilio/vmc-playground/sys/arm/allwinner/a10_ehci.c
==============================================================================
--- user/attilio/vmc-playground/sys/arm/allwinner/a10_ehci.c	Wed Feb  6 11:49:43 2013	(r246398)
+++ user/attilio/vmc-playground/sys/arm/allwinner/a10_ehci.c	Wed Feb  6 11:59:32 2013	(r246399)
@@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/condvar.h>
 #include <sys/kernel.h>
 #include <sys/module.h>
+#include <sys/gpio.h>
 
 #include <machine/bus.h>
 #include <dev/ofw/ofw_bus.h> 
@@ -58,6 +59,8 @@ __FBSDID("$FreeBSD$");
 #include <dev/usb/controller/ehci.h>
 #include <dev/usb/controller/ehcireg.h>
 
+#include "gpio_if.h"
+
 #include "a10_clk.h"
 
 #define EHCI_HC_DEVSTR			"Allwinner Integrated USB 2.0 controller"
@@ -70,8 +73,9 @@ __FBSDID("$FreeBSD$");
 
 #define SW_ULPI_BYPASS			(1 << 0)
 #define SW_AHB_INCRX_ALIGN		(1 << 8)
-#define	SW_AHB_INCR4			(1 << 9)
+#define SW_AHB_INCR4			(1 << 9)
 #define SW_AHB_INCR8			(1 << 10)
+#define GPIO_USB2_PWR			227
 
 #define A10_READ_4(sc, reg)		\
 	bus_space_read_4((sc)->sc_io_tag, (sc)->sc_io_hdl, reg)
@@ -101,6 +105,7 @@ a10_ehci_attach(device_t self)
 {
 	ehci_softc_t *sc = device_get_softc(self);
 	bus_space_handle_t bsh;
+	device_t sc_gpio_dev;
 	int err;
 	int rid;
 	uint32_t reg_value = 0;
@@ -153,6 +158,13 @@ a10_ehci_attach(device_t self)
 
 	sprintf(sc->sc_vendor, "Allwinner");
 
+        /* Get the GPIO device, we need this to give power to USB */
+	sc_gpio_dev = devclass_get_device(devclass_find("gpio"), 0);
+	if (sc_gpio_dev == NULL) {
+		device_printf(self, "Error: failed to get the GPIO device\n");
+		goto error;
+	}
+
 	err = bus_setup_intr(self, sc->sc_irq_res, INTR_TYPE_BIO | INTR_MPSAFE,
 	    NULL, (driver_intr_t *)ehci_interrupt, sc, &sc->sc_intr_hdl);
 	if (err) {
@@ -166,6 +178,10 @@ a10_ehci_attach(device_t self)
 	/* Enable clock for USB */
 	a10_clk_usb_activate();
 
+	/* Give power to USB */
+	GPIO_PIN_SETFLAGS(sc_gpio_dev, GPIO_USB2_PWR, GPIO_PIN_OUTPUT);
+	GPIO_PIN_SET(sc_gpio_dev, GPIO_USB2_PWR, GPIO_PIN_HIGH);
+
 	/* Enable passby */
 	reg_value = A10_READ_4(sc, SW_USB_PMU_IRQ_ENABLE);
 	reg_value |= SW_AHB_INCR8; /* AHB INCR8 enable */

Copied: user/attilio/vmc-playground/sys/arm/allwinner/a10_gpio.c (from r246398, user/attilio/vmcontention/sys/arm/allwinner/a10_gpio.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/attilio/vmc-playground/sys/arm/allwinner/a10_gpio.c	Wed Feb  6 11:59:32 2013	(r246399, copy of r246398, user/attilio/vmcontention/sys/arm/allwinner/a10_gpio.c)
@@ -0,0 +1,521 @@
+/*-
+ * Copyright (c) 2013 Ganbold Tsagaankhuu <ganbold@gmail.com>
+ * Copyright (c) 2012 Oleksandr Tymoshenko <gonzo@freebsd.org>
+ * Copyright (c) 2012 Luiz Otavio O Souza.
+ * 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 <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/bus.h>
+
+#include <sys/kernel.h>
+#include <sys/module.h>
+#include <sys/rman.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
+#include <sys/gpio.h>
+
+#include <machine/bus.h>
+#include <machine/cpu.h>
+#include <machine/cpufunc.h>
+#include <machine/resource.h>
+#include <machine/fdt.h>
+#include <machine/frame.h>
+#include <machine/intr.h>
+
+#include <dev/fdt/fdt_common.h>
+#include <dev/ofw/ofw_bus.h>
+#include <dev/ofw/ofw_bus_subr.h>
+
+#include "gpio_if.h"
+
+/*
+ * A10 have 9 banks of gpio.
+ * 32 pins per bank:
+ * PA0 - PA17 | PB0 - PB23 | PC0 - PC24
+ * PD0 - PD27 | PE0 - PE31 | PF0 - PF5
+ * PG0 - PG9 | PH0 - PH27 | PI0 - PI12
+ */
+
+#define	A10_GPIO_PINS		288
+#define	A10_GPIO_DEFAULT_CAPS	(GPIO_PIN_INPUT | GPIO_PIN_OUTPUT |	\
+    GPIO_PIN_PULLUP | GPIO_PIN_PULLDOWN)
+
+struct a10_gpio_softc {
+	device_t		sc_dev;
+	struct mtx		sc_mtx;
+	struct resource *	sc_mem_res;
+	struct resource *	sc_irq_res;
+	bus_space_tag_t		sc_bst;
+	bus_space_handle_t	sc_bsh;
+	void *			sc_intrhand;
+	int			sc_gpio_npins;
+	struct gpio_pin		sc_gpio_pins[A10_GPIO_PINS];
+};
+
+enum a10_gpio_fsel {
+	A10_GPIO_INPUT,
+	A10_GPIO_OUTPUT,
+};
+
+enum a10_gpio_pud {
+	A10_GPIO_NONE,
+	A10_GPIO_PULLDOWN,
+	A10_GPIO_PULLUP,
+};
+
+#define	A10_GPIO_LOCK(_sc)		mtx_lock(&_sc->sc_mtx)
+#define	A10_GPIO_UNLOCK(_sc)		mtx_unlock(&_sc->sc_mtx)
+#define	A10_GPIO_LOCK_ASSERT(_sc)	mtx_assert(&_sc->sc_mtx, MA_OWNED)
+
+#define	A10_GPIO_GP_CFG(_bank, _pin)	0x00 + ((_bank) * 0x24) + ((_pin)<<2)
+#define	A10_GPIO_GP_DAT(_bank)		0x10 + ((_bank) * 0x24)
+#define	A10_GPIO_GP_DRV(_bank, _pin)	0x14 + ((_bank) * 0x24) + ((_pin)<<2)
+#define	A10_GPIO_GP_PUL(_bank, _pin)	0x1c + ((_bank) * 0x24) + ((_pin)<<2)
+
+#define	A10_GPIO_GP_INT_CFG0		0x200
+#define	A10_GPIO_GP_INT_CFG1		0x204
+#define	A10_GPIO_GP_INT_CFG2		0x208
+#define	A10_GPIO_GP_INT_CFG3		0x20c
+
+#define	A10_GPIO_GP_INT_CTL		0x210
+#define	A10_GPIO_GP_INT_STA		0x214
+#define	A10_GPIO_GP_INT_DEB		0x218
+
+#define	A10_GPIO_WRITE(_sc, _off, _val)		\
+    bus_space_write_4(_sc->sc_bst, _sc->sc_bsh, _off, _val)
+#define	A10_GPIO_READ(_sc, _off)		\
+    bus_space_read_4(_sc->sc_bst, _sc->sc_bsh, _off)
+
+static uint32_t
+a10_gpio_get_function(struct a10_gpio_softc *sc, uint32_t pin)
+{
+	uint32_t bank, func, offset;
+
+	bank = pin / 32;
+	pin = pin - 32 * bank;
+	func = pin >> 3;
+	offset = ((pin & 0x07) << 2);
+
+	A10_GPIO_LOCK(sc);
+	func = (A10_GPIO_READ(sc, A10_GPIO_GP_CFG(bank, func)) >> offset) & 7;
+	A10_GPIO_UNLOCK(sc);
+
+	return (func);
+}
+
+static uint32_t
+a10_gpio_func_flag(uint32_t nfunc)
+{
+
+	switch (nfunc) {
+	case A10_GPIO_INPUT:
+		return (GPIO_PIN_INPUT);
+	case A10_GPIO_OUTPUT:
+		return (GPIO_PIN_OUTPUT);
+	}
+	return (0);
+}
+
+static void
+a10_gpio_set_function(struct a10_gpio_softc *sc, uint32_t pin, uint32_t f)
+{
+	uint32_t bank, func, data, offset;
+
+	/* Must be called with lock held. */
+	A10_GPIO_LOCK_ASSERT(sc);
+
+	bank = pin / 32;
+	pin = pin - 32 * bank;
+	func = pin >> 3;
+	offset = ((pin & 0x07) << 2);
+
+	data = A10_GPIO_READ(sc, A10_GPIO_GP_CFG(bank, func));
+	data &= ~(7 << offset);
+	data |= (f << offset);
+	A10_GPIO_WRITE(sc, A10_GPIO_GP_CFG(bank, func), data);
+}
+
+static void
+a10_gpio_set_pud(struct a10_gpio_softc *sc, uint32_t pin, uint32_t state)
+{
+	uint32_t bank, offset, pull, val;
+
+	/* Must be called with lock held. */
+	A10_GPIO_LOCK_ASSERT(sc);
+
+	bank = pin / 32;
+	pin = pin - 32 * bank;
+	pull = pin >> 4;
+	offset = ((pin & 0x0f) << 1);
+
+	val = A10_GPIO_READ(sc, A10_GPIO_GP_PUL(bank, pull));
+	val &= ~(0x03 << offset);
+	val |= (state << offset);
+	A10_GPIO_WRITE(sc, A10_GPIO_GP_PUL(bank, pull), val);
+}

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201302061159.r16BxW1r002283>