From owner-freebsd-sparc64@FreeBSD.ORG Wed Dec 10 04:54:11 2003 Return-Path: Delivered-To: freebsd-sparc64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2DCF616A4CE for ; Wed, 10 Dec 2003 04:54:11 -0800 (PST) Received: from liberty.onthenet.com.au (liberty.OntheNet.com.au [203.22.124.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id 88A6943D2A for ; Wed, 10 Dec 2003 04:54:09 -0800 (PST) (envelope-from grehan@freebsd.org) Received: from freebsd.org (CPE-30-201.dsl.onthenet.net [203.144.30.201]) hBACs7ZG056522 for ; Wed, 10 Dec 2003 22:54:07 +1000 (EST) (envelope-from grehan@freebsd.org) Message-ID: <3FD71793.8080503@freebsd.org> Date: Wed, 10 Dec 2003 22:54:43 +1000 From: Peter Grehan User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.3.1) Gecko/20030524 X-Accept-Language: en-us, en MIME-Version: 1.0 To: freebsd-sparc64@freebsd.org Content-Type: multipart/mixed; boundary="------------090109060005010501080905" Subject: boot/ofw/libofw changes for powerpc X-BeenThere: freebsd-sparc64@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting FreeBSD to the Sparc List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Dec 2003 12:54:11 -0000 This is a multi-part message in MIME format. --------------090109060005010501080905 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Hi, I'd like to commit the following changes to libofw. They cross-build OK, but I don't have access to an ultrasparc to test them on. Let me know if there are any problems with these. Diffs attached. devicename.c - add back the colon separator. Aliases such as "hd:9" are the norm on Macs - change the ofw_setcurrdev prototype to eliminate a compile warning (also libofw.h) elf_freebsd.c - a powerpc conditional to sync the icache. ofw_copy.c - a return value of 0 is benign, and happens almost every time when loading a module/ramdisk over NFS. ofw_disk.c - The unsigned long pos variable is 32 bits on PPC, truncating the byte offset when > 4G. Converted to daddr_t. later, Peter. --------------090109060005010501080905 Content-Type: text/plain; name="libofw.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="libofw.diff" Index: devicename.c =================================================================== RCS file: /home/ncvs/src/sys/boot/ofw/libofw/devicename.c,v retrieving revision 1.13 diff -u -r1.13 devicename.c --- devicename.c 16 Apr 2003 21:09:41 -0000 1.13 +++ devicename.c 5 Dec 2003 06:11:02 -0000 @@ -47,7 +47,8 @@ * device, go with the current device. */ if ((devspec == NULL) || - (strchr(devspec, '@') == NULL)) { + ((strchr(devspec, '@') == NULL) && + (strchr(devspec, ':') == NULL))) { if (((rv = ofw_parsedev(dev, getenv("currdev"), NULL)) == 0) && (path != NULL)) @@ -112,7 +113,7 @@ } int -ofw_setcurrdev(struct env_var *ev, int flags, void *value) +ofw_setcurrdev(struct env_var *ev, int flags, const void *value) { struct ofw_devdesc *ncurr; int rv; Index: elf_freebsd.c =================================================================== RCS file: /home/ncvs/src/sys/boot/ofw/libofw/elf_freebsd.c,v retrieving revision 1.5 diff -u -r1.5 elf_freebsd.c --- elf_freebsd.c 1 May 2003 03:56:30 -0000 1.5 +++ elf_freebsd.c 26 Nov 2003 05:15:53 -0000 @@ -42,7 +42,7 @@ extern vm_offset_t reloc; /* From /conf.c */ int -__elfN(ofw_loadfile)(char *filename, vm_offset_t dest, +__elfN(ofw_loadfile)(char *filename, u_int64_t dest, struct preloaded_file **result) { int r; @@ -52,6 +52,9 @@ if (r != 0) return (r); +#if defined(__powerpc__) + __syncicache((void *) (*result)->f_addr, (*result)->f_size); +#endif return (0); } Index: libofw.h =================================================================== RCS file: /home/ncvs/src/sys/boot/ofw/libofw/libofw.h,v retrieving revision 1.7 diff -u -r1.7 libofw.h --- libofw.h 10 Nov 2002 19:17:36 -0000 1.7 +++ libofw.h 25 Nov 2003 06:15:07 -0000 @@ -36,7 +36,7 @@ }; extern int ofw_getdev(void **vdev, const char *devspec, const char **path); -extern int ofw_setcurrdev(struct env_var *ev, int flags, void *value); +extern ev_sethook_t ofw_setcurrdev; extern struct devsw ofwdisk; extern struct netif_driver ofwnet; Index: ofw_copy.c =================================================================== RCS file: /home/ncvs/src/sys/boot/ofw/libofw/ofw_copy.c,v retrieving revision 1.11 diff -u -r1.11 ofw_copy.c --- ofw_copy.c 18 Jul 2002 12:39:02 -0000 1.11 +++ ofw_copy.c 23 Nov 2003 12:32:36 -0000 @@ -98,7 +98,8 @@ got = read(fd, buf, get); if (got <= 0) { - printf("ofw_readin: read failed\n"); + if (got < 0) + printf("ofw_readin: read failed\n"); break; } Index: ofw_disk.c =================================================================== RCS file: /home/ncvs/src/sys/boot/ofw/libofw/ofw_disk.c,v retrieving revision 1.9 diff -u -r1.9 ofw_disk.c --- ofw_disk.c 16 Apr 2003 21:09:41 -0000 1.9 +++ ofw_disk.c 3 Dec 2003 12:27:50 -0000 @@ -70,7 +70,7 @@ size_t *rsize) { struct ofw_devdesc *dp = (struct ofw_devdesc *)devdata; - unsigned long pos; + daddr_t pos; int n; int i, j; --------------090109060005010501080905--