Add sw64 architecture

Signed-off-by: wzx <wuzx1226@qq.com>
This commit is contained in:
wzx 2022-10-20 15:18:49 +08:00
parent 4db25ecedd
commit 5e6de45568
2 changed files with 364 additions and 1 deletions

359
hwinfo-21.77-sw.patch Executable file
View File

@ -0,0 +1,359 @@
diff -Naur hwinfo-21.77.org/hwinfo.c hwinfo-21.77.sw/hwinfo.c
--- hwinfo-21.77.org/hwinfo.c 2022-03-01 08:21:36.990000000 +0000
+++ hwinfo-21.77.sw/hwinfo.c 2022-03-01 08:23:03.890000000 +0000
@@ -598,6 +598,9 @@
case arch_alpha:
s = "Alpha";
break;
+ case arch_sw_64:
+ s = "Sw_64";
+ break;
case arch_sparc:
s = "Sparc (32)";
break;
@@ -1236,16 +1239,16 @@
"VGA16", "xvga16",
"RUSH", "xrush",
#endif
-#if defined(__i386__) || defined(__alpha__) || defined(__ia64__)
+#if defined(__i386__) || defined(__alpha__) || defined(__sw_64__) || defined(__ia64__)
"SVGA", "xsvga",
"3DLABS", "xglint",
#endif
-#if defined(__i386__) || defined(__alpha__)
+#if defined(__i386__) || defined(__alpha__) || defined(__sw_64__)
"MACH64", "xmach64",
"P9000", "xp9k",
"S3", "xs3",
#endif
-#ifdef __alpha__
+#ifdef __alpha__ || __sw_64__
"TGA", "xtga",
#endif
#ifdef __sparc__
diff -Naur hwinfo-21.77.org/src/hd/cpu.c hwinfo-21.77.sw/src/hd/cpu.c
--- hwinfo-21.77.org/src/hd/cpu.c 2022-03-01 08:21:36.990000000 +0000
+++ hwinfo-21.77.sw/src/hd/cpu.c 2022-03-01 08:48:25.950000000 +0000
@@ -101,7 +101,14 @@
double bogo;
#endif
-#ifdef __alpha__
+#ifdef __sw_64__
+ char model_id[80], system_id[80], serial_number[80], platform[80];
+ unsigned cpu_variation, cpu_revision, u, hz;
+ double bogo;
+ cpu_info_t *ct1;
+#endif
+
+#ifdef __alpha__
char model_id[80], system_id[80], serial_number[80], platform[80];
unsigned cpu_variation, cpu_revision, u, hz;
cpu_info_t *ct1;
@@ -217,6 +224,65 @@
}
#endif /* __alpha__ */
+#ifdef __sw_64__
+ *model_id = *system_id = *serial_number = *platform = 0;
+ cpu_variation = cpu_revision = hz = 0;
+
+ for(sl = hd_data->cpu; sl; sl = sl->next) {
+ if(sscanf(sl->str, "cpu model : %79[^\n]", model_id) == 1) continue;
+ if(sscanf(sl->str, "system type : %79[^\n]", system_id) == 1) continue;
+ if(sscanf(sl->str, "cpu variation : %u", &cpu_variation) == 1) continue;
+ if(sscanf(sl->str, "cpu revision : %u", &cpu_revision) == 1) continue;
+ if(sscanf(sl->str, "system serial number : %79[^\n]", serial_number) == 1) continue;
+ if(sscanf(sl->str, "cpus detected : %u", &cpus) == 1) continue;
+ if(sscanf(sl->str, "cycle frequency [Hz] : %u", &hz) == 1) continue;
+ if(sscanf(sl->str, "system variation : %79[^\n]", platform) == 1) continue;
+ }
+
+ if(*model_id || *system_id) { /* at least one of those */
+ ct = new_mem(sizeof *ct);
+ ct->architecture = arch_sw_64;
+ if(*model_id) ct->model_name = new_str(model_id);
+ if(*system_id) ct->vend_name = new_str(system_id);
+ if(strncmp(serial_number, "MILO", 4) == 0)
+ hd_data->boot = boot_milo;
+ else
+ hd_data->boot = boot_aboot;
+
+ ct->family = cpu_variation;
+ ct->model = cpu_revision;
+ ct->stepping = 0;
+ ct->cache = 0;
+ ct->clock = (hz + 500000) / 1000000;
+ ct->bogo = bogo;
+
+ if(platform && strcmp(platform, "0")) {
+ ct->platform = new_str(platform);
+ }
+
+ if(!cpus) cpus = 1; /* at least 1 machine had a "cpus: 0" entry... */
+ for(u = 0; u < cpus; u++) {
+ hd = add_hd_entry(hd_data, __LINE__, 0);
+ hd->base_class.id = bc_internal;
+ hd->sub_class.id = sc_int_cpu;
+ hd->slot = u;
+ hd->detail = new_mem(sizeof *hd->detail);
+ hd->detail->type = hd_detail_cpu;
+ if(u) {
+ hd->detail->cpu.data = ct1 = new_mem(sizeof *ct);
+ *ct1 = *ct;
+ ct1->model_name = new_str(ct1->model_name);
+ ct1->vend_name = new_str(ct1->vend_name);
+ ct1->platform = new_str(ct1->platform);
+ }
+ else {
+ hd->detail->cpu.data = ct;
+ }
+ }
+
+ }
+#endif /* __sw_64__ */
+
#ifdef __arm__
*model_id = *system_id = *serial_number = 0;
cpu_variation = cpu_revision = 0;
diff -Naur hwinfo-21.77.org/src/hd/hd.c hwinfo-21.77.sw/src/hd/hd.c
--- hwinfo-21.77.org/src/hd/hd.c 2022-03-01 08:21:37.000000000 +0000
+++ hwinfo-21.77.sw/src/hd/hd.c 2022-03-01 08:37:04.430000000 +0000
@@ -108,6 +108,10 @@
#define HD_ARCH "ia64"
#endif
+#ifdef __sw_64__
+#define HD_ARCH "axp"
+#endif
+
#ifdef __alpha__
#define HD_ARCH "axp"
#endif
@@ -2061,7 +2065,7 @@
hd_scan_monitor(hd_data);
#ifndef LIBHD_TINY
-#if defined(__i386__) || defined(__alpha__)
+#if defined(__i386__) || defined(__alpha__) || defined(__sw_64__)
hd_scan_isapnp(hd_data);
#endif
#endif
@@ -3124,6 +3128,9 @@
#ifdef __alpha__
return arch_alpha;
#else
+#ifdef __sw_64__
+ return arch_sw_64;
+#else
#ifdef __PPC__
return arch_ppc;
#else
@@ -3156,6 +3163,7 @@
#endif
#endif
#endif
+#endif
#endif
#endif
#endif
diff -Naur hwinfo-21.77.org/src/hd/hd.h hwinfo-21.77.sw/src/hd/hd.h
--- hwinfo-21.77.org/src/hd/hd.h 2022-03-01 08:21:37.000000000 +0000
+++ hwinfo-21.77.sw/src/hd/hd.h 2022-03-01 08:29:20.180000000 +0000
@@ -1438,6 +1438,7 @@
arch_unknown = 0,
arch_intel,
arch_alpha,
+ arch_sw_64,
arch_sparc, arch_sparc64,
arch_ppc, arch_ppc64,
arch_68k,
diff -Naur hwinfo-21.77.org/src/hd/hd_int.h hwinfo-21.77.sw/src/hd/hd_int.h
--- hwinfo-21.77.org/src/hd/hd_int.h 2022-03-01 08:21:37.000000000 +0000
+++ hwinfo-21.77.sw/src/hd/hd_int.h 2022-03-01 08:32:28.910000000 +0000
@@ -52,7 +52,7 @@
#define KERNEL_24 0x020400
#define KERNEL_26 0x020600
-#if defined(__s390__) || defined(__s390x__) || defined(__alpha__) || defined(LIBHD_TINY)
+#if defined(__s390__) || defined(__s390x__) || defined(__alpha__) || defined(__sw_64__) || defined(LIBHD_TINY)
#define WITH_ISDN 0
#else
#define WITH_ISDN 1
diff -Naur hwinfo-21.77.org/src/hd/hddb.c hwinfo-21.77.sw/src/hd/hddb.c
--- hwinfo-21.77.org/src/hd/hddb.c 2022-03-01 08:21:37.000000000 +0000
+++ hwinfo-21.77.sw/src/hd/hddb.c 2022-03-01 08:31:03.840000000 +0000
@@ -2278,6 +2278,7 @@
switch(arch) {
case arch_intel:
case arch_x86_64:
+ case arch_sw_64:
case arch_alpha:
ki->XkbRules = new_str("xfree86");
ki->XkbModel = new_str(hd->vendor.id == MAKE_ID(TAG_USB, 0x05ac) ? "macintosh" : "pc104");
diff -Naur hwinfo-21.77.org/src/hd/hdp.c hwinfo-21.77.sw/src/hd/hdp.c
--- hwinfo-21.77.org/src/hd/hdp.c 2022-03-01 08:21:37.000000000 +0000
+++ hwinfo-21.77.sw/src/hd/hdp.c 2022-03-01 08:30:28.850000000 +0000
@@ -1078,6 +1078,9 @@
case arch_intel:
dump_line0 ("Intel\n");
break;
+ case arch_sw_64:
+ dump_line0 ("Sw_64\n");
+ break;
case arch_alpha:
dump_line0 ("Alpha\n");
break;
diff -Naur hwinfo-21.77.org/src/hd/isapnp.c hwinfo-21.77.sw/src/hd/isapnp.c
--- hwinfo-21.77.org/src/hd/isapnp.c 2022-03-01 08:21:37.000000000 +0000
+++ hwinfo-21.77.sw/src/hd/isapnp.c 2022-03-01 08:32:09.110000000 +0000
@@ -15,7 +15,7 @@
* @{
*/
-#if defined(__i386__) || defined(__alpha__)
+#if defined(__i386__) || defined(__alpha__) || defined(__sw_64__)
static void get_pnp_devs(hd_data_t *hd_data);
@@ -421,7 +421,7 @@
#endif
-#endif /* defined(__i386__) || defined(__alpha__) */
+#endif /* defined(__i386__) || defined(__alpha__) || defined(__sw_64__) */
/** @} **/
diff -Naur hwinfo-21.77.org/src/hd/isdn.c hwinfo-21.77.sw/src/hd/isdn.c
--- hwinfo-21.77.org/src/hd/isdn.c 2022-03-01 08:21:37.000000000 +0000
+++ hwinfo-21.77.sw/src/hd/isdn.c 2022-03-01 08:30:02.560000000 +0000
@@ -18,7 +18,7 @@
#ifndef LIBHD_TINY
-#if !defined(__s390__) && !defined(__s390x__) && !defined(__alpha__)
+#if !defined(__s390__) && !defined(__s390x__) && !defined(__alpha__) && !defined(__sw_64__)
void hd_scan_isdn(hd_data_t *hd_data)
{
@@ -307,7 +307,7 @@
return NULL;
}
-#endif /* !defined(__s390__) && !defined(__s390x__) && !defined(__alpha__) */
+#endif /* !defined(__s390__) && !defined(__s390x__) && !defined(__alpha__) && !defined(__sw_64__) */
#endif /* !defined(LIBHD_TINY) */
diff -Naur hwinfo-21.77.org/src/hd/misc.c hwinfo-21.77.sw/src/hd/misc.c
--- hwinfo-21.77.org/src/hd/misc.c 2022-03-01 08:21:37.010000000 +0000
+++ hwinfo-21.77.sw/src/hd/misc.c 2022-03-01 08:49:53.010000000 +0000
@@ -364,7 +364,7 @@
if(i == 0) {
/* non-PCI VGA card ??? - really, we shouldn't care... */
/* FIX THIS !!! ############### */
-#ifdef __alpha__
+#if defined __alpha__ || defined __sw_64__
free_res_list(res);
#else
hd = add_hd_entry(hd_data, __LINE__, 0);
@@ -577,7 +577,7 @@
sscanf(sl->str + j, " %*s %99[^\n]", buf) == 1
) {
#else
-#if defined(__alpha__) || defined(__sparc__)
+#if defined(__alpha__) || defined(__sparc__) || defined(__sw_64__)
if(sscanf(sl->str + j, " %99[^\n]", buf) == 1) {
#else /* __i386__ || __x86_64__ || __ia64__ */
if(sscanf(sl->str + j, " %*s %99[^\n]", buf) == 1) {
diff -Naur hwinfo-21.77.org/src/ids/Makefile hwinfo-21.77.sw/src/ids/Makefile
--- hwinfo-21.77.org/src/ids/Makefile 2022-03-01 08:21:37.010000000 +0000
+++ hwinfo-21.77.sw/src/ids/Makefile 2022-03-01 08:25:27.150000000 +0000
@@ -25,6 +25,10 @@
IDFILES += src/x11.ppc src/x11.ppc.special
endif
+ifeq "$(ARCH)" "sw_64"
+IDFILES += src/x11.axp
+endif
+
ifeq "$(ARCH)" "alpha"
IDFILES += src/x11.axp
endif
diff -Naur hwinfo-21.77.org/src/ids/src/class hwinfo-21.77.sw/src/ids/src/class
--- hwinfo-21.77.org/src/ids/src/class 2022-03-01 08:21:37.020000000 +0000
+++ hwinfo-21.77.sw/src/ids/src/class 2022-03-01 08:33:03.390000000 +0000
@@ -517,6 +517,10 @@
baseclass.id 0x00b
&subclass.id 0x10
++subclass.name Sw_64
+
+ baseclass.id 0x00b
+&subclass.id 0x10
+subclass.name Alpha
baseclass.id 0x00b
diff -Naur hwinfo-21.77.org/src/ids/src/monitor hwinfo-21.77.sw/src/ids/src/monitor
--- hwinfo-21.77.org/src/ids/src/monitor 2022-03-01 08:21:37.020000000 +0000
+++ hwinfo-21.77.sw/src/ids/src/monitor 2022-03-01 08:33:36.290000000 +0000
@@ -242,6 +242,9 @@
+driver.display |50-160|30-70
vendor.id CPL
++vendor.name Sw_64
+
+ vendor.id CPL
+vendor.name Alpha
vendor.id CPL
diff -Naur hwinfo-21.77.org/src/ids/src/pci hwinfo-21.77.sw/src/ids/src/pci
--- hwinfo-21.77.org/src/ids/src/pci 2022-03-01 08:21:37.040000000 +0000
+++ hwinfo-21.77.sw/src/ids/src/pci 2022-03-01 08:35:13.420000000 +0000
@@ -28967,6 +28967,10 @@
vendor.id pci 0x1033
&device.id pci 0x002c
++device.name Star Sw_64 2
+
+ vendor.id pci 0x1033
+&device.id pci 0x002c
+device.name Star Alpha 2
vendor.id pci 0x1033
@@ -112727,6 +112731,9 @@
+vendor.name Digital Equipment Corp
vendor.id pci 0x4144
++vendor.name Sw_64 Data
+
+ vendor.id pci 0x4144
+vendor.name Alpha Data
vendor.id pci 0x4144
@@ -160260,6 +160267,10 @@
baseclass.id 0x00b
&subclass.id 0x10
++subclass.name Sw_64
+
+ baseclass.id 0x00b
+&subclass.id 0x10
+subclass.name Alpha
baseclass.id 0x00b
diff -Naur hwinfo-21.77.org/src/ids/src/usb hwinfo-21.77.sw/src/ids/src/usb
--- hwinfo-21.77.org/src/ids/src/usb 2022-03-01 08:21:37.040000000 +0000
+++ hwinfo-21.77.sw/src/ids/src/usb 2022-03-01 08:34:13.710000000 +0000
@@ -58487,6 +58487,10 @@
vendor.id usb 0x0f03
&device.id usb 0x0001
++device.name Sw_64 1200Sx
+
+ vendor.id usb 0x0f03
+&device.id usb 0x0001
+device.name Alpha 1200Sx
vendor.id usb 0x0f06

View File

@ -1,10 +1,11 @@
Name: hwinfo
Version: 21.82
Release: 1
Release: 2
Summary: Probe for hardware
License: GPL+
URL: https://github.com/openSUSE/hwinfo
Source0: https://github.com/openSUSE/hwinfo/archive/%{version}/%{name}-%{version}.tar.gz
Patch1: hwinfo-21.77-sw.patch
BuildRequires: libx86emu-devel libx86emu doxygen flex perl-XML-Parser pkgconfig udev util-linux-devel gcc
@ -49,6 +50,9 @@ make LDFLAGS="%{__global_ldflags} -Lsrc" LIBDIR=%{_libdir} HWINFO_VERSION=%{vers
%{_datadir}/hwinfo
%changelog
* Thu Oct 20 2022 wuzx<wuzx1226@qq.com> - 21.82-2
- add sw64 patch
* Sun Aug 28 2022 tianlijing <tianlijing@kylinos.cn> - 21.82-1
- update to 21.82