]> git.ozlabs.org Git - yaboot.git/blobdiff - second/prom.c
make: use STRIP
[yaboot.git] / second / prom.c
index 119d0f363cabbc971f259b6e6f4c61b27cbbaf4c..a9918840b30c899ba1e541955430c2f69a653b84 100644 (file)
@@ -196,7 +196,7 @@ prom_get_devtype (char *device)
      char       tmp[64];
 
      if (strstr(device, TOK_ISCSI))
-         device = strcpy(tmp, "/vdevice/gscsi/disk");
+         return FILE_DEVICE_ISCSI;
 
      /* Find OF device phandle */
      dev = prom_finddevice(device);
@@ -439,7 +439,7 @@ prom_puts (prom_handle file, char *s)
 }
 
 void
-prom_vfprintf (prom_handle file, char *fmt, va_list ap)
+prom_vfprintf (prom_handle file, const char *fmt, va_list ap)
 {
      static char printf_buf[2048];
      vsprintf (printf_buf, fmt, ap);
@@ -447,7 +447,7 @@ prom_vfprintf (prom_handle file, char *fmt, va_list ap)
 }
 
 void
-prom_vprintf (char *fmt, va_list ap)
+prom_vprintf (const char *fmt, va_list ap)
 {
      static char printf_buf[2048];
      vsprintf (printf_buf, fmt, ap);
@@ -455,7 +455,7 @@ prom_vprintf (char *fmt, va_list ap)
 }
 
 void
-prom_fprintf (prom_handle file, char *fmt, ...)
+prom_fprintf (prom_handle file, const char *fmt, ...)
 {
      va_list ap;
      va_start (ap, fmt);
@@ -464,7 +464,7 @@ prom_fprintf (prom_handle file, char *fmt, ...)
 }
 
 void
-prom_printf (char *fmt, ...)
+prom_printf (const char *fmt, ...)
 {
      va_list ap;
      va_start (ap, fmt);
@@ -473,7 +473,7 @@ prom_printf (char *fmt, ...)
 }
 
 void
-prom_debug (char *fmt, ...)
+prom_debug (const char *fmt, ...)
 {
      va_list ap;
 
@@ -599,6 +599,23 @@ prom_claim_chunk(void *virt, unsigned int size, unsigned int align)
      return((void*)-1);
 }
 
+/* Start from top of memory and work down to get the needed space */
+void *
+prom_claim_chunk_top(unsigned int size, unsigned int align)
+{
+     void *found, *addr;
+     for(addr=(void*)PROM_CLAIM_MAX_ADDR; addr >= (void *)size;
+         addr-=(0x100000/sizeof(addr))) {
+          found = call_prom("claim", 3, 1, addr, size, 0);
+          if (found != (void *)-1) {
+               prom_debug("claim of 0x%x at 0x%x returned 0x%x\n", size, (int)addr, (int)found);
+               return(found);
+          }
+     }
+     prom_printf("ERROR: claim of 0x%x in range 0x0-0x%x failed\n", size, PROM_CLAIM_MAX_ADDR);
+     return((void*)-1);
+}
+
 void *
 prom_claim (void *virt, unsigned int size, unsigned int align)
 {
@@ -698,7 +715,7 @@ struct bootp_packet * prom_get_netinfo (void)
 
      chosen = prom_finddevice("/chosen");
      if (chosen < 0) {
-          DEBUG_F("chosen=%d\n", chosen);
+          DEBUG_F("chosen=%lu\n", (unsigned long)chosen);
       return 0;
      }