Source-Changes-HG archive

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

[src/trunk]: src/sys/compat Parent itarators in the IOKit emulation. A driver...



details:   https://anonhg.NetBSD.org/src/rev/56e2df010488
branches:  trunk
changeset: 554693:56e2df010488
user:      manu <manu%NetBSD.org@localhost>
date:      Sat Nov 01 00:32:44 2003 +0000

description:
Parent itarators in the IOKit emulation. A driver can only
have one parent yet (on Darwin, multiple parents are possible: the IOKit
seems to handle a graph more than a tree). Introfuction of a keyboard
driver parent for IOHIDSystem.

The kernel keymapping is still a big mystery.

diffstat:

 sys/compat/darwin/darwin_ioframebuffer.c |   5 +++--
 sys/compat/darwin/darwin_iohidsystem.c   |  27 ++++++++++++++++++++-------
 sys/compat/darwin/darwin_iokit.h         |   6 ++++--
 sys/compat/darwin/files.darwin           |   6 +++---
 sys/compat/mach/mach_iokit.c             |  18 ++++++++++++++++--
 sys/compat/mach/mach_iokit.h             |   3 ++-
 6 files changed, 48 insertions(+), 17 deletions(-)

diffs (192 lines):

diff -r bbf88e8af1e7 -r 56e2df010488 sys/compat/darwin/darwin_ioframebuffer.c
--- a/sys/compat/darwin/darwin_ioframebuffer.c  Fri Oct 31 23:36:50 2003 +0000
+++ b/sys/compat/darwin/darwin_ioframebuffer.c  Sat Nov 01 00:32:44 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: darwin_ioframebuffer.c,v 1.21 2003/10/25 18:38:07 christos Exp $ */
+/*     $NetBSD: darwin_ioframebuffer.c,v 1.22 2003/11/01 00:32:44 manu Exp $ */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: darwin_ioframebuffer.c,v 1.21 2003/10/25 18:38:07 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: darwin_ioframebuffer.c,v 1.22 2003/11/01 00:32:44 manu Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -107,6 +107,7 @@
 struct mach_iokit_devclass darwin_ioframebuffer_devclass = {
        "<dict ID=\"0\"><key>IOProviderClass</key>"
            "<string ID=\"1\">IOFramebuffer</string></dict>",
+       NULL,
        darwin_ioframebuffer_properties,
        darwin_ioframebuffer_properties_array,
        darwin_ioframebuffer_connect_method_scalari_scalaro,
diff -r bbf88e8af1e7 -r 56e2df010488 sys/compat/darwin/darwin_iohidsystem.c
--- a/sys/compat/darwin/darwin_iohidsystem.c    Fri Oct 31 23:36:50 2003 +0000
+++ b/sys/compat/darwin/darwin_iohidsystem.c    Sat Nov 01 00:32:44 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: darwin_iohidsystem.c,v 1.18 2003/10/25 18:38:07 christos Exp $ */
+/*     $NetBSD: darwin_iohidsystem.c,v 1.19 2003/11/01 00:32:44 manu Exp $ */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: darwin_iohidsystem.c,v 1.18 2003/10/25 18:38:07 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: darwin_iohidsystem.c,v 1.19 2003/11/01 00:32:44 manu Exp $");
 
 #include "ioconf.h"
 #include "wsmux.h"
@@ -74,6 +74,7 @@
 #include <compat/darwin/darwin_iokit.h>
 #include <compat/darwin/darwin_sysctl.h>
 #include <compat/darwin/darwin_iohidsystem.h>
+#include <compat/darwin/darwin_ioresources.h>
 
 /* Redefined from sys/dev/wscons/wsmux.c */
 extern const struct cdevsw wsmux_cdevsw;
@@ -93,15 +94,27 @@
        int *dita_hidsystem_finished;
 };
 
-#if 0
-static char darwin_iohidsystem_properties[] = "<dict ID=\"0\"><key>IOKit</key><string ID=\"1\">IOService</string><key>AccessMPC106PerformanceRegister</key><string ID=\"2\">AppleGracklePCI is not 
serializable</string><key>IONVRAM</key><reference IDREF=\"1\"/><key>IOiic0</key><string ID=\"3\">ApplePMU is not serializable</string><key>IORTC</key><reference 
IDREF=\"3\"/><key>IOBSD</key><reference IDREF=\"1\"/><key>setModemSound</key><string ID=\"4\">AppleScreamerAudio is not serializable</string><key>kdp</key><reference IDREF=\"1\"/></dict>";
-#endif
-static char darwin_iohidsystem_properties[] = "<dict ID=\"0\"><key>IOClass</key><string ID=\"1\">AppleADBKeyboard</string><key>ADBVirtualKeys</key><string 
ID=\"2\">0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F,0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F,0x30,0x31,0x32,0x33,0x34,0x35,0x3B,0x37,0x38,0x39,0x3A,0x7B,0x7C,0x7D,0x7E,0x3F,0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F,0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F,0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F,0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x3C,0x3D,0x3E,0x36,0x7F</string><key>IOProbeScore</key><integer
 size=\"32\" ID=\"3\">0x3e8</integer><key>IOProviderClass</key><string ID=\"4\">IOADBDevice</string><key>CFBundleIdentifier</key><string ID=\"5\">com.apple.driver.AppleADBKeyboard</string><key>ADB 
Match</key><string ID=\"6\">2</string><key>PowerBook fn Foward Delete</key><integer size=\"64\" ID=\"7\">0x1</integer><key>IOMatchCategory</key><string 
ID=\"8\">IODefaultMatchCategory</string><key>HIDKeyMapping</key><data 
ID=\"10\">AAAIAAE5AQE4AgE7AwE6BAE3BRVSQUxTVFVFWFdWW1xDS1F7fX58TlkGAXIHAT9/DQBhAEEAAQABAMoAxwABAAENAHMAUwATABMA+wCnABMAEw0AZABEAAQABAFEAbYABAAEDQBmAEYABgAGAKYBrAAGAAYNAGgASAAIAAgA4wDrAAAYAA0AZwBHAAcABwDxAOEABwAHDQB6AFoAGgAaAM8BVwAaABoNAHgAWAAYABgBtAHOABgAGA0AYwBDAAMAAwHjAdMAAwADDQB2AFYAFgAWAdYB4AAWABYCADwAPg0AYgBCAAIAAgHlAfIAAgACDQBxAFEAEQARAPoA6gARABENAHcAVwAXABcByAHHABcAFw0AZQBFAAUABQDCAMUABQAFDQByAFIAEgASAeIB0gASABINAHkAWQAZABkApQHbABkAGQ0AdABUABQAFAHkAdQAFAAUCgAxACEBrQChDgAyAEAAMgAAALIAswAAAAAKADMAIwCjAboKADQAJACiAKgOADYAXgA2AB4AtgDDAB4AHgoANQAlAaUAvQoAPQArAbkBsQoAOQAoAKwAqwoANwAmAbABqw4ALQBfAB8AHwCxANAAHwAfCgA4ACoAtwC0CgAwACkArQC7DgBdAH0AHQAdACcAugAdAB0NAG8ATwAPAA8A+QDpAA8ADw0AdQBVABUAFQDIAM0AFQAVDgBbAHsAGwAbAGAAqgAbABsNAGkASQAJAAkAwQD1AAkACQ0AcABQABAAEAFwAVAAEAAQEAANAAMNAGwATAAMAAwA+ADoAAwADA0AagBKAAoACgDGAK4ACgAKCgAnACIAqQGuDQBrAEsACwALAM4ArwALAAsKADsAOgGyAaIOAFwAfAAcABwA4wDrABwAHAoALAA8AMsBowoALwA/AbgAvw0AbgBOAA4ADgDEAa8ADgAODQBtAE0ADQANAW0B2AANAA0KAC4APgC8AbMCAAkAGQwAIAAAAIAAAAoAYAB+AGABuwIAfwAI/wIAGwB+//////////////8AAC7/AAAq/wAAK/8AABv///8OAC8AXAAvABwALwBcAAAKAAAADf8AAC3//w4APQB8AD0AHAA9AHwAABhGAAAwAAAxAAAyAAAzAAA0AAA1AAA2AAA3/wAAOAAAOf///wD+JAD+JQD+JgD+IgD+JwD+KP8A/ir/AP4y/wD+M/8A/in/AP4r/wD+NP8A/i4A/jAA/i0A/iMA/i8A/iEA/jEA/iAAAawAAa4AAa8AAa0PAv8EADEC/wQAMgL/BAAzAv8EADQC/wQANQL/BAA2Av8EADcC/wQAOAL/BAA5Av8EADAC/wQALQL/BAA9Av8EAHAC/wQAXQL/BABbBgVyBn8HSgg+CT0KRw==</data><key>HIDKind</key><integer
 size=\"32\" ID=\"11\">0x1</integer><key>HIDInterfaceID</key><integer size=\"32\" ID=\"12\">0x2</integer><key>HIDSubinterfaceID</key><integer size=\"32\" ID=\"13\">0xc4</integer></dict>";
+static char darwin_iokbd_properties[] = "<dict ID=\"0\"><key>IOClass</key><string ID=\"1\">AppleADBKeyboard</string><key>ADBVirtualKeys</key><string 
ID=\"2\">0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F,0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F,0x30,0x31,0x32,0x33,0x34,0x35,0x3B,0x37,0x38,0x39,0x3A,0x7B,0x7C,0x7D,0x7E,0x3F,0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F,0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F,0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F,0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x3C,0x3D,0x3E,0x36,0x7F</string><key>IOProbeScore</key><integer
 size=\"32\" ID=\"3\">0x3e8</integer><key>IOProviderClass</key><string ID=\"4\">IOADBDevice</string><key>CFBundleIdentifier</key><string ID=\"5\">com.apple.driver.AppleADBKeyboard</string><key>ADB 
Match</key><string ID=\"6\">2</string><key>PowerBook fn Foward Delete</key><integer size=\"64\" ID=\"7\">0x1</integer><key>IOMatchCategory</key><string 
ID=\"8\">IODefaultMatchCategory</string><key>HIDKeyMapping</key><data 
ID=\"10\">AAAIAAE5AQE4AgE7AwE6BAE3BRVSQUxTVFVFWFdWW1xDS1F7fX58TlkGAXIHAT9/DQBhAEEAAQABAMoAxwABAAENAHMAUwATABMA+wCnABMAEw0AZABEAAQABAFEAbYABAAEDQBmAEYABgAGAKYBrAAGAAYNAGgASAAIAAgA4wDrAAAYAA0AZwBHAAcABwDxAOEABwAHDQB6AFoAGgAaAM8BVwAaABoNAHgAWAAYABgBtAHOABgAGA0AYwBDAAMAAwHjAdMAAwADDQB2AFYAFgAWAdYB4AAWABYCADwAPg0AYgBCAAIAAgHlAfIAAgACDQBxAFEAEQARAPoA6gARABENAHcAVwAXABcByAHHABcAFw0AZQBFAAUABQDCAMUABQAFDQByAFIAEgASAeIB0gASABINAHkAWQAZABkApQHbABkAGQ0AdABUABQAFAHkAdQAFAAUCgAxACEBrQChDgAyAEAAMgAAALIAswAAAAAKADMAIwCjAboKADQAJACiAKgOADYAXgA2AB4AtgDDAB4AHgoANQAlAaUAvQoAPQArAbkBsQoAOQAoAKwAqwoANwAmAbABqw4ALQBfAB8AHwCxANAAHwAfCgA4ACoAtwC0CgAwACkArQC7DgBdAH0AHQAdACcAugAdAB0NAG8ATwAPAA8A+QDpAA8ADw0AdQBVABUAFQDIAM0AFQAVDgBbAHsAGwAbAGAAqgAbABsNAGkASQAJAAkAwQD1AAkACQ0AcABQABAAEAFwAVAAEAAQEAANAAMNAGwATAAMAAwA+ADoAAwADA0AagBKAAoACgDGAK4ACgAKCgAnACIAqQGuDQBrAEsACwALAM4ArwALAAsKADsAOgGyAaIOAFwAfAAcABwA4wDrABwAHAoALAA8AMsBowoALwA/AbgAvw0AbgBOAA4ADgDEAa8ADgAODQBtAE0ADQANAW0B2AANAA0KAC4APgC8AbMCAAkAGQwAIAAAAIAAAAoAYAB+AGABuwIAfwAI/wIAGwB+//////////////8AAC7/AAAq/wAAK/8AABv///8OAC8AXAAvABwALwBcAAAKAAAADf8AAC3//w4APQB8AD0AHAA9AHwAABhGAAAwAAAxAAAyAAAzAAA0AAA1AAA2AAA3/wAAOAAAOf///wD+JAD+JQD+JgD+IgD+JwD+KP8A/ir/AP4y/wD+M/8A/in/AP4r/wD+NP8A/i4A/jAA/i0A/iMA/i8A/iEA/jEA/iAAAawAAa4AAa8AAa0PAv8EADEC/wQAMgL/BAAzAv8EADQC/wQANQL/BAA2Av8EADcC/wQAOAL/BAA5Av8EADAC/wQALQL/BAA9Av8EAHAC/wQAXQL/BABbBgVyBn8HSgg+CT0KRw==</data><key>HIDKind</key><integer
 size=\"32\" ID=\"11\">0x1</integer><key>HIDInterfaceID</key><integer size=\"32\" ID=\"12\">0x2</integer><key>HIDSubinterfaceID</key><integer size=\"32\" ID=\"13\">0xc4</integer></dict>";
+
+struct mach_iokit_devclass darwin_iokbd_devclass = {
+       "(unkown)",
+       NULL,
+       darwin_iokbd_properties,
+       NULL,
+       NULL,
+       NULL,
+       NULL,
+       NULL,
+       NULL,
+       "AppleADBKeyboard",
+       NULL,
+};
 
 struct mach_iokit_devclass darwin_iohidsystem_devclass = {
        "<dict ID=\"0\"><key>IOProviderClass</key>"
            "<string ID=\"1\">IOHIDSystem</string></dict>",
-       darwin_iohidsystem_properties,
+       &darwin_iokbd_devclass,
+       NULL,
        NULL,
        darwin_iohidsystem_connect_method_scalari_scalaro,
        NULL,
diff -r bbf88e8af1e7 -r 56e2df010488 sys/compat/darwin/darwin_iokit.h
--- a/sys/compat/darwin/darwin_iokit.h  Fri Oct 31 23:36:50 2003 +0000
+++ b/sys/compat/darwin/darwin_iokit.h  Sat Nov 01 00:32:44 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: darwin_iokit.h,v 1.4 2003/05/22 22:07:39 manu Exp $ */
+/*     $NetBSD: darwin_iokit.h,v 1.5 2003/11/01 00:32:44 manu Exp $ */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -63,9 +63,11 @@
 
 #include <compat/darwin/darwin_iohidsystem.h> 
 #include <compat/darwin/darwin_ioframebuffer.h>
+#include <compat/darwin/darwin_ioresources.h>
 
 #define DARWIN_IOKIT_DEVCLASSES                        \
        &darwin_iohidsystem_devclass,           \
-       &darwin_ioframebuffer_devclass,
+       &darwin_ioframebuffer_devclass,         \
+       &darwin_iokbd_devclass,
                                                        
 #endif /* _DARWIN_IOKIT_H_ */
diff -r bbf88e8af1e7 -r 56e2df010488 sys/compat/darwin/files.darwin
--- a/sys/compat/darwin/files.darwin    Fri Oct 31 23:36:50 2003 +0000
+++ b/sys/compat/darwin/files.darwin    Sat Nov 01 00:32:44 2003 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.darwin,v 1.13 2003/09/06 11:18:03 manu Exp $
+#      $NetBSD: files.darwin,v 1.14 2003/11/01 00:32:44 manu Exp $
 #
 # Config file description for machine-independent Darwin compat code.
 # Included by ports that need it.
@@ -8,9 +8,9 @@
 
 file   compat/darwin/darwin_exec.c             compat_darwin
 file   compat/darwin/darwin_ioctl.c            compat_darwin
-file   compat/darwin/darwin_iokit.c            compat_darwin
+file   compat/darwin/darwin_ioframebuffer.c    compat_darwin
 file   compat/darwin/darwin_iohidsystem.c      compat_darwin
-file   compat/darwin/darwin_ioframebuffer.c    compat_darwin
+file   compat/darwin/darwin_iokit.c            compat_darwin
 file   compat/darwin/darwin_mman.c             compat_darwin
 file   compat/darwin/darwin_mount.c            compat_darwin
 file   compat/darwin/darwin_signal.c           compat_darwin
diff -r bbf88e8af1e7 -r 56e2df010488 sys/compat/mach/mach_iokit.c
--- a/sys/compat/mach/mach_iokit.c      Fri Oct 31 23:36:50 2003 +0000
+++ b/sys/compat/mach/mach_iokit.c      Sat Nov 01 00:32:44 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mach_iokit.c,v 1.22 2003/09/11 23:16:18 manu Exp $ */
+/*     $NetBSD: mach_iokit.c,v 1.23 2003/11/01 00:32:44 manu Exp $ */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 
 #include "opt_compat_darwin.h"
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mach_iokit.c,v 1.22 2003/09/11 23:16:18 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mach_iokit.c,v 1.23 2003/11/01 00:32:44 manu Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -1079,14 +1079,28 @@
        struct lwp *l = args->l;
        struct mach_port *mp;
        struct mach_right *mr;
+       struct mach_iokit_devclass *mid;
+       mach_port_t mn;
 
 #ifdef DEBUG_MACH
        printf("mach_io_registry_entry_get_parent_iterator: plane = %s\n", 
            req->req_plane);
 #endif
+       /* Sanity check req->req_count */
+       if (MACH_REQMSG_OVERFLOW(args, req->req_plane[req->req_count]))
+               return mach_msg_error(args, EINVAL);
+
+       mn = req->req_msgh.msgh_remote_port;
+       if ((mr = mach_right_check(mn, l, MACH_PORT_TYPE_ALL_RIGHTS)) == NULL)
+               return mach_iokit_error(args, MACH_IOKIT_EPERM);
 
        mp = mach_port_get();
        mp->mp_flags |= MACH_MP_INKERNEL;
+       if (mr->mr_port->mp_datatype == MACH_MP_IOKIT_DEVCLASS) {
+               mp->mp_datatype = MACH_MP_IOKIT_DEVCLASS;
+               mid = (struct mach_iokit_devclass *)mr->mr_port->mp_data;
+               mp->mp_data = mid->mid_parent;
+       }
        mr = mach_right_get(mp, l, MACH_PORT_TYPE_SEND, 0);
 
        rep->rep_msgh.msgh_bits = 
diff -r bbf88e8af1e7 -r 56e2df010488 sys/compat/mach/mach_iokit.h
--- a/sys/compat/mach/mach_iokit.h      Fri Oct 31 23:36:50 2003 +0000
+++ b/sys/compat/mach/mach_iokit.h      Sat Nov 01 00:32:44 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mach_iokit.h,v 1.19 2003/10/18 13:25:27 manu Exp $ */
+/*     $NetBSD: mach_iokit.h,v 1.20 2003/11/01 00:32:44 manu Exp $ */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -555,6 +555,7 @@
 
 struct mach_iokit_devclass {
        char *mid_string;
+       struct mach_iokit_devclass *mid_parent;
        char *mid_properties;
        struct mach_iokit_property *mid_properties_array;
        int (*mid_connect_method_scalari_scalaro)(struct mach_trap_args *);



Home | Main Index | Thread Index | Old Index