From 14f76ec3d6851d95009c891dc86083d28e9b2ccc Mon Sep 17 00:00:00 2001 From: Matt Wilson Date: Wed, 17 Jul 2002 13:15:31 +0000 Subject: implement summit test --- isys/isys.c | 10 ++++++++++ isys/isys.py | 12 ++++++++++++ isys/smp.c | 33 ++++++++++++++++++++++++++++++--- isys/smp.h | 1 + 4 files changed, 53 insertions(+), 3 deletions(-) (limited to 'isys') diff --git a/isys/isys.c b/isys/isys.c index 3801f9b2c..00d25dfa7 100644 --- a/isys/isys.c +++ b/isys/isys.c @@ -63,6 +63,7 @@ static PyObject * makeDevInode(PyObject * s, PyObject * args); static PyObject * doMknod(PyObject * s, PyObject * args); static PyObject * smpAvailable(PyObject * s, PyObject * args); static PyObject * htAvailable(PyObject * s, PyObject * args); +static PyObject * summitAvailable(PyObject * s, PyObject * args); static PyObject * createProbedList(PyObject * s, PyObject * args); static PyObject * doChroot(PyObject * s, PyObject * args); static PyObject * doCheckBoot(PyObject * s, PyObject * args); @@ -130,6 +131,7 @@ static PyMethodDef isysModuleMethods[] = { { "mount", (PyCFunction) doMount, METH_VARARGS, NULL }, { "smpavailable", (PyCFunction) smpAvailable, METH_VARARGS, NULL }, { "htavailable", (PyCFunction) htAvailable, METH_VARARGS, NULL }, + { "summitavailable", (PyCFunction) summitAvailable, METH_VARARGS, NULL }, { "umount", (PyCFunction) doUMount, METH_VARARGS, NULL }, { "confignetdevice", (PyCFunction) doConfigNetDevice, METH_VARARGS, NULL }, { "pumpnetdevice", (PyCFunction) doPumpNetDevice, METH_VARARGS, NULL }, @@ -779,6 +781,14 @@ static PyObject * htAvailable(PyObject * s, PyObject * args) { return Py_BuildValue("i", detectHT()); } +static PyObject * summitAvailable(PyObject * s, PyObject * args) { + int result; + + if (!PyArg_ParseTuple(args, "")) return NULL; + + return Py_BuildValue("i", detectSummit()); +} + void init_isys(void) { PyObject * m, * d; diff --git a/isys/isys.py b/isys/isys.py index 0d94d3fe7..a0b394ed4 100644 --- a/isys/isys.py +++ b/isys/isys.py @@ -185,6 +185,18 @@ def smpAvailable(): htavailable = _isys.htavailable +def summitavailable(): + try: + f = open("/proc/cmdline") + line = f.readline() + if string.find(line, " summit") != -1: + return 1 + del f + except: + pass + + return _isys.summitavailable() + def chroot (path): return _isys.chroot (path) diff --git a/isys/smp.c b/isys/smp.c index dc6213324..32c42575b 100644 --- a/isys/smp.c +++ b/isys/smp.c @@ -249,7 +249,10 @@ readType() return (int)type; } -static int intelDetectSMP(void) +#define MODE_SMP_CHECK 1 +#define MODE_SUMMIT_CHECK 2 + +static int groupForSMP(int mode) { vm_offset_t paddr; int where; @@ -290,6 +293,15 @@ static int intelDetectSMP(void) close (pfd); return 0; } + + if (mode == MODE_SUMMIT_CHECK) { + if (!strncmp(cth.oem_id, "IBM ENSW", 8) && + (!strncmp(cth.product_id, "NF 6000R", 8) || + !strncmp(cth.product_id, "VIGIL SMP", 9))) + return 1; + return 0; + } + count = cth.entry_count; for (i = 0; i < count; i++) { if ( readType() == 0 ) { @@ -490,9 +502,12 @@ readEntry( void* entry, int size ) } } -#endif /* __i386__ */ +static int intelDetectSMP(void) +{ + return groupForSMP(MODE_SMP_CHECK); +} -#ifdef __i386__ +/* ---- end mptable mess ---- */ static inline void cpuid(int op, int *eax, int *ebx, int *ecx, int *edx) { @@ -501,6 +516,8 @@ static inline void cpuid(int op, int *eax, int *ebx, int *ecx, int *edx) : "a" (op)); } +/* XXX: rewrite using /proc/cpuinfo info if it there. Only fall + back to inline asm if it is not */ int detectHT(void) { FILE *f; @@ -536,6 +553,11 @@ int detectHT(void) return 0; } +int detectSummit(void) +{ + return groupForSMP(MODE_SUMMIT_CHECK); +} + #else /* ndef __i386__ */ int detectHT(void) @@ -543,6 +565,11 @@ int detectHT(void) return 0; } +int detectSummit(void) +{ + return 0; +} + #endif /* __i386__ */ int detectSMP(void) diff --git a/isys/smp.h b/isys/smp.h index e03726826..f16938ac7 100644 --- a/isys/smp.h +++ b/isys/smp.h @@ -3,5 +3,6 @@ int detectSMP(void); int detectHT(void); +int detectSummit(void); #endif /* SMP_H */ -- cgit