forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-10-16 50a212ec906f7524620675f0c57357691c26c81f
kernel/arch/mips/include/asm/sn/sn0/hub.h
....@@ -37,4 +37,26 @@
3737 #define UATTR_MSPEC 2
3838 #define UATTR_UNCAC 3
3939
40
+#ifdef __ASSEMBLY__
41
+/*
42
+ * Returns the local nasid into res.
43
+ */
44
+ .macro GET_NASID_ASM res
45
+ dli \res, LOCAL_HUB_ADDR(NI_STATUS_REV_ID)
46
+ ld \res, (\res)
47
+ and \res, NSRI_NODEID_MASK
48
+ dsrl \res, NSRI_NODEID_SHFT
49
+ .endm
50
+#else
51
+
52
+/*
53
+ * get_nasid() returns the physical node id number of the caller.
54
+ */
55
+static inline nasid_t get_nasid(void)
56
+{
57
+ return (nasid_t)((LOCAL_HUB_L(NI_STATUS_REV_ID) & NSRI_NODEID_MASK)
58
+ >> NSRI_NODEID_SHFT);
59
+}
60
+#endif
61
+
4062 #endif /* _ASM_SN_SN0_HUB_H */