[haiku-commits] Change in haiku[master]: m68k: Add more NeXT boot rom stuff

  • From: Gerrit <review@xxxxxxxxxxxxxxxxxxx>
  • To: waddlesplash <waddlesplash@xxxxxxxxx>, haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 27 Jul 2020 01:55:26 +0000

From François Revol <revol@xxxxxxx>:

François Revol has uploaded this change for review. ( 
https://review.haiku-os.org/c/haiku/+/3096 ;)


Change subject: m68k: Add more NeXT boot rom stuff
......................................................................

m68k: Add more NeXT boot rom stuff

Those were found in the official headers in the NeXTstep ISO, how come I
didn't even look there in the first place?

We do get enough info to use the framebuffer, but sadly the SCSI IO
seems invalid. Both the NetBSD and even NeXTstep bootblock have their
own embedded drivers, maybe they didn't trust their own rom?

Change-Id: I0a47c433da89b15091644cd5c69ffff24d0cdd1f
---
M src/system/boot/platform/next_m68k/nextrom.h
M src/system/boot/platform/next_m68k/start.cpp
2 files changed, 138 insertions(+), 3 deletions(-)



  git pull ssh://git.haiku-os.org:22/haiku refs/changes/96/3096/1

diff --git a/src/system/boot/platform/next_m68k/nextrom.h 
b/src/system/boot/platform/next_m68k/nextrom.h
index 02b86d0..f23c140 100644
--- a/src/system/boot/platform/next_m68k/nextrom.h
+++ b/src/system/boot/platform/next_m68k/nextrom.h
@@ -27,6 +27,8 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */

+/* parts from NeXT headers */
+
 #include <sys/types.h>

 #ifdef __cplusplus
@@ -97,20 +99,60 @@
 };

 struct mon_region {
-       char data[(232-200)/N_SIMM];
+       long    first_phys_addr;
+       long    last_phys_addr;
 };

 enum SIO_ARGS {
        SIO_ARGS_max = 1
 };

+struct sio {
+       enum SIO_ARGS si_args;
+       unsigned int si_ctrl, si_unit, si_part;
+       struct device *si_dev;
+       unsigned int si_blklen;
+       unsigned int si_lastlba;
+       /*caddr_t*/void *si_sadmem;
+       /*caddr_t*/void *si_protomem;
+       /*caddr_t*/void *si_devmem;
+};
+
 struct km_mon {
        char data[370-324];
 };

+struct km_console_info
+{
+       int     pixels_per_word;        /* Pixels per 32 bit word: 16, 4, 2, or 
1 */
+       int     bytes_per_scanline;
+       int     dspy_w;                 /* Visible display width in pixels */
+       int     dspy_max_w;             /* Display width in pixels */
+       int     dspy_h;                 /* Visible display height in pixels */
+#define KM_CON_ON_NEXTBUS      1       /* flag_bits: Console is NextBus device 
*/
+       int     flag_bits;              /* Vendor and NeXT flags */
+       int     color[4];               /* Bit pattern for white thru black */
+#define KM_HIGH_SLOT   6               /* highest possible console slot. */
+       char    slot_num;               /* Slot of console device */
+       char    fb_num;                 /* Logical frame buffer in slot for 
console */
+       char    byte_lane_id;           /* A value of 1, 4, or 8 */
+       int     start_access_pfunc;     /* P-code run before each FB access */
+       int     end_access_pfunc;       /* P-code run after each FB access */
+       struct  {               /* Frame buffer related addresses to be mapped 
*/
+                       int     phys_addr;
+                       int     virt_addr;
+                       int     size;
+#define KM_CON_MAP_ENTRIES     6
+#define KM_CON_PCODE           0
+#define KM_CON_FRAMEBUFFER     1
+#define KM_CON_BACKINGSTORE    2
+               } map_addr[KM_CON_MAP_ENTRIES];
+       int     access_stack;
+};
+/*
 struct km_console_info {
        char data[(936-4)-(788+16)];
-};
+};*/

 #pragma pack(push,2)

@@ -184,6 +226,11 @@
        int (*mg_as_tune)();
        int mg_flags2;
 #define        MGF2_PARITY     0x80000000
+       volatile struct bmap *mg_bmap_chip;
+       enum mg_pkg {PKG_CUBE, PKG_NS} mg_pkg;
+       enum mg_memory_system {MEMSYS_8, MEMSYS_32} mg_memory_system;
+       enum mg_video_system {VIDSYS_313, VIDSYS_W9C, VIDSYS_PC} 
mg_video_system;
+       int mg_cpu_clk;
 };

 #pragma pack(pop)
diff --git a/src/system/boot/platform/next_m68k/start.cpp 
b/src/system/boot/platform/next_m68k/start.cpp
index 4fe2636..3a53b44 100644
--- a/src/system/boot/platform/next_m68k/start.cpp
+++ b/src/system/boot/platform/next_m68k/start.cpp
@@ -123,6 +123,7 @@

 inline void dump_mg(struct mon_global *mg)
 {
+       int i;
        dprintf("mg@ %p\n", (void*)mg);

        dprintf("mg_flags\t%x\n", (unsigned char)mg->mg_flags);
@@ -132,6 +133,93 @@
        dprintf("mg_vbr\t%x\n", mg->mg_vbr);
        dprintf("mg_console_i\t%x\n", mg->mg_console_i);
        dprintf("mg_console_o\t%x\n", mg->mg_console_o);
+
+       for (i = 0; i < N_SIMM; i++) {
+               dprintf("mg_region[%d] = {%08lx, %08lx}\n", i,
+                               mg->mg_region[i].first_phys_addr,
+                               mg->mg_region[i].last_phys_addr);
+       }
+
+       dprintf("mg_boot_dev\t%s\n", mg->mg_boot_dev);
+       dprintf("mg_boot_arg\t%s\n", mg->mg_boot_arg);
+       dprintf("mg_boot_info\t%s\n", mg->mg_boot_info);
+       dprintf("mg_boot_file\t%s\n", mg->mg_boot_file);
+       dprintf("mg_boot_dev\t%s\n", mg->mg_boot_dev);
+       dprintf("mg_boot_how\t%d\n", mg->mg_boot_how);
+
+       dprintf("mg_sddp\t%p\n", mg->mg_sddp);
+       dprintf("mg_dgp\t%p\n", mg->mg_dgp);    // "dlV3" (disk label signature 
?) SCSI boot gives "@dlV3"
+       dprintf("mg_fdgp\t%p\n", mg->mg_fdgp);  // "A" ?? SCSI: "to become 
ready"
+       dprintf("mg_s5cp\t%p\n", mg->mg_s5cp);
+       dprintf("mg_odc\t%p\n", mg->mg_odc);
+       dprintf("mg_odd\t%p\n", mg->mg_odd);
+
+       /*
+       for (int i = 0; i < sizeof(struct mon_global); i++) {
+               uint8 *p = ((uint8 *)mg)+i;
+               if (i % 32 == 0)
+                       dprintf("%04x", i);
+               if (i % 4 == 0)
+                       dprintf(" ");
+               if (i % 8 == 0)
+                       dprintf(" ");
+               dprintf("%02x", *p);
+               if (i % 32 == 31 || i == sizeof(struct mon_global) - 1)
+                       dprintf("\n");
+       }
+       //while(true);
+       */
+
+
+       dprintf("mg_si\t%p\n", mg->mg_si);
+       /* XXX:the pointer seems completely random, sadly. Possibly the kernel 
is supposed to set it? */
+       /*
+       for (int i = 0; i < sizeof(struct sio); i++) {
+               uint8 *p = ((uint8 *)mg->mg_si)+i;
+               if (i % 32 == 0)
+                       dprintf("%04x", i);
+               if (i % 4 == 0)
+                       dprintf(" ");
+               if (i % 8 == 0)
+                       dprintf(" ");
+               dprintf("%02x", *p);
+               if (i % 32 == 31 || i == sizeof(struct sio) - 1)
+                       dprintf("\n");
+       }
+       for (i = 0; i < 5; i++) {
+               struct sio *s = &mg->mg_si[i];
+               dprintf("sio[%d] = {%08x, %u, %u, %u, %p, %u, %u, %p, %p, 
%p}\n", i,
+                               s->si_args, s->si_ctrl, s->si_unit, s->si_part,
+                               s->si_dev, s->si_blklen, s->si_lastlba, 
s->si_sadmem, s->si_protomem, s->si_devmem);
+               s++;
+       }
+       */
+
+       //dprintf("test_msg\t%p\n", mg->test_msg);
+       /* Framebuffer info */
+       /*
+       dprintf("km_coni = {%d, %d, %d, %d, %d, ... %d, %d, %d, ...%d}\n",
+                       mg->km_coni.pixels_per_word,
+                       mg->km_coni.bytes_per_scanline,
+                       mg->km_coni.dspy_w,
+                       mg->km_coni.dspy_max_w,
+                       mg->km_coni.dspy_h,
+                       //...
+                       mg->km_coni.slot_num,
+                       mg->km_coni.fb_num,
+                       mg->km_coni.byte_lane_id,
+                       mg->km_coni.access_stack);
+       for (i = 0; i < KM_CON_MAP_ENTRIES; i++) {
+               dprintf("km_coni.map_addr[%d] = {%08lx, %08lx, %08lx}\n", i,
+                               mg->km_coni.map_addr[i].phys_addr,
+                               mg->km_coni.map_addr[i].virt_addr,
+                               mg->km_coni.map_addr[i].size);
+       }
+       */
+
+       //XXX: this one crashes on older ROMs
+       //dprintf("mg_cpu_clk\t%d\n", mg->mg_cpu_clk);
+       //while(true);
 }

 extern "C" void *
@@ -166,9 +254,9 @@
        dump_mg(mg);
        //while(1);
        //return NULL;
+       cpu_init();
 #if 0
        // TODO
-       cpu_init();
        mmu_init();

        // wait a bit to give the user the opportunity to press a key

--
To view, visit https://review.haiku-os.org/c/haiku/+/3096
To unsubscribe, or for help writing mail filters, visit 
https://review.haiku-os.org/settings

Gerrit-Project: haiku
Gerrit-Branch: master
Gerrit-Change-Id: I0a47c433da89b15091644cd5c69ffff24d0cdd1f
Gerrit-Change-Number: 3096
Gerrit-PatchSet: 1
Gerrit-Owner: François Revol <revol@xxxxxxx>
Gerrit-MessageType: newchange

Other related posts:

  • » [haiku-commits] Change in haiku[master]: m68k: Add more NeXT boot rom stuff - Gerrit