Bugzilla – Attachment 98987 Details for
Bug 115415
hwinfo should create another section 'chrp-model'
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
IDP Log In
|
Forgot Password
[patch]
hwinfo.ppc-system_type.patch
hwinfo.ppc-system_type.patch (text/plain), 4.43 KB, created by
Olaf Hering
on 2006-09-18 17:49:08 UTC
(
hide
)
Description:
hwinfo.ppc-system_type.patch
Filename:
MIME Type:
Creator:
Olaf Hering
Created:
2006-09-18 17:49:08 UTC
Size:
4.43 KB
patch
obsolete
>--- > src/hd/sys.c | 86 ++++++++++++++++++++++++++++++++++++++++++++++------------- > 1 file changed, 68 insertions(+), 18 deletions(-) > >Index: hwinfo-13.3/src/hd/sys.c >=================================================================== >--- hwinfo-13.3.orig/src/hd/sys.c >+++ hwinfo-13.3/src/hd/sys.c >@@ -43,7 +43,9 @@ void hd_scan_sys(hd_data_t *hd_data) > sys_info_t *st; > hal_device_t *hal; > #if defined(__PPC__) || defined(__sparc__) >- char buf0[80], *s, *t; >+ FILE *f; >+ size_t r; >+ char buf0[256], *s, *t; > str_list_t *sl; > #endif > >@@ -68,37 +70,85 @@ void hd_scan_sys(hd_data_t *hd_data) > } > > #ifdef __PPC__ >+ /* >+ * system_type is a hint for yast2-storage to make the correct decision >+ * for the partition layout, the make the underlying firmware happy. >+ * perl-Bootloader (who gets it from lilo --get-arch) uses its own version of this logic: >+ * there is 'PReP' from grep PReP /proc/cpuinfo >+ * there is 'iSeries' from test -d /proc/iSeries >+ * there is 'pegasos' from grep -w Pegasos2 /proc/device-tree/model >+ * there is 'CHRP' from grep -w chrp /proc/device-tree/device_type >+ * there is 'CHRP' from grep -w chrp-cbea /proc/device-tree/device_type >+ * there is 'MacRISC' or 'MacRISC4' from grep -w 'MacRISC[4]?' /proc/device-tree/compatible >+ * PowerMacs have 2 classes, OldWorld and NewWorld (NuBus is unsupported) >+ * OldWorld better use BootX to boot the kernel because the OF is not mature enough >+ * NewWorld boot support from OpenFirmware is reliable >+ * the presence of an dir entry 'interrupt-controller' below /proc/device-tree flags NewWorld >+ * MacRISC is always 32bit, MacRISC4 is 64bit >+ * MacRISC2 and MacRISC3 are additional compatible properties, but they are unused >+ * there are a few custom boards that do not have the expected strings in model or device_type >+ * map 'model' "Momentum,Maple-D", "Momentum,Maple-L" and "Momentum,Maple" to 'chrp' >+ * >+ * in addition to the system_type property, unconditionally export /proc/device-tree/model >+ * This gives some info about the PowerMac and pSeries model >+ */ > for(sl = hd_data->cpu; sl; sl = sl->next) { >- if(sscanf(sl->str, "motherboard : %79[^\n]", buf0) == 1) { >- if((s = strstr(buf0, "MacRISC"))) { >- for(t = s + sizeof "MacRISC" - 1; isalnum(*t); t++); >- *t = 0; >- st->system_type = new_str(s); >- hd_data->flags.no_parport = 1; >- } >- } > if(sscanf(sl->str, "machine : %79[^\n]", buf0) == 1) { > if(strstr(buf0, "PReP")) { > st->system_type = new_str("PReP"); > } >- else if(strstr(buf0, "CHRP")) { >- st->system_type = new_str(/* is_64 ? "CHRP64" : */ "CHRP"); >- } > else if(strstr(buf0, "iSeries")) { > st->system_type = new_str("iSeries"); > hd_data->flags.iseries = 1; > } >- if(strstr(buf0, "PowerBook2,")) { >- st->model = new_str("iBook"); >- } >- else if(strstr(buf0, "PowerBook")) { >- st->model = new_str("PowerBook"); >- } > } > if(sscanf(sl->str, "pmac-generation : %79[^\n]", buf0) == 1) { > st->generation = new_str(buf0); > } > } >+ f = fopen("/proc/device-tree/model", "r"); >+ if(f) { >+ r = fread(buf0, 1, sizeof(buf0) - 1, f); >+ if(r > 0 && r < sizeof(buf0)) { >+ buf0[r] = '\0'; >+ st->model = new_str(buf0); >+ if(strcmp(buf0, "Pegasos2") == 0) >+ st->system_type = new_str("pegasos"); >+ else if (strcmp(buf0, "Momentum,Maple-D") == 0 || strcmp(buf0, "Momentum,Maple-L") == 0 || strcmp(buf0, "Momentum,Maple") == 0) >+ st->system_type = new_str("CHRP"); >+ } >+ fclose(f); >+ } >+ if(!st->system_type) { >+ f = fopen("/proc/device-tree/device_type", "r"); >+ if(f) { >+ r = fread(buf0, 1, sizeof(buf0) - 1, f); >+ if(r > 0 && r < sizeof(buf0)) { >+ buf0[r] = '\0'; >+ /* pSeries and cell */ >+ if(strcmp(buf0, "chrp") == 0 || strcmp(buf0, "chrp-cbea") == 0) >+ st->system_type = new_str("CHRP"); >+ } >+ fclose(f); >+ } >+ } >+ if(!st->system_type) { >+ f = fopen("/proc/device-tree/compatible", "r"); >+ if(f) { >+ r = fread(buf0, 1, sizeof(buf0) - 1, f); >+ if(r > 0 && r < sizeof(buf0)) { >+ buf0[r] = '\0'; >+ for(r = r - sizeof("MacRISC") - 1; r; r--) { >+ if(memcmp(&buf0[r], "MacRISC", sizeof("MacRISC") - 1) == 0) { >+ st->system_type = new_str("MacRISC"); >+ hd_data->flags.no_parport = 1; >+ break; >+ } >+ } >+ } >+ fclose(f); >+ } >+ } > #endif /* __PPC__ */ > > #ifdef __sparc__
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
|
Diff
Attachments on
bug 115415
:
48922
|
48923
|
48924
| 98987