diff mbox

Add some more dynamic debug

Message ID 20111019085535.7df06e06@kryten
State Under Review
Headers show

Commit Message

Anton Blanchard Oct. 18, 2011, 9:55 p.m. UTC
Allow some of the netboot debug to be turned on via the
linux,yaboot-debug property. I found this useful when chasing down
the POWER5 netboot issue.

Signed-off-by: Anton Blanchard <anton@samba.org>
---

Comments

Tony Breeds Oct. 19, 2011, 12:33 a.m. UTC | #1
On Wed, Oct 19, 2011 at 08:55:35AM +1100, Anton Blanchard wrote:
> 
> Allow some of the netboot debug to be turned on via the
> linux,yaboot-debug property. I found this useful when chasing down
> the POWER5 netboot issue.

Looks good.  I think at some stage soon I'll just change everything over
to the dynamic printf stype of debug output.  Perhaps I'll add a
verbosity filter or facility bitmask.

Yours Tony
diff mbox

Patch

Index: yaboot/second/file.c
===================================================================
--- yaboot.orig/second/file.c	2011-10-19 08:53:38.118995184 +1100
+++ yaboot/second/file.c	2011-10-19 08:53:55.387294843 +1100
@@ -245,16 +245,16 @@  extract_vendor_options(struct bootp_pack
                     if ((result->subnetmask == NULL ||
                          *(result->subnetmask) == '\x0') && value != 0) {
                          result->subnetmask = ipv4_to_str(value);
-                         DEBUG_F("Storing %s as subnetmask from options\n",
-                                 result->subnetmask);
+                         prom_debug("Using bootp submetmask %s\n",
+                                    result->subnetmask);
                     }
                     break;
                case DHCP_ROUTERS:
                     if ((result->giaddr == NULL || *(result->giaddr) == '\x0')
                         && value != 0) {
                          result->giaddr = ipv4_to_str(value);
-                         DEBUG_F("Storing %s as gateway from options\n",
-                                 result->giaddr);
+                         prom_debug("Using bootp gateway %s\n",
+                                    result->giaddr);
                     }
                     break;
                }
@@ -276,25 +276,27 @@  extract_netinfo_args(struct boot_fspec_t
      if (!packet)
           return;
 
-     DEBUG_F("We have a boot packet\n");
-     DEBUG_F(" siaddr = <%x>\n", packet->siaddr);
-     DEBUG_F(" ciaddr = <%x>\n", packet->ciaddr);
-     DEBUG_F(" yiaddr = <%x>\n", packet->yiaddr);
-     DEBUG_F(" giaddr = <%x>\n", packet->giaddr);
-
      /* Try to fallback to yiaddr if ciaddr is empty. Broken? */
      if (packet->ciaddr == 0 && packet->yiaddr != 0)
           packet->ciaddr = packet->yiaddr;
 
      if ((result->siaddr == NULL || *(result->siaddr) == '\x0')
-         && packet->siaddr != 0)
+         && packet->siaddr != 0) {
           result->siaddr = ipv4_to_str(packet->siaddr);
+          prom_debug("Using bootp siaddr %s\n", result->siaddr);
+     }
+
      if ((result->ciaddr == NULL || *(result->ciaddr) == '\x0')
-         && packet->ciaddr != 0)
+         && packet->ciaddr != 0) {
           result->ciaddr = ipv4_to_str(packet->ciaddr);
+          prom_debug("Using bootp ciaddr %s\n", result->ciaddr);
+     }
+
      if ((result->giaddr == NULL || *(result->giaddr) == '\x0')
-         && packet->giaddr != 0)
+         && packet->giaddr != 0) {
           result->giaddr = ipv4_to_str(packet->giaddr);
+          prom_debug("Using bootp giaddr %s\n", result->giaddr);
+     }
 
      extract_vendor_options(packet, result);
 
@@ -304,7 +306,7 @@  extract_netinfo_args(struct boot_fspec_t
       *        redirections */
      if (result->giaddr == NULL) {
           result->giaddr = ipv4_to_str(packet->siaddr);
-          DEBUG_F("Forcing giaddr to siaddr <%s>\n", result->giaddr);
+          prom_debug("Forcing giaddr to siaddr <%s>\n", result->giaddr);
      }
 }
 
@@ -361,8 +363,6 @@  extract_netboot_args(char *imagepath, st
 {
      int ret;
 
-     DEBUG_F("imagepath = %s\n", imagepath);
-
      if (!imagepath)
 	  return 1;
 
@@ -372,16 +372,16 @@  extract_netboot_args(char *imagepath, st
 	  ret = extract_ipv4_args(imagepath, result);
      extract_netinfo_args(result);
 
-     DEBUG_F("ipv6 = <%d>\n", result->is_ipv6);
-     DEBUG_F("siaddr = <%s>\n", result->siaddr);
-     DEBUG_F("file = <%s>\n", result->file);
-     DEBUG_F("ciaddr = <%s>\n", result->ciaddr);
-     DEBUG_F("giaddr = <%s>\n", result->giaddr);
-     DEBUG_F("bootp_retries = <%s>\n", result->bootp_retries);
-     DEBUG_F("tftp_retries = <%s>\n", result->tftp_retries);
-     DEBUG_F("addl_params = <%s>\n", result->addl_params);
-     DEBUG_F("dhcpv6 = <%s>\n", result->dhcpv6);
-     DEBUG_F("blksize = <%s>\n", result->blksize);
+     prom_debug("ipv6 = <%d>\n", result->is_ipv6);
+     prom_debug("siaddr = <%s>\n", result->siaddr);
+     prom_debug("file = <%s>\n", result->file);
+     prom_debug("ciaddr = <%s>\n", result->ciaddr);
+     prom_debug("giaddr = <%s>\n", result->giaddr);
+     prom_debug("bootp_retries = <%s>\n", result->bootp_retries);
+     prom_debug("tftp_retries = <%s>\n", result->tftp_retries);
+     prom_debug("addl_params = <%s>\n", result->addl_params);
+     prom_debug("dhcpv6 = <%s>\n", result->dhcpv6);
+     prom_debug("blksize = <%s>\n", result->blksize);
 
      return ret;
 }
Index: yaboot/second/yaboot.c
===================================================================
--- yaboot.orig/second/yaboot.c	2011-10-19 08:53:38.106994976 +1100
+++ yaboot/second/yaboot.c	2011-10-19 08:53:55.391294913 +1100
@@ -1574,9 +1574,9 @@  yaboot_main(void)
 	  setup_display();
 
      prom_get_chosen("bootargs", bootargs, sizeof(bootargs));
-     DEBUG_F("/chosen/bootargs = %s\n", bootargs);
+     prom_debug("/chosen/bootargs = %s\n", bootargs);
      prom_get_chosen("bootpath", bootdevice, BOOTDEVSZ);
-     DEBUG_F("/chosen/bootpath = %s\n", bootdevice);
+     prom_debug("/chosen/bootpath = %s\n", bootdevice);
      if (prom_get_options("ibm,client-architecture-support-reboot",fw_nbr_reboots, FW_NBR_REBOOTSZ) == -1 )
         prom_get_options("ibm,fw-nbr-reboots",fw_nbr_reboots, FW_NBR_REBOOTSZ);
      fw_reboot_cnt = simple_strtol(fw_nbr_reboots,&endp,10);
Index: yaboot/second/fs_of.c
===================================================================
--- yaboot.orig/second/fs_of.c	2011-10-19 08:53:38.134995462 +1100
+++ yaboot/second/fs_of.c	2011-10-19 08:53:55.391294913 +1100
@@ -191,7 +191,7 @@  of_net_open(struct boot_file_t* file,
           strcat(buffer, fspec->addl_params);
      }
 
-     DEBUG_F("Opening: \"%s\"\n", buffer);
+     prom_debug("Opening: \"%s\"\n", buffer);
 
      file->of_device = prom_open(buffer);