[haiku-commits] haiku: hrev54517 - src/system/boot/platform/next_m68k

  • From: Alex von Gluck IV <kallisti5@xxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 19 Aug 2020 09:36:54 -0400 (EDT)

hrev54517 adds 1 changeset to branch 'master'
old head: 5c9d51ef001b878ef17ab550b8da4f9ff156e2a3
new head: ab173783285ccdd3a0c62e7307e88851719ce45f
overview: 
https://git.haiku-os.org/haiku/log/?qt=range&q=ab173783285c+%5E5c9d51ef001b

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

ab173783285c: 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
  Reviewed-on: https://review.haiku-os.org/c/haiku/+/3096
  Reviewed-by: Alex von Gluck IV <kallisti5@xxxxxxxxxxx>

                                          [ François Revol <revol@xxxxxxx> ]

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

Revision:    hrev54517
Commit:      ab173783285ccdd3a0c62e7307e88851719ce45f
URL:         https://git.haiku-os.org/haiku/commit/?id=ab173783285c
Author:      François Revol <revol@xxxxxxx>
Date:        Wed Jul 22 20:37:55 2020 UTC
Committer:   Alex von Gluck IV <kallisti5@xxxxxxxxxxx>
Commit-Date: Wed Aug 19 13:36:51 2020 UTC

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

2 files changed, 143 insertions(+), 4 deletions(-)
src/system/boot/platform/next_m68k/nextrom.h | 51 ++++++++++++-
src/system/boot/platform/next_m68k/start.cpp | 96 +++++++++++++++++++++++-

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

diff --git a/src/system/boot/platform/next_m68k/nextrom.h 
b/src/system/boot/platform/next_m68k/nextrom.h
index 02b86d0482..f23c14082c 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 nvram_info {
 };
 
 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 @@ struct mon_global {
        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 4fe2636680..a69a32903c 100644
--- a/src/system/boot/platform/next_m68k/start.cpp
+++ b/src/system/boot/platform/next_m68k/start.cpp
@@ -123,6 +123,7 @@ platform_exit(void)
 
 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,8 +133,99 @@ inline void dump_mg(struct mon_global *mg)
        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);
+
+#if 0
+       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);
+#endif
+
+
+       dprintf("mg_si\t%p\n", mg->mg_si);
+       /* XXX:the pointer seems completely random, sadly.
+        * Possibly the kernel is supposed to set it?
+        */
+#if 0
+       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++;
+       }
+#endif
+
+       //dprintf("test_msg\t%p\n", mg->test_msg);
+       /* Framebuffer info */
+#if 1
+       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);
+       }
+#endif
+
+       //XXX: this one crashes on older ROMs
+       //dprintf("mg_cpu_clk\t%d\n", mg->mg_cpu_clk);
 }
 
+
 extern "C" void *
 start_next(const char *boot_args, struct mon_global *monitor)
 {
@@ -144,7 +236,7 @@ start_next(const char *boot_args, struct mon_global 
*monitor)
        //asm("cld");                   // Ain't nothing but a GCC thang.
        //asm("fninit");                // initialize floating point unit
 
-       clear_bss();
+       //clear_bss();
        /* save monitor ROM entry */
        mg = monitor;
        // DEBUG
@@ -166,9 +258,9 @@ start_next(const char *boot_args, struct mon_global 
*monitor)
        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


Other related posts:

  • » [haiku-commits] haiku: hrev54517 - src/system/boot/platform/next_m68k - Alex von Gluck IV