util: resource: Add resource_device struct and functions 01/270601/4
authorChanwoo Choi <cw00.choi@samsung.com>
Sun, 6 Feb 2022 08:13:48 +0000 (17:13 +0900)
committerChanwoo Choi <cw00.choi@samsung.com>
Mon, 7 Feb 2022 03:52:20 +0000 (12:52 +0900)
commitea01c7c00d5043af02a743d0452b4f97c50ad395
treef212bebe8b2fd82c06b93c78be608c967d0d6d94
parent8cdef20ec828a62b9ecb9b4d5a7ec2449391372c
util: resource: Add resource_device struct and functions

Add resource_device structure for expressing the each h/w resource
such as CPU, GPU, Memory BUS, battery and so on.

Each h/w board has the different h/w resource information
such as the number of h/w resource, name, access path and so on.
PASS daemon has already supported the configuration method to get
the h/w resource information like /hal/etc/pass/pass.json.
Each h/w resource has the unique name, resource type and resource index
because board is able to have the one more same resource like big.LITTLE
cpu cluster.

When creating the instance of struct resource, will use the struct
resource_drvier and resource_device with resource type and index argument
because the user of create_resource() cannot get the unique resource name
which depends on the specific h/w. But the user of create_resource()
can get the available count of specific resource type by get_resource_device_*().

[How to create the instance of struct resource]
1. Find resource_device with resource type and index
2. Find resource_driver with resource type
3. Create the instance of struct resource by using resouce_device/driver info.

And rename from get_resource_driver to find_resource_driver.

Change-Id: I8c2fa6c8d22dcea996a12048fcab7de21eca652d
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
include/util/resource.h
src/util/resource.c