mirror of
https://github.com/openharmony/device_board_osware.git
synced 2026-07-19 17:23:31 -04:00
@@ -59,6 +59,7 @@ Note:If the text contains special characters, please escape them according to th
|
||||
<policy name="projectPolicy" desc="">
|
||||
<policyitem type="copyright" name="Broadcom Corporation" path=".*" rule="may" group="defaultGroup" filefilter="copyrightPolicyFilter" desc=""/>
|
||||
<policyitem type="copyright" name="Beijing OSWare Technology Co., Ltd" path=".*" rule="may" group="defaultGroup" filefilter="copyrightPolicyFilter" desc=""/>
|
||||
<policyitem type="license" name="EndUserLicenseAgreement" path=".*" desc="License Header Invalid"/>
|
||||
</policy>
|
||||
</policylist>
|
||||
<filefilterlist>
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
# Copyright (C) 2021–2022 Beijing OSWare Technology Co., Ltd
|
||||
# This file contains confidential and proprietary information of
|
||||
# OSWare Technology Co., Ltd
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//build/test.gni")
|
||||
|
||||
module_output_path = "hdf/platform"
|
||||
ohos_unittest("hdf_adapter_uhdf_test_platform") {
|
||||
module_out_path = module_output_path
|
||||
include_dirs = [
|
||||
"//drivers/framework/include/platform",
|
||||
"//drivers/framework/include/core",
|
||||
"//drivers/framework/include/osal",
|
||||
"//drivers/adapter/uhdf/posix/include",
|
||||
"//drivers/framework/include/utils",
|
||||
"//drivers/framework/include",
|
||||
"//drivers/framework/test/unittest/include",
|
||||
"//drivers/framework/test/unittest/platform/common",
|
||||
"//drivers/framework/core/host/include",
|
||||
"//drivers/framework/core/manager/include",
|
||||
"//drivers/adapter/uhdf2/include/host",
|
||||
"//drivers/framework/support/platform/include",
|
||||
"//drivers/framework/support/platform/include/fwk",
|
||||
"//drivers/framework/model/storage/include/mmc",
|
||||
"//drivers/framework/support/platform/include/spi",
|
||||
"//drivers/framework/support/platform/include/watchdog",
|
||||
"//drivers/framework/support/platform/include/i2c",
|
||||
"//drivers/framework/support/platform/include/uart",
|
||||
"//drivers/framework/support/platform/include/rtc",
|
||||
]
|
||||
|
||||
sources = [
|
||||
"common/hdf_emmc_test.cpp",
|
||||
"common/hdf_gpio_test.cpp",
|
||||
"common/hdf_i2c_test.cpp",
|
||||
"common/hdf_pwm_test.cpp",
|
||||
"common/hdf_rtc_test.cpp",
|
||||
"common/hdf_spi_test.cpp",
|
||||
"common/hdf_uart_test.cpp",
|
||||
"common/hdf_watchdog_test.cpp",
|
||||
"common/hdf_mipi_dsi_test.cpp",
|
||||
"common/hdf_sdio_test.cpp",
|
||||
]
|
||||
|
||||
defines = [ "__USER__" ]
|
||||
deps = [
|
||||
"//drivers/adapter/build/test_common:libhdf_test_common",
|
||||
"//drivers/adapter/uhdf2/utils:libhdf_utils",
|
||||
]
|
||||
resource_config_file =
|
||||
"//drivers/adapter/uhdf2/test/resource/platform/ohos_test.xml"
|
||||
cflags = [
|
||||
"-Wall",
|
||||
"-Wextra",
|
||||
"-Werror",
|
||||
"-fsigned-char",
|
||||
"-fno-common",
|
||||
"-fno-strict-aliasing",
|
||||
]
|
||||
if (is_standard_system) {
|
||||
external_deps = [
|
||||
"hiviewdfx_hilog_native:libhilog",
|
||||
"utils_base:utils",
|
||||
]
|
||||
} else {
|
||||
external_deps = [ "hilog:libhilog" ]
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2021–2022 Beijing OSWare Technology Co., Ltd
|
||||
* This file contains confidential and proprietary information of
|
||||
* OSWare Technology Co., Ltd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <fcntl.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <string>
|
||||
#include <unistd.h>
|
||||
#include "emmc_if.h"
|
||||
#include "hdf_io_service_if.h"
|
||||
#include "hdf_uhdf_test.h"
|
||||
|
||||
using namespace testing::ext;
|
||||
|
||||
enum EmmcTestCmd {
|
||||
EMMC_GET_CID_01 = 0,
|
||||
};
|
||||
|
||||
class HdfLiteEmmcTest : public testing::Test {
|
||||
public:
|
||||
static void SetUpTestCase();
|
||||
static void TearDownTestCase();
|
||||
void SetUp();
|
||||
void TearDown();
|
||||
};
|
||||
|
||||
void HdfLiteEmmcTest::SetUpTestCase()
|
||||
{
|
||||
HdfTestOpenService();
|
||||
}
|
||||
|
||||
void HdfLiteEmmcTest::TearDownTestCase()
|
||||
{
|
||||
HdfTestCloseService();
|
||||
}
|
||||
|
||||
void HdfLiteEmmcTest::SetUp()
|
||||
{
|
||||
}
|
||||
|
||||
void HdfLiteEmmcTest::TearDown()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @tc.name: EmmcGetCid001
|
||||
* @tc.desc: test EmmcGetCid/EmmcGetHuid interface in kernel and user status.
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000F5LSD AR000F5LV3
|
||||
*/
|
||||
HWTEST_F(HdfLiteEmmcTest, EmmcGetCid001, TestSize.Level1)
|
||||
{
|
||||
struct HdfTestMsg msg = {TEST_PAL_EMMC_TYPE, EMMC_GET_CID_01, -1};
|
||||
EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
|
||||
}
|
||||
@@ -1,128 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2021–2022 Beijing OSWare Technology Co., Ltd
|
||||
* This file contains confidential and proprietary information of
|
||||
* OSWare Technology Co., Ltd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <fcntl.h>
|
||||
#include <string>
|
||||
#include <unistd.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include "gpio_test.h"
|
||||
#include "hdf_uhdf_test.h"
|
||||
#include "hdf_io_service_if.h"
|
||||
|
||||
using namespace testing::ext;
|
||||
|
||||
class HdfLiteGpioTest : public testing::Test {
|
||||
public:
|
||||
static void SetUpTestCase();
|
||||
static void TearDownTestCase();
|
||||
void SetUp();
|
||||
void TearDown();
|
||||
};
|
||||
|
||||
void HdfLiteGpioTest::SetUpTestCase()
|
||||
{
|
||||
HdfTestOpenService();
|
||||
}
|
||||
|
||||
void HdfLiteGpioTest::TearDownTestCase()
|
||||
{
|
||||
HdfTestCloseService();
|
||||
}
|
||||
|
||||
void HdfLiteGpioTest::SetUp()
|
||||
{
|
||||
}
|
||||
|
||||
void HdfLiteGpioTest::TearDown()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: GpioTestSetGetDir001
|
||||
* @tc.desc: gpio set and get dir test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000F868H
|
||||
*/
|
||||
HWTEST_F(HdfLiteGpioTest, GpioTestSetGetDir001, TestSize.Level1)
|
||||
{
|
||||
struct HdfTestMsg msg = {TEST_PAL_GPIO_TYPE, GPIO_TEST_SET_GET_DIR, -1};
|
||||
EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: GpioTestWriteRead001
|
||||
* @tc.desc: gpio write and read test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000F868H
|
||||
*/
|
||||
HWTEST_F(HdfLiteGpioTest, GpioTestWriteRead001, TestSize.Level1)
|
||||
{
|
||||
struct HdfTestMsg msg = {TEST_PAL_GPIO_TYPE, GPIO_TEST_WRITE_READ, -1};
|
||||
EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: GpioTestIrqLevel001
|
||||
* @tc.desc: gpio level irq trigger test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000F868H
|
||||
*/
|
||||
HWTEST_F(HdfLiteGpioTest, GpioTestIrqLevel001, TestSize.Level1)
|
||||
{
|
||||
struct HdfTestMsg msg = {TEST_PAL_GPIO_TYPE, GPIO_TEST_IRQ_LEVEL, -1};
|
||||
EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: GpioTestIrqEdge001
|
||||
* @tc.desc: gpio edge irq trigger test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000F868H
|
||||
*/
|
||||
HWTEST_F(HdfLiteGpioTest, GpioTestIrqEdge001, TestSize.Level1)
|
||||
{
|
||||
struct HdfTestMsg msg = {TEST_PAL_GPIO_TYPE, GPIO_TEST_IRQ_EDGE, -1};
|
||||
EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: GpioTestIrqThread001
|
||||
* @tc.desc: gpio thread irq trigger test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000F868H
|
||||
*/
|
||||
HWTEST_F(HdfLiteGpioTest, GpioTestIrqThread001, TestSize.Level1)
|
||||
{
|
||||
struct HdfTestMsg msg = {TEST_PAL_GPIO_TYPE, GPIO_TEST_IRQ_THREAD, -1};
|
||||
EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: GpioTestReliability001
|
||||
* @tc.desc: gpio reliability test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000F868H
|
||||
*/
|
||||
HWTEST_F(HdfLiteGpioTest, GpioTestReliability001, TestSize.Level1)
|
||||
{
|
||||
struct HdfTestMsg msg = {TEST_PAL_GPIO_TYPE, GPIO_TEST_RELIABILITY, -1};
|
||||
EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
|
||||
}
|
||||
@@ -1,108 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2021–2022 Beijing OSWare Technology Co., Ltd
|
||||
* This file contains confidential and proprietary information of
|
||||
* OSWare Technology Co., Ltd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <fcntl.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <string>
|
||||
#include <unistd.h>
|
||||
#include "hdf_uhdf_test.h"
|
||||
#include "i2c_test.h"
|
||||
#include "hdf_io_service_if.h"
|
||||
|
||||
using namespace testing::ext;
|
||||
|
||||
class HdfLiteI2cTest : public testing::Test {
|
||||
public:
|
||||
static void SetUpTestCase();
|
||||
static void TearDownTestCase();
|
||||
void SetUp();
|
||||
void TearDown();
|
||||
};
|
||||
|
||||
void HdfLiteI2cTest::SetUpTestCase()
|
||||
{
|
||||
struct HdfTestMsg msg = {TEST_PAL_I2C_TYPE, I2C_TEST_CMD_SETUP_ALL, -1};
|
||||
HdfTestOpenService();
|
||||
HdfTestSendMsgToService(&msg);
|
||||
}
|
||||
|
||||
void HdfLiteI2cTest::TearDownTestCase()
|
||||
{
|
||||
struct HdfTestMsg msg = {TEST_PAL_I2C_TYPE, I2C_TEST_CMD_TEARDOWN_ALL, -1};
|
||||
HdfTestSendMsgToService(&msg);
|
||||
HdfTestCloseService();
|
||||
}
|
||||
|
||||
void HdfLiteI2cTest::SetUp()
|
||||
{
|
||||
}
|
||||
|
||||
void HdfLiteI2cTest::TearDown()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: HdfLiteI2cTestTransfer001
|
||||
* @tc.desc: i2c transfer test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000F8688
|
||||
*/
|
||||
HWTEST_F(HdfLiteI2cTest, HdfLiteI2cTestTransfer001, TestSize.Level1)
|
||||
{
|
||||
struct HdfTestMsg msg = {TEST_PAL_I2C_TYPE, I2C_TEST_CMD_TRANSFER, -1};
|
||||
EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: HdfLiteI2cTestWriteRead001
|
||||
* @tc.desc: i2c write and read test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000F8688
|
||||
*/
|
||||
HWTEST_F(HdfLiteI2cTest, HdfLiteI2cTestWriteRead001, TestSize.Level1)
|
||||
{
|
||||
struct HdfTestMsg msg = {TEST_PAL_I2C_TYPE, I2C_TEST_CMD_WRITE_READ, -1};
|
||||
EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: HdfLiteI2cTestMultiThread001
|
||||
* @tc.desc: i2c multithread test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000F8688
|
||||
*/
|
||||
HWTEST_F(HdfLiteI2cTest, HdfLiteI2cTestMultiThread001, TestSize.Level1)
|
||||
{
|
||||
struct HdfTestMsg msg = {TEST_PAL_I2C_TYPE, I2C_TEST_CMD_MULTI_THREAD, -1};
|
||||
EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: HdfLiteI2cTestReliability001
|
||||
* @tc.desc: i2c reliability test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000F8688
|
||||
*/
|
||||
HWTEST_F(HdfLiteI2cTest, HdfLiteI2cTestReliability001, TestSize.Level1)
|
||||
{
|
||||
struct HdfTestMsg msg = {TEST_PAL_I2C_TYPE, I2C_TEST_CMD_RELIABILITY, -1};
|
||||
EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
|
||||
}
|
||||
@@ -1,110 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2021–2022 Beijing OSWare Technology Co., Ltd
|
||||
* This file contains confidential and proprietary information of
|
||||
* OSWare Technology Co., Ltd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "hdf_uhdf_test.h"
|
||||
|
||||
using namespace testing::ext;
|
||||
|
||||
// pal mipi dsi test case number
|
||||
enum MipiDsiTestCmd {
|
||||
MIPI_DSI_TEST_SET_CFG = 0,
|
||||
MIPI_DSI_TEST_GET_CFG = 1,
|
||||
MIPI_DSI_TEST_TX_RX = 2,
|
||||
MIPI_DSI_TEST_TO_LP_TO_HS = 3,
|
||||
MIPI_DSI_TEST_ENTER_ULPS_EXIT_ULPS = 4,
|
||||
MIPI_DSI_TEST_POWER_CONTROL = 5,
|
||||
MIPI_DSI_TEST_MAX = 6,
|
||||
};
|
||||
|
||||
class HdfLiteMipiDsiTest : public testing::Test {
|
||||
public:
|
||||
static void SetUpTestCase();
|
||||
static void TearDownTestCase();
|
||||
void SetUp();
|
||||
void TearDown();
|
||||
};
|
||||
|
||||
void HdfLiteMipiDsiTest::SetUpTestCase()
|
||||
{
|
||||
HdfTestOpenService();
|
||||
}
|
||||
|
||||
void HdfLiteMipiDsiTest::TearDownTestCase()
|
||||
{
|
||||
HdfTestCloseService();
|
||||
}
|
||||
|
||||
void HdfLiteMipiDsiTest::SetUp()
|
||||
{
|
||||
}
|
||||
|
||||
void HdfLiteMipiDsiTest::TearDown()
|
||||
{
|
||||
}
|
||||
|
||||
static void MipiDsiTest(enum MipiDsiTestCmd cmd)
|
||||
{
|
||||
struct HdfTestMsg msg = {TEST_PAL_MIPI_DSI_TYPE, (uint8_t)cmd, -1};
|
||||
EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: MipiDsiSetCfgTest001
|
||||
* @tc.desc: mipi dsi function test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000F868F
|
||||
*/
|
||||
HWTEST_F(HdfLiteMipiDsiTest, MipiDsiSetCfgTest001, TestSize.Level1)
|
||||
{
|
||||
MipiDsiTest(MIPI_DSI_TEST_SET_CFG);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: MipiDsiGetCfgTest001
|
||||
* @tc.desc: mipi dsi function test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000F868F
|
||||
*/
|
||||
HWTEST_F(HdfLiteMipiDsiTest, MipiDsiGetCfgTest001, TestSize.Level1)
|
||||
{
|
||||
MipiDsiTest(MIPI_DSI_TEST_GET_CFG);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: MipiDsiTxRxTest001
|
||||
* @tc.desc: mipi dsi function test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000F868F
|
||||
*/
|
||||
HWTEST_F(HdfLiteMipiDsiTest, MipiDsiTxRxTest001, TestSize.Level1)
|
||||
{
|
||||
MipiDsiTest(MIPI_DSI_TEST_TX_RX);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: MipiDsiLpHsTest001
|
||||
* @tc.desc: mipi dsi function test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000F868F
|
||||
*/
|
||||
HWTEST_F(HdfLiteMipiDsiTest, MipiDsiLpHsTest001, TestSize.Level1)
|
||||
{
|
||||
MipiDsiTest(MIPI_DSI_TEST_TO_LP_TO_HS);
|
||||
}
|
||||
|
||||
@@ -1,128 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2021–2022 Beijing OSWare Technology Co., Ltd
|
||||
* This file contains confidential and proprietary information of
|
||||
* OSWare Technology Co., Ltd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <fcntl.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <string>
|
||||
#include <unistd.h>
|
||||
#include "hdf_uhdf_test.h"
|
||||
#include "pwm_test.h"
|
||||
#include "hdf_io_service_if.h"
|
||||
|
||||
using namespace testing::ext;
|
||||
|
||||
class HdfLitePwmTest : public testing::Test {
|
||||
public:
|
||||
static void SetUpTestCase();
|
||||
static void TearDownTestCase();
|
||||
void SetUp();
|
||||
void TearDown();
|
||||
};
|
||||
|
||||
void HdfLitePwmTest::SetUpTestCase()
|
||||
{
|
||||
HdfTestOpenService();
|
||||
}
|
||||
|
||||
void HdfLitePwmTest::TearDownTestCase()
|
||||
{
|
||||
HdfTestCloseService();
|
||||
}
|
||||
|
||||
void HdfLitePwmTest::SetUp()
|
||||
{
|
||||
}
|
||||
|
||||
void HdfLitePwmTest::TearDown()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: PwmSetPeriodTest001
|
||||
* @tc.desc: pwm function test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000F868C
|
||||
*/
|
||||
HWTEST_F(HdfLitePwmTest, PwmSetPeriodTest001, TestSize.Level1)
|
||||
{
|
||||
struct HdfTestMsg msg = {TEST_PAL_PWM_TYPE, PWM_SET_PERIOD_TEST, -1};
|
||||
EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: PwmSetDutyTest001
|
||||
* @tc.desc: pwm function test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000F868C
|
||||
*/
|
||||
HWTEST_F(HdfLitePwmTest, PwmSetDutyTest001, TestSize.Level1)
|
||||
{
|
||||
struct HdfTestMsg msg = {TEST_PAL_PWM_TYPE, PWM_SET_DUTY_TEST, -1};
|
||||
EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: PwmSetPolarityTest001
|
||||
* @tc.desc: pwm function test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000F868C
|
||||
*/
|
||||
HWTEST_F(HdfLitePwmTest, PwmSetPolarityTest001, TestSize.Level1)
|
||||
{
|
||||
struct HdfTestMsg msg = { TEST_PAL_PWM_TYPE, PWM_SET_POLARITY_TEST, -1};
|
||||
EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: PwmSetGetConfigTest001
|
||||
* @tc.desc: pwm function test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000F868D
|
||||
*/
|
||||
HWTEST_F(HdfLitePwmTest, PwmSetGetConfigTest001, TestSize.Level1)
|
||||
{
|
||||
struct HdfTestMsg msg = {TEST_PAL_PWM_TYPE, PWM_SET_GET_CONFIG_TEST, -1};
|
||||
EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: PwmEnableTest001
|
||||
* @tc.desc: pwm function test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000F868D
|
||||
*/
|
||||
HWTEST_F(HdfLitePwmTest, PwmEnableTest001, TestSize.Level1)
|
||||
{
|
||||
struct HdfTestMsg msg = {TEST_PAL_PWM_TYPE, PWM_ENABLE_TEST, -1};
|
||||
EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: PwmDisableTest001
|
||||
* @tc.desc: pwm function test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000F868D
|
||||
*/
|
||||
HWTEST_F(HdfLitePwmTest, PwmDisableTest001, TestSize.Level1)
|
||||
{
|
||||
struct HdfTestMsg msg = {TEST_PAL_PWM_TYPE, PWM_DISABLE_TEST, -1};
|
||||
EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
|
||||
}
|
||||
@@ -1,265 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2021–2022 Beijing OSWare Technology Co., Ltd
|
||||
* This file contains confidential and proprietary information of
|
||||
* OSWare Technology Co., Ltd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <fcntl.h>
|
||||
#include <string>
|
||||
#include <unistd.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include "hdf_uhdf_test.h"
|
||||
#include "hdf_io_service_if.h"
|
||||
#include "rtc_test.h"
|
||||
|
||||
using namespace testing::ext;
|
||||
|
||||
class HdfRtcTest : public testing::Test {
|
||||
public:
|
||||
static void SetUpTestCase();
|
||||
static void TearDownTestCase();
|
||||
void SetUp();
|
||||
void TearDown();
|
||||
};
|
||||
|
||||
void HdfRtcTest::SetUpTestCase()
|
||||
{
|
||||
HdfTestOpenService();
|
||||
}
|
||||
|
||||
void HdfRtcTest::TearDownTestCase()
|
||||
{
|
||||
HdfTestCloseService();
|
||||
}
|
||||
|
||||
void HdfRtcTest::SetUp()
|
||||
{
|
||||
}
|
||||
|
||||
void HdfRtcTest::TearDown()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: testRtcReadWriteTime001
|
||||
* @tc.desc: rtc function test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000F868I
|
||||
*/
|
||||
HWTEST_F(HdfRtcTest, testRtcReadWriteTime001, TestSize.Level1)
|
||||
{
|
||||
struct HdfTestMsg msg = { TEST_PAL_RTC_TYPE, RTC_TEST_CMD_WR_TIME, -1 };
|
||||
EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: testRtcReadWriteMaxTime001
|
||||
* @tc.desc: rtc function test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000F868I
|
||||
*/
|
||||
HWTEST_F(HdfRtcTest, testRtcReadWriteMaxTime001, TestSize.Level1)
|
||||
{
|
||||
struct HdfTestMsg msg = { TEST_PAL_RTC_TYPE, RTC_TEST_CMD_WR_MAX_TIME, -1 };
|
||||
EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: testRtcReadWriteMinTime001
|
||||
* @tc.desc: rtc function test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000F868I
|
||||
*/
|
||||
HWTEST_F(HdfRtcTest, testRtcReadWriteMinTime001, TestSize.Level1)
|
||||
{
|
||||
struct HdfTestMsg msg = { TEST_PAL_RTC_TYPE, RTC_TEST_CMD_WR_MIN_TIME, -1 };
|
||||
EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: testRtcReadWriteAlarmTime001
|
||||
* @tc.desc: rtc function test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000F868I
|
||||
*/
|
||||
HWTEST_F(HdfRtcTest, testRtcReadWriteAlarmTime001, TestSize.Level1)
|
||||
{
|
||||
struct HdfTestMsg msg = { TEST_PAL_RTC_TYPE, RTC_TEST_CMD_WR_ALARM_TIME, -1 };
|
||||
EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: testRtcReadWriteAlarmMaxTime001
|
||||
* @tc.desc: rtc function test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000F868I
|
||||
*/
|
||||
HWTEST_F(HdfRtcTest, testRtcReadWriteAlarmMaxTime001, TestSize.Level1)
|
||||
{
|
||||
struct HdfTestMsg msg = { TEST_PAL_RTC_TYPE, RTC_TEST_CMD_WR_ALARM_MAX_TIME, -1 };
|
||||
EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
|
||||
}
|
||||
/**
|
||||
* @tc.name: testRtcReadWriteAlarmMinTime001
|
||||
* @tc.desc: rtc function test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000F868I
|
||||
*/
|
||||
HWTEST_F(HdfRtcTest, testRtcReadWriteAlarmMinTime001, TestSize.Level1)
|
||||
{
|
||||
struct HdfTestMsg msg = { TEST_PAL_RTC_TYPE, RTC_TEST_CMD_WR_ALARM_MIN_TIME, -1 };
|
||||
EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
|
||||
}
|
||||
|
||||
#ifndef HDF_LITEOS_TEST
|
||||
/**
|
||||
* @tc.name: testRtcAlarmEnable001
|
||||
* @tc.desc: rtc function test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000F868I
|
||||
*/
|
||||
HWTEST_F(HdfRtcTest, testRtcAlarmEnable001, TestSize.Level1)
|
||||
{
|
||||
struct HdfTestMsg msg = { TEST_PAL_RTC_TYPE, RTC_TEST_CMD_RTC_ALARM_ENABLE, -1 };
|
||||
EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(HDF_LITEOS_TEST)
|
||||
|
||||
/**
|
||||
* @tc.name: testRtcAlarmIrq001
|
||||
* @tc.desc: rtc function test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000EKRKU
|
||||
*/
|
||||
HWTEST_F(HdfRtcTest, testRtcAlarmIrq001, TestSize.Level1)
|
||||
{
|
||||
struct HdfTestMsg msg = { TEST_PAL_RTC_TYPE, RTC_TEST_CMD_RTC_ALARM_IRQ, -1 };
|
||||
EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: testRtcRegCallback001
|
||||
* @tc.desc: rtc function test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000EKRKU
|
||||
*/
|
||||
HWTEST_F(HdfRtcTest, testRtcRegCallback001, TestSize.Level1)
|
||||
{
|
||||
struct HdfTestMsg msg = { TEST_PAL_RTC_TYPE, RTC_TEST_CMD_RTC_REGISTER_CALLBACK, -1 };
|
||||
EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: testRtcRegCallbackNull001
|
||||
* @tc.desc: rtc function test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000EKRKU
|
||||
*/
|
||||
HWTEST_F(HdfRtcTest, testRtcRegCallbackNull001, TestSize.Level1)
|
||||
{
|
||||
struct HdfTestMsg msg = { TEST_PAL_RTC_TYPE, RTC_TEST_CMD_RTC_REGISTER_CALLBACK_NULL, -1 };
|
||||
EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: testRtcFreq001
|
||||
* @tc.desc: rtc function test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000EKRKU
|
||||
*/
|
||||
HWTEST_F(HdfRtcTest, testRtcFreq001, TestSize.Level1)
|
||||
{
|
||||
struct HdfTestMsg msg = { TEST_PAL_RTC_TYPE, RTC_TEST_CMD_RTC_WR_FREQ, -1 };
|
||||
EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: testRtcMaxFreq001
|
||||
* @tc.desc: rtc function test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000EKRKU
|
||||
*/
|
||||
HWTEST_F(HdfRtcTest, testRtcMaxFreq001, TestSize.Level1)
|
||||
{
|
||||
struct HdfTestMsg msg = { TEST_PAL_RTC_TYPE, RTC_TEST_CMD_RTC_WR_MAX_FREQ, -1 };
|
||||
EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: testRtcMinFreq001
|
||||
* @tc.desc: rtc function test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000EKRKU
|
||||
*/
|
||||
HWTEST_F(HdfRtcTest, testRtcMinFreq001, TestSize.Level1)
|
||||
{
|
||||
struct HdfTestMsg msg = { TEST_PAL_RTC_TYPE, RTC_TEST_CMD_RTC_WR_MIN_FREQ, -1 };
|
||||
EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: testRtcUserReg001
|
||||
* @tc.desc: rtc function test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000EKRKU
|
||||
*/
|
||||
HWTEST_F(HdfRtcTest, testRtcUserReg001, TestSize.Level1)
|
||||
{
|
||||
struct HdfTestMsg msg = { TEST_PAL_RTC_TYPE, RTC_TEST_CMD_RTC_WR_USER_REG, -1 };
|
||||
EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: testRtcUserRegMaxIndex001
|
||||
* @tc.desc: rtc function test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000EKRKU
|
||||
*/
|
||||
HWTEST_F(HdfRtcTest, testRtcUserRegMaxIndex001, TestSize.Level1)
|
||||
{
|
||||
struct HdfTestMsg msg = { TEST_PAL_RTC_TYPE, RTC_TEST_CMD_RTC_WR_USER_REG_MAX_INDEX, -1 };
|
||||
EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
|
||||
}
|
||||
#endif
|
||||
/**
|
||||
* @tc.name: testRtcReliability001
|
||||
* @tc.desc: rtc function test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000EKRKU
|
||||
*/
|
||||
HWTEST_F(HdfRtcTest, testRtcReliability001, TestSize.Level1)
|
||||
{
|
||||
struct HdfTestMsg msg = { TEST_PAL_RTC_TYPE, RTC_TEST_CMD_RTC_WR_RELIABILITY, -1 };
|
||||
EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
|
||||
}
|
||||
|
||||
#if defined(HDF_LITEOS_TEST)
|
||||
/**
|
||||
* @tc.name: testRtcModule001
|
||||
* @tc.desc: rtc function test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000EKRKU
|
||||
*/
|
||||
HWTEST_F(HdfRtcTest, testRtcModule001, TestSize.Level1)
|
||||
{
|
||||
struct HdfTestMsg msg = { TEST_PAL_RTC_TYPE, RTC_TEST_CMD_RTC_FUNCTION_TEST, -1 };
|
||||
EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
|
||||
}
|
||||
#endif
|
||||
@@ -1,149 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2021–2022 Beijing OSWare Technology Co., Ltd
|
||||
* This file contains confidential and proprietary information of
|
||||
* OSWare Technology Co., Ltd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <fcntl.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <string>
|
||||
#include <unistd.h>
|
||||
#include "hdf_uhdf_test.h"
|
||||
#include "hdf_io_service_if.h"
|
||||
|
||||
using namespace testing::ext;
|
||||
|
||||
enum SdioTestCmd {
|
||||
SDIO_DISABLE_FUNC_01 = 0,
|
||||
SDIO_ENABLE_FUNC_01,
|
||||
SDIO_SET_BLOCK_SIZE_01,
|
||||
SDIO_INCR_ADDR_READ_AND_WRITE_BYTES_01,
|
||||
SDIO_FIXED_ADDR_READ_AND_WRITE_BYTES_01,
|
||||
SDIO_FUNC0_READ_AND_WRITE_BYTES_01,
|
||||
SDIO_SET_AND_GET_COMMON_INFO_01,
|
||||
};
|
||||
|
||||
class HdfLiteSdioTest : public testing::Test {
|
||||
public:
|
||||
static void SetUpTestCase();
|
||||
static void TearDownTestCase();
|
||||
void SetUp();
|
||||
void TearDown();
|
||||
};
|
||||
|
||||
void HdfLiteSdioTest::SetUpTestCase()
|
||||
{
|
||||
HdfTestOpenService();
|
||||
}
|
||||
|
||||
void HdfLiteSdioTest::TearDownTestCase()
|
||||
{
|
||||
HdfTestCloseService();
|
||||
}
|
||||
|
||||
void HdfLiteSdioTest::SetUp()
|
||||
{
|
||||
}
|
||||
|
||||
void HdfLiteSdioTest::TearDown()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SdioDisableFunc001
|
||||
* @tc.desc: SdioDisableFunc Interface test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000F868B
|
||||
*/
|
||||
HWTEST_F(HdfLiteSdioTest, SdioDisableFunc001, TestSize.Level1)
|
||||
{
|
||||
struct HdfTestMsg msg = {TEST_PAL_SDIO_TYPE, SDIO_DISABLE_FUNC_01, -1};
|
||||
EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SdioEnableFunc001
|
||||
* @tc.desc: SdioEnableFunc Interface test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000F868B
|
||||
*/
|
||||
HWTEST_F(HdfLiteSdioTest, SdioEnableFunc001, TestSize.Level1)
|
||||
{
|
||||
struct HdfTestMsg msg = {TEST_PAL_SDIO_TYPE, SDIO_ENABLE_FUNC_01, -1};
|
||||
EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SdioSetBlockSize001
|
||||
* @tc.desc: SdioSetBlockSize Interface test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000F868B
|
||||
*/
|
||||
HWTEST_F(HdfLiteSdioTest, SdioSetBlockSize001, TestSize.Level1)
|
||||
{
|
||||
struct HdfTestMsg msg = {TEST_PAL_SDIO_TYPE, SDIO_SET_BLOCK_SIZE_01, -1};
|
||||
EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SdioIncrAddrReadAndWriteBytes001
|
||||
* @tc.desc: SdioReadBytes and SdioWriteBytes Interface test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000F868B
|
||||
*/
|
||||
HWTEST_F(HdfLiteSdioTest, SdioIncrAddrReadAndWriteBytes001, TestSize.Level1)
|
||||
{
|
||||
struct HdfTestMsg msg = {TEST_PAL_SDIO_TYPE, SDIO_INCR_ADDR_READ_AND_WRITE_BYTES_01, -1};
|
||||
EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SdioFixedAddrReadAndWriteBytes001
|
||||
* @tc.desc: SdioReadBytesFromFixedAddr and SdioWriteBytesToFixedAddr Interface test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000F868B
|
||||
*/
|
||||
HWTEST_F(HdfLiteSdioTest, SdioFixedAddrReadAndWriteBytes001, TestSize.Level1)
|
||||
{
|
||||
struct HdfTestMsg msg = {TEST_PAL_SDIO_TYPE, SDIO_FIXED_ADDR_READ_AND_WRITE_BYTES_01, -1};
|
||||
EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SdioFunc0ReadAndWriteBytes001
|
||||
* @tc.desc: SdioReadBytesFromFunc0 and SdioWriteBytesToFunc0 Interface test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000F868B
|
||||
*/
|
||||
HWTEST_F(HdfLiteSdioTest, SdioFunc0ReadAndWriteBytes001, TestSize.Level1)
|
||||
{
|
||||
struct HdfTestMsg msg = { TEST_PAL_SDIO_TYPE, SDIO_FUNC0_READ_AND_WRITE_BYTES_01, -1};
|
||||
EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SdioSetAndGetCommonInfo001
|
||||
* @tc.desc: SdioGetCommonInfo and SdioSetCommonInfo Interface test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000F868B
|
||||
*/
|
||||
HWTEST_F(HdfLiteSdioTest, SdioSetAndGetCommonInfo001, TestSize.Level1)
|
||||
{
|
||||
struct HdfTestMsg msg = {TEST_PAL_SDIO_TYPE, SDIO_SET_AND_GET_COMMON_INFO_01, -1};
|
||||
EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
|
||||
}
|
||||
@@ -1,120 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2021–2022 Beijing OSWare Technology Co., Ltd
|
||||
* This file contains confidential and proprietary information of
|
||||
* OSWare Technology Co., Ltd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <fcntl.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <string>
|
||||
#include <unistd.h>
|
||||
#include "hdf_uhdf_test.h"
|
||||
#include "hdf_io_service_if.h"
|
||||
#include "spi_test.h"
|
||||
|
||||
using namespace testing::ext;
|
||||
|
||||
class HdfLiteSpiTest : public testing::Test {
|
||||
public:
|
||||
static void SetUpTestCase();
|
||||
static void TearDownTestCase();
|
||||
void SetUp();
|
||||
void TearDown();
|
||||
};
|
||||
|
||||
void HdfLiteSpiTest::SetUpTestCase()
|
||||
{
|
||||
HdfTestOpenService();
|
||||
}
|
||||
|
||||
void HdfLiteSpiTest::TearDownTestCase()
|
||||
{
|
||||
HdfTestCloseService();
|
||||
}
|
||||
|
||||
void HdfLiteSpiTest::SetUp()
|
||||
{
|
||||
}
|
||||
|
||||
void HdfLiteSpiTest::TearDown()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SpiTransferTest001
|
||||
* @tc.desc: spi function test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: SR000DQ0VO
|
||||
*/
|
||||
HWTEST_F(HdfLiteSpiTest, SpiTransferTest001, TestSize.Level1)
|
||||
{
|
||||
struct HdfTestMsg msg = {TEST_PAL_SPI_TYPE, SPI_TRANSFER_TEST, -1};
|
||||
EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SpiMultiTransferTest001
|
||||
* @tc.desc: spi function test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: SR000DQ0VO
|
||||
*/
|
||||
#ifdef __LITEOS__
|
||||
HWTEST_F(HdfLiteSpiTest, SpiMultiTransferTest001, TestSize.Level1)
|
||||
{
|
||||
struct HdfTestMsg msg = {TEST_PAL_SPI_TYPE, SPI_MULTI_TRANSFER_TEST, -1};
|
||||
EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
|
||||
|
||||
EXPECT_EQ(0, SpiTestExecute(SPI_MULTI_TRANSFER_TEST));
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @tc.name: SpiDmaTransferTest001
|
||||
* @tc.desc: Spi function test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: NA
|
||||
*/
|
||||
HWTEST_F(HdfLiteSpiTest, SpiDmaTransferTest001, TestSize.Level1)
|
||||
{
|
||||
struct HdfTestMsg msg = {TEST_PAL_SPI_TYPE, SPI_DMA_TRANSFER_TEST, -1};
|
||||
EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SpiIntTransferTest001
|
||||
* @tc.desc: Spi function test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: NA
|
||||
*/
|
||||
HWTEST_F(HdfLiteSpiTest, SpiIntTransferTest001, TestSize.Level1)
|
||||
{
|
||||
struct HdfTestMsg msg = {TEST_PAL_SPI_TYPE, SPI_INT_TRANSFER_TEST, -1};
|
||||
EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SpiReliabilityTest001
|
||||
* @tc.desc: spi function test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: SR000DQ0VO
|
||||
*/
|
||||
HWTEST_F(HdfLiteSpiTest, SpiReliabilityTest001, TestSize.Level1)
|
||||
{
|
||||
struct HdfTestMsg msg = {TEST_PAL_SPI_TYPE, SPI_RELIABILITY_TEST, -1};
|
||||
EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
|
||||
}
|
||||
@@ -1,154 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2021–2022 Beijing OSWare Technology Co., Ltd
|
||||
* This file contains confidential and proprietary information of
|
||||
* OSWare Technology Co., Ltd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <fcntl.h>
|
||||
#include <string>
|
||||
#include <unistd.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include "hdf_uhdf_test.h"
|
||||
#include "hdf_io_service_if.h"
|
||||
#include "uart_test.h"
|
||||
|
||||
using namespace testing::ext;
|
||||
|
||||
class HdfLiteUartTest : public testing::Test {
|
||||
public:
|
||||
static void SetUpTestCase();
|
||||
static void TearDownTestCase();
|
||||
void SetUp();
|
||||
void TearDown();
|
||||
};
|
||||
|
||||
void HdfLiteUartTest::SetUpTestCase()
|
||||
{
|
||||
HdfTestOpenService();
|
||||
}
|
||||
|
||||
void HdfLiteUartTest::TearDownTestCase()
|
||||
{
|
||||
HdfTestCloseService();
|
||||
}
|
||||
|
||||
void HdfLiteUartTest::SetUp()
|
||||
{
|
||||
}
|
||||
|
||||
void HdfLiteUartTest::TearDown()
|
||||
{
|
||||
}
|
||||
|
||||
#ifdef HDF_LITEOS_TEST
|
||||
/**
|
||||
* @tc.name: UartSetTransModeTest001
|
||||
* @tc.desc: uart function test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000F8689
|
||||
*/
|
||||
HWTEST_F(HdfLiteUartTest, UartSetTransModeTest001, TestSize.Level1)
|
||||
{
|
||||
struct HdfTestMsg msg = {TEST_PAL_UART_TYPE, UART_TEST_CMD_SET_TRANSMODE, -1};
|
||||
EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @tc.name: UartWriteTest001
|
||||
* @tc.desc: uart function test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000F8689
|
||||
*/
|
||||
HWTEST_F(HdfLiteUartTest, UartWriteTest001, TestSize.Level1)
|
||||
{
|
||||
struct HdfTestMsg msg = {TEST_PAL_UART_TYPE, UART_TEST_CMD_WRITE, -1};
|
||||
EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: UartReadTest001
|
||||
* @tc.desc: uart function test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000F8689
|
||||
*/
|
||||
HWTEST_F(HdfLiteUartTest, UartReadTest001, TestSize.Level1)
|
||||
{
|
||||
struct HdfTestMsg msg = { TEST_PAL_UART_TYPE, UART_TEST_CMD_READ, -1};
|
||||
EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: UartSetBaudTest001
|
||||
* @tc.desc: uart function test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000F8689
|
||||
*/
|
||||
HWTEST_F(HdfLiteUartTest, UartSetBaudTest001, TestSize.Level1)
|
||||
{
|
||||
struct HdfTestMsg msg = {TEST_PAL_UART_TYPE, UART_TEST_CMD_SET_BAUD, -1};
|
||||
EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: UartGetBaudTest001
|
||||
* @tc.desc: uart function test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000F8689
|
||||
*/
|
||||
HWTEST_F(HdfLiteUartTest, UartGetBaudTest001, TestSize.Level1)
|
||||
{
|
||||
struct HdfTestMsg msg = {TEST_PAL_UART_TYPE, UART_TEST_CMD_GET_BAUD, -1};
|
||||
EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: UartSetAttributeTest001
|
||||
* @tc.desc: uart function test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000F8689
|
||||
*/
|
||||
HWTEST_F(HdfLiteUartTest, UartSetAttributeTest001, TestSize.Level1)
|
||||
{
|
||||
struct HdfTestMsg msg = {TEST_PAL_UART_TYPE, UART_TEST_CMD_SET_ATTRIBUTE, -1};
|
||||
EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: UartGetAttributeTest001
|
||||
* @tc.desc: uart function test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000F8689
|
||||
*/
|
||||
HWTEST_F(HdfLiteUartTest, UartGetAttributeTest001, TestSize.Level1)
|
||||
{
|
||||
struct HdfTestMsg msg = {TEST_PAL_UART_TYPE, UART_TEST_CMD_GET_ATTRIBUTE, -1};
|
||||
EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: UartReliabilityTest001
|
||||
* @tc.desc: uart function test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000F8689
|
||||
*/
|
||||
HWTEST_F(HdfLiteUartTest, UartReliabilityTest001, TestSize.Level1)
|
||||
{
|
||||
struct HdfTestMsg msg = {TEST_PAL_UART_TYPE, UART_TEST_CMD_RELIABILITY, -1};
|
||||
EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
|
||||
}
|
||||
@@ -1,105 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2021–2022 Beijing OSWare Technology Co., Ltd
|
||||
* This file contains confidential and proprietary information of
|
||||
* OSWare Technology Co., Ltd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <fcntl.h>
|
||||
#include <string>
|
||||
#include <unistd.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include "hdf_uhdf_test.h"
|
||||
#include "hdf_io_service_if.h"
|
||||
#include "watchdog_test.h"
|
||||
|
||||
using namespace testing::ext;
|
||||
|
||||
class HdfLiteWatchdogTest : public testing::Test {
|
||||
public:
|
||||
static void SetUpTestCase();
|
||||
static void TearDownTestCase();
|
||||
void SetUp();
|
||||
void TearDown();
|
||||
};
|
||||
|
||||
void HdfLiteWatchdogTest::SetUpTestCase()
|
||||
{
|
||||
HdfTestOpenService();
|
||||
}
|
||||
|
||||
void HdfLiteWatchdogTest::TearDownTestCase()
|
||||
{
|
||||
HdfTestCloseService();
|
||||
}
|
||||
|
||||
void HdfLiteWatchdogTest::SetUp()
|
||||
{
|
||||
}
|
||||
|
||||
void HdfLiteWatchdogTest::TearDown()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: HdfLiteWatchdogTestSetGetTimeout001
|
||||
* @tc.desc: watchdog function test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000F868G
|
||||
*/
|
||||
HWTEST_F(HdfLiteWatchdogTest, HdfLiteWatchdogTestSetGetTimeout001, TestSize.Level1)
|
||||
{
|
||||
struct HdfTestMsg msg = {TEST_PAL_WDT_TYPE, WATCHDOG_TEST_SET_GET_TIMEOUT, -1};
|
||||
EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: HdfLiteWatchdogTestStartStop001
|
||||
* @tc.desc: watchdog function test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000F868G
|
||||
*/
|
||||
HWTEST_F(HdfLiteWatchdogTest, HdfLiteWatchdogTestStartStop001, TestSize.Level1)
|
||||
{
|
||||
struct HdfTestMsg msg = {TEST_PAL_WDT_TYPE, WATCHDOG_TEST_START_STOP, -1};
|
||||
EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: HdfLiteWatchdogTestFeed001
|
||||
* @tc.desc: watchdog function test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000F868G
|
||||
*/
|
||||
HWTEST_F(HdfLiteWatchdogTest, HdfLiteWatchdogTestFeed001, TestSize.Level1)
|
||||
{
|
||||
struct HdfTestMsg msg = {TEST_PAL_WDT_TYPE, WATCHDOG_TEST_FEED, -1};
|
||||
EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: HdfLiteWatchdogTestReliability001
|
||||
* @tc.desc: watchdog function test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000F868G
|
||||
*/
|
||||
HWTEST_F(HdfLiteWatchdogTest, HdfLiteWatchdogTestReliability001, TestSize.Level1)
|
||||
{
|
||||
struct HdfTestMsg msg = {TEST_PAL_WDT_TYPE, WATCHDOG_TEST_RELIABILITY, -1};
|
||||
EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
|
||||
}
|
||||
|
||||
@@ -722,33 +722,8 @@ struct AudioPcmHwParams g_PcmParams = {0};
|
||||
#define FORMAT_HW (16385)
|
||||
#define RATE_MULTIPLE (10)
|
||||
#define LOW_SAMPLE_RATES (24000)
|
||||
int Wm8904DaiHwParamsSet(const struct AudioCard *card, const struct AudioPcmHwParams *param)
|
||||
int WM8904GetAif1(int width, unsigned int *aif1)
|
||||
{
|
||||
int fs = 0, width = 0, channel = 0, slots = 0, dir = 0;
|
||||
int ret = 0, i = 0, best = 0, best_val = 0, cur_val = 0, errno = 0;
|
||||
unsigned int aif1 = 0, aif2 = 0, aif3 = 0, clock1 = 0, dac_digital1 = 0;
|
||||
|
||||
errno = memcpy_s(&g_PcmParams, sizeof(struct AudioPcmHwParams), param, sizeof(struct AudioPcmHwParams));
|
||||
if (errno != 0) {
|
||||
WM8904_CODEC_LOG_ERR("Memcpy pcm parameters failed!");
|
||||
}
|
||||
|
||||
fs = param->rate;
|
||||
Frame_To_Bit_Width(param->format, &width);
|
||||
channel = param->channels;
|
||||
slots = 1;
|
||||
|
||||
dir = param->streamType == AUDIO_RENDER_STREAM ? 1 : 0;
|
||||
|
||||
WM8904_Set_Fmt(FORMAT_HW);
|
||||
msleep(SLEEP_TIME_10);
|
||||
WM8904_Set_Sysclk(1, 0);
|
||||
msleep(SLEEP_TIME_10);
|
||||
|
||||
/* What BCLK do we need? */
|
||||
gpwm8904->fs = fs;
|
||||
gpwm8904->bclk = fs * width * channel * slots;
|
||||
|
||||
switch (width) {
|
||||
case BIT_WIDTH_16:
|
||||
break;
|
||||
@@ -764,14 +739,13 @@ int Wm8904DaiHwParamsSet(const struct AudioCard *card, const struct AudioPcmHwPa
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
return HDF_SUCCESS;
|
||||
}
|
||||
|
||||
ret = WM8904_Configure_Clocking();
|
||||
if (ret != 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
void WM8904HwParamsGetClkRate(unsigned int *dac_digital1, unsigned int *aif2, unsigned int *aif3, unsigned int *clock1)
|
||||
{
|
||||
int ret = 0, i = 0, best = 0, best_val = 0, cur_val = 0;
|
||||
/* Select nearest CLK_SYS_RATE */
|
||||
best = 0;
|
||||
best_val = abs((gpwm8904->sysclk_rate / clk_sys_rates[0].ratio) - gpwm8904->fs);
|
||||
for (i = 1; i < ARRAY_SIZE(clk_sys_rates); i++) {
|
||||
cur_val = abs((gpwm8904->sysclk_rate / clk_sys_rates[i].ratio) - gpwm8904->fs);
|
||||
@@ -780,7 +754,7 @@ int Wm8904DaiHwParamsSet(const struct AudioCard *card, const struct AudioPcmHwPa
|
||||
best_val = cur_val;
|
||||
}
|
||||
}
|
||||
clock1 |= (clk_sys_rates[best].clk_sys_rate << WM8904_CLK_SYS_RATE_SHIFT);
|
||||
*clock1 |= (clk_sys_rates[best].clk_sys_rate << WM8904_CLK_SYS_RATE_SHIFT);
|
||||
|
||||
/* SAMPLE_RATE */
|
||||
best = 0;
|
||||
@@ -793,12 +767,12 @@ int Wm8904DaiHwParamsSet(const struct AudioCard *card, const struct AudioPcmHwPa
|
||||
best_val = cur_val;
|
||||
}
|
||||
}
|
||||
WM8904_CODEC_LOG_DEBUG("Selected SAMPLE_RATE of %dHz", sample_rates[best].rate);
|
||||
clock1 |= (sample_rates[best].sample_rate << WM8904_SAMPLE_RATE_SHIFT);
|
||||
WM8904_CODEC_LOG_DEBUG("Selected SAMPLE_RATE of %dHz", sample_rates[best].rate);
|
||||
*clock1 |= (sample_rates[best].sample_rate << WM8904_SAMPLE_RATE_SHIFT);
|
||||
|
||||
/* Enable sloping stopband filter for low sample rates */
|
||||
if (gpwm8904->fs <= LOW_SAMPLE_RATES) {
|
||||
dac_digital1 |= WM8904_DAC_SB_FILT;
|
||||
*dac_digital1 |= WM8904_DAC_SB_FILT;
|
||||
}
|
||||
|
||||
/* BCLK_DIV */
|
||||
@@ -815,9 +789,44 @@ int Wm8904DaiHwParamsSet(const struct AudioCard *card, const struct AudioPcmHwPa
|
||||
}
|
||||
}
|
||||
gpwm8904->bclk = (gpwm8904->sysclk_rate * RATE_MULTIPLE) / bclk_divs[best].div;
|
||||
*aif2 |= bclk_divs[best].bclk_div;
|
||||
*aif3 |= gpwm8904->bclk / gpwm8904->fs;
|
||||
}
|
||||
|
||||
aif2 |= bclk_divs[best].bclk_div;
|
||||
aif3 |= gpwm8904->bclk / gpwm8904->fs;
|
||||
int Wm8904DaiHwParamsSet(const struct AudioCard *card, const struct AudioPcmHwParams *param)
|
||||
{
|
||||
int fs = 0, width = 0, channel = 0, slots = 1, dir = 0, ret = 0, errno = 0;
|
||||
unsigned int aif1 = 0, aif2 = 0, aif3 = 0, clock1 = 0, dac_digital1 = 0;
|
||||
|
||||
errno = memcpy_s(&g_PcmParams, sizeof(struct AudioPcmHwParams), param, sizeof(struct AudioPcmHwParams));
|
||||
if (errno != 0) {
|
||||
WM8904_CODEC_LOG_ERR("Memcpy pcm parameters failed!");
|
||||
}
|
||||
|
||||
fs = param->rate;
|
||||
channel = param->channels;
|
||||
dir = param->streamType == AUDIO_RENDER_STREAM ? 1 : 0;
|
||||
Frame_To_Bit_Width(param->format, &width);
|
||||
|
||||
WM8904_Set_Fmt(FORMAT_HW);
|
||||
msleep(SLEEP_TIME_10);
|
||||
WM8904_Set_Sysclk(1, 0);
|
||||
msleep(SLEEP_TIME_10);
|
||||
|
||||
/* What BCLK do we need? */
|
||||
gpwm8904->fs = fs;
|
||||
gpwm8904->bclk = fs * width * channel * slots;
|
||||
|
||||
ret = WM8904GetAif1(&aif1);
|
||||
if (ret != 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = WM8904_Configure_Clocking();
|
||||
if (ret != 0) {
|
||||
return ret;
|
||||
}
|
||||
WM8904HwParamsGetClkRate(&dac_digital1, &aif2, &aif3, &clock1);
|
||||
|
||||
/* Apply the settings */
|
||||
WM8904RegUpdateBits(g_wm8904_i2c_handle, WM8904_DAC_DIGITAL_1, WM8904_DAC_SB_FILT, dac_digital1, BYTE_NUM);
|
||||
@@ -825,7 +834,7 @@ int Wm8904DaiHwParamsSet(const struct AudioCard *card, const struct AudioPcmHwPa
|
||||
WM8904RegUpdateBits(g_wm8904_i2c_handle, WM8904_AUDIO_INTERFACE_2, WM8904_BCLK_DIV_MASK, aif2, BYTE_NUM);
|
||||
WM8904RegUpdateBits(g_wm8904_i2c_handle, WM8904_AUDIO_INTERFACE_3, WM8904_LRCLK_RATE_MASK, aif3, BYTE_NUM);
|
||||
WM8904RegUpdateBits(g_wm8904_i2c_handle, WM8904_CLOCK_RATES_1,
|
||||
WM8904_SAMPLE_RATE_MASK | WM8904_CLK_SYS_RATE_MASK, clock1, BYTE_NUM);
|
||||
WM8904_SAMPLE_RATE_MASK | WM8904_CLK_SYS_RATE_MASK, clock1, BYTE_NUM);
|
||||
|
||||
/* Update filters for the new settings */
|
||||
WM8904_Set_Retune_Mobile();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -713,27 +713,13 @@ int32_t WalDisconnect(NetDevice *netDev, uint16_t reasonCode)
|
||||
return retVal;
|
||||
}
|
||||
|
||||
struct cfg80211_scan_request g_request;
|
||||
int32_t WalStartScan(NetDevice *netDev, struct WlanScanRequest *scanParam)
|
||||
int32_t WalBuildChannelInfo(struct wiphy* wiphy, struct WlanScanRequest *scanParam,
|
||||
struct cfg80211_scan_request **request)
|
||||
{
|
||||
int32_t loop;
|
||||
int32_t count = 0;
|
||||
int32_t retVal = 0;
|
||||
enum Ieee80211Band band = IEEE80211_BAND_2GHZ;
|
||||
struct ieee80211_channel *chan = NULL;
|
||||
struct wiphy* wiphy = wrap_get_wiphy();
|
||||
|
||||
struct cfg80211_scan_request *request = &g_request;
|
||||
|
||||
if (request == NULL) {
|
||||
HDF_LOGE("%s: calloc request null!\n", __func__);
|
||||
return HDF_FAILURE;
|
||||
}
|
||||
|
||||
// basic info
|
||||
request->wiphy = wiphy;
|
||||
request->wdev = GET_NET_DEV_CFG80211_WIRELESS(netDev);
|
||||
request->n_ssids = scanParam->ssidCount;
|
||||
enum Ieee80211Band band = IEEE80211_BAND_2GHZ;
|
||||
|
||||
// channel info
|
||||
if ((scanParam->freqs == NULL) || (scanParam->freqsCount == 0)) {
|
||||
@@ -747,17 +733,16 @@ int32_t WalStartScan(NetDevice *netDev, struct WlanScanRequest *scanParam)
|
||||
if ((chan->flags & WIFI_CHAN_DISABLED) != 0) {
|
||||
continue;
|
||||
}
|
||||
request->channels[count++] = chan;
|
||||
(*request)->channels[count++] = chan;
|
||||
}
|
||||
} else {
|
||||
for (loop = 0; loop < scanParam->freqsCount; loop++) {
|
||||
chan = GetChannelByFreq(wiphy, (uint16_t)(scanParam->freqs[loop]));
|
||||
if (chan == NULL) {
|
||||
HDF_LOGE("%s: freq not found!freq=%d!\n", __func__, scanParam->freqs[loop]);
|
||||
continue;
|
||||
}
|
||||
|
||||
request->channels[count++] = chan;
|
||||
(*request)->channels[count++] = chan;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -765,11 +750,14 @@ int32_t WalStartScan(NetDevice *netDev, struct WlanScanRequest *scanParam)
|
||||
HDF_LOGE("%s: invalid freq info!\n", __func__);
|
||||
return HDF_FAILURE;
|
||||
}
|
||||
request->n_channels = count;
|
||||
(*request)->n_channels = count;
|
||||
|
||||
// ssid info
|
||||
count = 0;
|
||||
loop = 0;
|
||||
return HDF_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t WalBuildSSidInfo(struct WlanScanRequest *scanParam, struct cfg80211_scan_request **request)
|
||||
{
|
||||
int32_t loop, count = 0, retVal = 0;
|
||||
if (scanParam->ssidCount > WPAS_MAX_SCAN_SSIDS) {
|
||||
HDF_LOGE("%s:unexpected numSsids!numSsids=%u", __func__, scanParam->ssidCount);
|
||||
return HDF_FAILURE;
|
||||
@@ -780,7 +768,7 @@ int32_t WalStartScan(NetDevice *netDev, struct WlanScanRequest *scanParam)
|
||||
return HDF_SUCCESS;
|
||||
}
|
||||
|
||||
request->ssids = (struct cfg80211_ssid *)OsalMemCalloc(scanParam->ssidCount * sizeof(struct cfg80211_ssid));
|
||||
(*request)->ssids = (struct cfg80211_ssid *)OsalMemCalloc(scanParam->ssidCount * sizeof(struct cfg80211_ssid));
|
||||
if (request->ssids == NULL) {
|
||||
HDF_LOGE("%s: calloc request->ssids null", __func__);
|
||||
return HDF_FAILURE;
|
||||
@@ -795,25 +783,53 @@ int32_t WalStartScan(NetDevice *netDev, struct WlanScanRequest *scanParam)
|
||||
continue;
|
||||
}
|
||||
|
||||
request->ssids[count].ssid_len = scanParam->ssids[loop].ssidLen;
|
||||
if (memcpy_s(request->ssids[count].ssid, OAL_IEEE80211_MAX_SSID_LEN, scanParam->ssids[loop].ssid,
|
||||
(*request)->ssids[count].ssid_len = scanParam->ssids[loop].ssidLen;
|
||||
if (memcpy_s((*request)->ssids[count].ssid, OAL_IEEE80211_MAX_SSID_LEN, scanParam->ssids[loop].ssid,
|
||||
scanParam->ssids[loop].ssidLen) != 0) {
|
||||
continue;
|
||||
}
|
||||
count++;
|
||||
}
|
||||
request->n_ssids = count;
|
||||
(*request)->n_ssids = count;
|
||||
|
||||
return HDF_SUCCESS;
|
||||
}
|
||||
|
||||
struct cfg80211_scan_request g_request;
|
||||
int32_t WalStartScan(NetDevice *netDev, struct WlanScanRequest *scanParam)
|
||||
{
|
||||
int32_t loop, count = 0, retVal = 0;
|
||||
enum Ieee80211Band band = IEEE80211_BAND_2GHZ;
|
||||
struct ieee80211_channel *chan = NULL;
|
||||
struct wiphy* wiphy = wrap_get_wiphy();
|
||||
struct cfg80211_scan_request *request = &g_request;
|
||||
|
||||
if (request == NULL) {
|
||||
return HDF_FAILURE;
|
||||
}
|
||||
|
||||
// basic info
|
||||
request->wiphy = wiphy;
|
||||
request->wdev = GET_NET_DEV_CFG80211_WIRELESS(netDev);
|
||||
request->n_ssids = scanParam->ssidCount;
|
||||
|
||||
if (WalBuildChannelInfo(wiphy, scanParam, &request) == HDF_FAILURE) {
|
||||
return HDF_FAILURE;
|
||||
}
|
||||
|
||||
// ssid info
|
||||
if (WalBuildSSidInfo(scanParam, &request) == HDF_FAILURE) {
|
||||
return HDF_FAILURE;
|
||||
}
|
||||
|
||||
// User Ie Info
|
||||
if (scanParam->extraIEsLen > 512) {
|
||||
HDF_LOGE("%s:unexpected extra len!extraIesLen=%d", __func__, scanParam->extraIEsLen);
|
||||
return HDF_FAILURE;
|
||||
}
|
||||
|
||||
if ((scanParam->extraIEs != NULL) && (scanParam->extraIEsLen != 0)) {
|
||||
request->ie = (uint8_t *)OsalMemCalloc(scanParam->extraIEsLen);
|
||||
if (request->ie == NULL) {
|
||||
HDF_LOGE("%s: calloc request->ie null", __func__);
|
||||
if (request->ie != NULL) {
|
||||
OsalMemFree((void*)request->ie);
|
||||
request->ie = NULL;
|
||||
@@ -827,7 +843,6 @@ int32_t WalStartScan(NetDevice *netDev, struct WlanScanRequest *scanParam)
|
||||
|
||||
retVal = (int32_t)wl_cfg80211_ops.scan(wiphy, request);
|
||||
if (retVal < 0) {
|
||||
HDF_LOGE("%s: scan Failed!", __func__);
|
||||
if (request != NULL) {
|
||||
if ((request)->ie != NULL) {
|
||||
OsalMemFree((void*)(request->ie));
|
||||
@@ -840,8 +855,6 @@ int32_t WalStartScan(NetDevice *netDev, struct WlanScanRequest *scanParam)
|
||||
OsalMemFree(request);
|
||||
request = NULL;
|
||||
}
|
||||
} else {
|
||||
HDF_LOGE("%s: scan OK!", __func__);
|
||||
}
|
||||
|
||||
return retVal;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,430 +0,0 @@
|
||||
commit 7a434b62f6103c56ff61a003221fa659a19083ea
|
||||
Author: zhaoxc0502 <zhaoxc0502@thundersoft.com>
|
||||
Date: Wed Jun 1 11:59:43 2022 +0800
|
||||
|
||||
modify kernel init & kernel for imx8m mini
|
||||
|
||||
Change-Id: I76d9482ecef6553e20548fd91fa759b84324d1dd
|
||||
|
||||
diff --git a/init/Kconfig b/init/Kconfig
|
||||
index 2e5b92880..ded631516 100644
|
||||
--- a/init/Kconfig
|
||||
+++ b/init/Kconfig
|
||||
@@ -1779,16 +1779,6 @@ config BPF_JIT_DEFAULT_ON
|
||||
def_bool ARCH_WANT_DEFAULT_BPF_JIT || BPF_JIT_ALWAYS_ON
|
||||
depends on HAVE_EBPF_JIT && BPF_JIT
|
||||
|
||||
-config BPF_UNPRIV_DEFAULT_OFF
|
||||
- bool "Disable unprivileged BPF by default"
|
||||
- depends on BPF_SYSCALL
|
||||
- help
|
||||
- Disables unprivileged BPF by default by setting the corresponding
|
||||
- /proc/sys/kernel/unprivileged_bpf_disabled knob to 2. An admin can
|
||||
- still reenable it by setting it to 0 later on, or permanently
|
||||
- disable it by setting it to 1 (from which no other transition to
|
||||
- 0 is possible anymore).
|
||||
-
|
||||
source "kernel/bpf/preload/Kconfig"
|
||||
|
||||
config USERFAULTFD
|
||||
diff --git a/init/main.c b/init/main.c
|
||||
index 93364d974..d736cc4fe 100644
|
||||
--- a/init/main.c
|
||||
+++ b/init/main.c
|
||||
@@ -98,9 +98,6 @@
|
||||
#include <linux/mem_encrypt.h>
|
||||
#include <linux/kcsan.h>
|
||||
#include <linux/init_syscalls.h>
|
||||
-#ifdef CONFIG_RECLAIM_ACCT
|
||||
-#include <linux/reclaim_acct.h>
|
||||
-#endif
|
||||
|
||||
#include <asm/io.h>
|
||||
#include <asm/bugs.h>
|
||||
@@ -850,6 +847,14 @@ void __init __weak arch_call_rest_init(void)
|
||||
rest_init();
|
||||
}
|
||||
|
||||
+static void __init setup_slient_log(char *command_line)
|
||||
+{
|
||||
+ if( !command_line )
|
||||
+ return ;
|
||||
+ if (strstr(command_line , "quiet")){
|
||||
+ console_silent();
|
||||
+ }
|
||||
+}
|
||||
asmlinkage __visible void __init __no_sanitize_address start_kernel(void)
|
||||
{
|
||||
char *command_line;
|
||||
@@ -875,6 +880,7 @@ asmlinkage __visible void __init __no_sanitize_address start_kernel(void)
|
||||
setup_arch(&command_line);
|
||||
setup_boot_config(command_line);
|
||||
setup_command_line(command_line);
|
||||
+ setup_slient_log(command_line);
|
||||
setup_nr_cpu_ids();
|
||||
setup_per_cpu_areas();
|
||||
smp_prepare_boot_cpu(); /* arch-specific boot-cpu hooks */
|
||||
@@ -1049,9 +1055,6 @@ asmlinkage __visible void __init __no_sanitize_address start_kernel(void)
|
||||
cgroup_init();
|
||||
taskstats_init_early();
|
||||
delayacct_init();
|
||||
-#ifdef CONFIG_RECLAIM_ACCT
|
||||
- reclaimacct_init();
|
||||
-#endif
|
||||
|
||||
poking_init();
|
||||
check_bugs();
|
||||
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
|
||||
index 209e6567c..bb9a9cb1f 100644
|
||||
--- a/kernel/bpf/syscall.c
|
||||
+++ b/kernel/bpf/syscall.c
|
||||
@@ -50,8 +50,7 @@ static DEFINE_SPINLOCK(map_idr_lock);
|
||||
static DEFINE_IDR(link_idr);
|
||||
static DEFINE_SPINLOCK(link_idr_lock);
|
||||
|
||||
-int sysctl_unprivileged_bpf_disabled __read_mostly =
|
||||
- IS_BUILTIN(CONFIG_BPF_UNPRIV_DEFAULT_OFF) ? 2 : 0;
|
||||
+int sysctl_unprivileged_bpf_disabled __read_mostly;
|
||||
|
||||
static const struct bpf_map_ops * const bpf_map_types[] = {
|
||||
#define BPF_PROG_TYPE(_id, _name, prog_ctx_type, kern_ctx_type)
|
||||
diff --git a/kernel/events/core.c b/kernel/events/core.c
|
||||
index 54dad4695..51a8ee5bd 100644
|
||||
--- a/kernel/events/core.c
|
||||
+++ b/kernel/events/core.c
|
||||
@@ -11901,9 +11901,6 @@ SYSCALL_DEFINE5(perf_event_open,
|
||||
* Do not allow to attach to a group in a different task
|
||||
* or CPU context. If we're moving SW events, we'll fix
|
||||
* this up later, so allow that.
|
||||
- *
|
||||
- * Racy, not holding group_leader->ctx->mutex, see comment with
|
||||
- * perf_event_ctx_lock().
|
||||
*/
|
||||
if (!move_group && group_leader->ctx != ctx)
|
||||
goto err_context;
|
||||
@@ -11971,7 +11968,6 @@ SYSCALL_DEFINE5(perf_event_open,
|
||||
} else {
|
||||
perf_event_ctx_unlock(group_leader, gctx);
|
||||
move_group = 0;
|
||||
- goto not_move_group;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11988,17 +11984,7 @@ SYSCALL_DEFINE5(perf_event_open,
|
||||
}
|
||||
} else {
|
||||
mutex_lock(&ctx->mutex);
|
||||
-
|
||||
- /*
|
||||
- * Now that we hold ctx->lock, (re)validate group_leader->ctx == ctx,
|
||||
- * see the group_leader && !move_group test earlier.
|
||||
- */
|
||||
- if (group_leader && group_leader->ctx != ctx) {
|
||||
- err = -EINVAL;
|
||||
- goto err_locked;
|
||||
- }
|
||||
}
|
||||
-not_move_group:
|
||||
|
||||
if (ctx->task == TASK_TOMBSTONE) {
|
||||
err = -ESRCH;
|
||||
diff --git a/kernel/fork.c b/kernel/fork.c
|
||||
index 298c44dc5..be79601c0 100644
|
||||
--- a/kernel/fork.c
|
||||
+++ b/kernel/fork.c
|
||||
@@ -42,7 +42,6 @@
|
||||
#include <linux/mmu_notifier.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/mm.h>
|
||||
-#include <linux/mm_inline.h>
|
||||
#include <linux/vmacache.h>
|
||||
#include <linux/nsproxy.h>
|
||||
#include <linux/capability.h>
|
||||
@@ -97,9 +96,6 @@
|
||||
#include <linux/kasan.h>
|
||||
#include <linux/scs.h>
|
||||
#include <linux/io_uring.h>
|
||||
-#ifdef CONFIG_RECLAIM_ACCT
|
||||
-#include <linux/reclaim_acct.h>
|
||||
-#endif
|
||||
|
||||
#include <asm/pgalloc.h>
|
||||
#include <linux/uaccess.h>
|
||||
@@ -369,14 +365,14 @@ struct vm_area_struct *vm_area_dup(struct vm_area_struct *orig)
|
||||
*new = data_race(*orig);
|
||||
INIT_LIST_HEAD(&new->anon_vma_chain);
|
||||
new->vm_next = new->vm_prev = NULL;
|
||||
- dup_anon_vma_name(orig, new);
|
||||
+ dup_vma_anon_name(orig, new);
|
||||
}
|
||||
return new;
|
||||
}
|
||||
|
||||
void vm_area_free(struct vm_area_struct *vma)
|
||||
{
|
||||
- free_anon_vma_name(vma);
|
||||
+ free_vma_anon_name(vma);
|
||||
kmem_cache_free(vm_area_cachep, vma);
|
||||
}
|
||||
|
||||
@@ -2002,9 +1998,6 @@ static __latent_entropy struct task_struct *copy_process(
|
||||
goto bad_fork_cleanup_count;
|
||||
|
||||
delayacct_tsk_init(p); /* Must remain after dup_task_struct() */
|
||||
-#ifdef CONFIG_RECLAIM_ACCT
|
||||
- reclaimacct_tsk_init(p);
|
||||
-#endif
|
||||
p->flags &= ~(PF_SUPERPRIV | PF_WQ_WORKER | PF_IDLE);
|
||||
p->flags |= PF_FORKNOEXEC;
|
||||
INIT_LIST_HEAD(&p->children);
|
||||
diff --git a/kernel/ptrace.c b/kernel/ptrace.c
|
||||
index d99f73f83..eb4d04cb3 100644
|
||||
--- a/kernel/ptrace.c
|
||||
+++ b/kernel/ptrace.c
|
||||
@@ -370,26 +370,6 @@ bool ptrace_may_access(struct task_struct *task, unsigned int mode)
|
||||
return !err;
|
||||
}
|
||||
|
||||
-static int check_ptrace_options(unsigned long data)
|
||||
-{
|
||||
- if (data & ~(unsigned long)PTRACE_O_MASK)
|
||||
- return -EINVAL;
|
||||
-
|
||||
- if (unlikely(data & PTRACE_O_SUSPEND_SECCOMP)) {
|
||||
- if (!IS_ENABLED(CONFIG_CHECKPOINT_RESTORE) ||
|
||||
- !IS_ENABLED(CONFIG_SECCOMP))
|
||||
- return -EINVAL;
|
||||
-
|
||||
- if (!capable(CAP_SYS_ADMIN))
|
||||
- return -EPERM;
|
||||
-
|
||||
- if (seccomp_mode(¤t->seccomp) != SECCOMP_MODE_DISABLED ||
|
||||
- current->ptrace & PT_SUSPEND_SECCOMP)
|
||||
- return -EPERM;
|
||||
- }
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
static int ptrace_attach(struct task_struct *task, long request,
|
||||
unsigned long addr,
|
||||
unsigned long flags)
|
||||
@@ -401,16 +381,8 @@ static int ptrace_attach(struct task_struct *task, long request,
|
||||
if (seize) {
|
||||
if (addr != 0)
|
||||
goto out;
|
||||
- /*
|
||||
- * This duplicates the check in check_ptrace_options() because
|
||||
- * ptrace_attach() and ptrace_setoptions() have historically
|
||||
- * used different error codes for unknown ptrace options.
|
||||
- */
|
||||
if (flags & ~(unsigned long)PTRACE_O_MASK)
|
||||
goto out;
|
||||
- retval = check_ptrace_options(flags);
|
||||
- if (retval)
|
||||
- return retval;
|
||||
flags = PT_PTRACED | PT_SEIZED | (flags << PT_OPT_FLAG_SHIFT);
|
||||
} else {
|
||||
flags = PT_PTRACED;
|
||||
@@ -683,11 +655,22 @@ int ptrace_writedata(struct task_struct *tsk, char __user *src, unsigned long ds
|
||||
static int ptrace_setoptions(struct task_struct *child, unsigned long data)
|
||||
{
|
||||
unsigned flags;
|
||||
- int ret;
|
||||
|
||||
- ret = check_ptrace_options(data);
|
||||
- if (ret)
|
||||
- return ret;
|
||||
+ if (data & ~(unsigned long)PTRACE_O_MASK)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ if (unlikely(data & PTRACE_O_SUSPEND_SECCOMP)) {
|
||||
+ if (!IS_ENABLED(CONFIG_CHECKPOINT_RESTORE) ||
|
||||
+ !IS_ENABLED(CONFIG_SECCOMP))
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ if (!capable(CAP_SYS_ADMIN))
|
||||
+ return -EPERM;
|
||||
+
|
||||
+ if (seccomp_mode(¤t->seccomp) != SECCOMP_MODE_DISABLED ||
|
||||
+ current->ptrace & PT_SUSPEND_SECCOMP)
|
||||
+ return -EPERM;
|
||||
+ }
|
||||
|
||||
/* Avoid intermediate state when all opts are cleared */
|
||||
flags = child->ptrace;
|
||||
diff --git a/kernel/sched/wait.c b/kernel/sched/wait.c
|
||||
index a55642aa3..21005b980 100644
|
||||
--- a/kernel/sched/wait.c
|
||||
+++ b/kernel/sched/wait.c
|
||||
@@ -223,13 +223,6 @@ void __wake_up_sync(struct wait_queue_head *wq_head, unsigned int mode)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(__wake_up_sync); /* For internal use only */
|
||||
|
||||
-void __wake_up_pollfree(struct wait_queue_head *wq_head)
|
||||
-{
|
||||
- __wake_up(wq_head, TASK_NORMAL, 0, poll_to_key(EPOLLHUP | POLLFREE));
|
||||
- /* POLLFREE must have cleared the queue. */
|
||||
- WARN_ON_ONCE(waitqueue_active(wq_head));
|
||||
-}
|
||||
-
|
||||
/*
|
||||
* Note: we use "set_current_state()" _after_ the wait-queue add,
|
||||
* because we need a memory barrier there on SMP, so that any
|
||||
diff --git a/kernel/sys.c b/kernel/sys.c
|
||||
index c63de7188..ab78ae833 100644
|
||||
--- a/kernel/sys.c
|
||||
+++ b/kernel/sys.c
|
||||
@@ -7,7 +7,6 @@
|
||||
|
||||
#include <linux/export.h>
|
||||
#include <linux/mm.h>
|
||||
-#include <linux/mm_inline.h>
|
||||
#include <linux/utsname.h>
|
||||
#include <linux/mman.h>
|
||||
#include <linux/reboot.h>
|
||||
@@ -2291,16 +2290,15 @@ static int prctl_set_vma(unsigned long opt, unsigned long addr,
|
||||
{
|
||||
struct mm_struct *mm = current->mm;
|
||||
const char __user *uname;
|
||||
- struct anon_vma_name *anon_name = NULL;
|
||||
+ char *name, *pch;
|
||||
int error;
|
||||
|
||||
switch (opt) {
|
||||
case PR_SET_VMA_ANON_NAME:
|
||||
uname = (const char __user *)arg;
|
||||
if (uname) {
|
||||
- char *name, *pch;
|
||||
-
|
||||
name = strndup_user(uname, ANON_VMA_NAME_MAX_LEN);
|
||||
+
|
||||
if (IS_ERR(name))
|
||||
return PTR_ERR(name);
|
||||
|
||||
@@ -2310,18 +2308,15 @@ static int prctl_set_vma(unsigned long opt, unsigned long addr,
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
- /* anon_vma has its own copy */
|
||||
- anon_name = anon_vma_name_alloc(name);
|
||||
- kfree(name);
|
||||
- if (!anon_name)
|
||||
- return -ENOMEM;
|
||||
-
|
||||
+ } else {
|
||||
+ /* Reset the name */
|
||||
+ name = NULL;
|
||||
}
|
||||
|
||||
mmap_write_lock(mm);
|
||||
- error = madvise_set_anon_name(mm, addr, size, anon_name);
|
||||
+ error = madvise_set_anon_name(mm, addr, size, name);
|
||||
mmap_write_unlock(mm);
|
||||
- anon_vma_name_put(anon_name);
|
||||
+ kfree(name);
|
||||
break;
|
||||
default:
|
||||
error = -EINVAL;
|
||||
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
|
||||
index a5be63fcb..e34d69375 100644
|
||||
--- a/kernel/sysctl.c
|
||||
+++ b/kernel/sysctl.c
|
||||
@@ -233,34 +233,7 @@ static int bpf_stats_handler(struct ctl_table *table, int write,
|
||||
mutex_unlock(&bpf_stats_enabled_mutex);
|
||||
return ret;
|
||||
}
|
||||
-
|
||||
-void __weak unpriv_ebpf_notify(int new_state)
|
||||
-{
|
||||
-}
|
||||
-
|
||||
-static int bpf_unpriv_handler(struct ctl_table *table, int write,
|
||||
- void *buffer, size_t *lenp, loff_t *ppos)
|
||||
-{
|
||||
- int ret, unpriv_enable = *(int *)table->data;
|
||||
- bool locked_state = unpriv_enable == 1;
|
||||
- struct ctl_table tmp = *table;
|
||||
-
|
||||
- if (write && !capable(CAP_SYS_ADMIN))
|
||||
- return -EPERM;
|
||||
-
|
||||
- tmp.data = &unpriv_enable;
|
||||
- ret = proc_dointvec_minmax(&tmp, write, buffer, lenp, ppos);
|
||||
- if (write && !ret) {
|
||||
- if (locked_state && unpriv_enable != 1)
|
||||
- return -EPERM;
|
||||
- *(int *)table->data = unpriv_enable;
|
||||
- }
|
||||
-
|
||||
- unpriv_ebpf_notify(unpriv_enable);
|
||||
-
|
||||
- return ret;
|
||||
-}
|
||||
-#endif /* CONFIG_BPF_SYSCALL && CONFIG_SYSCTL */
|
||||
+#endif
|
||||
|
||||
/*
|
||||
* /proc/sys support
|
||||
@@ -2705,9 +2678,10 @@ static struct ctl_table kern_table[] = {
|
||||
.data = &sysctl_unprivileged_bpf_disabled,
|
||||
.maxlen = sizeof(sysctl_unprivileged_bpf_disabled),
|
||||
.mode = 0644,
|
||||
- .proc_handler = bpf_unpriv_handler,
|
||||
- .extra1 = SYSCTL_ZERO,
|
||||
- .extra2 = &two,
|
||||
+ /* only handle a transition from default "0" to "1" */
|
||||
+ .proc_handler = proc_dointvec_minmax,
|
||||
+ .extra1 = SYSCTL_ONE,
|
||||
+ .extra2 = SYSCTL_ONE,
|
||||
},
|
||||
{
|
||||
.procname = "bpf_stats_enabled",
|
||||
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
|
||||
index cc4dc2857..917c0993b 100644
|
||||
--- a/kernel/time/timekeeping.c
|
||||
+++ b/kernel/time/timekeeping.c
|
||||
@@ -1288,6 +1288,22 @@ int get_device_system_crosststamp(int (*get_time_fn)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(get_device_system_crosststamp);
|
||||
|
||||
+/**
|
||||
+ * do_gettimeofday - Returns the time of day in a timeval
|
||||
+ * @tv: pointer to the timeval to be set
|
||||
+ *
|
||||
+ * NOTE: Users should be converted to using getnstimeofday()
|
||||
+ */
|
||||
+void do_gettimeofday(struct old_timeval32 *tv)
|
||||
+{
|
||||
+ struct timespec64 now;
|
||||
+
|
||||
+ ktime_get_real_ts64(&now);
|
||||
+ tv->tv_sec = now.tv_sec;
|
||||
+ tv->tv_usec = now.tv_nsec/1000;
|
||||
+}
|
||||
+EXPORT_SYMBOL(do_gettimeofday);
|
||||
+
|
||||
/**
|
||||
* do_settimeofday64 - Sets the time of day.
|
||||
* @ts: pointer to the timespec64 variable containing the new time
|
||||
diff --git a/kernel/watch_queue.c b/kernel/watch_queue.c
|
||||
index 0defb921d..0ef8f65bd 100644
|
||||
--- a/kernel/watch_queue.c
|
||||
+++ b/kernel/watch_queue.c
|
||||
@@ -320,7 +320,7 @@ long watch_queue_set_filter(struct pipe_inode_info *pipe,
|
||||
tf[i].info_mask & WATCH_INFO_LENGTH)
|
||||
goto err_filter;
|
||||
/* Ignore any unknown types */
|
||||
- if (tf[i].type >= WATCH_TYPE__NR)
|
||||
+ if (tf[i].type >= sizeof(wfilter->type_filter) * 8)
|
||||
continue;
|
||||
nr_filter++;
|
||||
}
|
||||
@@ -336,7 +336,7 @@ long watch_queue_set_filter(struct pipe_inode_info *pipe,
|
||||
|
||||
q = wfilter->filters;
|
||||
for (i = 0; i < filter.nr_filters; i++) {
|
||||
- if (tf[i].type >= WATCH_TYPE__NR)
|
||||
+ if (tf[i].type >= sizeof(wfilter->type_filter) * BITS_PER_LONG)
|
||||
continue;
|
||||
|
||||
q->type = tf[i].type;
|
||||
@@ -1,814 +0,0 @@
|
||||
commit 4ed3a676c54a61ca6e9dffadc36e89937306d7ac
|
||||
Author: zhaoxc0502 <zhaoxc0502@thundersoft.com>
|
||||
Date: Wed Jun 1 12:00:16 2022 +0800
|
||||
|
||||
modify kernel mm for imx8m mini
|
||||
|
||||
Change-Id: I69127927a5e3d5b9e4990bbf487e6aec203d6b24
|
||||
|
||||
diff --git a/mm/Kconfig b/mm/Kconfig
|
||||
index c35f9f8a0..df9bf9f4a 100644
|
||||
--- a/mm/Kconfig
|
||||
+++ b/mm/Kconfig
|
||||
@@ -90,18 +90,6 @@ config HYPERHOLD_ZSWAPD
|
||||
and the refault of anonymous pages is high, the content of
|
||||
zram will exchanged to eswap by a certain percentage.
|
||||
|
||||
-config PAGE_TRACING
|
||||
- bool "Enable Page Tracing"
|
||||
- default n
|
||||
- help
|
||||
- This option enables page tracing.
|
||||
-
|
||||
-config RECLAIM_ACCT
|
||||
- bool "Memory reclaim delay accounting"
|
||||
- default n
|
||||
- help
|
||||
- Memory reclaim delay accounting. Never use it as a kernel module.
|
||||
-
|
||||
config DISCONTIGMEM
|
||||
def_bool y
|
||||
depends on (!SELECT_MEMORY_MODEL && ARCH_DISCONTIGMEM_ENABLE) || DISCONTIGMEM_MANUAL
|
||||
@@ -924,28 +912,5 @@ config ANON_VMA_NAME
|
||||
Assigning a name to anonymous virtual memory area might prevent that
|
||||
area from being merged with adjacent virtual memory areas due to the
|
||||
difference in their name.
|
||||
-#
|
||||
-# For lmkd to trigger in-kernel lowmem info
|
||||
-#
|
||||
-config LOWMEM
|
||||
- bool "Low Memory Killer"
|
||||
- default n
|
||||
- help
|
||||
- Enables lowmem killer parameter tuning
|
||||
-
|
||||
-config LMKD_DBG
|
||||
- bool "Low Memory Killer Debug"
|
||||
- default n
|
||||
- help
|
||||
- print processes info when lmk happen per several seconds
|
||||
-#
|
||||
-# Show the process ashmem for debug
|
||||
-#
|
||||
-config MEMTRACE_ASHMEM
|
||||
- bool "Ashmem Process Info Show"
|
||||
- depends on ASHMEM
|
||||
- default n
|
||||
- help
|
||||
- Enable the Ashmem Process Info Show
|
||||
|
||||
endmenu
|
||||
diff --git a/mm/Makefile b/mm/Makefile
|
||||
index 4c0ca82c4..56abb804c 100644
|
||||
--- a/mm/Makefile
|
||||
+++ b/mm/Makefile
|
||||
@@ -66,9 +66,6 @@ ifdef CONFIG_MMU
|
||||
obj-$(CONFIG_ADVISE_SYSCALLS) += madvise.o
|
||||
endif
|
||||
|
||||
-obj-$(CONFIG_MEMTRACE_ASHMEM) += memtrace_ashmem.o
|
||||
-obj-$(CONFIG_LMKD_DBG) += lmkd_dbg_trigger.o
|
||||
-obj-$(CONFIG_LOWMEM) += lowmem_dbg.o
|
||||
obj-$(CONFIG_SWAP) += page_io.o swap_state.o swapfile.o swap_slots.o
|
||||
obj-$(CONFIG_FRONTSWAP) += frontswap.o
|
||||
obj-$(CONFIG_ZSWAP) += zswap.o
|
||||
@@ -126,4 +123,3 @@ obj-$(CONFIG_PAGE_REPORTING) += page_reporting.o
|
||||
obj-$(CONFIG_HYPERHOLD_FILE_LRU) += memcg_reclaim.o
|
||||
obj-$(CONFIG_HYPERHOLD_MEMCG) += memcg_control.o
|
||||
obj-$(CONFIG_HYPERHOLD_ZSWAPD) += zswapd.o zswapd_control.o
|
||||
-obj-$(CONFIG_RECLAIM_ACCT) += reclaim_acct.o reclaimacct_show.o
|
||||
diff --git a/mm/debug.c b/mm/debug.c
|
||||
index e97a23eba..ccca576b2 100644
|
||||
--- a/mm/debug.c
|
||||
+++ b/mm/debug.c
|
||||
@@ -29,10 +29,6 @@ const char *migrate_reason_names[MR_TYPES] = {
|
||||
|
||||
const struct trace_print_flags pageflag_names[] = {
|
||||
__def_pageflag_names,
|
||||
-#ifdef CONFIG_PAGE_TRACING
|
||||
- {1UL << PG_skb, "skb"},
|
||||
- {1UL << PG_zspage, "zspage"},
|
||||
-#endif
|
||||
{0, NULL}
|
||||
};
|
||||
|
||||
diff --git a/mm/internal.h b/mm/internal.h
|
||||
index 708a18c63..ccdee4a03 100644
|
||||
--- a/mm/internal.h
|
||||
+++ b/mm/internal.h
|
||||
@@ -13,8 +13,6 @@
|
||||
#include <linux/tracepoint-defs.h>
|
||||
#include <linux/swap.h>
|
||||
#include <linux/rmap.h>
|
||||
-#include <linux/types.h>
|
||||
-#include <linux/reclaim_acct.h>
|
||||
|
||||
/*
|
||||
* The set of flags that only affect watermark checking and reclaim
|
||||
@@ -773,26 +771,4 @@ struct migration_target_control {
|
||||
gfp_t gfp_mask;
|
||||
};
|
||||
|
||||
-#define DELAY_LV0 5000000 /* 5ms */
|
||||
-#define DELAY_LV1 10000000 /* 10ms */
|
||||
-#define DELAY_LV2 50000000 /* 50ms */
|
||||
-#define DELAY_LV3 100000000 /* 100ms */
|
||||
-#define DELAY_LV4 2000000000 /* 2000ms */
|
||||
-#define DELAY_LV5 50000000000 /* 50000ms */
|
||||
-#define NR_DELAY_LV 6
|
||||
-
|
||||
-struct reclaim_acct {
|
||||
- u64 start[NR_RA_STUBS];
|
||||
- u64 delay[NR_RA_STUBS];
|
||||
- u64 count[NR_RA_STUBS];
|
||||
- u64 freed[NR_RA_STUBS];
|
||||
- unsigned int reclaim_type;
|
||||
-};
|
||||
-
|
||||
-bool reclaimacct_initialize_show_data(void);
|
||||
-void reclaimacct_destroy_show_data(void);
|
||||
-
|
||||
-void reclaimacct_collect_data(void);
|
||||
-void reclaimacct_collect_reclaim_efficiency(void);
|
||||
-
|
||||
#endif /* __MM_INTERNAL_H */
|
||||
diff --git a/mm/ioremap.c b/mm/ioremap.c
|
||||
index 5fa1ab41d..d63c4ba06 100644
|
||||
--- a/mm/ioremap.c
|
||||
+++ b/mm/ioremap.c
|
||||
@@ -248,6 +248,7 @@ int ioremap_page_range(unsigned long addr,
|
||||
|
||||
return err;
|
||||
}
|
||||
+EXPORT_SYMBOL_GPL(ioremap_page_range);
|
||||
|
||||
#ifdef CONFIG_GENERIC_IOREMAP
|
||||
void __iomem *ioremap_prot(phys_addr_t addr, size_t size, unsigned long prot)
|
||||
diff --git a/mm/madvise.c b/mm/madvise.c
|
||||
index b23f6155a..23b48a004 100644
|
||||
--- a/mm/madvise.c
|
||||
+++ b/mm/madvise.c
|
||||
@@ -18,7 +18,6 @@
|
||||
#include <linux/fadvise.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/sched/mm.h>
|
||||
-#include <linux/mm_inline.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/uio.h>
|
||||
#include <linux/ksm.h>
|
||||
@@ -63,7 +62,7 @@ static int madvise_need_mmap_write(int behavior)
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ANON_VMA_NAME
|
||||
-struct anon_vma_name *anon_vma_name_alloc(const char *name)
|
||||
+static struct anon_vma_name *anon_vma_name_alloc(const char *name)
|
||||
{
|
||||
struct anon_vma_name *anon_name;
|
||||
size_t count;
|
||||
@@ -79,48 +78,78 @@ struct anon_vma_name *anon_vma_name_alloc(const char *name)
|
||||
return anon_name;
|
||||
}
|
||||
|
||||
-void anon_vma_name_free(struct kref *kref)
|
||||
+static void vma_anon_name_free(struct kref *kref)
|
||||
{
|
||||
struct anon_vma_name *anon_name =
|
||||
container_of(kref, struct anon_vma_name, kref);
|
||||
kfree(anon_name);
|
||||
}
|
||||
|
||||
-struct anon_vma_name *anon_vma_name(struct vm_area_struct *vma)
|
||||
+static inline bool has_vma_anon_name(struct vm_area_struct *vma)
|
||||
{
|
||||
- mmap_assert_locked(vma->vm_mm);
|
||||
+ return !vma->vm_file && vma->anon_name;
|
||||
+}
|
||||
|
||||
- if (vma->vm_file)
|
||||
+const char *vma_anon_name(struct vm_area_struct *vma)
|
||||
+{
|
||||
+ if (!has_vma_anon_name(vma))
|
||||
return NULL;
|
||||
|
||||
- return vma->anon_name;
|
||||
+ mmap_assert_locked(vma->vm_mm);
|
||||
+
|
||||
+ return vma->anon_name->name;
|
||||
+}
|
||||
+
|
||||
+void dup_vma_anon_name(struct vm_area_struct *orig_vma,
|
||||
+ struct vm_area_struct *new_vma)
|
||||
+{
|
||||
+ if (!has_vma_anon_name(orig_vma))
|
||||
+ return;
|
||||
+
|
||||
+ kref_get(&orig_vma->anon_name->kref);
|
||||
+ new_vma->anon_name = orig_vma->anon_name;
|
||||
+}
|
||||
+
|
||||
+void free_vma_anon_name(struct vm_area_struct *vma)
|
||||
+{
|
||||
+ struct anon_vma_name *anon_name;
|
||||
+
|
||||
+ if (!has_vma_anon_name(vma))
|
||||
+ return;
|
||||
+
|
||||
+ anon_name = vma->anon_name;
|
||||
+ vma->anon_name = NULL;
|
||||
+ kref_put(&anon_name->kref, vma_anon_name_free);
|
||||
}
|
||||
|
||||
/* mmap_lock should be write-locked */
|
||||
-static int replace_anon_vma_name(struct vm_area_struct *vma,
|
||||
- struct anon_vma_name *anon_name)
|
||||
+static int replace_vma_anon_name(struct vm_area_struct *vma, const char *name)
|
||||
{
|
||||
- struct anon_vma_name *orig_name = anon_vma_name(vma);
|
||||
+ const char *anon_name;
|
||||
|
||||
- if (!anon_name) {
|
||||
- vma->anon_name = NULL;
|
||||
- anon_vma_name_put(orig_name);
|
||||
+ if (!name) {
|
||||
+ free_vma_anon_name(vma);
|
||||
return 0;
|
||||
}
|
||||
|
||||
- if (anon_vma_name_eq(orig_name, anon_name))
|
||||
- return 0;
|
||||
+ anon_name = vma_anon_name(vma);
|
||||
+ if (anon_name) {
|
||||
+ /* Same name, nothing to do here */
|
||||
+ if (!strcmp(name, anon_name))
|
||||
+ return 0;
|
||||
|
||||
- vma->anon_name = anon_vma_name_reuse(anon_name);
|
||||
- anon_vma_name_put(orig_name);
|
||||
+ free_vma_anon_name(vma);
|
||||
+ }
|
||||
+ vma->anon_name = anon_vma_name_alloc(name);
|
||||
+ if (!vma->anon_name)
|
||||
+ return -ENOMEM;
|
||||
|
||||
return 0;
|
||||
}
|
||||
#else /* CONFIG_ANON_VMA_NAME */
|
||||
-static int replace_anon_vma_name(struct vm_area_struct *vma,
|
||||
- struct anon_vma_name *anon_name)
|
||||
+static int replace_vma_anon_name(struct vm_area_struct *vma, const char *name)
|
||||
{
|
||||
- if (anon_name)
|
||||
+ if (name)
|
||||
return -EINVAL;
|
||||
|
||||
return 0;
|
||||
@@ -129,19 +158,17 @@ static int replace_anon_vma_name(struct vm_area_struct *vma,
|
||||
/*
|
||||
* Update the vm_flags on region of a vma, splitting it or merging it as
|
||||
* necessary. Must be called with mmap_sem held for writing;
|
||||
- * Caller should ensure anon_name stability by raising its refcount even when
|
||||
- * anon_name belongs to a valid vma because this function might free that vma.
|
||||
*/
|
||||
static int madvise_update_vma(struct vm_area_struct *vma,
|
||||
struct vm_area_struct **prev, unsigned long start,
|
||||
unsigned long end, unsigned long new_flags,
|
||||
- struct anon_vma_name *anon_name)
|
||||
+ const char *name)
|
||||
{
|
||||
struct mm_struct *mm = vma->vm_mm;
|
||||
int error;
|
||||
pgoff_t pgoff;
|
||||
|
||||
- if (new_flags == vma->vm_flags && anon_vma_name_eq(anon_vma_name(vma), anon_name)) {
|
||||
+ if (new_flags == vma->vm_flags && is_same_vma_anon_name(vma, name)) {
|
||||
*prev = vma;
|
||||
return 0;
|
||||
}
|
||||
@@ -149,7 +176,7 @@ static int madvise_update_vma(struct vm_area_struct *vma,
|
||||
pgoff = vma->vm_pgoff + ((start - vma->vm_start) >> PAGE_SHIFT);
|
||||
*prev = vma_merge(mm, *prev, start, end, new_flags, vma->anon_vma,
|
||||
vma->vm_file, pgoff, vma_policy(vma),
|
||||
- vma->vm_userfaultfd_ctx, anon_name);
|
||||
+ vma->vm_userfaultfd_ctx, name);
|
||||
if (*prev) {
|
||||
vma = *prev;
|
||||
goto success;
|
||||
@@ -179,7 +206,7 @@ static int madvise_update_vma(struct vm_area_struct *vma,
|
||||
*/
|
||||
vma->vm_flags = new_flags;
|
||||
if (!vma->vm_file) {
|
||||
- error = replace_anon_vma_name(vma, anon_name);
|
||||
+ error = replace_vma_anon_name(vma, name);
|
||||
if (error)
|
||||
return error;
|
||||
}
|
||||
@@ -887,7 +914,6 @@ static int madvise_vma_behavior(struct vm_area_struct *vma,
|
||||
unsigned long behavior)
|
||||
{
|
||||
int error;
|
||||
- struct anon_vma_name *anon_name;
|
||||
unsigned long new_flags = vma->vm_flags;
|
||||
|
||||
switch (behavior) {
|
||||
@@ -950,11 +976,8 @@ static int madvise_vma_behavior(struct vm_area_struct *vma,
|
||||
break;
|
||||
}
|
||||
|
||||
- anon_name = anon_vma_name(vma);
|
||||
- anon_vma_name_get(anon_name);
|
||||
error = madvise_update_vma(vma, prev, start, end, new_flags,
|
||||
- anon_name);
|
||||
- anon_vma_name_put(anon_name);
|
||||
+ vma_anon_name(vma));
|
||||
|
||||
out:
|
||||
/*
|
||||
@@ -1140,7 +1163,7 @@ int madvise_walk_vmas(struct mm_struct *mm, unsigned long start,
|
||||
static int madvise_vma_anon_name(struct vm_area_struct *vma,
|
||||
struct vm_area_struct **prev,
|
||||
unsigned long start, unsigned long end,
|
||||
- unsigned long anon_name)
|
||||
+ unsigned long name)
|
||||
{
|
||||
int error;
|
||||
|
||||
@@ -1149,7 +1172,7 @@ static int madvise_vma_anon_name(struct vm_area_struct *vma,
|
||||
return -EBADF;
|
||||
|
||||
error = madvise_update_vma(vma, prev, start, end, vma->vm_flags,
|
||||
- (struct anon_vma_name *)anon_name);
|
||||
+ (const char *)name);
|
||||
|
||||
/*
|
||||
* madvise() returns EAGAIN if kernel resources, such as
|
||||
@@ -1161,7 +1184,7 @@ static int madvise_vma_anon_name(struct vm_area_struct *vma,
|
||||
}
|
||||
|
||||
int madvise_set_anon_name(struct mm_struct *mm, unsigned long start,
|
||||
- unsigned long len_in, struct anon_vma_name *anon_name)
|
||||
+ unsigned long len_in, const char *name)
|
||||
{
|
||||
unsigned long end;
|
||||
unsigned long len;
|
||||
@@ -1181,7 +1204,7 @@ int madvise_set_anon_name(struct mm_struct *mm, unsigned long start,
|
||||
if (end == start)
|
||||
return 0;
|
||||
|
||||
- return madvise_walk_vmas(mm, start, end, (unsigned long)anon_name,
|
||||
+ return madvise_walk_vmas(mm, start, end, (unsigned long)name,
|
||||
madvise_vma_anon_name);
|
||||
}
|
||||
#endif /* CONFIG_ANON_VMA_NAME */
|
||||
diff --git a/mm/memcg_control.c b/mm/memcg_control.c
|
||||
index 07fc597db..dd62304a9 100644
|
||||
--- a/mm/memcg_control.c
|
||||
+++ b/mm/memcg_control.c
|
||||
@@ -218,9 +218,6 @@ unsigned long reclaim_all_anon_memcg(struct pglist_data *pgdat, struct mem_cgrou
|
||||
.may_swap = 1,
|
||||
};
|
||||
|
||||
-#ifdef CONFIG_RECLAIM_ACCT
|
||||
- reclaimacct_substage_start(RA_SHRINKANON);
|
||||
-#endif
|
||||
count_vm_event(FREEZE_RECLAIME_COUNT);
|
||||
move_pages_to_page_list(lruvec, LRU_INACTIVE_ANON, &page_list);
|
||||
|
||||
@@ -233,10 +230,6 @@ unsigned long reclaim_all_anon_memcg(struct pglist_data *pgdat, struct mem_cgrou
|
||||
putback_lru_page(page);
|
||||
}
|
||||
|
||||
-#ifdef CONFIG_RECLAIM_ACCT
|
||||
- reclaimacct_substage_end(RA_SHRINKANON, nr_reclaimed, NULL);
|
||||
-#endif
|
||||
-
|
||||
return nr_reclaimed;
|
||||
}
|
||||
|
||||
diff --git a/mm/memcg_reclaim.c b/mm/memcg_reclaim.c
|
||||
index 9f879a385..74c3d4dfa 100644
|
||||
--- a/mm/memcg_reclaim.c
|
||||
+++ b/mm/memcg_reclaim.c
|
||||
@@ -217,9 +217,6 @@ void shrink_anon_memcg(struct pglist_data *pgdat,
|
||||
|
||||
static inline bool memcg_is_child_of(struct mem_cgroup *mcg, struct mem_cgroup *tmcg)
|
||||
{
|
||||
- if (tmcg == NULL)
|
||||
- return true;
|
||||
-
|
||||
while (!mem_cgroup_is_root(mcg)) {
|
||||
if (mcg == tmcg)
|
||||
break;
|
||||
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
|
||||
index 46efcd21d..35e323d60 100644
|
||||
--- a/mm/mempolicy.c
|
||||
+++ b/mm/mempolicy.c
|
||||
@@ -830,7 +830,7 @@ static int mbind_range(struct mm_struct *mm, unsigned long start,
|
||||
prev = vma_merge(mm, prev, vmstart, vmend, vma->vm_flags,
|
||||
vma->anon_vma, vma->vm_file, pgoff,
|
||||
new_pol, vma->vm_userfaultfd_ctx,
|
||||
- anon_vma_name(vma));
|
||||
+ vma_anon_name(vma));
|
||||
if (prev) {
|
||||
vma = prev;
|
||||
next = vma->vm_next;
|
||||
diff --git a/mm/mlock.c b/mm/mlock.c
|
||||
index 7080803ef..08b4f44ef 100644
|
||||
--- a/mm/mlock.c
|
||||
+++ b/mm/mlock.c
|
||||
@@ -540,7 +540,7 @@ static int mlock_fixup(struct vm_area_struct *vma, struct vm_area_struct **prev,
|
||||
pgoff = vma->vm_pgoff + ((start - vma->vm_start) >> PAGE_SHIFT);
|
||||
*prev = vma_merge(mm, *prev, start, end, newflags, vma->anon_vma,
|
||||
vma->vm_file, pgoff, vma_policy(vma),
|
||||
- vma->vm_userfaultfd_ctx, anon_vma_name(vma));
|
||||
+ vma->vm_userfaultfd_ctx, vma_anon_name(vma));
|
||||
if (*prev) {
|
||||
vma = *prev;
|
||||
goto success;
|
||||
diff --git a/mm/mmap.c b/mm/mmap.c
|
||||
index a5e0958ac..1f13b3069 100644
|
||||
--- a/mm/mmap.c
|
||||
+++ b/mm/mmap.c
|
||||
@@ -13,7 +13,6 @@
|
||||
#include <linux/slab.h>
|
||||
#include <linux/backing-dev.h>
|
||||
#include <linux/mm.h>
|
||||
-#include <linux/mm_inline.h>
|
||||
#include <linux/vmacache.h>
|
||||
#include <linux/shm.h>
|
||||
#include <linux/mman.h>
|
||||
@@ -1030,7 +1029,7 @@ int __vma_adjust(struct vm_area_struct *vma, unsigned long start,
|
||||
static inline int is_mergeable_vma(struct vm_area_struct *vma,
|
||||
struct file *file, unsigned long vm_flags,
|
||||
struct vm_userfaultfd_ctx vm_userfaultfd_ctx,
|
||||
- struct anon_vma_name *anon_name)
|
||||
+ const char *anon_name)
|
||||
{
|
||||
/*
|
||||
* VM_SOFTDIRTY should not prevent from VMA merging, if we
|
||||
@@ -1048,7 +1047,7 @@ static inline int is_mergeable_vma(struct vm_area_struct *vma,
|
||||
return 0;
|
||||
if (!is_mergeable_vm_userfaultfd_ctx(vma, vm_userfaultfd_ctx))
|
||||
return 0;
|
||||
- if (!anon_vma_name_eq(anon_vma_name(vma), anon_name))
|
||||
+ if (!is_same_vma_anon_name(vma, anon_name))
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
@@ -1083,7 +1082,7 @@ can_vma_merge_before(struct vm_area_struct *vma, unsigned long vm_flags,
|
||||
struct anon_vma *anon_vma, struct file *file,
|
||||
pgoff_t vm_pgoff,
|
||||
struct vm_userfaultfd_ctx vm_userfaultfd_ctx,
|
||||
- struct anon_vma_name *anon_name)
|
||||
+ const char *anon_name)
|
||||
{
|
||||
if (is_mergeable_vma(vma, file, vm_flags, vm_userfaultfd_ctx, anon_name) &&
|
||||
is_mergeable_anon_vma(anon_vma, vma->anon_vma, vma)) {
|
||||
@@ -1105,7 +1104,7 @@ can_vma_merge_after(struct vm_area_struct *vma, unsigned long vm_flags,
|
||||
struct anon_vma *anon_vma, struct file *file,
|
||||
pgoff_t vm_pgoff,
|
||||
struct vm_userfaultfd_ctx vm_userfaultfd_ctx,
|
||||
- struct anon_vma_name *anon_name)
|
||||
+ const char *anon_name)
|
||||
{
|
||||
if (is_mergeable_vma(vma, file, vm_flags, vm_userfaultfd_ctx, anon_name) &&
|
||||
is_mergeable_anon_vma(anon_vma, vma->anon_vma, vma)) {
|
||||
@@ -1166,7 +1165,7 @@ struct vm_area_struct *vma_merge(struct mm_struct *mm,
|
||||
struct anon_vma *anon_vma, struct file *file,
|
||||
pgoff_t pgoff, struct mempolicy *policy,
|
||||
struct vm_userfaultfd_ctx vm_userfaultfd_ctx,
|
||||
- struct anon_vma_name *anon_name)
|
||||
+ const char *anon_name)
|
||||
{
|
||||
pgoff_t pglen = (end - addr) >> PAGE_SHIFT;
|
||||
struct vm_area_struct *area, *next;
|
||||
@@ -3306,7 +3305,7 @@ struct vm_area_struct *copy_vma(struct vm_area_struct **vmap,
|
||||
return NULL; /* should never get here */
|
||||
new_vma = vma_merge(mm, prev, addr, addr + len, vma->vm_flags,
|
||||
vma->anon_vma, vma->vm_file, pgoff, vma_policy(vma),
|
||||
- vma->vm_userfaultfd_ctx, anon_vma_name(vma));
|
||||
+ vma->vm_userfaultfd_ctx, vma_anon_name(vma));
|
||||
if (new_vma) {
|
||||
/*
|
||||
* Source vma may have been merged into new_vma
|
||||
diff --git a/mm/mprotect.c b/mm/mprotect.c
|
||||
index 53b6b1b8f..8f7dda857 100644
|
||||
--- a/mm/mprotect.c
|
||||
+++ b/mm/mprotect.c
|
||||
@@ -454,7 +454,7 @@ mprotect_fixup(struct vm_area_struct *vma, struct vm_area_struct **pprev,
|
||||
pgoff = vma->vm_pgoff + ((start - vma->vm_start) >> PAGE_SHIFT);
|
||||
*pprev = vma_merge(mm, *pprev, start, end, newflags,
|
||||
vma->anon_vma, vma->vm_file, pgoff, vma_policy(vma),
|
||||
- vma->vm_userfaultfd_ctx, anon_vma_name(vma));
|
||||
+ vma->vm_userfaultfd_ctx, vma_anon_name(vma));
|
||||
if (*pprev) {
|
||||
vma = *pprev;
|
||||
VM_WARN_ON((vma->vm_flags ^ newflags) & ~VM_SOFTDIRTY);
|
||||
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
|
||||
index 125e8f9f9..15d25006c 100644
|
||||
--- a/mm/page_alloc.c
|
||||
+++ b/mm/page_alloc.c
|
||||
@@ -71,9 +71,6 @@
|
||||
#include <linux/padata.h>
|
||||
#include <linux/khugepaged.h>
|
||||
#include <linux/zswapd.h>
|
||||
-#ifdef CONFIG_RECLAIM_ACCT
|
||||
-#include <linux/reclaim_acct.h>
|
||||
-#endif
|
||||
|
||||
#include <asm/sections.h>
|
||||
#include <asm/tlbflush.h>
|
||||
@@ -4399,13 +4396,7 @@ __alloc_pages_direct_reclaim(gfp_t gfp_mask, unsigned int order,
|
||||
*/
|
||||
if (!page && !drained) {
|
||||
unreserve_highatomic_pageblock(ac, false);
|
||||
-#ifdef CONFIG_RECLAIM_ACCT
|
||||
- reclaimacct_substage_start(RA_DRAINALLPAGES);
|
||||
-#endif
|
||||
drain_all_pages(NULL);
|
||||
-#ifdef CONFIG_RECLAIM_ACCT
|
||||
- reclaimacct_substage_end(RA_DRAINALLPAGES, 0, NULL);
|
||||
-#endif
|
||||
drained = true;
|
||||
goto retry;
|
||||
}
|
||||
@@ -4662,7 +4653,6 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
|
||||
int no_progress_loops;
|
||||
unsigned int cpuset_mems_cookie;
|
||||
int reserve_flags;
|
||||
- struct reclaim_acct ra = {0};
|
||||
|
||||
/*
|
||||
* We also sanity check to catch abuse of atomic reserves being used by
|
||||
@@ -4796,14 +4786,8 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
|
||||
goto nopage;
|
||||
|
||||
/* Try direct reclaim and then allocating */
|
||||
-#ifdef CONFIG_RECLAIM_ACCT
|
||||
- reclaimacct_start(DIRECT_RECLAIMS, &ra);
|
||||
-#endif
|
||||
page = __alloc_pages_direct_reclaim(gfp_mask, order, alloc_flags, ac,
|
||||
&did_some_progress);
|
||||
-#ifdef CONFIG_RECLAIM_ACCT
|
||||
- reclaimacct_end(DIRECT_RECLAIMS);
|
||||
-#endif
|
||||
if (page)
|
||||
goto got_pg;
|
||||
|
||||
@@ -5111,23 +5095,6 @@ static struct page *__page_frag_cache_refill(struct page_frag_cache *nc,
|
||||
|
||||
nc->va = page ? page_address(page) : NULL;
|
||||
|
||||
-#ifdef CONFIG_PAGE_TRACING
|
||||
- if (likely(page)) {
|
||||
- int order = get_order(nc->size);
|
||||
- int i;
|
||||
- struct page *newpage = page;
|
||||
- unsigned int deta = 1U << (unsigned int)order;
|
||||
-
|
||||
- for (i = 0; i < (1 << order); i++) {
|
||||
- if (!newpage)
|
||||
- break;
|
||||
- SetPageSKB(newpage);
|
||||
- newpage++;
|
||||
- }
|
||||
- mod_zone_page_state(page_zone(page), NR_SKB_PAGES, (long)deta);
|
||||
- }
|
||||
-#endif
|
||||
-
|
||||
return page;
|
||||
}
|
||||
|
||||
@@ -5135,16 +5102,8 @@ void __page_frag_cache_drain(struct page *page, unsigned int count)
|
||||
{
|
||||
VM_BUG_ON_PAGE(page_ref_count(page) == 0, page);
|
||||
|
||||
- if (page_ref_sub_and_test(page, count)) {
|
||||
-#ifdef CONFIG_PAGE_TRACING
|
||||
- if (likely(page)) {
|
||||
- unsigned int deta = 1U << compound_order(page);
|
||||
-
|
||||
- mod_zone_page_state(page_zone(page), NR_SKB_PAGES, -(long)deta);
|
||||
- }
|
||||
-#endif
|
||||
+ if (page_ref_sub_and_test(page, count))
|
||||
free_the_page(page, compound_order(page));
|
||||
- }
|
||||
}
|
||||
EXPORT_SYMBOL(__page_frag_cache_drain);
|
||||
|
||||
@@ -5214,16 +5173,8 @@ void page_frag_free(void *addr)
|
||||
{
|
||||
struct page *page = virt_to_head_page(addr);
|
||||
|
||||
- if (unlikely(put_page_testzero(page))) {
|
||||
-#ifdef CONFIG_PAGE_TRACING
|
||||
- if (likely(page)) {
|
||||
- unsigned int deta = 1U << compound_order(page);
|
||||
-
|
||||
- mod_zone_page_state(page_zone(page), NR_SKB_PAGES, -(long)deta);
|
||||
- }
|
||||
-#endif
|
||||
+ if (unlikely(put_page_testzero(page)))
|
||||
free_the_page(page, compound_order(page));
|
||||
- }
|
||||
}
|
||||
EXPORT_SYMBOL(page_frag_free);
|
||||
|
||||
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
|
||||
index f98801428..11bd44f92 100644
|
||||
--- a/mm/vmalloc.c
|
||||
+++ b/mm/vmalloc.c
|
||||
@@ -2097,6 +2097,7 @@ struct vm_struct *__get_vm_area_caller(unsigned long size, unsigned long flags,
|
||||
return __get_vm_area_node(size, 1, flags, start, end, NUMA_NO_NODE,
|
||||
GFP_KERNEL, caller);
|
||||
}
|
||||
+EXPORT_SYMBOL_GPL(__get_vm_area_caller);
|
||||
|
||||
/**
|
||||
* get_vm_area - reserve a contiguous kernel virtual area
|
||||
diff --git a/mm/vmscan.c b/mm/vmscan.c
|
||||
index 5371b75ff..86da03e27 100644
|
||||
--- a/mm/vmscan.c
|
||||
+++ b/mm/vmscan.c
|
||||
@@ -67,10 +67,6 @@
|
||||
#include <linux/memcg_policy.h>
|
||||
#endif
|
||||
|
||||
-#ifdef CONFIG_RECLAIM_ACCT
|
||||
-#include <linux/reclaim_acct.h>
|
||||
-#endif
|
||||
-
|
||||
#ifdef ARCH_HAS_PREFETCHW
|
||||
#define prefetchw_prev_lru_page(_page, _base, _field) \
|
||||
do { \
|
||||
@@ -599,16 +595,10 @@ unsigned long shrink_slab(gfp_t gfp_mask, int nid,
|
||||
.memcg = memcg,
|
||||
};
|
||||
|
||||
-#ifdef CONFIG_RECLAIM_ACCT
|
||||
- reclaimacct_substage_start(RA_SHRINKSLAB);
|
||||
-#endif
|
||||
ret = do_shrink_slab(&sc, shrinker, priority);
|
||||
if (ret == SHRINK_EMPTY)
|
||||
ret = 0;
|
||||
freed += ret;
|
||||
-#ifdef CONFIG_RECLAIM_ACCT
|
||||
- reclaimacct_substage_end(RA_SHRINKSLAB, ret, shrinker);
|
||||
-#endif
|
||||
/*
|
||||
* Bail out if someone want to register a new shrinker to
|
||||
* prevent the registration from being stalled for long periods
|
||||
@@ -2122,31 +2112,15 @@ unsigned long reclaim_pages(struct list_head *page_list)
|
||||
unsigned long shrink_list(enum lru_list lru, unsigned long nr_to_scan,
|
||||
struct lruvec *lruvec, struct scan_control *sc)
|
||||
{
|
||||
-#ifdef CONFIG_RECLAIM_ACCT
|
||||
- unsigned long nr_reclaimed;
|
||||
- unsigned int stub;
|
||||
-
|
||||
- stub = is_file_lru(lru) ? RA_SHRINKFILE : RA_SHRINKANON;
|
||||
- reclaimacct_substage_start(stub);
|
||||
-#endif
|
||||
if (is_active_lru(lru)) {
|
||||
if (sc->may_deactivate & (1 << is_file_lru(lru)))
|
||||
shrink_active_list(nr_to_scan, lruvec, sc, lru);
|
||||
else
|
||||
sc->skipped_deactivate = 1;
|
||||
-#ifdef CONFIG_RECLAIM_ACCT
|
||||
- reclaimacct_substage_end(stub, 0, NULL);
|
||||
-#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
-#ifdef CONFIG_RECLAIM_ACCT
|
||||
- nr_reclaimed = shrink_inactive_list(nr_to_scan, lruvec, sc, lru);
|
||||
- reclaimacct_substage_end(stub, nr_reclaimed, NULL);
|
||||
- return nr_reclaimed;
|
||||
-#else
|
||||
return shrink_inactive_list(nr_to_scan, lruvec, sc, lru);
|
||||
-#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -3878,7 +3852,6 @@ static int kswapd(void *p)
|
||||
pg_data_t *pgdat = (pg_data_t*)p;
|
||||
struct task_struct *tsk = current;
|
||||
const struct cpumask *cpumask = cpumask_of_node(pgdat->node_id);
|
||||
- struct reclaim_acct ra = {0};
|
||||
|
||||
if (!cpumask_empty(cpumask))
|
||||
set_cpus_allowed_ptr(tsk, cpumask);
|
||||
@@ -3939,14 +3912,8 @@ static int kswapd(void *p)
|
||||
*/
|
||||
trace_mm_vmscan_kswapd_wake(pgdat->node_id, highest_zoneidx,
|
||||
alloc_order);
|
||||
-#ifdef CONFIG_RECLAIM_ACCT
|
||||
- reclaimacct_start(KSWAPD_RECLAIM, &ra);
|
||||
-#endif
|
||||
reclaim_order = balance_pgdat(pgdat, alloc_order,
|
||||
highest_zoneidx);
|
||||
-#ifdef CONFIG_RECLAIM_ACCT
|
||||
- reclaimacct_end(KSWAPD_RECLAIM);
|
||||
-#endif
|
||||
if (reclaim_order < alloc_order)
|
||||
goto kswapd_try_sleep;
|
||||
}
|
||||
diff --git a/mm/vmstat.c b/mm/vmstat.c
|
||||
index 5b9b46f42..ec58ac28b 100644
|
||||
--- a/mm/vmstat.c
|
||||
+++ b/mm/vmstat.c
|
||||
@@ -1164,9 +1164,6 @@ const char * const vmstat_text[] = {
|
||||
#endif
|
||||
"nr_free_cma",
|
||||
|
||||
-#ifdef CONFIG_PAGE_TRACING
|
||||
- "nr_skb_pages",
|
||||
-#endif
|
||||
/* enum numa_stat_item counters */
|
||||
#ifdef CONFIG_NUMA
|
||||
"numa_hit",
|
||||
diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
|
||||
index daa9703b6..7a0b79b0a 100644
|
||||
--- a/mm/zsmalloc.c
|
||||
+++ b/mm/zsmalloc.c
|
||||
@@ -1085,9 +1085,6 @@ static struct zspage *alloc_zspage(struct zs_pool *pool,
|
||||
}
|
||||
|
||||
inc_zone_page_state(page, NR_ZSPAGES);
|
||||
-#ifdef CONFIG_PAGE_TRACING
|
||||
- SetPageZspage(page);
|
||||
-#endif
|
||||
pages[i] = page;
|
||||
}
|
||||
|
||||
diff --git a/mm/zswapd.c b/mm/zswapd.c
|
||||
index 547bcf94b..4bde41f21 100644
|
||||
--- a/mm/zswapd.c
|
||||
+++ b/mm/zswapd.c
|
||||
@@ -10,9 +10,6 @@
|
||||
#include <trace/events/vmscan.h>
|
||||
#include <uapi/linux/sched/types.h>
|
||||
#include <linux/zswapd.h>
|
||||
-#ifdef CONFIG_RECLAIM_ACCT
|
||||
-#include <linux/reclaim_acct.h>
|
||||
-#endif
|
||||
|
||||
#include "zswapd_internal.h"
|
||||
#include "internal.h"
|
||||
@@ -533,29 +530,15 @@ static unsigned long zswapd_shrink_list(enum lru_list lru,
|
||||
unsigned long nr_to_scan, struct lruvec *lruvec,
|
||||
struct scan_control *sc)
|
||||
{
|
||||
-#ifdef CONFIG_RECLAIM_ACCT
|
||||
- unsigned long nr_reclaimed;
|
||||
-
|
||||
- reclaimacct_substage_start(RA_SHRINKANON);
|
||||
-#endif
|
||||
if (is_active_lru(lru)) {
|
||||
if (sc->may_deactivate & (1 << is_file_lru(lru)))
|
||||
zswapd_shrink_active_list(nr_to_scan, lruvec, sc, lru);
|
||||
else
|
||||
sc->skipped_deactivate = 1;
|
||||
-#ifdef CONFIG_RECLAIM_ACCT
|
||||
- reclaimacct_substage_end(RA_SHRINKANON, 0, NULL);
|
||||
-#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
-#ifdef CONFIG_RECLAIM_ACCT
|
||||
- nr_reclaimed = shrink_inactive_list(nr_to_scan, lruvec, sc, lru);
|
||||
- reclaimacct_substage_end(RA_SHRINKANON, nr_reclaimed, NULL);
|
||||
- return nr_reclaimed;
|
||||
-#else
|
||||
return shrink_inactive_list(nr_to_scan, lruvec, sc, lru);
|
||||
-#endif
|
||||
}
|
||||
|
||||
static void zswapd_shrink_anon_memcg(struct pglist_data *pgdat,
|
||||
@@ -763,12 +746,10 @@ static int zswapd(void *p)
|
||||
struct task_struct *tsk = current;
|
||||
pg_data_t *pgdat = (pg_data_t *)p;
|
||||
const struct cpumask *cpumask = cpumask_of_node(pgdat->node_id);
|
||||
- struct reclaim_acct ra = {0};
|
||||
|
||||
/* save zswapd pid for schedule strategy */
|
||||
zswapd_pid = tsk->pid;
|
||||
|
||||
-
|
||||
if (!cpumask_empty(cpumask))
|
||||
set_cpus_allowed_ptr(tsk, cpumask);
|
||||
|
||||
@@ -790,13 +771,7 @@ static int zswapd(void *p)
|
||||
goto do_eswap;
|
||||
}
|
||||
|
||||
-#ifdef CONFIG_RECLAIM_ACCT
|
||||
- reclaimacct_start(ZSWAPD_RECLAIM, &ra);
|
||||
-#endif
|
||||
zswapd_shrink_node(pgdat);
|
||||
-#ifdef CONFIG_RECLAIM_ACCT
|
||||
- reclaimacct_end(ZSWAPD_RECLAIM);
|
||||
-#endif
|
||||
last_zswapd_time = jiffies;
|
||||
|
||||
do_eswap:
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user