]> git.ozlabs.org Git - yaboot.git/commitdiff
Handle ipv6 boot parameters for POWER architecture.
authorTony Breeds <tony@bakeyournoodle.com>
Thu, 22 Oct 2009 04:53:00 +0000 (15:53 +1100)
committerTony Breeds <tony@bakeyournoodle.com>
Thu, 22 Oct 2009 05:15:40 +0000 (16:15 +1100)
This is implementation derived.

This follows the semantics defined in section 4.3.1 of
http://www.power.org/apps/org/workgroup/parch/download.php/2380/latest
(It is under the Members area of TSC - Platform Architecture committee).

[ Fixed merge conflicts in second/file.c and second/fs_of.c ]

Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com>
Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
include/file.h
include/prom.h
second/file.c
second/fs_of.c

index cff6cbb646511ae23e037701a17509fb5b5c7d41..b2d9c63a71d9082f499382c877fdb3ee074883d5 100644 (file)
@@ -47,6 +47,11 @@ struct boot_fspec_t {
        char*   tftp_retries;   /* TFTP retries */
        char*   subnetmask;     /* Subnet mask */
        char*   addl_params;    /* copy all additional parameters */
+
+       /* Following fields are used only in ipv6 format */
+       int     is_ipv6;        /* is ipv6 specified ? */
+       char*   dhcpv6;         /* dhcpv6 string */
+       char*   blksize;        /* blksize string */
 };
 
 struct boot_file_t {
index e0397ecaea2276b28be552f8ad462cab2db95da3..a512f2be5a4d1db15a144dfc3e256ce81eb0bc93 100644 (file)
@@ -37,6 +37,7 @@ typedef void *phandle;
 #define PROM_INVALID_HANDLE    ((prom_handle)-1UL)
 #define BOOTDEVSZ               (2048) /* iscsi args can be in excess of 1040 bytes */
 #define TOK_ISCSI               "iscsi"
+#define TOK_IPV6                "ipv6"
 #define PROM_CLAIM_MAX_ADDR    0x8000000
 #define BOOTLASTSZ             1024
 #define FW_NBR_REBOOTSZ                4
index aad1ba466e91d30fe040793eba843484313b35a0..81d91a9f6c6341511238d03439cdd8be46ed9ac3 100644 (file)
@@ -308,6 +308,50 @@ extract_netinfo_args(struct boot_fspec_t *result)
      return 1;
 }
 
+/*
+ * Extract all the ipv6 arguments from the bootpath provided and fill result
+ * Syntax: ipv6,[dhcpv6[=diaddr,]]ciaddr=c_iaddr,giaddr=g_iaddr,siaddr=s_iaddr,
+ *      filename=file_name,tftp-retries=tftp_retries,blksize=block_size
+ * Returns 1 on success, 0 on failure.
+ */
+static int
+extract_ipv6_args(char *imagepath, struct boot_fspec_t *result)
+{
+     char *str, *tmp;
+     int total_len;
+
+     result->is_ipv6 = 1;
+
+     /* Just allocate the max required size */
+     total_len = strlen(imagepath) + 1;
+     str = malloc(total_len);
+     if (!str)
+       return 0;
+
+     if ((tmp = strstr(imagepath, "dhcpv6=")) != NULL)
+       result->dhcpv6 = scopy(&str, &tmp);
+
+     if ((tmp = strstr(imagepath, "ciaddr=")) != NULL)
+       result->ciaddr = scopy(&str, &tmp);
+
+     if ((tmp = strstr(imagepath, "giaddr=")) != NULL)
+       result->giaddr = scopy(&str, &tmp);
+
+     if ((tmp = strstr(imagepath, "siaddr=")) != NULL)
+       result->siaddr = scopy(&str, &tmp);
+
+     if ((tmp = strstr(imagepath, "filename=")) != NULL)
+       result->file = scopy(&str, &tmp);
+
+     if ((tmp = strstr(imagepath, "tftp-retries=")) != NULL)
+       result->tftp_retries = scopy(&str, &tmp);
+
+     if ((tmp = strstr(imagepath, "blksize=")) != NULL)
+       result->blksize = scopy(&str, &tmp);
+
+     return 1;
+}
+
 /*
  * Extract all the arguments provided in the imagepath and fill it in result.
  * Returns 1 on success, 0 on failure.
@@ -322,9 +366,13 @@ extract_netboot_args(char *imagepath, struct boot_fspec_t *result)
      if (!imagepath)
          return 1;
 
-     ret = extract_ipv4_args(imagepath, result);
+     if (strstr(imagepath, TOK_IPV6))
+         ret = extract_ipv6_args(imagepath, result);
+     else
+         ret = extract_ipv4_args(imagepath, result);
      ret |= 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);
@@ -332,7 +380,9 @@ extract_netboot_args(char *imagepath, struct boot_fspec_t *result)
      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);
+
      return ret;
 }
 
index 17a4df3517bea60a6dbe45500df6e3610d38f7f2..bd481e43ed66007b2430f63348a029e519bf1d75 100644 (file)
@@ -149,8 +149,11 @@ of_net_open(struct boot_file_t* file,
                    *p = '\\';
      }
 
-     DEBUG_F("siaddr <%s>; filename <%s>; ciaddr <%s>; giaddr <%s>;\n",
-               fspec->siaddr, filename, fspec->ciaddr, fspec->giaddr);
+     DEBUG_F("siaddr <%s>; filename <%s>; ciaddr <%s>; giaddr <%s>;"
+             " ipv6 <%d>\n",
+             fspec->siaddr, filename, fspec->ciaddr, fspec->giaddr,
+             fspec->is_ipv6);
+
      strncpy(buffer, fspec->dev, 768);
      /* If we didn't get a ':' include one */
      if (fspec->dev[strlen(fspec->dev)-1] != ':')
@@ -166,6 +169,10 @@ of_net_open(struct boot_file_t* file,
      if (new_tftp) {
           strcat(buffer, fspec->siaddr);
           strcat(buffer, ",");
+
+          if (fspec->is_ipv6 && (strstr(filename, "filename=") == NULL))
+               strcat(buffer, "filename=");
+
           strcat(buffer, filename);
           strcat(buffer, ",");
           strcat(buffer, fspec->ciaddr);