Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d5c77672 authored by Maria Yu's avatar Maria Yu
Browse files

soc: qcom: socinfo: Implement arch specific machine_name



For device tree's overlay solution, the only model
string for machine name is not sufficient, since
board device tree's model cannot overall present
each soc information. So introduce two properties
"qcom,msm-name" and "qcom,pmic-name" for soc device
tree to add soc specific information name, which can
be merged into machine_name later in kernel setup.

Change-Id: I16b4ad4e203694bfa900eb0b6403690d585e3ddb
Signed-off-by: default avatarMaria Yu <aiquny@codeaurora.org>
parent 11f1add2
Loading
Loading
Loading
Loading
+63 −0
Original line number Diff line number Diff line
Msm Machine Name

Machine name is used to:
	1. show up in the beginning of kernel message.
	Example:
		[    0.000000] Machine: Qualcomm Technologies, Inc. MSM8953 PMI8950 MTP
	2. show up as arch description when do dump stack.
	Example:
		[    1.222319] WARNING: CPU: 2 PID: 1 at kernel/lib/debugobjects.c:263 debug_print_object+0xa8/0xb0
		[    1.222334] Modules linked in:
		[    1.222362] CPU: 2 PID: 1 Comm: swapper/0 Not tainted 4.9.65+ #71
		[    1.222376] Hardware name: Qualcomm Technologies, Inc. MSM8953 PMI8950 MTP (DT)
		[    1.222392] task: ffffffc0ed1b0080 task.stack: ffffffc0ed1b8000
		[    1.222408] PC is at debug_print_object+0xa8/0xb0
		[    1.222424] LR is at debug_print_object+0xa8/0xb0

Msm machine name is a string concatenated from:
	1. constant string contain msm information: "Qualcomm Technologies, Inc.".
	2. string of device tree property "qcom,msm-name".
	3. string of device tree property "qcom,pmic-name".
	4. string of device tree property "model".

The reason for using msm machine Name is single board overlay device tree
may applied to multiple soc device trees. The "model" property in soc device
tree is overwritten with board overlay device tree. So the final string in
"model" property can only contain Board information. And "qcom,msm-name"
and "qcom,pmic-name" property is introduced.

Optional properties:
- qcom,msm-name: The name string of MSM SoC chip
- qcom,pmic-name: The name string of MSM Pmic chip

Required properties:
- model: in soc device tree
	Contain the soc and pmic information.
	Will be overwritten by model string in board overlay device tree.
	It will be used in bootloader for debug purpose.
- model: in board overlay device tree
	Contain the board information. It is the final model string that
	kernel can see.

Note:
When device tree property qcom,msm-name and qcom,pmic-name exist, it will
use concatenated msm machine name string for final machine name.
When device tree property qcom,msm-name and qcom,pmic-name doesn't exist,
it will use model property string for final machine name.

Example:
* In soc device tree:
	/ {
		model = "Qualcomm Technologies, Inc. APQ 8953 + PMI8950 SOC";
		compatible = "qcom,apq8053";
		qcom,pmic-id = <0x010016 0x010011 0x0 0x0>;
		qcom,pmic-name = "PMI8950";
		qcom,msm-id = <293 0x0>;
		qcom,msm-name = "APQ8053";
	};
* In board overlay device tree:
	/ {
		model = "MTP";
		compatible = "qcom,mtp";
	};
+49 −0
Original line number Diff line number Diff line
@@ -652,6 +652,55 @@ static char *msm_read_hardware_id(void)
	return "UNKNOWN SOC TYPE";
}

const char * __init arch_read_machine_name(void)
{
	static char msm_machine_name[256] = "Qualcomm Technologies, Inc. ";
	static bool string_generated;
	u32 len = 0;
	const char *name;

	if (string_generated)
		return msm_machine_name;

	len = strlen(msm_machine_name);
	name = of_get_flat_dt_prop(of_get_flat_dt_root(),
				"qcom,msm-name", NULL);
	if (name)
		len += snprintf(msm_machine_name + len,
					sizeof(msm_machine_name) - len,
					"%s", name);
	else
		goto no_prop_path;

	name = of_get_flat_dt_prop(of_get_flat_dt_root(),
				"qcom,pmic-name", NULL);
	if (name) {
		len += snprintf(msm_machine_name + len,
					sizeof(msm_machine_name) - len,
					"%s", " ");
		len += snprintf(msm_machine_name + len,
					sizeof(msm_machine_name) - len,
					"%s", name);
	} else
		goto no_prop_path;

	name = of_flat_dt_get_machine_name();
	if (name) {
		len += snprintf(msm_machine_name + len,
					sizeof(msm_machine_name) - len,
					"%s", " ");
		len += snprintf(msm_machine_name + len,
					sizeof(msm_machine_name) - len,
					"%s", name);
	} else
		goto no_prop_path;

	string_generated = true;
	return msm_machine_name;
no_prop_path:
	return of_flat_dt_get_machine_name();
}

uint32_t socinfo_get_raw_id(void)
{
	return socinfo ?