PERFORCE change 222848 for review
Brooks Davis
brooks at FreeBSD.org
Thu Mar 14 18:09:45 UTC 2013
http://p4web.freebsd.org/@@222848?ac=10
Change 222848 by brooks at brooks_zenith on 2013/03/14 18:09:37
Integrate from FreeBSD/BERI. Switch most partitioning to
geom_flashmap.c.
Affected files ...
.. //depot/projects/ctsrd/cheribsd/src/sys/boot/fdt/dts/beripad-de4.dts#6 integrate
.. //depot/projects/ctsrd/cheribsd/src/sys/dev/cfi/cfi_disk.c#4 integrate
.. //depot/projects/ctsrd/cheribsd/src/sys/geom/geom_flashmap.c#3 integrate
.. //depot/projects/ctsrd/cheribsd/src/sys/mips/conf/BERI_DE4.hints#14 integrate
Differences ...
==== //depot/projects/ctsrd/cheribsd/src/sys/boot/fdt/dts/beripad-de4.dts#6 (text+ko) ====
@@ -1,5 +1,6 @@
/*-
* Copyright (c) 2012-2013 Robert N. M. Watson
+ * Copyright (c) 2013 SRI International
* All rights reserved.
*
* This software was developed by SRI International and the University of
@@ -100,8 +101,40 @@
* Ethernet addresses for now.
*/
flash at 74000000 {
+ #address-cells = <1>;
+ #size-cells = <1>;
compatible = "cfi-flash";
reg = <0x74000000 0x4000000>;
+
+ /* Board configuration */
+ partition at 0 {
+ reg = <0x0 0x20000>;
+ label = "config";
+ };
+
+ /* Power up FPGA image */
+ partition at 20000 {
+ reg = <0x20000 0xc00000>;
+ label = "fpga0";
+ };
+
+ /* Secondary FPGA image (on RE_CONFIGn button) */
+ partition at C20000 {
+ reg = <0xc20000 0xc00000>;
+ label = "fpga1";
+ };
+
+ /* Space for operating system use */
+ partition at 1820000 {
+ reg = <0x1820000 0x027c0000>;
+ label = "os";
+ };
+
+ /* Second stage bootloader */
+ parition at 3fe0000 {
+ reg = <0x3fe0000 0x20000>;
+ label = "boot";
+ };
};
ethernet at 7f007000 {
==== //depot/projects/ctsrd/cheribsd/src/sys/dev/cfi/cfi_disk.c#4 (text+ko) ====
@@ -44,6 +44,7 @@
#include <dev/cfi/cfi_var.h>
+#include <geom/geom.h>
#include <geom/geom_disk.h>
struct cfi_disk_softc {
@@ -64,9 +65,11 @@
static int cfi_disk_open(struct disk *);
static int cfi_disk_close(struct disk *);
static void cfi_io_proc(void *, int);
+static int cfi_disk_getattr(struct bio *);
static void cfi_disk_strategy(struct bio *);
static int cfi_disk_ioctl(struct disk *, u_long, void *, int, struct thread *);
+
static int
cfi_disk_probe(device_t dev)
{
@@ -95,6 +98,7 @@
sc->disk->d_strategy = cfi_disk_strategy;
sc->disk->d_ioctl = cfi_disk_ioctl;
sc->disk->d_dump = NULL; /* NB: no dumps */
+ sc->disk->d_getattr = cfi_disk_getattr;
sc->disk->d_sectorsize = CFI_DISK_SECSIZE;
sc->disk->d_mediasize = sc->parent->sc_size;
sc->disk->d_maxsize = CFI_DISK_MAXIOSIZE;
@@ -275,6 +279,31 @@
}
}
+static int
+cfi_disk_getattr(struct bio *bp)
+{
+ struct cfi_disk_softc *dsc;
+ struct cfi_softc *sc;
+ device_t dev;
+
+ if (bp->bio_disk == NULL || bp->bio_disk->d_drv1 == NULL)
+ return (ENXIO);
+
+ dsc = bp->bio_disk->d_drv1;
+ sc = dsc->parent;
+ dev = sc->sc_dev;
+
+ do {
+ if (g_handleattr(bp, "CFI::device", &dev, sizeof(device_t)))
+ break;
+
+ return (ERESTART);
+ } while(0);
+
+ return (EJUSTRETURN);
+}
+
+
static void
cfi_disk_strategy(struct bio *bp)
{
==== //depot/projects/ctsrd/cheribsd/src/sys/geom/geom_flashmap.c#3 (text+ko) ====
@@ -174,7 +174,7 @@
g_topology_assert();
if (flags == G_TF_NORMAL &&
- !strcmp(pp->geom->class->name, FLASHMAP_CLASS_NAME))
+ strcmp(pp->geom->class->name, "DISK") != 0)
return (NULL);
gp = g_slice_new(mp, FLASH_SLICES_MAX_NUM, pp, &cp, NULL, 0,
@@ -186,8 +186,11 @@
do {
size = sizeof(device_t);
- if (g_io_getattr("NAND::device", cp, &size, &dev))
- break;
+ if (g_io_getattr("NAND::device", cp, &size, &dev)) {
+ size = sizeof(device_t);
+ if (g_io_getattr("CFI::device", cp, &size, &dev))
+ break;
+ }
nslices = g_flashmap_load(dev, &head);
if (nslices == 0)
==== //depot/projects/ctsrd/cheribsd/src/sys/mips/conf/BERI_DE4.hints#14 (text+ko) ====
@@ -1,67 +1,16 @@
# $FreeBSD: head/sys/mips/conf/BERI_DE4.hints 239713 2012-08-26 10:40:13Z rwatson $
-# Reserved configuration blocks. Don't touch.
-hint.map.0.at="cfid0"
+# Hardwired location of bitfile
+hint.map.0.at="cfid0s.fpga0"
hint.map.0.start=0x00000000
-hint.map.0.end=0x00020000
-hint.map.0.name="config"
-hint.map.0.readonly=1
-
-# Hardwired location of bitfile
-hint.map.1.at="cfid0"
-hint.map.1.start=0x00020000
-hint.map.1.end=0x01820000
-hint.map.1.name="fpga"
-
-# Currently unused space on the first chip
-# XXX: To be merged with the kernel map when we begin using the boot loader
-hint.map.2.at="cfid0"
-hint.map.2.start=0x01820000
-hint.map.2.end=0x02000000
-hint.map.2.name="reserved"
+hint.map.0.end=0x00c00000
+hint.map.0.name="fpga"
# Kernel on the second chip
-hint.map.3.at="cfid0"
-hint.map.3.start=0x02000000
-hint.map.3.end=0x03fe0000
-hint.map.3.name="kernel"
-
-# Area for use by the boot loader
-hint.map.4.at="cfid0"
-hint.map.4.start=0x03fe0000
-hint.map.4.end=0x04000000
-hint.map.4.name="boot"
-
-# Reserved configuration blocks. Don't touch.
-hint.map.5.at="isf0"
-hint.map.5.start=0x00000000
-hint.map.5.end=0x00020000
-hint.map.5.name="config"
-hint.map.5.readonly=1
-
-# Hardwired location of bitfile
-hint.map.6.at="isf0"
-hint.map.6.start=0x00020000
-hint.map.6.end=0x01820000
-hint.map.6.name="fpga"
-
-# Currently unused space on the first chip
-hint.map.7.at="isf0"
-hint.map.7.start=0x01820000
-hint.map.7.end=0x02000000
-hint.map.7.name="reserved"
-
-# Kernel on the second chip
-hint.map.8.at="isf1"
-hint.map.8.start=0x00000000
-hint.map.8.end=0x01fe0000
-hint.map.8.name="kernel"
-
-# Area for use by the boot loader
-hint.map.10.at="isf1"
-hint.map.10.start=0x01fe0000
-hint.map.10.end=0x02000000
-hint.map.10.name="kernel"
+hint.map.1.at="cfid0s.os"
+hint.map.1.start=0x007e0000
+hint.map.1.end=0x01fe0000
+hint.map.1.name="kernel"
# Altera Triple-Speed Ethernet Mac, present in tPad and DE-4 configurations
# configured from fdt(4) but PHYs are still described in here.
More information about the p4-projects
mailing list