Date: Wed, 10 Dec 2003 22:54:43 +1000 From: Peter Grehan <grehan@freebsd.org> To: freebsd-sparc64@freebsd.org Subject: boot/ofw/libofw changes for powerpc Message-ID: <3FD71793.8080503@freebsd.org>
next in thread | raw e-mail | index | archive | help
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 <arch>/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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3FD71793.8080503>