Author: brooks Date: Thu May 30 01:19:02 2013 New Revision: 251117 URL: http://svnweb.freebsd.org/changeset/base/251117
Log: MFP4 @222836 Add support for partitioning CFI disks from FDT using geom_flashmap. Sponsored by: DARPA, AFRL Modified: head/sys/dev/cfi/cfi_disk.c head/sys/geom/geom_flashmap.c Modified: head/sys/dev/cfi/cfi_disk.c ============================================================================== --- head/sys/dev/cfi/cfi_disk.c Thu May 30 00:22:07 2013 (r251116) +++ head/sys/dev/cfi/cfi_disk.c Thu May 30 01:19:02 2013 (r251117) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include <dev/cfi/cfi_var.h> +#include <geom/geom.h> #include <geom/geom_disk.h> struct cfi_disk_softc { @@ -64,6 +65,7 @@ static int cfi_disk_detach(device_t); 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 *); @@ -95,6 +97,7 @@ cfi_disk_attach(device_t dev) 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 +278,31 @@ cfi_io_proc(void *arg, int pending) } } +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) { Modified: head/sys/geom/geom_flashmap.c ============================================================================== --- head/sys/geom/geom_flashmap.c Thu May 30 00:22:07 2013 (r251116) +++ head/sys/geom/geom_flashmap.c Thu May 30 01:19:02 2013 (r251117) @@ -186,8 +186,11 @@ g_flashmap_taste(struct g_class *mp, str 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) _______________________________________________ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"