Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/compat/netbsd32 compat/netbsd32 ioctl support for FLASH_...



details:   https://anonhg.NetBSD.org/src/rev/0236af6bd233
branches:  trunk
changeset: 763423:0236af6bd233
user:      cliff <cliff%NetBSD.org@localhost>
date:      Sat Mar 19 04:07:35 2011 +0000

description:
compat/netbsd32 ioctl support for FLASH_GET_INFO

diffstat:

 sys/compat/netbsd32/netbsd32_ioctl.c |  27 +++++++++++++++++++++++++--
 sys/compat/netbsd32/netbsd32_ioctl.h |  10 +++++++++-
 2 files changed, 34 insertions(+), 3 deletions(-)

diffs (83 lines):

diff -r fc32fdcd470d -r 0236af6bd233 sys/compat/netbsd32/netbsd32_ioctl.c
--- a/sys/compat/netbsd32/netbsd32_ioctl.c      Sat Mar 19 01:34:24 2011 +0000
+++ b/sys/compat/netbsd32/netbsd32_ioctl.c      Sat Mar 19 04:07:35 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_ioctl.c,v 1.54 2011/02/01 00:53:22 matt Exp $ */
+/*     $NetBSD: netbsd32_ioctl.c,v 1.55 2011/03/19 04:07:35 cliff Exp $        */
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.54 2011/02/01 00:53:22 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.55 2011/03/19 04:07:35 cliff Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -51,6 +51,7 @@
 #include <sys/ktrace.h>
 #include <sys/kmem.h>
 #include <sys/envsys.h>
+#include <sys/flashio.h>
 
 #ifdef __sparc__
 #include <dev/sun/fbio.h>
@@ -442,6 +443,25 @@
        *s32p = (netbsd32_u_long)*p;
 }
 
+static inline void
+netbsd32_to_flash_info_params(struct netbsd32_flash_info_params *s32p,
+       struct flash_info_params *p, u_long cmd)
+{
+       p->ip_flash_size = s32p->ip_flash_size;
+       p->ip_page_size = (size_t)s32p->ip_page_size;
+       p->ip_erase_size = (size_t)s32p->ip_erase_size;
+       p->ip_flash_type = s32p->ip_flash_type;
+}
+
+static inline void
+netbsd32_from_flash_info_params(struct flash_info_params *p,
+       struct netbsd32_flash_info_params *s32p, u_long cmd)
+{
+       s32p->ip_flash_size = p->ip_flash_size;
+       s32p->ip_page_size = (netbsd32_size_t)p->ip_page_size;
+       s32p->ip_erase_size = (netbsd32_size_t)p->ip_erase_size;
+       s32p->ip_flash_type = p->ip_flash_type;
+}
 
 /*
  * main ioctl syscall.
@@ -744,6 +764,9 @@
        case ENVSYS_REMOVEPROPS32:
                IOCTL_STRUCT_CONV_TO(ENVSYS_REMOVEPROPS, plistref);
 
+       case FLASH_GET_INFO32:
+               IOCTL_STRUCT_CONV_TO(FLASH_GET_INFO, flash_info_params);
+
        default:
 #ifdef NETBSD32_MD_IOCTL
                error = netbsd32_md_ioctl(fp, com, data32, l);
diff -r fc32fdcd470d -r 0236af6bd233 sys/compat/netbsd32/netbsd32_ioctl.h
--- a/sys/compat/netbsd32/netbsd32_ioctl.h      Sat Mar 19 01:34:24 2011 +0000
+++ b/sys/compat/netbsd32/netbsd32_ioctl.h      Sat Mar 19 04:07:35 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_ioctl.h,v 1.31 2011/03/06 17:08:34 bouyer Exp $       */
+/*     $NetBSD: netbsd32_ioctl.h,v 1.32 2011/03/19 04:07:35 cliff Exp $        */
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -393,3 +393,11 @@
 #define ENVSYS_SETDICTIONARY32 _IOWR('E', 1, struct netbsd32_plistref)
 #define ENVSYS_REMOVEPROPS32   _IOWR('E', 2, struct netbsd32_plistref)
 
+/* from <sys/flashio.h> */
+struct netbsd32_flash_info_params {
+       flash_addr_t ip_flash_size;
+       netbsd32_size_t ip_page_size;
+       netbsd32_size_t ip_erase_size;
+       uint8_t ip_flash_type;
+};
+#define FLASH_GET_INFO32        _IOWR('&', 2, struct netbsd32_flash_info_params)



Home | Main Index | Thread Index | Old Index