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

[MiNT] [PATCH] CT2 fix and improvements



Hi,

thanks to good karma or something I've become proud owner of a CT2B Falcon which I've even managed to fix. To repay my debt I've decided to improve the kernel. :)

Changelist:
- re-enable memory protection on CT2 machines (was accidentally disabled by my fix back in 2013!)
- add new machine directory "ct2" (super helpful for the ethernec driver which comes in two variants so I just put them in "falcon" and "ct2" folders, respectively)
- cleanup ct2 detection, add ct2 cookie

Tested & works.

--
MiKRO / Mystic Bytes
http://mikro.atari.org
diff --git a/sys/arch/info_mach.c b/sys/arch/info_mach.c
index eca1a48..9688f83 100644
--- a/sys/arch/info_mach.c
+++ b/sys/arch/info_mach.c
@@ -75,6 +75,9 @@ char *machine_str (void)
 		case machine_hades:
 			str = "Hades";
 			break;
+		case machine_ct2:
+			str = "Atari Falcon/CT2";
+			break;
 		case machine_ct60:
 			str = "Atari Falcon/CT60";
 			break;
diff --git a/sys/arch/init_mach.c b/sys/arch/init_mach.c
index ec0be11..486d971 100644
--- a/sys/arch/init_mach.c
+++ b/sys/arch/init_mach.c
@@ -50,12 +50,13 @@
 
 /*
  * _MCH cookie is not exact anymore
- * (special hades cookie, special ct60 cookie, special aranym cookie)
+ * (special hades cookie, special ct2/ct60 cookie, special aranym cookie)
  */
 enum special_hw
 {
 	none = 0,
 	hades,
+	ct2,
 	ct60
 # ifdef ARANYM
 	,
@@ -157,6 +158,12 @@ _getmch (void)
 					add_info = hades;
 					break;
 				}
+				
+				case COOKIE__CT2:
+				{
+					add_info = ct2;
+					break;
+				}
 
 				case COOKIE_CT60:
 				{
@@ -197,9 +204,9 @@ _getmch (void)
 		fpu = 1;
 
 #ifdef WITH_MMU_SUPPORT
-	if (add_info == ct60 && !old_no_mem_prot)
+	if ((add_info == ct60 || add_info == ct2) && !old_no_mem_prot)
 	{
-		// HACK: PMMU cookie is for some reason set on CT60
+		// HACK: PMMU cookie is for some reason set on CT2/CT60
 		// so make sure we set the old value as intended
 		no_mem_prot = 0;
 	}
@@ -334,6 +341,9 @@ identify (long mch, enum special_hw info)
 		case hades:
 			machine = machine_hades;
 			break;
+		case ct2:
+			machine = machine_ct2;
+			break;
 		case ct60:
 			machine = machine_ct60;
 			break;
diff --git a/sys/arch/mprot030.c b/sys/arch/mprot030.c
index b42383b..0759a86 100644
--- a/sys/arch/mprot030.c
+++ b/sys/arch/mprot030.c
@@ -200,7 +200,6 @@ init_tables(void)
 	}
 
 {
-    struct cookie *cookie;
     int n_megabytes;
     long global_mode_table_size;
 
@@ -214,21 +213,8 @@ init_tables(void)
         mint_top_tt = 0;
     else
     {
-        int ct2 = 0;
-        mint_top_tt = phys_top_tt;
-        cookie = *CJAR;
-
-        if (cookie)
-        {
-            while (cookie->tag)
-            {
-                if (cookie->tag == 0x5f435432)	/* _CT2 */
-                    ct2=1;
-                cookie++;
-           }
-       }
-
-       if ((machine == machine_falcon) && ct2)
+       mint_top_tt = phys_top_tt;
+       if (machine == machine_ct2)
        {
             offset_tt_ram = 0x03000000L;
             DEBUG (("init_tables: Falcon CT2 -> offset 0x%lx", offset_tt_ram));
diff --git a/sys/cookie.h b/sys/cookie.h
index 7ce2cb7..b654e23 100644
--- a/sys/cookie.h
+++ b/sys/cookie.h
@@ -82,6 +82,7 @@ long	del_rsvfentry	(char *name);
 # define COOKIE_NF	0x5F5F4E46L
 
 /* hardware cookies */
+# define COOKIE__CT2	0x5f435432L
 # define COOKIE_CT60	0x43543630L
 # define COOKIE_HADES	0x68616465L
 # define COOKIE__PCI	0x5f504349L
diff --git a/sys/init.c b/sys/init.c
index 52451d7..9c2765f 100644
--- a/sys/init.c
+++ b/sys/init.c
@@ -684,6 +684,9 @@ init (void)
 			case machine_hades:
 				mch_str = "hades";
 				break;
+			case machine_ct2:
+				mch_str = "ct2";
+				break;
 			case machine_ct60:
 				mch_str = "ct60";
 				break;
diff --git a/sys/mint/ktypes.h b/sys/mint/ktypes.h
index 42c5814..993e58e 100644
--- a/sys/mint/ktypes.h
+++ b/sys/mint/ktypes.h
@@ -121,6 +121,7 @@ typedef enum
 	machine_falcon,
 	machine_milan,
 	machine_hades,
+	machine_ct2,
 	machine_ct60,
 	machine_firebee
 #ifdef ARANYM