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

[MiNT] [PATCH][1/6] Add XHDI interface to kentry



Alan, at the end I have been able to do it faster than expected.

Commit message:

Add XHDI driver to kentry structure.

Contributed by David Gálvez.
diff -r ae0200e33ec0 -r d9580e181d7d sys/kentry.c
--- a/sys/kentry.c	Fri Apr 17 16:14:31 2015 +0200
+++ b/sys/kentry.c	Fri Apr 17 16:19:50 2015 +0200
@@ -63,7 +63,7 @@
 # include "umemory.h"		/* umalloc, ufree */
 # include "util.h"		/* pid2proc */
 # include "xfs_xdd.h"
-# include "xhdi.h"		/* XHNewCookie */
+# include "xhdi.h"
 
 
 # undef DEFAULT_MODE
diff -r ae0200e33ec0 -r d9580e181d7d sys/libkern/kernel_module.h
--- a/sys/libkern/kernel_module.h	Fri Apr 17 16:14:31 2015 +0200
+++ b/sys/libkern/kernel_module.h	Fri Apr 17 16:19:50 2015 +0200
@@ -953,7 +953,6 @@
 
 # define ROM_Setexc(vnum,vptr)	(void (*)(void))trap_13_emu(0x05,(short)(vnum),(long)(vptr))
 
-# define xhnewcookie		(*KENTRY->vec_misc.XHNewCookie)
 
 /*
  * kentry_debug
@@ -1156,4 +1155,30 @@
 INLINE long Write_io_word(long handle, unsigned long offset, unsigned short val)
 { wrap3 f = (wrap3)_Write_io_word; return (*f)(handle, offset, val); }
 
+
+/*
+ * kentry_xhdi
+ */
+
+# define xhgetversion		(*KENTRY->vec_xhdi.XHGetVersion)
+# define xhinqtarget		(*KENTRY->vec_xhdi.XHInqTarget)
+# define xhreserve			(*KENTRY->vec_xhdi.XHReserve)
+# define xhlock				(*KENTRY->vec_xhdi.XHLock)
+# define xhstop				(*KENTRY->vec_xhdi.XHStop)
+# define xheject			(*KENTRY->vec_xhdi.XHEject)
+# define xhdrvmap			(*KENTRY->vec_xhdi.XHDrvMap)
+# define xhinqdev			(*KENTRY->vec_xhdi.XHInqDev)
+# define xhinqdriver		(*KENTRY->vec_xhdi.XHInqDriver)
+# define xhnewcookie		(*KENTRY->vec_xhdi.XHNewCookie)
+# define xhreadwrite		(*KENTRY->vec_xhdi.XHReadWrite)
+# define xhinqtarget		(*KENTRY->vec_xhdi.XHInqTarget)
+# define xhinqdev2			(*KENTRY->vec_xhdi.XHInqDev2)
+# define xhdriverspecial	(*KENTRY->vec_xhdi.XHDriverSpecial)
+# define xhgetcapacity		(*KENTRY->vec_xhdi.XHGetCapacity)
+# define xhmediumchaged		(*KENTRY->vec_xhdi.XHMediumChanged)
+# define xhmintinfo			(*KENTRY->vec_xhdi.XHMiNTInfo)
+# define xhdoslimits		(*KENTRY->vec_xhdi.XHDOSLimits)
+# define xhlastaccess		(*KENTRY->vec_xhdi.XHLastAccess)
+# define xhreaccess			(*KENTRY->vec_xhdi.XHReaccess)
+
 # endif /* _libkern_kernel_module_h */
diff -r ae0200e33ec0 -r d9580e181d7d sys/mint/kentry.h
--- a/sys/mint/kentry.h	Fri Apr 17 16:14:31 2015 +0200
+++ b/sys/mint/kentry.h	Fri Apr 17 16:19:50 2015 +0200
@@ -49,12 +49,14 @@
 /* forward declarations */
 struct basepage;
 struct bio;
+struct bpb;
 struct create_process_opts;
 struct dirstruct;
 struct dma;
 struct file;
 struct global;
 struct ilock;
+struct kerinfo;
 struct memregion;
 struct mfp;
 struct module_callback;
@@ -109,7 +111,7 @@
  * versions are enough :-)
  */
 #define KENTRY_MAJ_VERSION	0
-#define KENTRY_MIN_VERSION	19
+#define KENTRY_MIN_VERSION	20
 
 /* hardware dependant vector
  */
@@ -563,11 +565,6 @@
 	long _cdecl (*trap_1_emu)(short fnum, ...);
 	long _cdecl (*trap_13_emu)(short fnum, ...);
 	long _cdecl (*trap_14_emu)(short fnum, ...);
-
-	/*
-	 * function to install XHDI drivers
-	 */
-	long _cdecl (*XHNewCookie)(void *newcookie);
 };
 #define DEFAULTS_kentry_misc \
 { \
@@ -583,7 +580,6 @@
 	trap_1_emu, \
 	trap_13_emu, \
 	trap_14_emu, \
-	XHNewCookie, \
 }
 
 /* debug support
@@ -975,6 +971,53 @@
 	Phys_to_virt, \
 }
 
+struct kentry_xhdi
+{
+long _cdecl (*XHGetVersion)(void);
+long _cdecl (*XHInqTarget)(ushort major, ushort minor, ulong *block_size, ulong *device_flags, char *product_name);
+long _cdecl (*XHReserve)(ushort major, ushort minor, ushort do_reserve, ushort key);
+long _cdecl (*XHLock)(ushort major, ushort minor, ushort do_lock, ushort key);
+long _cdecl (*XHStop)(ushort major, ushort minor, ushort do_stop, ushort key);
+long _cdecl (*XHEject)(ushort major, ushort minor, ushort do_eject, ushort key);
+long _cdecl (*XHDrvMap)(void);
+long _cdecl (*XHInqDev)(ushort bios_device, ushort *major, ushort *minor, ulong *start_sector, struct bpb *bpb);
+long _cdecl (*XHInqDriver)(ushort bios_device, char *name, char *ver, char *company, ushort *ahdi_version, ushort *maxIPL);
+long _cdecl (*XHNewCookie)(void *newcookie);
+long _cdecl (*XHReadWrite)(ushort major, ushort minor, ushort rwflag, ulong recno, ushort count, void *buf);
+long _cdecl (*XHInqTarget2)(ushort major, ushort minor, ulong *block_size, ulong *device_flags, char *product_name, ushort stringlen);
+long _cdecl (*XHInqDev2)(ushort bios_device, ushort *major, ushort *minor, ulong *start_sector, struct bpb *bpb, ulong *blocks, char *partid);
+long _cdecl (*XHDriverSpecial)(ulong key1, ulong key2, ushort subopcode, void *data);
+long _cdecl (*XHGetCapacity)(ushort major, ushort minor, ulong *blocks, ulong *bs);
+long _cdecl (*XHMediumChanged)(ushort major, ushort minor);
+long _cdecl (*XHMiNTInfo)(ushort opcode, struct kerinfo *data);
+long _cdecl (*XHDOSLimits)(ushort which, ulong limit);
+long _cdecl (*XHLastAccess)(ushort major, ushort minor, ulong *ms);
+long _cdecl (*XHReaccess)(ushort major, ushort minor);
+};
+#define DEFAULTS_kentry_xhdi \
+{ \
+	XHGetVersion, \
+	XHInqTarget, \
+	XHReserve, \
+	XHLock, \
+	XHStop, \
+	XHEject, \
+	XHDrvMap, \
+	XHInqDev, \
+	XHInqDriver, \
+	XHNewCookie, \
+	XHReadWrite, \
+	XHInqTarget2, \
+	XHInqDev2, \
+	XHDriverSpecial, \
+	XHGetCapacity, \
+	XHMediumChanged, \
+	XHMiNTInfo, \
+	XHDOSLimits, \
+	XHLastAccess, \
+	XHReaccess, \
+}
+
 /* the complete kernel entry
  */
 struct kentry
@@ -1011,6 +1054,7 @@
 	struct kentry_xdd vec_xdd;
 
 	struct kentry_pcibios vec_pcibios;
+	struct kentry_xhdi vec_xhdi;
 };
 # define DEFAULTS_kentry \
 { \
@@ -1041,7 +1085,8 @@
 	DEFAULTS_kentry_libkern, \
 	DEFAULTS_kentry_xfs, \
 	DEFAULTS_kentry_xdd, \
-	DEFAULTS_kentry_pcibios \
+	DEFAULTS_kentry_pcibios, \
+	DEFAULTS_kentry_xhdi, \
 }
 
 # endif /* _mint_kentry_h */
diff -r ae0200e33ec0 -r d9580e181d7d sys/xhdi.h
--- a/sys/xhdi.h	Fri Apr 17 16:14:31 2015 +0200
+++ b/sys/xhdi.h	Fri Apr 17 16:19:50 2015 +0200
@@ -33,7 +33,7 @@
  * BIOS parameter block (osbind.h is buggy)
  */
 
-typedef struct
+typedef struct bpb
 {
 	ushort	recsiz;		/* bytes per sector */
 	short	clsiz;		/* sectors per cluster */