Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/uebayasi-xip]: src/sys Export flash_init() correctly. Calculate disk pa...
details: https://anonhg.NetBSD.org/src/rev/2141c9e6b1aa
branches: uebayasi-xip
changeset: 751761:2141c9e6b1aa
user: uebayasi <uebayasi%NetBSD.org@localhost>
date: Wed Aug 11 13:24:47 2010 +0000
description:
Export flash_init() correctly. Calculate disk partition correctly.
Correct dmesg. Correct conditional compilation.
diffstat:
sys/conf/files | 5 ++++-
sys/dev/flash.c | 19 ++++++++++++-------
sys/dev/flashvar.h | 3 ++-
3 files changed, 18 insertions(+), 9 deletions(-)
diffs (101 lines):
diff -r 2f0207945565 -r 2141c9e6b1aa sys/conf/files
--- a/sys/conf/files Wed Aug 11 13:20:07 2010 +0000
+++ b/sys/conf/files Wed Aug 11 13:24:47 2010 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files,v 1.974.2.5 2010/07/07 16:35:25 uebayasi Exp $
+# $NetBSD: files,v 1.974.2.6 2010/08/11 13:24:47 uebayasi Exp $
# @(#)files.newconf 7.5 (Berkeley) 5/10/93
version 20090313
@@ -1686,3 +1686,6 @@
# alternate memory device
#
include "dev/altmem/files.altmem"
+
+device flash
+file dev/flash.c flash
diff -r 2f0207945565 -r 2141c9e6b1aa sys/dev/flash.c
--- a/sys/dev/flash.c Wed Aug 11 13:20:07 2010 +0000
+++ b/sys/dev/flash.c Wed Aug 11 13:24:47 2010 +0000
@@ -1,4 +1,4 @@
-/* $Id: flash.c,v 1.1.2.11 2010/07/27 01:16:21 uebayasi Exp $ */
+/* $Id: flash.c,v 1.1.2.12 2010/08/11 13:24:47 uebayasi Exp $ */
/*-
* Copyright (c) 2010 Tsubai Masanari. All rights reserved.
@@ -36,8 +36,10 @@
#include <sys/buf.h>
#include <sys/bufq.h>
#include <sys/disklabel.h>
+#include <sys/stat.h>
+#include <sys/mman.h>
-#include <dev/flash/flashvar.h>
+#include <dev/flashvar.h>
static dev_type_open(flash_open);
static dev_type_close(flash_close);
@@ -57,8 +59,10 @@
static int
flash_open(dev_t dev, int flags, int fmt, struct lwp *l)
{
- struct flash_softc *sc = device_lookup_private(&flash_cd, minor(dev));
+ struct flash_softc *sc = device_lookup_private(&flash_cd, DISKUNIT(dev));
struct disk *dk = &sc->sc_dkdev;
+ const int part = DISKUNIT(dev);
+ const int pmask = 1 << part;
if (sc == NULL)
return ENXIO;
@@ -87,8 +91,8 @@
int
flash_ioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
{
- struct flash_softc *sc = device_lookup_private(&flash_cd, minor(dev));
- struct flash_program *fp;
+ struct flash_softc *sc = device_lookup_private(&flash_cd, DISKUNIT(dev));
+ const int part = DISKUNIT(dev);
int error = 0;
if (sc == NULL)
@@ -125,7 +129,7 @@
paddr_t
flash_mmap(dev_t dev, off_t off, int prot)
{
- struct flash_softc *sc = device_lookup_private(&flash_cd, minor(dev));
+ struct flash_softc *sc = device_lookup_private(&flash_cd, DISKUNIT(dev));
if (sc == NULL)
return -1;
@@ -237,7 +241,7 @@
#endif
#ifdef XIP
-#ifndef __BUS_SPACE_HAS_PHYSLOAD
+#ifndef __BUS_SPACE_HAS_PHYSLOAD_METHODS
#error bus_space_physload_device(9) must be supported to use XIP!
#else
sc->sc_phys = bus_space_physload_device(sc->sc_iot, sc->sc_addr, sc->sc_size,
@@ -247,4 +251,5 @@
disk_init(&sc->sc_dkdev, device_xname(&sc->sc_dev), NULL);
disk_attach(&sc->sc_dkdev);
+ printf("\n");
}
diff -r 2f0207945565 -r 2141c9e6b1aa sys/dev/flashvar.h
--- a/sys/dev/flashvar.h Wed Aug 11 13:20:07 2010 +0000
+++ b/sys/dev/flashvar.h Wed Aug 11 13:24:47 2010 +0000
@@ -1,4 +1,4 @@
-/* $Id: flashvar.h,v 1.1.2.3 2010/04/28 13:41:41 uebayasi Exp $ */
+/* $Id: flashvar.h,v 1.1.2.4 2010/08/11 13:24:48 uebayasi Exp $ */
/*-
* Copyright (c) 2010 Tsubai Masanari. All rights reserved.
@@ -53,6 +53,7 @@
void *sc_phys;
};
+void flash_init(struct flash_softc *);
int flash_map(struct flash_softc *, u_long);
void flash_unmap(struct flash_softc *);
Home |
Main Index |
Thread Index |
Old Index