diff options
author | Jeremy Katz <katzj@redhat.com> | 2002-10-23 16:40:35 +0000 |
---|---|---|
committer | Jeremy Katz <katzj@redhat.com> | 2002-10-23 16:40:35 +0000 |
commit | ab76ae268d8b78cad2f71908770e4b967e29ed37 (patch) | |
tree | f153fdfb3e99c6e075f47628172a7d9beb63c502 /isys/smp.c | |
parent | 28a42efbdbc9bcf42a4b749b4636664dd3fa7ccd (diff) | |
download | anaconda-ab76ae268d8b78cad2f71908770e4b967e29ed37.tar.gz anaconda-ab76ae268d8b78cad2f71908770e4b967e29ed37.tar.xz anaconda-ab76ae268d8b78cad2f71908770e4b967e29ed37.zip |
* build with diet on ppc
* support for determining smp for pSeries and mac
patches from dan burcaw (dburcaw@terrasoftsolutions.com)
Diffstat (limited to 'isys/smp.c')
-rw-r--r-- | isys/smp.c | 41 |
1 files changed, 36 insertions, 5 deletions
diff --git a/isys/smp.c b/isys/smp.c index ef13ef3b4..1ddda330b 100644 --- a/isys/smp.c +++ b/isys/smp.c @@ -21,6 +21,7 @@ typedef unsigned long u_long; typedef unsigned int u_int; #endif + #ifdef __alpha__ int alphaDetectSMP(void) { @@ -98,11 +99,41 @@ int sparcDetectSMP(void) #endif /* __sparc__ */ #ifdef __powerpc__ -/* FIXME: placeholder */ -int ppcDetectSMP(void) { - return 0; +#include "minifind.h" + +/* FIXME: this won't work on iSeries */ +int powerpcDetectSMP(void) +{ + int issmp = -1; + FILE *f; + struct findNode *list = (struct findNode *) malloc(sizeof(struct findNode)); + struct pathNode *n; + + list->result = (struct pathNode *) malloc(sizeof(struct pathNode)); + list->result->path = NULL; + list->result->next = list->result; + + minifind("/proc/device-tree/cpus", "device_type", list); + + for (n = list->result->next; n != list->result; n = n->next) + { + f = fopen(n->path, "r"); + if (f) { + char buff[1024]; + while (fgets (buff, 1024, f) != NULL) { + if (!strncmp (buff, "cpu", 3)) + { + issmp++; + break; + } + } + fclose(f); + } + } + + return issmp; } -#endif +#endif /* __powerpc__ */ #ifdef __i386__ /* @@ -601,7 +632,7 @@ int detectSMP(void) #elif __x86_64__ return isSMP = 1; #elif __powerpc__ - return isSMP = ppcDetectSMP(); + return isSMP = powerpcDetectSMP(); #else #error unknown architecture #endif |