Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 Jun 2007 10:51:39 GMT
From:      Ulf Lilleengen <lulf@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 122083 for review
Message-ID:  <200706211051.l5LApdue034623@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=122083

Change 122083 by lulf@lulf_carrot on 2007/06/21 10:51:31

	- integrate

Affected files ...

.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/conf/NOTES#8 integrate
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/conf/files#10 integrate
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/conf/files.sparc64#3 integrate
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/conf/files.sun4v#3 integrate
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/conf/options#7 integrate
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/geom/part/g_part.c#6 integrate
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/geom/part/g_part.h#3 integrate
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/geom/part/g_part_mbr.c#2 integrate
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/i386/cpufreq/smist.c#2 integrate
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/i386/isa/clock.c#3 integrate
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/i386/xbox/xboxfb.c#2 integrate
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/kern/kern_conf.c#3 integrate
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/kern/kern_descrip.c#5 integrate
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/kern/kern_fork.c#5 integrate
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/kern/kern_ntptime.c#2 integrate
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/kern/kern_priv.c#3 integrate
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/kern/kern_resource.c#5 integrate
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/kern/sched_ule.c#5 integrate
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/kern/subr_unit.c#2 integrate
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/kern/subr_witness.c#6 integrate
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/kern/vfs_cache.c#3 integrate
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/modules/Makefile#5 integrate
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/sys/priv.h#5 integrate
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/sys/tree.h#2 integrate
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/vm/vm_contig.c#6 integrate
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/vm/vm_fault.c#4 integrate
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/vm/vm_mmap.c#4 integrate
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/vm/vm_object.c#5 integrate
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/vm/vm_page.c#6 integrate
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/vm/vm_page.h#3 integrate
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/vm/vm_pageout.c#6 integrate
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/vm/vm_pageq.c#5 integrate
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/vm/vm_phys.c#2 integrate
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/vm/vm_zeroidle.c#4 integrate

Differences ...

==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/conf/NOTES#8 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/NOTES,v 1.1432 2007/06/13 14:01:42 rwatson Exp $
+# $FreeBSD: src/sys/conf/NOTES,v 1.1434 2007/06/16 04:57:03 alc Exp $
 #
 # NOTES -- Lines that can be cut/pasted into kernel and hints configs.
 #
@@ -125,10 +125,6 @@
 options 	MAXPHYS=(128*1024)
 
 
-# Options for the VM subsystem
-# Deprecated options supported for backwards compatibility
-#options 	PQ_NOOPT		# No coloring
-
 # This allows you to actually store this configuration file into
 # the kernel binary itself, where it may be later read by saying:
 #    strings -n 3 /boot/kernel/kernel | sed -n 's/^___//p' > MYKERNEL
@@ -584,17 +580,7 @@
 # for in a captured lab environment :-)
 options SCTP_WITH_NO_CSUM
 #
-# Logging, this is another debug tool thats way
-# cool.. but does take resources so its off 
-# by default. To do any logging you must first
-# enable SCTP_STAT_LOGGING. This gets the utilities
-# into the code base that actually do the logging and
-# alocates a hugh fixed circular buffer that logging
-# uses (about 80,000 entires that are probably 8 long
-# words or so long.. so it does take a LOT of memory).
-# Its cool for real-time debugging though.
-#
-options SCTP_STAT_LOGGING
+
 #
 # All that options after that turn on specific types of
 # logging. You can monitor CWND growth, flight size
@@ -605,25 +591,19 @@
 # I have not yet commited the tools to get and print
 # the logs, I will do that eventually .. before then
 # if you want them send me an email rrs@freebsd.org
+# You basically must have KTR enabled for these
+# and you then set the sysctl to turn on/off various
+# logging bits. Use ktrdump to pull the log and run
+# it through a dispaly program.. and graphs and other
+# things too.
 #
-options SCTP_LOG_MAXBURST
-options SCTP_LOG_RWND
-options SCTP_CWND_LOGGING
-options SCTP_CWND_MONITOR
-options SCTP_BLK_LOGGING
-options SCTP_STR_LOGGING
-options SCTP_FR_LOGGING
-options SCTP_MAP_LOGGING
-options SCTP_SACK_LOGGING
-options SCTP_LOCK_LOGGING
-options SCTP_RTTVAR_LOGGING
-options SCTP_SB_LOGGING
-options SCTP_EARLYFR_LOGGING
-options SCTP_NAGLE_LOGGING
-options SCTP_WAKE_LOGGING
-options SCTP_RECV_RWND_LOGGING
-options SCTP_SACK_RWND_LOGGING
-options SCTP_MBUF_LOGGING
+options 	SCTP_LOCK_LOGGING
+options 	SCTP_MBUF_LOGGING
+options 	SCTP_MBCNT_LOGGING
+options 	SCTP_PACKET_LOGGING
+options		SCTP_LTRACE_CHUNKS
+options 	SCTP_LTRACE_ERRORS
+
 
 # altq(9). Enable the base part of the hooks with the ALTQ option.
 # Individual disciplines must be built into the base system and can not be

==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/conf/files#10 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/files,v 1.1220 2007/06/13 14:01:42 rwatson Exp $
+# $FreeBSD: src/sys/conf/files,v 1.1222 2007/06/16 04:57:04 alc Exp $
 #
 # The long compile-with and dependency lines are required because of
 # limitations in config: backslash-newline doesn't work in strings, and
@@ -1205,6 +1205,11 @@
 fs/unionfs/union_subr.c		optional unionfs
 fs/unionfs/union_vfsops.c	optional unionfs
 fs/unionfs/union_vnops.c	optional unionfs
+fs/tmpfs/tmpfs_vnops.c		optional tmpfs
+fs/tmpfs/tmpfs_fifoops.c 	optional tmpfs
+fs/tmpfs/tmpfs_vfsops.c 	optional tmpfs
+fs/tmpfs/tmpfs_subr.c 		optional tmpfs
+fs/tmpfs/tmpfs_uma.c 		optional tmpfs
 gdb/gdb_cons.c			optional gdb
 gdb/gdb_main.c			optional gdb
 gdb/gdb_packet.c		optional gdb
@@ -2073,6 +2078,7 @@
 vm/vm_pageout.c			standard
 vm/vm_pageq.c			standard
 vm/vm_pager.c			standard
+vm/vm_phys.c			standard
 vm/vm_unix.c			standard
 vm/vm_zeroidle.c		standard
 vm/vnode_pager.c		standard

==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/conf/files.sparc64#3 (text+ko) ====

@@ -1,7 +1,7 @@
 # This file tells config what files go into building a kernel,
 # files marked standard are always included.
 #
-# $FreeBSD: src/sys/conf/files.sparc64,v 1.89 2007/06/11 00:38:06 marcel Exp $
+# $FreeBSD: src/sys/conf/files.sparc64,v 1.91 2007/06/18 21:49:42 marius Exp $
 #
 # The long compile-with and dependency lines are required because of
 # limitations in config: backslash-newline doesn't work in strings, and
@@ -46,6 +46,7 @@
 dev/esp/esp_sbus.c		optional	esp sbus
 dev/fb/creator.c		optional	creator sc
 dev/fb/fb.c			optional	sc
+dev/fb/gallant12x22.c		optional	sc
 dev/fb/machfb.c			optional	machfb sc
 dev/hwpmc/hwpmc_sparc64.c	optional	hwpmc
 dev/kbd/kbd.c			optional	atkbd | sc | ukbd
@@ -80,7 +81,6 @@
 sparc64/isa/isa_dma.c		optional	isa
 sparc64/isa/ofw_isa.c		optional	ebus | isa
 sparc64/pci/apb.c		optional	pci
-sparc64/pci/ofw_pci.c		optional	pci
 sparc64/pci/ofw_pcib.c		optional	pci
 sparc64/pci/ofw_pcib_subr.c	optional	pci
 sparc64/pci/ofw_pcibus.c	optional	pci

==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/conf/files.sun4v#3 (text+ko) ====

@@ -1,7 +1,7 @@
 # This file tells config what files go into building a kernel,
 # files marked standard are always included.
 #
-# $FreeBSD: src/sys/conf/files.sun4v,v 1.9 2007/06/11 00:38:06 marcel Exp $
+# $FreeBSD: src/sys/conf/files.sun4v,v 1.10 2007/06/18 21:49:42 marius Exp $
 #
 # The long compile-with and dependency lines are required because of
 # limitations in config: backslash-newline doesn't work in strings, and
@@ -47,7 +47,6 @@
 sparc64/sparc64/gdb_machdep.c	optional	gdb
 sun4v/sun4v/hv_pci.c	optional	pci
 sun4v/sun4v/trap_trace.S	optional	trap_tracing
-sparc64/pci/ofw_pci.c		optional	pci
 sparc64/pci/ofw_pcib.c		optional	pci
 sparc64/pci/ofw_pcib_subr.c	optional	pci
 sparc64/pci/ofw_pcibus.c	optional	pci

==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/conf/options#7 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/options,v 1.593 2007/06/13 14:01:42 rwatson Exp $
+# $FreeBSD: src/sys/conf/options,v 1.596 2007/06/16 04:57:04 alc Exp $
 #
 #        On the handling of kernel options
 #
@@ -196,6 +196,7 @@
 PSEUDOFS	opt_dontuse.h
 REISERFS	opt_dontuse.h
 SMBFS		opt_dontuse.h
+TMPFS		opt_dontuse.h
 UDF		opt_dontuse.h
 UMAPFS		opt_dontuse.h
 UNIONFS		opt_dontuse.h
@@ -397,30 +398,18 @@
 # SCTP
 #
 SCTP			opt_sctp.h
-SCTP_DEBUG		opt_sctp.h
-SCTP_HIGH_SPEED		opt_sctp.h
-SCTP_LOG_MAXBURST       opt_sctp.h
-SCTP_LOG_RWND           opt_sctp.h	
-SCTP_STAT_LOGGING	opt_sctp.h
-SCTP_CWND_LOGGING	opt_sctp.h
-SCTP_CWND_MONITOR	opt_sctp.h
-SCTP_BLK_LOGGING	opt_sctp.h
-SCTP_STR_LOGGING	opt_sctp.h
-SCTP_FR_LOGGING		opt_sctp.h
-SCTP_MAP_LOGGING	opt_sctp.h
-SCTP_SACK_LOGGING	opt_sctp.h
-SCTP_LOCK_LOGGING       opt_sctp.h
-SCTP_RTTVAR_LOGGING     opt_sctp.h
-SCTP_SB_LOGGING         opt_sctp.h
-SCTP_WITH_NO_CSUM       opt_sctp.h
-SCTP_EARLYFR_LOGGING    opt_sctp.h
-SCTP_NAGLE_LOGGING      opt_sctp.h
-SCTP_WAKE_LOGGING       opt_sctp.h
-SCTP_RECV_RWND_LOGGING  opt_sctp.h
-SCTP_SACK_RWND_LOGGING  opt_sctp.h
-SCTP_FLIGHT_LOGGING     opt_sctp.h
-SCTP_MBUF_LOGGING       opt_sctp.h
-SCTP_PACKET_LOGGING     opt_sctp.h
+SCTP_DEBUG		opt_sctp.h # Enable debug printfs
+SCTP_HIGH_SPEED		opt_sctp.h # Enable Sally Floyds HS TCP CC
+SCTP_WITH_NO_CSUM       opt_sctp.h # Use this at your peril
+SCTP_LOCK_LOGGING       opt_sctp.h # Log to KTR lock activity
+SCTP_MBUF_LOGGING       opt_sctp.h # Log to KTR general mbuf aloc/free
+SCTP_MBCNT_LOGGING	opt_sctp.h # Log to KTR mbcnt activity
+SCTP_PACKET_LOGGING     opt_sctp.h # Log to a packet buffer last N packets
+SCTP_LTRACE_CHUNKS      opt_sctp.h # Log to KTR chunks processed
+SCTP_LTRACE_ERRORS      opt_sctp.h # Log to KTR error returns.
+#
+#
+#
 
 # Netgraph(4). Use option NETGRAPH to enable the base netgraph code.
 # Each netgraph node type can be either be compiled into the kernel
@@ -566,7 +555,6 @@
 NO_SWAPPING		opt_vm.h
 MALLOC_MAKE_FAILURES	opt_vm.h
 MALLOC_PROFILE		opt_vm.h
-PQ_NOOPT		opt_vmpage.h
 
 # The MemGuard replacement allocator used for tamper-after-free detection
 DEBUG_MEMGUARD		opt_vm.h

==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/geom/part/g_part.c#6 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/geom/part/g_part.c,v 1.8 2007/06/06 05:01:41 marcel Exp $");
+__FBSDID("$FreeBSD: src/sys/geom/part/g_part.c,v 1.9 2007/06/17 22:19:19 marcel Exp $");
 
 #include <sys/param.h>
 #include <sys/bio.h>
@@ -136,6 +136,81 @@
 	return (NULL);
 }
 
+void
+g_part_geometry_heads(off_t blocks, u_int sectors, off_t *bestchs,
+    u_int *bestheads)
+{
+	static u_int candidate_heads[] = { 1, 2, 16, 32, 64, 128, 255, 0 };
+	off_t chs, cylinders;
+	u_int heads;
+	int idx;
+
+	*bestchs = 0;
+	*bestheads = 0;
+	for (idx = 0; candidate_heads[idx] != 0; idx++) {
+		heads = candidate_heads[idx];
+		cylinders = blocks / heads / sectors;
+		if (cylinders < heads || cylinders < sectors)
+			break;
+		if (cylinders > 1023)
+			continue;
+		chs = cylinders * heads * sectors;
+		if (chs > *bestchs || (chs == *bestchs && *bestheads == 1)) {
+			*bestchs = chs;
+			*bestheads = heads;
+		}
+	}
+}
+
+static void
+g_part_geometry(struct g_part_table *table, struct g_consumer *cp,
+    off_t blocks)
+{
+	static u_int candidate_sectors[] = { 1, 9, 17, 33, 63, 0 };
+	off_t chs, bestchs;
+	u_int heads, sectors;
+	int idx;
+
+	if (g_getattr("GEOM::fwsectors", cp, &sectors) != 0 ||
+	    sectors < 1 || sectors > 63 ||
+	    g_getattr("GEOM::fwheads", cp, &heads) != 0 ||
+	    heads < 1 || heads > 255) {
+		table->gpt_fixgeom = 0;
+		table->gpt_heads = 0;
+		table->gpt_sectors = 0;
+		bestchs = 0;
+		for (idx = 0; candidate_sectors[idx] != 0; idx++) {
+			sectors = candidate_sectors[idx];
+			g_part_geometry_heads(blocks, sectors, &chs, &heads);
+			if (chs == 0)
+				continue;
+			/*
+			 * Prefer a geometry with sectors > 1, but only if
+			 * it doesn't bump down the numbver of heads to 1.
+			 */
+			if (chs > bestchs || (chs == bestchs && heads > 1 &&
+			    table->gpt_sectors == 1)) {
+				bestchs = chs;
+				table->gpt_heads = heads;
+				table->gpt_sectors = sectors;
+			}
+		}
+		/*
+		 * If we didn't find a geometry at all, then the disk is
+		 * too big. This means we can use the maximum number of
+		 * heads and sectors.
+		 */
+		if (bestchs == 0) {
+			table->gpt_heads = 255;
+			table->gpt_sectors = 63;
+		}
+	} else {
+		table->gpt_fixgeom = 1;
+		table->gpt_heads = heads;
+		table->gpt_sectors = sectors;
+	}
+}
+
 struct g_part_entry *
 g_part_new_entry(struct g_part_table *table, int index, quad_t start,
     quad_t end)
@@ -574,6 +649,12 @@
 
 	g_topology_unlock();
 
+	/* Make sure the provider has media. */
+	if (pp->mediasize == 0 || pp->sectorsize == 0) {
+		error = ENODEV;
+		goto fail;
+	}
+
 	/* Make sure we can nest and if so, determine our depth. */
 	error = g_getattr("PART::isleaf", cp, &attr);
 	if (!error && attr) {
@@ -583,6 +664,14 @@
 	error = g_getattr("PART::depth", cp, &attr);
 	table->gpt_depth = (!error) ? attr + 1 : 0;
 
+	/*
+	 * Synthesize a disk geometry. Some partitioning schemes
+	 * depend on it and since some file systems need it even
+	 * when the partitition scheme doesn't, we do it here in
+	 * scheme-independent code.
+	 */
+	g_part_geometry(table, cp, pp->mediasize / pp->sectorsize);
+
 	error = G_PART_CREATE(table, gpp);
 	if (error)
 		goto fail;
@@ -1217,6 +1306,15 @@
 
 	g_topology_unlock();
 
+	/*
+	 * Short-circuit the whole probing galore when there's no
+	 * media present.
+	 */
+	if (pp->mediasize == 0 || pp->sectorsize == 0) {
+		error = ENODEV;
+		goto fail;
+	}
+
 	/* Make sure we can nest and if so, determine our depth. */
 	error = g_getattr("PART::isleaf", cp, &attr);
 	if (!error && attr) {
@@ -1231,6 +1329,15 @@
 		goto fail;
 
 	table = gp->softc;
+	
+	/*
+	 * Synthesize a disk geometry. Some partitioning schemes
+	 * depend on it and since some file systems need it even
+	 * when the partitition scheme doesn't, we do it here in
+	 * scheme-independent code.
+	 */
+	g_part_geometry(table, cp, pp->mediasize / pp->sectorsize);
+
 	error = G_PART_READ(table, cp);
 	if (error)
 		goto fail;
@@ -1311,6 +1418,10 @@
 		    (uintmax_t)table->gpt_first);
 		sbuf_printf(sb, "%s<last>%ju</last>\n", indent,
 		    (uintmax_t)table->gpt_last);
+		sbuf_printf(sb, "%s<fwsectors>%u</fwsectors>\n", indent,
+		    table->gpt_sectors);
+		sbuf_printf(sb, "%s<fwheads>%u</fwheads>\n", indent,
+		    table->gpt_heads);
 		G_PART_DUMPCONF(table, NULL, sb, indent);
 	}
 }
@@ -1349,7 +1460,6 @@
 	struct g_part_table *table;
 	struct g_kerneldump *gkd;
 	struct g_provider *pp;
-	int attr;
 
 	pp = bp->bio_to;
 	gp = pp->geom;
@@ -1387,6 +1497,14 @@
 	case BIO_FLUSH:
 		break;
 	case BIO_GETATTR:
+		if (g_handleattr_int(bp, "GEOM::fwheads", table->gpt_heads))
+			return;
+		if (g_handleattr_int(bp, "GEOM::fwsectors", table->gpt_sectors))
+			return;
+		if (g_handleattr_int(bp, "PART::isleaf", table->gpt_isleaf))
+			return;
+		if (g_handleattr_int(bp, "PART::depth", table->gpt_depth))
+			return;
 		if (!strcmp("GEOM::kerneldump", bp->bio_attribute)) {
 			/*
 			 * Check that the partition is suitable for kernel
@@ -1405,25 +1523,6 @@
 			if (gkd->offset + gkd->length > pp->mediasize)
 				gkd->length = pp->mediasize - gkd->offset;
 			gkd->offset += entry->gpe_offset;
-		} else if (!strcmp("PART::isleaf", bp->bio_attribute)) {
-			if (bp->bio_length != sizeof(int)) {
-				g_io_deliver(bp, EFAULT);
-				return;
-			}
-			attr = table->gpt_isleaf ? 1 : 0;
-			bcopy(&attr, bp->bio_data, sizeof(int));
-			bp->bio_completed = sizeof(int);
-			g_io_deliver(bp, 0);
-			return;
-		} else if (!strcmp("PART::depth", bp->bio_attribute)) {
-			if (bp->bio_length != sizeof(int)) {
-				g_io_deliver(bp, EFAULT);
-				return;
-			}
-			bcopy(&table->gpt_depth, bp->bio_data, sizeof(int));
-			bp->bio_completed = sizeof(int);
-			g_io_deliver(bp, 0);
-			return;
 		}
 		break;
 	default:

==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/geom/part/g_part.h#3 (text+ko) ====

@@ -23,7 +23,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/geom/part/g_part.h,v 1.2 2007/05/08 20:18:17 marcel Exp $
+ * $FreeBSD: src/sys/geom/part/g_part.h,v 1.3 2007/06/17 22:19:19 marcel Exp $
  */
 
 #ifndef _GEOM_PART_H_
@@ -87,12 +87,25 @@
 	 */
 	uint32_t	gpt_smhead;
 	uint32_t	gpt_smtail;
+	/*
+	 * gpt_sectors and gpt_heads are the fixed or synchesized number
+	 * of sectors per track and heads (resp) that make up a disks
+	 * geometry. This is to support partitioning schemes as well as
+	 * file systems that work on a geometry. The MBR scheme and the
+	 * MS-DOS (FAT) file system come to mind.
+	 * We keep track of whether the geometry is fixed or synchesized
+	 * so that a partitioning scheme can correct the synthesized
+	 * geometry, based on the on-disk metadata.
+	 */
+	uint32_t	gpt_sectors;
+	uint32_t	gpt_heads;
 
 	int		gpt_depth;	/* Sub-partitioning level. */
 	int		gpt_isleaf:1;	/* Cannot be sub-partitioned. */
 	int		gpt_created:1;	/* Newly created. */
 	int		gpt_modified:1;	/* Table changes have been made. */
 	int		gpt_opened:1;	/* Permissions obtained. */
+	int		gpt_fixgeom:1;	/* Geometry is fixed. */
 };
 
 struct g_part_entry *g_part_new_entry(struct g_part_table *, int, quad_t,
@@ -127,4 +140,6 @@
 	unsigned int	gpp_version;
 };
 
+void g_part_geometry_heads(off_t, u_int, off_t *, u_int *);
+
 #endif /* !_GEOM_PART_H_ */

==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/geom/part/g_part_mbr.c#2 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/geom/part/g_part_mbr.c,v 1.1 2007/06/13 04:27:36 marcel Exp $");
+__FBSDID("$FreeBSD: src/sys/geom/part/g_part_mbr.c,v 1.2 2007/06/17 22:19:19 marcel Exp $");
 
 #include <sys/param.h>
 #include <sys/bio.h>
@@ -50,7 +50,6 @@
 struct g_part_mbr_table {
 	struct g_part_table	base;
 	u_char		mbr[MBRSIZE];
-	int		spt;		/* Sectors/track. */
 };
 
 struct g_part_mbr_entry {
@@ -119,31 +118,52 @@
 	return (EINVAL);
 }
 
+static void
+mbr_set_chs(struct g_part_table *table, uint32_t lba, u_char *cylp, u_char *hdp,
+    u_char *secp)
+{
+	uint32_t cyl, hd, sec;
+
+	sec = lba % table->gpt_sectors + 1;
+	lba /= table->gpt_sectors;
+	hd = lba % table->gpt_heads;
+	lba /= table->gpt_heads;
+	cyl = lba;
+	if (cyl > 1023)
+		sec = hd = cyl = ~0;
+
+	*cylp = cyl & 0xff;
+	*hdp = hd & 0xff;
+	*secp = (sec & 0x3f) | ((cyl >> 2) & 0xc0);
+}
+
 static int
 g_part_mbr_add(struct g_part_table *basetable, struct g_part_entry *baseentry,
     struct g_part_parms *gpp)
 {
 	struct g_part_mbr_entry *entry;
 	struct g_part_mbr_table *table;
-	uint32_t start, size;
+	uint32_t start, size, sectors;
 
 	if (gpp->gpp_parms & G_PART_PARM_LABEL)
 		return (EINVAL);
 
+	sectors = basetable->gpt_sectors;
+
 	entry = (struct g_part_mbr_entry *)baseentry;
 	table = (struct g_part_mbr_table *)basetable;
 
 	start = gpp->gpp_start;
 	size = gpp->gpp_size;
-	if (size < table->spt)
+	if (size < sectors)
 		return (EINVAL);
-	if (start % table->spt) {
-		size = size - table->spt + (start % table->spt);
-		start = start - (start % table->spt) + table->spt;
+	if (start % sectors) {
+		size = size - sectors + (start % sectors);
+		start = start - (start % sectors) + sectors;
 	}
-	if (size % table->spt)
-		size = size - (size % table->spt);
-	if (size < table->spt)
+	if (size % sectors)
+		size = size - (size % sectors);
+	if (size < sectors)
 		return (EINVAL);
 
 	if (baseentry->gpe_deleted)
@@ -155,6 +175,10 @@
 	baseentry->gpe_end = start + size - 1;
 	entry->ent.dp_start = start;
 	entry->ent.dp_size = size;
+	mbr_set_chs(basetable, baseentry->gpe_start, &entry->ent.dp_scyl,
+	    &entry->ent.dp_shd, &entry->ent.dp_ssect);
+	mbr_set_chs(basetable, baseentry->gpe_end, &entry->ent.dp_ecyl,
+	    &entry->ent.dp_ehd, &entry->ent.dp_esect);
 	return (mbr_parse_type(gpp->gpp_type, &entry->ent.dp_typ));
 }
 
@@ -165,27 +189,19 @@
 	struct g_provider *pp;
 	struct g_part_mbr_table *table;
 	uint64_t msize;
-	int error, spt;
 
 	pp = gpp->gpp_provider;
 	cp = LIST_FIRST(&pp->consumers);
 
-	error = g_getattr("GEOM::fwsectors", cp, &spt);
-	if (error)
-		spt = 17;
-	else if (spt == 0)
-		spt = 1;
-
-	if (pp->sectorsize < MBRSIZE || pp->mediasize < spt * pp->sectorsize)
+	if (pp->sectorsize < MBRSIZE)
 		return (ENOSPC);
 
 	msize = pp->mediasize / pp->sectorsize;
-	basetable->gpt_first = spt;
-	basetable->gpt_last = msize - (msize % spt) - 1;
+	basetable->gpt_first = basetable->gpt_sectors;
+	basetable->gpt_last = msize - (msize % basetable->gpt_sectors) - 1;
 
 	table = (struct g_part_mbr_table *)basetable;
 	le16enc(table->mbr + DOSMAGICOFFSET, DOSMAGIC);
-	table->spt = spt;
 	return (0);
 }
 
@@ -262,23 +278,13 @@
 	struct g_part_mbr_table *table;
 	struct g_part_mbr_entry *entry;
 	u_char *buf, *p;
-	uint64_t msize;
-	int error, index, spt;
-
-	error = g_getattr("GEOM::fwsectors", cp, &spt);
-	if (error)
-		spt = 17;
-	else if (spt == 0)
-		spt = 1;
+	off_t chs, msize;
+	u_int sectors, heads;
+	int error, index;
 
 	pp = cp->provider;
 	table = (struct g_part_mbr_table *)basetable;
-	table->spt = spt;
-
 	msize = pp->mediasize / pp->sectorsize;
-	basetable->gpt_first = spt;
-	basetable->gpt_last = msize - (msize % spt) - 1;
-	basetable->gpt_entries = NDOSPART;
 
 	buf = g_read_data(cp, 0L, pp->sectorsize, &error);
 	if (buf == NULL)
@@ -303,10 +309,19 @@
 			continue;
 		if (ent.dp_start == 0 || ent.dp_size == 0)
 			continue;
-		if ((ent.dp_start % spt) != 0)
+		sectors = ent.dp_esect & 0x3f;
+		if (sectors > basetable->gpt_sectors &&
+		    !basetable->gpt_fixgeom) {
+			g_part_geometry_heads(msize, sectors, &chs, &heads);
+			if (chs != 0) {
+				basetable->gpt_sectors = sectors;
+				basetable->gpt_heads = heads;
+			}
+		}
+		if ((ent.dp_start % basetable->gpt_sectors) != 0)
 			printf("GEOM: %s: partition %d does not start on a "
 			    "track boundary.\n", pp->name, index + 1);
-		if ((ent.dp_size % spt) != 0)
+		if ((ent.dp_size % basetable->gpt_sectors) != 0)
 			printf("GEOM: %s: partition %d does not end on a "
 			    "track boundary.\n", pp->name, index + 1);
 
@@ -314,6 +329,11 @@
 		    index + 1, ent.dp_start, ent.dp_start + ent.dp_size - 1);
 		entry->ent = ent;
 	}
+
+	basetable->gpt_entries = NDOSPART;
+	basetable->gpt_first = basetable->gpt_sectors;
+	basetable->gpt_last = msize - (msize % basetable->gpt_sectors) - 1;
+
 	return (0);
 }
 

==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/i386/cpufreq/smist.c#2 (text+ko) ====

@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/i386/cpufreq/smist.c,v 1.1 2005/04/19 16:38:24 njl Exp $");
+__FBSDID("$FreeBSD: src/sys/i386/cpufreq/smist.c,v 1.2 2007/06/17 07:18:23 njl Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -45,6 +45,7 @@
 #include <sys/module.h>
 #include <sys/systm.h>
 
+#include <machine/bus.h>
 #include <machine/md_var.h>
 #include <machine/vm86.h>
 
@@ -71,6 +72,8 @@
 	struct cf_setting	 sets[2];	/* Only two settings. */
 };
 
+static char smist_magic[] = "Copyright (c) 1999 Intel Corporation";
+
 static void	smist_identify(driver_t *driver, device_t parent);
 static int	smist_probe(device_t dev);
 static int	smist_attach(device_t dev);
@@ -147,34 +150,84 @@
 	return (0);
 }
 
-static int
-set_ownership(device_t dev)
+/* Temporary structure to hold mapped page and status. */
+struct set_ownership_data {
+	int	smi_cmd;
+	int	command;
+	int	result;
+	void	*buf;
+};
+
+/* Perform actual SMI call to enable SpeedStep. */
+static void
+set_ownership_cb(void *arg, bus_dma_segment_t *segs, int nsegs, int error)
 {
-	int result;
-	struct smist_softc *sc;
-	vm_paddr_t pmagic;
-	static char magic[] = "Copyright (c) 1999 Intel Corporation";
+	struct set_ownership_data *data;
 
-	sc = device_get_softc(dev);
-	if (!sc)
-		return (ENXIO);
+	data = arg;
+	if (error) {
+		data->result = error;
+		return;
+	}
 
-	pmagic = vtophys(magic);
-
+	/* Copy in the magic string and send it by writing to the SMI port. */
+	strlcpy(data->buf, smist_magic, PAGE_SIZE);
 	__asm __volatile(
 	    "movl $-1, %%edi\n\t"
 	    "out %%al, (%%dx)\n"
-	    : "=D" (result)
-	    : "a" (sc->command),
+	    : "=D" (data->result)
+	    : "a" (data->command),
 	      "b" (0),
 	      "c" (0),
-	      "d" (sc->smi_cmd),
-	      "S" (pmagic)
+	      "d" (data->smi_cmd),
+	      "S" ((uint32_t)segs[0].ds_addr)
 	);
+}
 
-	DPRINT(dev, "taking ownership over BIOS return %d\n", result);
+static int
+set_ownership(device_t dev)
+{
+	struct smist_softc *sc;
+	struct set_ownership_data cb_data;
+	bus_dma_tag_t tag;
+	bus_dmamap_t map;
+
+	/*
+	 * Specify the region to store the magic string.  Since its address is
+	 * passed to the BIOS in a 32-bit register, we have to make sure it is
+	 * located in a physical page below 4 GB (i.e., for PAE.)
+	 */
+	sc = device_get_softc(dev);
+	if (bus_dma_tag_create(/*parent*/ NULL,
+	    /*alignment*/ PAGE_SIZE, /*no boundary*/ 0,
+	    /*lowaddr*/ BUS_SPACE_MAXADDR_32BIT, /*highaddr*/ BUS_SPACE_MAXADDR,
+	    NULL, NULL, /*maxsize*/ PAGE_SIZE, /*segments*/ 1,
+	    /*maxsegsize*/ PAGE_SIZE, 0, busdma_lock_mutex, &Giant,
+	    &tag) != 0) {
+		device_printf(dev, "can't create mem tag\n");
+		return (ENXIO);
+	}
+	if (bus_dmamem_alloc(tag, &cb_data.buf, BUS_DMA_NOWAIT, &map) != 0) {
+		bus_dma_tag_destroy(tag);
+		device_printf(dev, "can't alloc mapped mem\n");
+		return (ENXIO);
+	}
 
-	return (result ? ENXIO : 0);
+	/* Load the physical page map and take ownership in the callback. */
+	cb_data.smi_cmd = sc->smi_cmd;
+	cb_data.command = sc->command;
+	if (bus_dmamap_load(tag, map, cb_data.buf, PAGE_SIZE, set_ownership_cb,
+	    &cb_data, BUS_DMA_NOWAIT) != 0) {
+		bus_dmamem_free(tag, cb_data.buf, map);
+		bus_dma_tag_destroy(tag);
+		device_printf(dev, "can't load mem\n");
+		return (ENXIO);
+	};
+	DPRINT(dev, "taking ownership over BIOS return %d\n", cb_data.result);
+	bus_dmamap_unload(tag, map);
+	bus_dmamem_free(tag, cb_data.buf, map);
+	bus_dma_tag_destroy(tag);
+	return (cb_data.result ? ENXIO : 0);
 }
 
 static int

==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/i386/isa/clock.c#3 (text+ko) ====

@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/i386/isa/clock.c,v 1.236 2007/06/04 18:25:07 dwmalone Exp $");
+__FBSDID("$FreeBSD: src/sys/i386/isa/clock.c,v 1.237 2007/06/15 22:58:13 peter Exp $");
 
 /*
  * Routines to handle clock hardware.
@@ -56,12 +56,15 @@
 #include <sys/systm.h>
 #include <sys/bus.h>
 #include <sys/clock.h>
+#include <sys/conf.h>
+#include <sys/fcntl.h>
 #include <sys/lock.h>
 #include <sys/kdb.h>
 #include <sys/mutex.h>
 #include <sys/proc.h>
 #include <sys/time.h>
 #include <sys/timetc.h>
+#include <sys/uio.h>
 #include <sys/kernel.h>
 #include <sys/limits.h>
 #include <sys/module.h>
@@ -930,4 +933,100 @@
 
 DRIVER_MODULE(attimer, isa, attimer_driver, attimer_devclass, 0, 0);
 DRIVER_MODULE(attimer, acpi, attimer_driver, attimer_devclass, 0, 0);
+
+/*
+ * Linux-style /dev/nvram driver
+ *
+ * cmos ram starts at bytes 14 through 128, for a total of 114 bytes.
+ * bytes 16 through 31 are checksummed at byte 32.
+ * Unlike Linux, you have to take care of the checksums yourself.
+ * The driver exposes byte 14 as file offset 0.
+ */
+
+#define NVRAM_FIRST	RTC_DIAG	/* 14 */
+#define NVRAM_LAST	128
+
+static d_open_t		nvram_open;
+static d_read_t		nvram_read;
+static d_write_t	nvram_write;
+
+static struct cdev *nvram_dev;
+
+static struct cdevsw nvram_cdevsw = {
+	.d_version =	D_VERSION,
+	.d_flags =	D_NEEDGIANT,
+	.d_open =	nvram_open,
+	.d_read =	nvram_read,
+	.d_write =	nvram_write,
+	.d_name =	"nvram",
+};
+
+static int
+nvram_open(struct cdev *dev __unused, int flags, int fmt __unused,
+    struct thread *td)
+{
+	int error = 0;
+
+	if (flags & FWRITE)
+		error = securelevel_gt(td->td_ucred, 0);
+
+	return (error);
+}
+
+static int
+nvram_read(struct cdev *dev, struct uio *uio, int flags)
+{
+	int nv_off;
+	u_char v;
+	int error = 0;
+
+	while (uio->uio_resid > 0 && error == 0) {
+		nv_off = uio->uio_offset + NVRAM_FIRST;
+		if (nv_off < NVRAM_FIRST || nv_off >= NVRAM_LAST)
+			return (0);	/* Signal EOF */
+		/* Single byte at a time */
+		v = rtcin(nv_off);
+		error = uiomove(&v, 1, uio);
+	}
+	return (error);
+
+}
+
+static int
+nvram_write(struct cdev *dev, struct uio *uio, int flags)
+{
+	int nv_off;
+	u_char v;
+	int error = 0;
+
+	while (uio->uio_resid > 0 && error == 0) {
+		nv_off = uio->uio_offset + NVRAM_FIRST;
+		if (nv_off < NVRAM_FIRST || nv_off >= NVRAM_LAST)
+			return (0);	/* Signal EOF */
+		/* Single byte at a time */
+		error = uiomove(&v, 1, uio);
+		writertc(nv_off, v);
+	}
+	return (error);
+}
+
+static int
+nvram_modevent(module_t mod __unused, int type, void *data __unused)
+{
+	switch (type) {
+	case MOD_LOAD:
+		nvram_dev = make_dev(&nvram_cdevsw, 0,
+		    UID_ROOT, GID_KMEM, 0640, "nvram");
+		break;
+	case MOD_UNLOAD:
+	case MOD_SHUTDOWN:
+		destroy_dev(nvram_dev);
+		break;
+	default:
+		return (EOPNOTSUPP);
+	}
+	return (0);
+}
+DEV_MODULE(nvram, nvram_modevent, NULL);
+
 #endif /* DEV_ISA */

==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/i386/xbox/xboxfb.c#2 (text+ko) ====

@@ -23,10 +23,11 @@
  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD: src/sys/i386/xbox/xboxfb.c,v 1.4 2006/03/03 14:52:57 rink Exp $
  */
 
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: src/sys/i386/xbox/xboxfb.c,v 1.5 2007/06/16 21:31:53 marius Exp $");
+
 /*
  * This is the syscon(4)-ized version of the Xbox Frame Buffer driver. It
  * supports about all features required, such as mouse support.
@@ -71,7 +72,7 @@
 	char* sc_framebuffer;
 
 	/* pointer to the font used */
-	struct gfb_font* sc_font;
+	const struct gfb_font* sc_font;
 };
 
 #define SCREEN_WIDTH	640
@@ -79,7 +80,7 @@
 
 #define XBOXFB_DRIVER_NAME "xboxsc"
 
-extern struct gfb_font bold8x16;
+extern const struct gfb_font bold8x16;
 

>>> TRUNCATED FOR MAIL (1000 lines) <<<



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