There are a couple of problems with using LiS 2.16.13 with
the s390 (31-bit IBM mainframe) linux distributions (rh7.2-s390,
suse sles8-s390, rhel3-s390[beta]).

The first is that the s390 h/w does not have the concept of a pci
bus, so all the PCI_* syscalls are not valid.  This was mentioned
previously in the mailing list in reference to sparc.  I have put
in a bunch of ifdef conditionals to bypass this for s390.

The second is that the s390 kernels are all SMP capable, although
the same indicators may not be available in the kernel source (e.g.
/boot/kernel.h) to indicate SMPness.  I have added some build time
changes to bypass this for s390.

A third problem is that the strinet code does not compile
cleanly on s390, but I am not using it so the patch below
just no-ops it for s390.

Attached is 'diff -Naur' output with the complete set of changes.
It also contains changes for s390x (64-bit IBM mainframe), but
I don't currently have access to an s390x system to confirm
those changes are complete.

Paul Landay
diff -Naur LiS-2.16-orig/Configure LiS-2.16-s390/Configure
--- LiS-2.16-orig/Configure     Tue Jun 10 15:24:04 2003
+++ LiS-2.16-s390/Configure     Mon Sep 15 09:14:59 2003
@@ -518,7 +518,7 @@
        return 1
     fi
 
-    if grep -w -q cpu_online_map $SMAP; then
+    if grep -w -q $SMP_GREP_ID $SMAP; then
        NEED_KSMP=0
        KSMP=y                  # SMP kernel
     else
@@ -535,7 +535,7 @@
 {
     NEED_KSMP=0                                # default is "found"
     if [ "$USE_RUNNING_KERNEL..." = "y..." ]; then
-       if grep -q cpu_online_map /proc/ksyms; then
+       if grep -q $SMP_GREP_ID /proc/ksyms; then
            KSMP=y
        else
            KSMP=
@@ -545,7 +545,7 @@
        if [ $? -eq 0 ]; then           # found
            : OK
        elif [ -f $KSRC/vmlinux ]; then # compiled kernel?
-           if nm -g $KSRC/vmlinux |grep -w -q cpu_online_map; then
+           if nm -g $KSRC/vmlinux |grep -w -q $SMP_GREP_ID; then
                KSMP=y                  # SMP kernel
            else
                KSMP=                   # non-SMP kernel
@@ -823,6 +823,12 @@
     INT_PSW=y
 fi
 
+if [ "$MACHINE" = "s390" -o "$MACHINE" = "s390x" ]; then
+  SMP_GREP_ID='smp_num_cpus'
+else
+  SMP_GREP_ID='cpu_online_map'
+fi
+
 #
 # LIS_HOME
 #
diff -Naur LiS-2.16-orig/config.mk LiS-2.16-s390/config.mk
--- LiS-2.16-orig/config.mk     Thu May 22 12:22:34 2003
+++ LiS-2.16-s390/config.mk     Mon Sep 15 09:01:20 2003
@@ -160,6 +160,13 @@
 ifeq ($(ARCH),ppc)
 XOPTS += -D__powerpc__ -fno-builtin -pipe -D_PPC_LIS_
 endif
+# For s390 & s390x architecture we need some bypasses
+ifeq ($(ARCH),s390)
+XOPTS += -D_S390_LIS_
+endif
+ifeq ($(ARCH),s390x)
+XOPTS += -D_S390X_LIS_
+endif
 
 #
 # This will make glibc define only the types defined in the good old SysV
@@ -190,6 +197,14 @@
 XOPTS += -D__SMP__
 endif
 endif
+ifeq ($(ARCH),s390)
+XOPTS += -D__BOOT_KERNEL_SMP
+endif
+ifeq ($(ARCH),s390x)
+XOPTS += -D__BOOT_KERNEL_SMP
+endif
+
+
 
 #
 # If LiS generated a modversions.h file, note that fact.  linux-mdep.h
diff -Naur LiS-2.16-orig/drivers/str/linux/Makefile 
LiS-2.16-s390/drivers/str/linux/Makefile
--- LiS-2.16-orig/drivers/str/linux/Makefile    Wed Jun  4 17:11:09 2003
+++ LiS-2.16-s390/drivers/str/linux/Makefile    Mon Sep 15 08:54:04 2003
@@ -25,6 +25,12 @@
 ifneq ($(KVER_MAJORMINOR),2.2)
 TOBJS += ip_to_dlpi
 endif
+ifeq ($(ARCH),s390)
+TOBJS := connld
+endif
+ifeq ($(ARCH),s390x)
+TOBJS := connld
+endif
 
 # Similar to TOBJS, but non-streams modules
 ZOBJS := liskmod
diff -Naur LiS-2.16-orig/drivers/str/strinet/make_strinet 
LiS-2.16-s390/drivers/str/strinet/make_strinet
--- LiS-2.16-orig/drivers/str/strinet/make_strinet      Wed Jun  4 17:05:22 2003
+++ LiS-2.16-s390/drivers/str/strinet/make_strinet      Mon Sep 15 08:53:56 2003
@@ -20,6 +20,15 @@
     exit 0
 fi
 
+if [ "$MACHINE..." = "s390..." ]; then
+    echo "Cannot make strinet for an s390 kernel"
+    exit 0
+fi
+if [ "$MACHINE..." = "s390x..." ]; then
+    echo "Cannot make strinet for an s390x kernel"
+    exit 0
+fi
+
 archive=`ls *.tgz`
 dir=`echo $archive | sed -e 's/\.tgz//'`
 
diff -Naur LiS-2.16-orig/head/linux/Makefile LiS-2.16-s390/head/linux/Makefile
--- LiS-2.16-orig/head/linux/Makefile   Tue Nov  5 16:07:47 2002
+++ LiS-2.16-s390/head/linux/Makefile   Mon Sep 15 08:54:53 2003
@@ -45,7 +45,11 @@
 ifeq ($(KVER_MAJOR),2)
 ifeq ($(KVER_MINOR),0)
 else
+  ifneq ($(ARCH),s390)
+  ifneq ($(ARCH),s390x)
   XOBJS += lispci.o
+  endif
+  endif
 endif
 endif
 
diff -Naur LiS-2.16-orig/head/linux/exports.c LiS-2.16-s390/head/linux/exports.c
--- LiS-2.16-orig/head/linux/exports.c  Mon May 19 12:47:36 2003
+++ LiS-2.16-s390/head/linux/exports.c  Mon Sep 15 09:02:49 2003
@@ -220,7 +220,9 @@
 EXPORT_SYMBOL(lis_malloc);
 EXPORT_SYMBOL(lis_mark_mem);
 EXPORT_SYMBOL(lis_max_mem);
+#if (!defined(_S390_LIS_) && !defined(_S390X_LIS_))
 EXPORT_SYMBOL(lis_membar);
+#endif          /* S390 or S390X */
 EXPORT_SYMBOL(lis_milli_to_ticks);
 EXPORT_SYMBOL(lis_mknod);
 EXPORT_SYMBOL(lis_mount);
@@ -251,6 +253,7 @@
 EXPORT_SYMBOL(lis_osif_pci_write_config_word);
 EXPORT_SYMBOL(lis_osif_sti);
 EXPORT_SYMBOL(lis_own_spl);
+#if (!defined(_S390_LIS_) && !defined(_S390X_LIS_))
 EXPORT_SYMBOL(lis_pcibios_find_class);
 EXPORT_SYMBOL(lis_pcibios_find_device);
 EXPORT_SYMBOL(lis_pcibios_init);
@@ -284,6 +287,7 @@
 EXPORT_SYMBOL(lis_pci_write_config_byte);
 EXPORT_SYMBOL(lis_pci_write_config_dword);
 EXPORT_SYMBOL(lis_pci_write_config_word);
+#endif          /* S390 or S390X */
 EXPORT_SYMBOL(lis_phys_to_virt);
 EXPORT_SYMBOL(lis_pipe);
 EXPORT_SYMBOL(lis_poll_2_1);
@@ -421,6 +425,7 @@
 EXPORT_SYMBOL(lis_xmsgsize);
 EXPORT_SYMBOL(lis_zmalloc);
 
+#if (!defined(_S390_LIS_) && !defined(_S390X_LIS_))
 #if defined(KERNEL_2_3)                        /* only for 2.4 or newer kernels */
 
 EXPORT_SYMBOL(lis_osif_pci_alloc_consistent);
@@ -447,3 +452,4 @@
 #endif                                  /* 2.4.13 */
 
 #endif                                 /* defined(KERNEL_2_3) */
+#endif          /* S390 or S390X */
diff -Naur LiS-2.16-orig/head/linux-mdep.c LiS-2.16-s390/head/linux-mdep.c
--- LiS-2.16-orig/head/linux-mdep.c     Tue Jul 15 15:58:21 2003
+++ LiS-2.16-s390/head/linux-mdep.c     Mon Sep 15 08:57:04 2003
@@ -3679,10 +3679,12 @@
     lis_kill_qsched() ;                        /* drivers/str/runq.c */
     lis_terminate_head();
 
+#if (!defined(_S390_LIS_) && !defined(_S390X_LIS_))
     {
         extern void    lis_pci_cleanup(void) ;
         lis_pci_cleanup() ;
     } 
+#endif          /* S390 or S390X */
 
     unregister_chrdev(lis_major,"streams");
 #if defined(KERNEL_2_3)                        /* 2.4 */
diff -Naur LiS-2.16-orig/head/osif.c LiS-2.16-s390/head/osif.c
--- LiS-2.16-orig/head/osif.c   Fri May 30 16:31:00 2003
+++ LiS-2.16-s390/head/osif.c   Mon Sep 15 08:57:41 2003
@@ -335,6 +335,7 @@
 #endif
 
 #if LINUX_VERSION_CODE >= 0x020400             /* 2.4 kernel */
+#if (!defined(_S390_LIS_) && !defined(_S390X_LIS_))
 
         /***************************************
         *        PCI DMA Mapping Fcns          *
@@ -462,6 +463,7 @@
 
 #endif                                  /* 2.4.13 */
 
+#endif          /* S390 or S390X */
 
 #endif         /* LINUX_VERSION_CODE >= 0x020400 */
 
diff -Naur LiS-2.16-orig/include/sys/osif.h LiS-2.16-s390/include/sys/osif.h
--- LiS-2.16-orig/include/sys/osif.h    Wed Dec 18 11:00:13 2002
+++ LiS-2.16-s390/include/sys/osif.h    Mon Sep 15 09:03:55 2003
@@ -171,6 +171,7 @@
 
 #if LINUX_VERSION_CODE >= 0x020400     /* 2.4 kernel */
 
+#if (!defined(_S390_LIS_) && !defined(_S390X_LIS_))
 #ifdef pci_alloc_consistent
 #undef pci_alloc_consistent
 #endif
@@ -252,6 +253,7 @@
 #endif
 #define sg_dma_len lis_osif_sg_dma_len
 
+#endif          /* S390 or S390X */
 #endif
 
 

Reply via email to