From patchwork Tue Oct 18 21:55:35 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Blanchard X-Patchwork-Id: 120529 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (localhost [IPv6:::1]) by ozlabs.org (Postfix) with ESMTP id 66F931007E4 for ; Wed, 19 Oct 2011 08:55:40 +1100 (EST) Received: from kryten (ppp121-44-79-234.lns20.syd6.internode.on.net [121.44.79.234]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPSA id A6FBFB71BB for ; Wed, 19 Oct 2011 08:55:37 +1100 (EST) Date: Wed, 19 Oct 2011 08:55:35 +1100 From: Anton Blanchard To: yaboot-devel@lists.ozlabs.org Subject: [PATCH] Add some more dynamic debug Message-ID: <20111019085535.7df06e06@kryten> X-Mailer: Claws Mail 3.7.8 (GTK+ 2.24.4; i686-pc-linux-gnu) Mime-Version: 1.0 X-BeenThere: yaboot-devel@lists.ozlabs.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical and development discussion regarding yaboot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: yaboot-devel-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: yaboot-devel-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org 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 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);