diff --git a/srcpkgs/intel-undervolt/patches/use_stdint_types.patch b/srcpkgs/intel-undervolt/patches/use_stdint_types.patch new file mode 100644 index 00000000000..a1a60c1e262 --- /dev/null +++ b/srcpkgs/intel-undervolt/patches/use_stdint_types.patch @@ -0,0 +1,88 @@ +--- main.c.orig 2018-07-27 05:54:27.274246612 -0700 ++++ main.c 2018-07-27 05:54:15.286170284 -0700 +@@ -2,6 +2,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -19,7 +20,7 @@ + siglongjmp(sigsegv_handler_jmp_buf, 1); + } + +-static bool safe_read_write(u_int64_t * addr, u_int64_t * data, bool write) { ++static bool safe_read_write(uint64_t * addr, uint64_t * data, bool write) { + struct sigaction oldact; + struct sigaction act; + memset(&act, 0, sizeof(struct sigaction)); +@@ -57,10 +58,10 @@ + undervolt_ctx * ctx = data; + + static int mask = 0x800; +- u_int64_t uvint = ((u_int64_t) (mask - absf(uv->value) * 1.024f + 0.5f) ++ uint64_t uvint = ((uint64_t) (mask - absf(uv->value) * 1.024f + 0.5f) + << 21) & 0xffffffff; +- u_int64_t rdval = 0x8000001000000000 | ((u_int64_t) uv->index << 40); +- u_int64_t wrval = rdval | 0x100000000 | uvint; ++ uint64_t rdval = 0x8000001000000000 | ((uint64_t) uv->index << 40); ++ uint64_t wrval = rdval | 0x100000000 | uvint; + + bool write_success = !ctx->write || + wr(ctx->config, MSR_ADDR_VOLTAGE, wrval); +@@ -138,9 +139,9 @@ + void * mem = config->tdp_mem + (MEM_ADDR_TDP & MAP_MASK); + const char * errstr = NULL; + +- u_int64_t msr_limit; +- u_int64_t mchbar_limit; +- u_int64_t units; ++ uint64_t msr_limit; ++ uint64_t mchbar_limit; ++ uint64_t units; + if (rd(config, MSR_ADDR_TDP, msr_limit)) { + if (!safe_read_write(mem, &mchbar_limit, false)) { + errstr = "Segmentation fault"; +@@ -161,15 +162,15 @@ + + if (write) { + int max_tdp = 0x7fff / power_unit; +- u_int64_t masked = msr_limit & 0xffff8000ffff8000; +- u_int64_t short_term = config->tdp_short_term < 0 ? 0 : ++ uint64_t masked = msr_limit & 0xffff8000ffff8000; ++ uint64_t short_term = config->tdp_short_term < 0 ? 0 : + config->tdp_short_term > max_tdp ? max_tdp : + config->tdp_short_term * power_unit; +- u_int64_t long_term = config->tdp_long_term < 0 ? 0 : ++ uint64_t long_term = config->tdp_long_term < 0 ? 0 : + config->tdp_long_term > max_tdp ? max_tdp : + config->tdp_long_term * power_unit; +- u_int64_t value = masked | (short_term << 32) | long_term; +- u_int64_t time; ++ uint64_t value = masked | (short_term << 32) | long_term; ++ uint64_t time; + if (config->tdp_short_time_window > 0) { + masked = value & 0xff01ffffffffffff; + time = tdp_from_seconds(config->tdp_short_time_window, +@@ -229,9 +230,9 @@ + const char * errstr = NULL; + + if (write) { +- u_int64_t limit; ++ uint64_t limit; + if (rd(config, MSR_ADDR_TEMPERATURE, limit)) { +- u_int64_t offset = abs(config->tjoffset); ++ uint64_t offset = abs(config->tjoffset); + offset = offset > 0x3f ? 0x3f : offset; + limit = (limit & 0xffffffffc0ffffff) | (offset << 24); + if (!wr(config, MSR_ADDR_TEMPERATURE, limit)) { +@@ -245,7 +246,7 @@ + if (errstr) { + printf("Failed to write temperature offset: %s\n", errstr); + } else if (nl) { +- u_int64_t limit; ++ uint64_t limit; + if (rd(config, MSR_ADDR_TEMPERATURE, limit)) { + int offset = (limit & 0x3f000000) >> 24; + printf("Critical offset: -%d°C\n", offset); diff --git a/srcpkgs/intel-undervolt/template b/srcpkgs/intel-undervolt/template new file mode 100644 index 00000000000..59a318f9284 --- /dev/null +++ b/srcpkgs/intel-undervolt/template @@ -0,0 +1,12 @@ +# Template file for 'intel-undervolt' +pkgname=intel-undervolt +version=1.4 +revision=1 +build_style=gnu-makefile +conf_files="/etc/intel-undervolt.conf" +short_desc="Intel CPU undervolting tool" +maintainer="Renato Aguiar " +license="GPL-3.0-or-later" +homepage="https://github.com/kitsunyan/intel-undervolt" +distfiles="https://github.com/kitsunyan/intel-undervolt/archive/${version}.tar.gz" +checksum=89c555d03ee7ab3073c5ae0a2879a83b12a7a1325f33c43aea562b656953d410