Port-sgimips archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: port-sgimips/53539: irisboot (I named) Yet another sgimips bootloader



Dear Tsutsui-san,

I have additional patch for you.

This patch to fix the following issues.

* NO arguments causes panic.
https://twitter.com/nullnilaki/status/1036687998899740673
https://twitter.com/nullnilaki/status/1036685667994984448
https://twitter.com/nullnilaki/status/1036681770303799296

* Lacking disklabel causes panic.
http://mail-index.netbsd.org/port-sgimips/2018/08/25/msg000761.html

https://gist.github.com/nullnilaki/9696a23d1251b2c61cdf2408f1ba5a68

--------------------------------------------------------------
diff -Naru NetBSD_irisboot.orig/common/iris_boot.c
NetBSD_irisboot/common/iris_boot.c
--- NetBSD_irisboot.orig/common/iris_boot.c 2018-12-31 21:15:11.369528923 +0000
+++ NetBSD_irisboot/common/iris_boot.c 2018-12-31 21:44:37.994480922 +0000
@@ -88,10 +88,28 @@
  /* initialise bootinfo structure early */
  bi_init(bootinfo);

- if (strstr(argv[1], "dksc(")) {
- parse(argv, kernelname);
- } else {
- abort();
+ switch (argc) {
+#ifdef INDIGO_R3K_MODE
+ case 1:
+ again();
+ break;
+#endif
+ case 2:
+ /* To specify HDD on Indigo R3K */
+ if (strstr(argv[1], "dksc(")) {
+ parse(argv, kernelname);
+ } else {
+ again();
+ }
+ break;
+ default:
+ /* To specify HDD on Indigo R4K and Indy */
+ if (strstr(argv[1], "dksc(")) {
+ parse(argv, kernelname);
+ } else {
+ again();
+ }
+ break;
  }

  find_devs();
@@ -100,11 +118,7 @@

  if (win < 0) {
  printf("Boot failed!  Halting...\n");
-#ifdef INDIGO_R3K_MODE
- romrestart();
-#else
- arcbios_Reboot();
-#endif
+ reboot();
  }

  strlcpy(bi_bpath.bootpath, kernelname, BTINFO_BOOTPATH_LEN);
@@ -123,11 +137,16 @@
 }

 void
-abort(void)
+again(void)
 {
-
  printf("Invalid argument\n");
  printf("i.e., dksc(0,X,8)loader dksc(0,X,0)/kernel\n");
+ reboot();
+}
+
+void
+reboot(void)
+{
 #ifdef INDIGO_R3K_MODE
  romrestart();
 #else
diff -Naru NetBSD_irisboot.orig/common/iris_disk.c
NetBSD_irisboot/common/iris_disk.c
--- NetBSD_irisboot.orig/common/iris_disk.c 2018-12-31 21:15:11.373129923 +0000
+++ NetBSD_irisboot/common/iris_disk.c 2018-12-31 21:40:30.682090922 +0000
@@ -150,11 +150,7 @@
  if (stat != 0) {
  printf("diskinit abort!\n");
  printf("Boot failed!  Halting...\n");
-#ifdef INDIGO_R3K_MODE
- romrestart();
-#else
- arcbios_Reboot();
-#endif
+ reboot();
  }
  }

@@ -220,7 +216,7 @@
  if (msg) {
  /* If no label, just assume 0 and return */
  printf("No disklabel...\n");
- return 0;
+ reboot();
  }

  return 0;
diff -Naru NetBSD_irisboot.orig/common/iris_machdep.h
NetBSD_irisboot/common/iris_machdep.h
--- NetBSD_irisboot.orig/common/iris_machdep.h 2018-12-31
21:15:11.374121923 +0000
+++ NetBSD_irisboot/common/iris_machdep.h 2018-12-31 21:35:33.454806922 +0000
@@ -32,7 +32,8 @@
 #include "iris_scsivar.h"

 /* iris_boot.c */
-void abort(void);
+void again(void);
+void reboot(void);

 /* iris_parse.c */
 void parse(char **, char *);
diff -Naru NetBSD_irisboot.orig/common/iris_parse.c
NetBSD_irisboot/common/iris_parse.c
--- NetBSD_irisboot.orig/common/iris_parse.c 2018-12-31 21:15:11.375916923 +0000
+++ NetBSD_irisboot/common/iris_parse.c 2018-12-31 21:37:12.770926922 +0000
@@ -46,7 +46,7 @@
  char *ep = strcpy(bootpath, argv[1]);
  ep = strrchr(bootpath, '/');
  if (ep == NULL)
- abort();
+ again();

  strcpy(kernelname, ep + 1);

@@ -56,7 +56,7 @@
  ep = strchr(bootpath, '(');
  if (ep == NULL)
  /* horrible! */
- abort();
+ again();

  /* ctlr,id,part */
  strcpy(disksetting, ep + 1);
@@ -76,5 +76,5 @@
  }

  if ((scsi_ctlr == 255) || (scsi_id == 255) || (scsi_part == 255))
- abort();
+ again();
 }
diff -Naru NetBSD_irisboot.orig/common/iris_scsi.c
NetBSD_irisboot/common/iris_scsi.c
--- NetBSD_irisboot.orig/common/iris_scsi.c 2018-12-31 21:15:11.374936923 +0000
+++ NetBSD_irisboot/common/iris_scsi.c 2018-12-31 21:46:42.389370921 +0000
@@ -286,11 +286,7 @@
  printf("wd33c93_selectbus: wrong target selected WANTED %d GOT %d \n",
     target, id);
  printf("Boot failed!  Halting...\n");
-#ifdef INDIGO_R3K_MODE
- romrestart();
-#else
- arcbios_Reboot();
-#endif
+ reboot();
  }

  sc->sc_flags |= SBICF_SELECTED;
@@ -462,11 +458,7 @@
  /* Something unexpected happend -- deal with it. */
  printf("wd33c93_nextstate:abort\n");
  printf("Boot failed!  Halting...\n");
-#ifdef INDIGO_R3K_MODE
- romrestart();
-#else
- arcbios_Reboot();
-#endif
+ reboot();
  }
  return SBIC_STATE_RUNNING;
 }

--------------------------------------------------------------

Cheers to 2019!

-- 
Naruaki Etomi
nullnilaki%gmail.com@localhost


Home | Main Index | Thread Index | Old Index