From owner-freebsd-amd64@FreeBSD.ORG Sat Dec 11 00:19:04 2004 Return-Path: Delivered-To: freebsd-amd64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0906316A4CE for ; Sat, 11 Dec 2004 00:19:04 +0000 (GMT) Received: from canning.wemm.org (canning.wemm.org [192.203.228.65]) by mx1.FreeBSD.org (Postfix) with ESMTP id CCC5B43D39 for ; Sat, 11 Dec 2004 00:19:03 +0000 (GMT) (envelope-from peter@wemm.org) Received: from fw.wemm.org (canning.wemm.org [192.203.228.65]) by canning.wemm.org (Postfix) with ESMTP id 813A82A904 for ; Fri, 10 Dec 2004 16:19:03 -0800 (PST) (envelope-from peter@wemm.org) Received: from overcee.wemm.org (overcee.wemm.org [10.0.0.3]) by fw.wemm.org (Postfix) with ESMTP id 16FEFE2B7 for ; Fri, 10 Dec 2004 16:19:02 -0800 (PST) (envelope-from peter@wemm.org) Received: from overcee.wemm.org (localhost [127.0.0.1]) by overcee.wemm.org (8.13.1/8.13.1) with ESMTP id iBB0J2Nt013107; Fri, 10 Dec 2004 16:19:02 -0800 (PST) (envelope-from peter@wemm.org) Received: from localhost (localhost [[UNIX: localhost]]) by overcee.wemm.org (8.13.1/8.13.1/Submit) id iBB0J113013106; Fri, 10 Dec 2004 16:19:01 -0800 (PST) (envelope-from peter@wemm.org) X-Authentication-Warning: overcee.wemm.org: peter set sender to peter@wemm.org using -f From: Peter Wemm To: freebsd-amd64@freebsd.org Date: Fri, 10 Dec 2004 16:19:01 -0800 User-Agent: KMail/1.7.1 References: <20041210202037.GA12369@flash.atmos.colostate.edu> In-Reply-To: <20041210202037.GA12369@flash.atmos.colostate.edu> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200412101619.01488.peter@wemm.org> cc: Tony Arcieri Subject: Re: Issuing rebuild instruction to 3Ware 7000 series TwinStor array X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Dec 2004 00:19:04 -0000 On Friday 10 December 2004 12:20 pm, Tony Arcieri wrote: > I have a 3Ware 7000 series controller on a FreeBSD 5.3/amd64 system. > Unfortunately, after stability problems the array is in the degraded > state: > > twed0: on twe0 > > As there is currently no version of the 3Ware CLI for FreeBSD/AMD64, > I was wondering how hard it would be to set up the ioctl() calls to > issue the rebuild command to the controller directly. Looking in > twe_tables.h, I see the following memeber of the twe_table_opcode > array: > > {"REBUILDUNIT", 0x17}, > > Is this the command I need to send to the device and if so, what > parameters does it need? I have a horrible hack to the twe driver to enable it to understand the 32 bit binary ioctl's. It was enough for me to run the CLI. I was thinking about committing it, but I've been meaning to ask the 3ware folks for a native build, which would be much better. Maybe they do a build so I won't have to commit this. I've given this diff to all the people that have asked. Their management stuff generally passes opaque data blobs through from the cli/3dm to the firmware. We don't need to see what it is. Anyway, the diff: http://people.freebsd.org/~peter/twe.diff Index: sys/dev/twe/twe.c =========================================================================== --- sys/dev/twe/twe.c 2004/12/11 00:10:34 #14 +++ sys/dev/twe/twe.c 2004/12/11 00:10:34 @@ -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; Index: sys/dev/twe/tweio.h =========================================================================== --- sys/dev/twe/tweio.h 2004/12/11 00:10:34 #3 +++ sys/dev/twe/tweio.h 2004/12/11 00:10:34 @@ -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 */ -- Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com "All of this is for nothing if we don't go to the stars" - JMS/B5