Skip to content

main_v2 - Optimize Crater Lake - Fix Warnings#224

Closed
DelphineChiu wants to merge 1 commit into
facebook:main_v2from
Wiwynn:PR/cl-refactor
Closed

main_v2 - Optimize Crater Lake - Fix Warnings#224
DelphineChiu wants to merge 1 commit into
facebook:main_v2from
Wiwynn:PR/cl-refactor

Conversation

@DelphineChiu

Copy link
Copy Markdown

Summary:

  • Fix all warnings in CL layer and common layer.
  • Refactor ME portion APIs
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Apr 1, 2022
@facebook-github-bot

Copy link
Copy Markdown
Contributor

@GoldenBug has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

Comment thread common/dev/adc.c

int bat_3v_set_gpio(uint8_t sensor_num, void *arg)
{
SET_GPIO_VALUE_CFG *cfg = arg;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check to make sure arg != NULL

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The optimization code is based on v2022.07.01. After that, the main branch has been phased in some
commits related to sensor monitoring. Those changes will be phased in main_v2 in the other PRs. This
problem will be solved in those PRs.
Please check #223 .

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The optimization code is based on v2022.07.01. After that, the main branch has been phased in some
commits related to sensor monitoring. Those changes will be phased in main_v2 in the other PRs. This
problem will be solved in those PRs.
Please check #223 .

Comment thread common/dev/adc.c
Comment on lines +121 to +132
*reading = (float)val * cfg->arg0 / cfg->arg1 / 1000;
cfg->cache = *reading;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check reading != NULL before use

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The optimization code is based on v2022.07.01. After that, the main branch has been phased in some
commits related to sensor monitoring. Those changes will be phased in main_v2 in the other PRs. This
problem will be solved in those PRs.
Please check #223 .

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The optimization code is based on v2022.07.01. After that, the main branch has been phased in some
commits related to sensor monitoring. Those changes will be phased in main_v2 in the other PRs. This
problem will be solved in those PRs.
Please check #223 .

Comment thread common/dev/adm1278.c
printf("Sensor number %x read fail\n", sensor_num);
return false;
}
*reading = val;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check reading != NULL before use.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The optimization code is based on v2022.07.01. After that, the main branch has been phased in some
commits related to sensor monitoring. Those changes will be phased in main_v2 in the other PRs. This
problem will be solved in those PRs.
Please check #223 .

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The optimization code is based on v2022.07.01. After that, the main branch has been phased in some
commits related to sensor monitoring. Those changes will be phased in main_v2 in the other PRs. This
problem will be solved in those PRs.
Please check #223 .

Comment thread common/dev/guid.c
return GUID_OUT_OF_RANGE;
}

memcpy(&entry->config, &guid_config[entry->config.dev_id], sizeof(EEPROM_CFG));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should check that entry != NULL when passed in

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The optimization code is based on v2022.07.01. After that, the main branch has been phased in some
commits related to sensor monitoring. Those changes will be phased in main_v2 in the other PRs. This
problem will be solved in those PRs.
Please check #223 .

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @GoldenBug
The optimization code is based on v2022.07.01. After that, the main branch has been phased in some
commits related to sensor monitoring. Those changes will be phased in main_v2 in the other PRs. This
problem will be solved in those PRs.
Please check #223 .

Comment thread common/dev/isl69260.c

struct isl69260_page_data isl69260_page_data_args[] = { [0] = { 0x0, 0x0 }, [1] = { 0x0, 0x1 } };

int isl69260_switch_page(uint8_t sensor_num, void *args)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check args != NULL

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The optimization code is based on v2022.07.01. After that, the main branch has been phased in some
commits related to sensor monitoring. Those changes will be phased in main_v2 in the other PRs. This
problem will be solved in those PRs.
Please check #223 .

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The optimization code is based on v2022.07.01. After that, the main branch has been phased in some
commits related to sensor monitoring. Those changes will be phased in main_v2 in the other PRs. This
problem will be solved in those PRs.
Please check #223 .

Comment thread common/dev/peci.c
} else {
// energy / unit time
*reading = ((float)diff_energy / (float)diff_time * 0.06103515625);
free(read_buf);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SAFE_FREE

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The optimization code is based on v2022.07.01. After that, the main branch has been phased in some
commits related to sensor monitoring. Those changes will be phased in main_v2 in the other PRs. This
problem will be solved in those PRs.
Please check #223 .

Comment thread common/dev/peci.c
}
}

bool peci_sensor_read(uint8_t sensor_num, float *reading)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check reading != NULL

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The optimization code is based on v2022.07.01. After that, the main branch has been phased in some
commits related to sensor monitoring. Those changes will be phased in main_v2 in the other PRs. This
problem will be solved in those PRs.
Please check #223 .

Comment thread common/dev/peci.c
*reading = (float)val;
cfg->cache = *reading;
cfg->cache_status = SENSOR_READ_SUCCESS;
free(read_buf);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SAFE_FREE

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The optimization code is based on v2022.07.01. After that, the main branch has been phased in some
commits related to sensor monitoring. Those changes will be phased in main_v2 in the other PRs. This
problem will be solved in those PRs.
Please check #223 .

Comment thread common/dev/tmp75.c

#define RETRY 5

bool tmp75_read(uint8_t sensor_num, float *reading)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check reading != NULL

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The optimization code is based on v2022.07.01. After that, the main branch has been phased in some
commits related to sensor monitoring. Those changes will be phased in main_v2 in the other PRs. This
problem will be solved in those PRs.
Please check #223 .

Comment thread common/lib/libutil.c Outdated
ipmi_message.InF_source = source_inft;
ipmi_message.InF_target = target_inft;
ipmi_message.data_len = data_len;
if (data_len != 0) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

&& data != NULL ?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have fixed this and do the forced update.
Please review it. Thanks.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have fixed this and do the forced update.
Please review it. Thanks.

@facebook-github-bot

Copy link
Copy Markdown
Contributor

@DelphineChiu has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot

Copy link
Copy Markdown
Contributor

@DelphineChiu has updated the pull request. You must reimport the pull request before landing.

@DelphineChiu

Copy link
Copy Markdown
Author

Dependency: #214

@facebook-github-bot

Copy link
Copy Markdown
Contributor

@GoldenBug has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

Comment thread common/hal/hal_gpio.c
gpio_num = (group * GPIO_GROUP_SIZE) + pins;

if (gpio_cfg[gpio_num].int_cb == NULL) {
printk("CB func pointer NULL for gpio num %d\n", gpio_num);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CB -> Callback

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @GoldenBug
We have fixed this and done the forced update.
Please review it. Thanks.

Comment thread common/lib/util_sys.c Outdated
if (me_msg == NULL) {
printf("[%s] Failed to allocate memory\n", __func__);
if ((me_fw_mode != ME_FW_RECOVERY) && (me_fw_mode != ME_FW_RESTORE)) {
printf("Not support the ME frimware mode 0x%x setting", me_fw_mode);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Unsupported ME firmware mode 0x%x setting"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have fixed this and done the forced update.
Please review it. Thanks.

Comment thread common/lib/util_sys.c Outdated
data_len, data);
ret = ipmb_read(me_msg, IPMB_inf_index_map[me_msg->InF_target]);
if (ret != IPMB_ERROR_SUCCESS) {
printf("Failed to set ME frimware mode to 0x%x, ret: 0x%x\n", me_fw_mode,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ME firmware

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have fixed this and done the forced update.
Please review it. Thanks.

Comment thread common/lib/util_sys.c Outdated
}
}
if (i == retry) {
printf("Failed to set ME frimware mode to 0x%x, retry time: %d\n", me_fw_mode,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ME firmware

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have fixed this and done the forced update.
Please review it. Thanks.

Comment thread meta-facebook/yv35-cl/src/main.c Outdated
{
uint8_t proj_stage = (FIRMWARE_REVISION_1 & 0xf0) >> 4;
printk("Hello, wellcome to yv35 craterlake %x%x.%x.%x\n", BIC_FW_YEAR_MSB, BIC_FW_YEAR_LSB,
printf("Hello, wellcome to yv35 craterlake %x%x.%x.%x\n", BIC_FW_YEAR_MSB, BIC_FW_YEAR_LSB,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

welcome

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have fixed this and done the forced update.
Please review it. Thanks.

Summary:
    - Fix all warnings in CL layer and common layer.
    - Refactor ME portion APIs
@facebook-github-bot

Copy link
Copy Markdown
Contributor

@DelphineChiu has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot

Copy link
Copy Markdown
Contributor

@GoldenBug has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

facebook-github-bot pushed a commit that referenced this pull request Apr 12, 2022
Summary:
- Fix all warnings in CL layer and common layer.
- Refactor ME portion APIs

Pull Request resolved: #224

Reviewed By: garnermic

Differential Revision: D35319956

Pulled By: GoldenBug

fbshipit-source-id: c5ec0e0806bd40c5a92ac1c9c8792446dd4cd88d
@GoldenBug GoldenBug closed this Apr 13, 2022
facebook-github-bot pushed a commit that referenced this pull request Apr 26, 2022
Summary:
- Fix all warnings in CL layer and common layer.
- Refactor ME portion APIs

Pull Request resolved: #224

Reviewed By: garnermic

Differential Revision: D35941608

Pulled By: GoldenBug

fbshipit-source-id: 5537e193e18801062cd0acc728bd1c6466aeebbb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

4 participants