From owner-p4-projects@FreeBSD.ORG Tue Oct 19 00:17:55 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 5261916A4D2; Tue, 19 Oct 2004 00:17:55 +0000 (GMT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0E7FA16A4CE for ; Tue, 19 Oct 2004 00:17:55 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id DB31A43D31 for ; Tue, 19 Oct 2004 00:17:54 +0000 (GMT) (envelope-from peter@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.11/8.12.11) with ESMTP id i9J0Hs5x018715 for ; Tue, 19 Oct 2004 00:17:54 GMT (envelope-from peter@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.11/8.12.11/Submit) id i9J0Hsb1018712 for perforce@freebsd.org; Tue, 19 Oct 2004 00:17:54 GMT (envelope-from peter@freebsd.org) Date: Tue, 19 Oct 2004 00:17:54 GMT Message-Id: <200410190017.i9J0Hsb1018712@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to peter@freebsd.org using -f From: Peter Wemm To: Perforce Change Reviews Subject: PERFORCE change 63340 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Oct 2004 00:17:56 -0000 http://perforce.freebsd.org/chv.cgi?CH=63340 Change 63340 by peter@peter_daintree on 2004/10/19 00:17:19 Recognize and convert the 32-bit ioctl's that the 3ware tools generate. This is kinda gross, but there isn't much choice unless we can sweet-talk them into a native binary. Affected files ... .. //depot/projects/hammer/sys/dev/twe/twe.c#10 edit .. //depot/projects/hammer/sys/dev/twe/tweio.h#4 edit Differences ... ==== //depot/projects/hammer/sys/dev/twe/twe.c#10 (text+ko) ==== @@ -500,9 +500,25 @@ struct twe_request *tr; u_int8_t srid; int s, error; +#ifdef __amd64__ + struct twe_paramcommand32 *tp32 = (struct twe_paramcommand32 *)addr; + struct twe_usercommand32 *tu32 = (struct twe_usercommand32 *)addr; + struct twe_paramcommand tp_swab; + struct twe_usercommand tu_swab; +#endif error = 0; switch(ioctlcmd) { + +#ifdef __amd64__ + case TWEIO_COMMAND32: + tu_swab.tu_command = tu32->tu_command; + tu_swab.tu_data = (void *)(uintptr_t)tu32->tu_data; + tu_swab.tu_size = tu32->tu_size; + tu = &tu_swab; + /* FALLTHROUGH */ +#endif + /* handle a command from userspace */ case TWEIO_COMMAND: /* get a request */ @@ -588,6 +604,16 @@ splx(s); break; +#ifdef __amd64__ + case TWEIO_GET_PARAM32: + tp_swab.tp_table_id = tp32->tp_table_id; + tp_swab.tp_param_id = tp32->tp_param_id; + tp_swab.tp_data = (void *)(uintptr_t)tp32->tp_data; + tp_swab.tp_size = tp32->tp_size; + tp = &tp_swab; + /* FALLTHROUGH */ +#endif + case TWEIO_GET_PARAM: if ((param = twe_get_param(sc, tp->tp_table_id, tp->tp_param_id, tp->tp_size, NULL)) == NULL) { twe_printf(sc, "TWEIO_GET_PARAM failed for 0x%x/0x%x/%d\n", @@ -605,6 +631,16 @@ } break; +#ifdef __amd64__ + case TWEIO_SET_PARAM32: + tp_swab.tp_table_id = tp32->tp_table_id; + tp_swab.tp_param_id = tp32->tp_param_id; + tp_swab.tp_data = (void *)(uintptr_t)tp32->tp_data; + tp_swab.tp_size = tp32->tp_size; + tp = &tp_swab; + /* FALLTHROUGH */ +#endif + case TWEIO_SET_PARAM: if ((data = malloc(tp->tp_size, M_DEVBUF, M_WAITOK)) == NULL) { error = ENOMEM; ==== //depot/projects/hammer/sys/dev/twe/tweio.h#4 (text+ko) ==== @@ -44,6 +44,17 @@ #define TWEIO_COMMAND _IOWR('T', 100, struct twe_usercommand) +#ifdef __amd64__ +struct twe_usercommand32 { + TWE_Command tu_command; /* command ready for the controller */ + uint32_t tu_data; /* pointer to data in userspace */ + uint32_t tu_size; /* userspace data length */ +}; + +#define TWEIO_COMMAND32 _IOWR('T', 100, struct twe_usercommand32) +#endif + + /* * Command queue statistics */ @@ -89,6 +100,18 @@ #define TWEIO_SET_PARAM _IOW ('T', 104, struct twe_paramcommand) #define TWEIO_GET_PARAM _IOW ('T', 105, struct twe_paramcommand) +#ifdef __amd64__ +struct twe_paramcommand32 { + u_int16_t tp_table_id; + u_int8_t tp_param_id; + u_int32_t tp_data; + u_int8_t tp_size; +}; + +#define TWEIO_SET_PARAM32 _IOW ('T', 104, struct twe_paramcommand32) +#define TWEIO_GET_PARAM32 _IOW ('T', 105, struct twe_paramcommand32) +#endif + /* * Request a controller soft-reset */