Hi,
This patch makes OSS building again for BeOS (missing oss_get_procinfo,
ossdevlinks used missing things but we don't need it anyway), adds
support for buiding in Haiku with the help of Paulo Matias, and adds
support for detecting devices on matching PCI subsystem IDs
automatically, since we have no use for ossdetect anyway.

François.

diff -r 7656ac428350 cmd/ossdevlinks/.config
--- a/cmd/ossdevlinks/.config   Wed Oct 29 22:46:59 2008 +0200
+++ b/cmd/ossdevlinks/.config   Sun Nov 09 19:38:35 2008 +0100
@@ -1,1 +1,3 @@
 mode=sbin
+forgetos=BeOS
+forgetos=Haiku
diff -r 7656ac428350 kernel/OS/BeOS/module.inc
--- a/kernel/OS/BeOS/module.inc Wed Oct 29 22:46:59 2008 +0200
+++ b/kernel/OS/BeOS/module.inc Sun Nov 09 19:38:35 2008 +0100
@@ -45,11 +45,30 @@
       /* if we match a supported vendor */
       while (id_table[vendor].vendor)
         {
-          if (id_table[vendor].vendor == pcii.vendor_id &&
+          bool match = false;
+
+          /* check for function vendor & device id */
+          if (id_table[vendor].subsystem == false &&
+              id_table[vendor].vendor == pcii.vendor_id &&
               id_table[vendor].product == pcii.device_id)
             {
+              dprintf("oss: matching pci %04x,%04x\n", 
id_table[vendor].vendor, id_table[vendor].product);
+              match = true;
+            }
+
+          /* check for subsystem vendor & device id */
+          if (id_table[vendor].subsystem == true &&
+              pcii.header_type == 0 &&
+              id_table[vendor].vendor == pcii.u.h0.subsystem_vendor_id &&
+              id_table[vendor].product == pcii.u.h0.subsystem_id)
+            {
+              dprintf("oss: matching pci subsystem %04x,%04x\n", 
id_table[vendor].vendor, id_table[vendor].product);
+              match = true;
+            }
+
+          if (match)
+            {
               dev_info_t *di;
-              dprintf("oss: matching pci %04x,%04x\n", pcii.vendor_id, 
pcii.device_id);
               di = PMALLOC(NULL, sizeof(dev_info_t));
               if (!di)
                 break;
diff -r 7656ac428350 kernel/OS/BeOS/os_beos.c
--- a/kernel/OS/BeOS/os_beos.c  Wed Oct 29 22:46:59 2008 +0200
+++ b/kernel/OS/BeOS/os_beos.c  Sun Nov 09 19:38:35 2008 +0100
@@ -985,6 +985,18 @@
   return NULL; // XXX:TODO
 }
 
+int
+oss_get_procinfo(int what)
+{
+       switch (what)
+       {
+       case OSS_GET_PROCINFO_UID:
+               return getuid();
+               break;
+       }
+
+       return OSS_EINVAL;
+}
 
 oss_device_t *
 osdev_create (dev_info_t * dip, int dev_type, int instance, const char *nick,
diff -r 7656ac428350 kernel/OS/BeOS/os_beos.h
--- a/kernel/OS/BeOS/os_beos.h  Wed Oct 29 22:46:59 2008 +0200
+++ b/kernel/OS/BeOS/os_beos.h  Sun Nov 09 19:38:35 2008 +0100
@@ -56,7 +56,7 @@
 #include <sys/param.h>
 #include <oss_errno.h>
 #include <sys/uio.h>
-#include <sys/fcntl.h>
+#include <fcntl.h>
 #ifdef __HAIKU__
 #include <poll.h>
 #endif
@@ -417,7 +417,6 @@
 #define UNMAP_PCI_IOADDR(osdev, ix)    {}
 
 #define GET_PROCESS_PID(f)  find_thread(NULL)
-//#define GET_PROCESS_UID()    getuid()
 #define GET_PROCESS_UID()      getuid()
 #define GET_PROCESS_NAME(f) NULL
 
diff -r 7656ac428350 setup/gen_driver_beos.inc
--- a/setup/gen_driver_beos.inc Wed Oct 29 22:46:59 2008 +0200
+++ b/setup/gen_driver_beos.inc Sun Nov 09 19:38:35 2008 +0100
@@ -71,7 +71,10 @@
 
   if (strcmp (conf->bus, "PCI") == 0)
     {
-      fprintf (src, "static struct { uint32 vendor, product; } id_table[] = 
{\n");
+      fprintf (src, "static struct {\n");
+      fprintf (src, "\tbool subsystem;\n");
+      fprintf (src, "\tuint32 vendor, product;\n");
+      fprintf (src, "} id_table[] = {\n");
 
       while (fgets (line, sizeof (line) - 1, f) != NULL)
        {
@@ -97,24 +100,25 @@
          if (*p == '\t')
            *p++ = 0;
 
-         if (strncmp (s, "pci", 3) == 0)
+         if (strncmp (s, "pci", 3) == 0 || strncmp (s, "pcs", 3) == 0)
            {
+             const char *sub = (strncmp (s, "pcs", 3) == 0) ? "true" : "false";
              if (sscanf (s + 3, "%x,%x", &vendor, &product) != 2)
                {
                  fprintf (stderr, "Bad PCI id %s\n", s);
                }
 
-             fprintf (src, "\t{0x%x,\t0x%x},\n", vendor, product);
+             fprintf (src, "\t{%s,\t0x%x,\t0x%x},\n", sub, vendor, product);
            }
 
        }
-
-      fclose (f);
 
       fprintf (src, "\t{0}\n");
       fprintf (src, "};\n");
       fprintf (src, "\n");
     }
+
+  fclose (f);
 
 
 /*
diff -r 7656ac428350 setup/setupdir.sh
--- a/setup/setupdir.sh Wed Oct 29 22:46:59 2008 +0200
+++ b/setup/setupdir.sh Sun Nov 09 19:38:35 2008 +0100
@@ -18,6 +18,12 @@
 if test "$OS " = "UnixWare "
 then
        OS=SCO_SV
+fi
+
+# Use the same source directories for Haiku and BeOS
+if test "$OS " = "Haiku "
+then
+       OS=BeOS
 fi
 
 # Use Linux24 as the OS name for Linux 2.4.x
diff -r 7656ac428350 setup/srcconf.c
--- a/setup/srcconf.c   Wed Oct 29 22:46:59 2008 +0200
+++ b/setup/srcconf.c   Sun Nov 09 19:38:35 2008 +0100
@@ -408,7 +408,7 @@
 #include "gen_driver_sco.inc"
 #endif
 
-#if defined(__BEOS__)
+#if defined(__BEOS__) || defined(__HAIKU__)
 #include "gen_driver_beos.inc"
 #endif
 
@@ -762,7 +762,7 @@
 # endif
 #endif
 
-#if defined(__BEOS__)
+#if defined(__BEOS__) || defined(__HAIKU__)
       fprintf (f, "CFLAGS=-O2 -D_KERNEL -D_KERNEL_MODE=1 -no-fpic\n");
 #endif
 
@@ -1018,7 +1018,7 @@
 #include "srcconf_solaris.inc"
 #endif
 
-#ifdef __BEOS__
+#if defined(__BEOS__) || defined(__HAIKU__)
 #include "srcconf_beos.inc"
 #endif
 
@@ -1182,6 +1182,8 @@
 
   if (strcmp (un.sysname, "UnixWare") == 0)
     strcpy (un.sysname, "SCO_SV");
+  if (strcmp (un.sysname, "Haiku") == 0)
+    strcpy (un.sysname, "BeOS");
   printf ("System: %s\n", un.sysname);
   strcpy (conf->system, un.sysname);
   sprintf (this_os, "kernel/OS/%s", un.sysname);
diff -r 7656ac428350 setup/srcconf_beos.inc
--- a/setup/srcconf_beos.inc    Wed Oct 29 22:46:59 2008 +0200
+++ b/setup/srcconf_beos.inc    Sun Nov 09 19:38:35 2008 +0100
@@ -2,9 +2,6 @@
 static void
 check_sysdep (conf_t * conf, struct utsname *un)
 {
-  if (strcmp (un->sysname, "Haiku") == 0)
-    strcpy (un->sysname, "BeOS");
-
   strcpy (conf->cplusplus, "g++ -fno-rtti -fno-exceptions -I.");
 
   /* fixup machine names */
@@ -22,10 +19,9 @@
   if (strcmp (un->machine, "BeMac") == 0 ||
       strcmp (un->machine, "BeBox") == 0)
     {
-      /* XXX: those are PPC 
+      /* seems to be what Linux uses */
+      /* XXX: check for ppc64 ? */
       strcpy (conf->arch, "ppc");
-      strcpy (conf->platform, "ppc");*/
-      fprintf(stderr, "FIXME: convert arch/machine BeMac/BeBox\n");
-      exit(1);
+      strcpy (conf->platform, "ppc");
     }
 }
_______________________________________________
oss-devel mailing list
oss-devel@mailman.opensound.com
http://mailman.opensound.com/mailman/listinfo/oss-devel

Reply via email to