diff --git a/sys/compat/darwin/darwin_iohidsystem.c b/sys/compat/darwin/darwin_iohidsystem.c index c5f3af83be62..01193cb83368 100644 --- a/sys/compat/darwin/darwin_iohidsystem.c +++ b/sys/compat/darwin/darwin_iohidsystem.c @@ -1,4 +1,4 @@ -/* $NetBSD: darwin_iohidsystem.c,v 1.7 2003/05/22 22:07:38 manu Exp $ */ +/* $NetBSD: darwin_iohidsystem.c,v 1.8 2003/06/03 06:48:49 manu Exp $ */ /*- * Copyright (c) 2003 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: darwin_iohidsystem.c,v 1.7 2003/05/22 22:07:38 manu Exp $"); +__KERNEL_RCSID(0, "$NetBSD: darwin_iohidsystem.c,v 1.8 2003/06/03 06:48:49 manu Exp $"); #include #include @@ -66,10 +66,15 @@ static struct uvm_object *darwin_iohidsystem_shmem = NULL; static void darwin_iohidsystem_shmeminit(vaddr_t); static void darwin_iohidsystem_thread(void *); +#if 0 +static char darwin_iohidsystem_properties[] = "IOKitIOServiceAccessMPC106PerformanceRegisterAppleGracklePCI is not serializableIONVRAMIOiic0ApplePMU is not serializableIORTCIOBSDsetModemSoundAppleScreamerAudio is not serializablekdp"; +#endif +static char darwin_iohidsystem_properties[] = "IOClassAppleADBKeyboardADBVirtualKeys0x00,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,0x7FIOProbeScore0x3e8IOProviderClassIOADBDeviceCFBundleIdentifiercom.apple.driver.AppleADBKeyboardADB Match2PowerBook fn Foward Delete0x1IOMatchCategoryIODefaultMatchCategoryHIDKeyMappingAAAIAAE5AQE4AgE7AwE6BAE3BRVSQUxTVFVFWFdWW1xDS1F7fX58TlkGAXIHAT9/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==HIDKind0x1HIDInterfaceID0x2HIDSubinterfaceID0xc4"; + struct mach_iokit_devclass darwin_iohidsystem_devclass = { "IOProviderClass" "IOHIDSystem", - NULL, + darwin_iohidsystem_properties, NULL, darwin_iohidsystem_connect_method_scalari_scalaro, NULL, diff --git a/sys/compat/mach/mach_iokit.c b/sys/compat/mach/mach_iokit.c index ddc8015ce416..be4e635420bc 100644 --- a/sys/compat/mach/mach_iokit.c +++ b/sys/compat/mach/mach_iokit.c @@ -1,4 +1,4 @@ -/* $NetBSD: mach_iokit.c,v 1.19 2003/05/22 22:07:36 manu Exp $ */ +/* $NetBSD: mach_iokit.c,v 1.20 2003/06/03 06:48:47 manu Exp $ */ /*- * Copyright (c) 2003 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ #include "opt_compat_darwin.h" #include -__KERNEL_RCSID(0, "$NetBSD: mach_iokit.c,v 1.19 2003/05/22 22:07:36 manu Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mach_iokit.c,v 1.20 2003/06/03 06:48:47 manu Exp $"); #include #include @@ -992,6 +992,8 @@ mach_io_registry_entry_from_path(args) struct lwp *l = args->l; struct mach_port *mp; struct mach_right *mr; + struct mach_iokit_devclass *mid; + int i, len; #ifdef DEBUG_MACH printf("mach_io_registry_entry_from_path: path = %s\n", req->req_path); @@ -1001,6 +1003,29 @@ mach_io_registry_entry_from_path(args) mp->mp_flags |= MACH_MP_INKERNEL; mr = mach_right_get(mp, l, MACH_PORT_TYPE_SEND, 0); + if (sizeof(*req) - 512 + req->req_pathcount > args->ssize) { +#ifdef DEBUG_MACH + printf("pathcount too big, truncating\n"); +#endif + req->req_pathcount = args->ssize - (sizeof(*req) - 512); + } + + i = 0; + while ((mid = mach_iokit_devclasses[i++]) != NULL) { + len = strlen(mid->mid_name); +#ifdef DEBUG_MACH + printf("trying \"%s\" vs \"%s\"\n", + &req->req_path[req->req_pathcount - 1 - len], + mid->mid_name); +#endif + if (memcmp(&req->req_path[req->req_pathcount - 1 - len], + mid->mid_name, len) == 0) { + mp->mp_datatype = MACH_MP_IOKIT_DEVCLASS; + mp->mp_data = mid; + break; + } + } + rep->rep_msgh.msgh_bits = MACH_MSGH_REPLY_LOCAL_BITS(MACH_MSG_TYPE_MOVE_SEND_ONCE) | MACH_MSGH_BITS_COMPLEX; @@ -1015,3 +1040,38 @@ mach_io_registry_entry_from_path(args) *msglen = sizeof(*rep); return 0; } + +int +mach_io_registry_entry_get_parent_iterator(args) + struct mach_trap_args *args; +{ + mach_io_registry_entry_get_parent_iterator_request_t *req = args->smsg; + mach_io_registry_entry_get_parent_iterator_reply_t *rep = args->rmsg; + size_t *msglen = args->rsize; + struct lwp *l = args->l; + struct mach_port *mp; + struct mach_right *mr; + +#ifdef DEBUG_MACH + printf("mach_io_registry_entry_get_parent_iterator: plane = %s\n", + req->req_plane); +#endif + + mp = mach_port_get(); + mp->mp_flags |= MACH_MP_INKERNEL; + mr = mach_right_get(mp, l, MACH_PORT_TYPE_SEND, 0); + + rep->rep_msgh.msgh_bits = + MACH_MSGH_REPLY_LOCAL_BITS(MACH_MSG_TYPE_MOVE_SEND_ONCE) | + MACH_MSGH_BITS_COMPLEX; + rep->rep_msgh.msgh_size = sizeof(*rep) - sizeof(rep->rep_trailer); + rep->rep_msgh.msgh_local_port = req->req_msgh.msgh_local_port; + rep->rep_msgh.msgh_id = req->req_msgh.msgh_id + 100; + rep->rep_body.msgh_descriptor_count = 1; + rep->rep_iterator.name = (mach_port_t)mr->mr_name; + rep->rep_iterator.disposition = 0x11; /* XXX */ + rep->rep_trailer.msgh_trailer_size = 8; + + *msglen = sizeof(*rep); + return 0; +} diff --git a/sys/compat/mach/mach_iokit.h b/sys/compat/mach/mach_iokit.h index b78f831560a8..012e03c33002 100644 --- a/sys/compat/mach/mach_iokit.h +++ b/sys/compat/mach/mach_iokit.h @@ -1,4 +1,4 @@ -/* $NetBSD: mach_iokit.h,v 1.16 2003/05/22 22:07:37 manu Exp $ */ +/* $NetBSD: mach_iokit.h,v 1.17 2003/06/03 06:48:47 manu Exp $ */ /*- * Copyright (c) 2003 The NetBSD Foundation, Inc. @@ -496,6 +496,23 @@ typedef struct { mach_msg_trailer_t rep_trailer; } mach_io_registry_entry_from_path_reply_t; +/* io_registry_entry_get_parent_iterator */ + +typedef struct { + mach_msg_header_t req_msgh; + mach_ndr_record_t req_ndr; + mach_msg_type_number_t req_offset; + mach_msg_type_number_t req_count; + char req_plane[128]; +} mach_io_registry_entry_get_parent_iterator_request_t; + +typedef struct { + mach_msg_header_t rep_msgh; + mach_msg_body_t rep_body; + mach_msg_port_descriptor_t rep_iterator; + mach_msg_trailer_t rep_trailer; +} mach_io_registry_entry_get_parent_iterator_reply_t; + int mach_io_service_get_matching_services(struct mach_trap_args *); int mach_io_iterator_next(struct mach_trap_args *); int mach_io_service_open(struct mach_trap_args *); @@ -522,6 +539,7 @@ int mach_io_service_close(struct mach_trap_args *); int mach_io_connect_add_client(struct mach_trap_args *); int mach_io_connect_method_scalari_structi(struct mach_trap_args *); int mach_io_registry_entry_from_path(struct mach_trap_args *); +int mach_io_registry_entry_get_parent_iterator(struct mach_trap_args *); extern struct mach_iokit_devclass *mach_iokit_devclasses[]; diff --git a/sys/compat/mach/mach_message.c b/sys/compat/mach/mach_message.c index e745228c49da..8a0fabc5bc7e 100644 --- a/sys/compat/mach/mach_message.c +++ b/sys/compat/mach/mach_message.c @@ -1,4 +1,4 @@ -/* $NetBSD: mach_message.c,v 1.24 2003/02/05 23:58:10 manu Exp $ */ +/* $NetBSD: mach_message.c,v 1.25 2003/06/03 06:48:48 manu Exp $ */ /*- * Copyright (c) 2002-2003 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mach_message.c,v 1.24 2003/02/05 23:58:10 manu Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mach_message.c,v 1.25 2003/06/03 06:48:48 manu Exp $"); #include "opt_ktrace.h" #include "opt_compat_mach.h" /* For COMPAT_MACH in */ @@ -228,6 +228,7 @@ mach_sys_msg_overwrite_trap(l, v, retval) args.smsg = sm; args.rmsg = rm; args.rsize = &rcv_size; + args.ssize = send_size; if ((*retval = (*map->map_handler)(&args)) != 0) goto out1; diff --git a/sys/compat/mach/mach_message.h b/sys/compat/mach/mach_message.h index cce6cb4dba9b..a0a2a50e6dff 100644 --- a/sys/compat/mach/mach_message.h +++ b/sys/compat/mach/mach_message.h @@ -1,4 +1,4 @@ -/* $NetBSD: mach_message.h,v 1.15 2003/03/03 22:07:39 manu Exp $ */ +/* $NetBSD: mach_message.h,v 1.16 2003/06/03 06:48:48 manu Exp $ */ /*- * Copyright (c) 2001-2003 The NetBSD Foundation, Inc. @@ -214,6 +214,7 @@ struct mach_trap_args { struct lwp *l; void *smsg; void *rmsg; + size_t ssize; size_t *rsize; }; diff --git a/sys/compat/mach/mach_namemap.c b/sys/compat/mach/mach_namemap.c index 3e425503ad2c..a67562fabe77 100644 --- a/sys/compat/mach/mach_namemap.c +++ b/sys/compat/mach/mach_namemap.c @@ -1,4 +1,4 @@ -/* $NetBSD: mach_namemap.c,v 1.29 2003/05/22 22:07:37 manu Exp $ */ +/* $NetBSD: mach_namemap.c,v 1.30 2003/06/03 06:48:48 manu Exp $ */ /*- * Copyright (c) 2002-2003 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mach_namemap.c,v 1.29 2003/05/22 22:07:37 manu Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mach_namemap.c,v 1.30 2003/06/03 06:48:48 manu Exp $"); #include #include @@ -81,6 +81,8 @@ struct mach_subsystem_namemap mach_namemap[] = { "io_registry_entry_get_properties" }, { 2813, mach_io_registry_entry_get_child_iterator, "io_registry_entry_get_child_iterator" }, + { 2814, mach_io_registry_entry_get_parent_iterator, + "io_registry_entry_get_parent_iterator" }, { 2815, mach_io_service_open, "io_service_open" }, { 2816, mach_io_service_close, "io_service_close" }, { 2817, mach_io_connect_get_service, "io_connect_get_service" },