Skip to content

Instantly share code, notes, and snippets.

@lwhsu
Last active January 26, 2022 20:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lwhsu/569a815f6509a116aaaf637235072a35 to your computer and use it in GitHub Desktop.
Save lwhsu/569a815f6509a116aaaf637235072a35 to your computer and use it in GitHub Desktop.
diff --git a/sys/dev/mana/gdma_main.c b/sys/dev/mana/gdma_main.c
index aa5d5fd5b50..b21a66d0d56 100644
--- a/sys/dev/mana/gdma_main.c
+++ b/sys/dev/mana/gdma_main.c
@@ -1060,9 +1060,6 @@ mana_gd_destroy_queue(struct gdma_context *gc, struct gdma_queue *queue)
free(queue, M_DEVBUF);
}
-#define OS_MAJOR_DIV 100000
-#define OS_BUILD_MOD 1000
-
int
mana_gd_verify_vf_version(device_t dev)
{
@@ -1079,9 +1076,9 @@ mana_gd_verify_vf_version(device_t dev)
req.drv_ver = 0; /* Unused */
req.os_type = 0x30; /* Other */
- req.os_ver_major = osreldate / OS_MAJOR_DIV;
- req.os_ver_minor = (osreldate % OS_MAJOR_DIV) / OS_BUILD_MOD;
- req.os_ver_build = osreldate % OS_BUILD_MOD;
+ req.os_ver_major = P_OSREL_MAJOR(osreldate);
+ req.os_ver_minor = P_OSREL_MNIOR(osreldate);
+ req.os_ver_build = osreldate;
strncpy(req.os_ver_str1, ostype, sizeof(req.os_ver_str1) - 1);
strncpy(req.os_ver_str2, osrelease, sizeof(req.os_ver_str2) - 1);
diff --git a/sys/sys/param.h b/sys/sys/param.h
index 948a34da94e..5ac2d405701 100644
--- a/sys/sys/param.h
+++ b/sys/sys/param.h
@@ -109,6 +109,7 @@
#define P_OSREL_POWERPC_NEW_AUX_ARGS 1300070
#define P_OSREL_MAJOR(x) ((x) / 100000)
+#define P_OSREL_MNIOR(x) (((x) % 100000) / 1000)
#endif
#ifndef LOCORE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment