mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-04-20 19:08:20 +07:00
intel_pmc_ipc: update acpi resource structure for Punit
BIOS restructure exported memory resources for Punit in acpi table, So update resources for Punit. Signed-off-by: Qipeng Zha <qipeng.zha@intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
This commit is contained in:
parent
edde316acb
commit
8cc7fb4a65
@ -68,8 +68,12 @@
|
|||||||
#define PLAT_RESOURCE_IPC_INDEX 0
|
#define PLAT_RESOURCE_IPC_INDEX 0
|
||||||
#define PLAT_RESOURCE_IPC_SIZE 0x1000
|
#define PLAT_RESOURCE_IPC_SIZE 0x1000
|
||||||
#define PLAT_RESOURCE_GCR_SIZE 0x1000
|
#define PLAT_RESOURCE_GCR_SIZE 0x1000
|
||||||
#define PLAT_RESOURCE_PUNIT_DATA_INDEX 1
|
#define PLAT_RESOURCE_BIOS_DATA_INDEX 1
|
||||||
#define PLAT_RESOURCE_PUNIT_INTER_INDEX 2
|
#define PLAT_RESOURCE_BIOS_IFACE_INDEX 2
|
||||||
|
#define PLAT_RESOURCE_ISP_DATA_INDEX 4
|
||||||
|
#define PLAT_RESOURCE_ISP_IFACE_INDEX 5
|
||||||
|
#define PLAT_RESOURCE_GTD_DATA_INDEX 6
|
||||||
|
#define PLAT_RESOURCE_GTD_IFACE_INDEX 7
|
||||||
#define PLAT_RESOURCE_ACPI_IO_INDEX 0
|
#define PLAT_RESOURCE_ACPI_IO_INDEX 0
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -105,10 +109,6 @@ static struct intel_pmc_ipc_dev {
|
|||||||
int gcr_size;
|
int gcr_size;
|
||||||
|
|
||||||
/* punit */
|
/* punit */
|
||||||
resource_size_t punit_base;
|
|
||||||
int punit_size;
|
|
||||||
resource_size_t punit_base2;
|
|
||||||
int punit_size2;
|
|
||||||
struct platform_device *punit_dev;
|
struct platform_device *punit_dev;
|
||||||
} ipcdev;
|
} ipcdev;
|
||||||
|
|
||||||
@ -444,9 +444,22 @@ static const struct attribute_group intel_ipc_group = {
|
|||||||
.attrs = intel_ipc_attrs,
|
.attrs = intel_ipc_attrs,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define PUNIT_RESOURCE_INTER 1
|
static struct resource punit_res_array[] = {
|
||||||
static struct resource punit_res[] = {
|
/* Punit BIOS */
|
||||||
/* Punit */
|
{
|
||||||
|
.flags = IORESOURCE_MEM,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.flags = IORESOURCE_MEM,
|
||||||
|
},
|
||||||
|
/* Punit ISP */
|
||||||
|
{
|
||||||
|
.flags = IORESOURCE_MEM,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.flags = IORESOURCE_MEM,
|
||||||
|
},
|
||||||
|
/* Punit GTD */
|
||||||
{
|
{
|
||||||
.flags = IORESOURCE_MEM,
|
.flags = IORESOURCE_MEM,
|
||||||
},
|
},
|
||||||
@ -481,7 +494,6 @@ static struct itco_wdt_platform_data tco_info = {
|
|||||||
static int ipc_create_punit_device(void)
|
static int ipc_create_punit_device(void)
|
||||||
{
|
{
|
||||||
struct platform_device *pdev;
|
struct platform_device *pdev;
|
||||||
struct resource *res;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
pdev = platform_device_alloc(PUNIT_DEVICE_NAME, -1);
|
pdev = platform_device_alloc(PUNIT_DEVICE_NAME, -1);
|
||||||
@ -491,17 +503,8 @@ static int ipc_create_punit_device(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
pdev->dev.parent = ipcdev.dev;
|
pdev->dev.parent = ipcdev.dev;
|
||||||
|
ret = platform_device_add_resources(pdev, punit_res_array,
|
||||||
res = punit_res;
|
ARRAY_SIZE(punit_res_array));
|
||||||
res->start = ipcdev.punit_base;
|
|
||||||
res->end = res->start + ipcdev.punit_size - 1;
|
|
||||||
|
|
||||||
res = punit_res + PUNIT_RESOURCE_INTER;
|
|
||||||
res->start = ipcdev.punit_base2;
|
|
||||||
res->end = res->start + ipcdev.punit_size2 - 1;
|
|
||||||
|
|
||||||
ret = platform_device_add_resources(pdev, punit_res,
|
|
||||||
ARRAY_SIZE(punit_res));
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(ipcdev.dev, "Failed to add platform punit resources\n");
|
dev_err(ipcdev.dev, "Failed to add platform punit resources\n");
|
||||||
goto err;
|
goto err;
|
||||||
@ -590,7 +593,7 @@ static int ipc_create_pmc_devices(void)
|
|||||||
|
|
||||||
static int ipc_plat_get_res(struct platform_device *pdev)
|
static int ipc_plat_get_res(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct resource *res;
|
struct resource *res, *punit_res;
|
||||||
void __iomem *addr;
|
void __iomem *addr;
|
||||||
int size;
|
int size;
|
||||||
|
|
||||||
@ -603,32 +606,68 @@ static int ipc_plat_get_res(struct platform_device *pdev)
|
|||||||
size = resource_size(res);
|
size = resource_size(res);
|
||||||
ipcdev.acpi_io_base = res->start;
|
ipcdev.acpi_io_base = res->start;
|
||||||
ipcdev.acpi_io_size = size;
|
ipcdev.acpi_io_size = size;
|
||||||
dev_info(&pdev->dev, "io res: %llx %x\n",
|
dev_info(&pdev->dev, "io res: %pR\n", res);
|
||||||
(long long)res->start, (int)resource_size(res));
|
|
||||||
|
|
||||||
|
/* This is index 0 to cover BIOS data register */
|
||||||
|
punit_res = punit_res_array;
|
||||||
res = platform_get_resource(pdev, IORESOURCE_MEM,
|
res = platform_get_resource(pdev, IORESOURCE_MEM,
|
||||||
PLAT_RESOURCE_PUNIT_DATA_INDEX);
|
PLAT_RESOURCE_BIOS_DATA_INDEX);
|
||||||
if (!res) {
|
if (!res) {
|
||||||
dev_err(&pdev->dev, "Failed to get punit resource\n");
|
dev_err(&pdev->dev, "Failed to get res of punit BIOS data\n");
|
||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
}
|
}
|
||||||
size = resource_size(res);
|
*punit_res = *res;
|
||||||
ipcdev.punit_base = res->start;
|
dev_info(&pdev->dev, "punit BIOS data res: %pR\n", res);
|
||||||
ipcdev.punit_size = size;
|
|
||||||
dev_info(&pdev->dev, "punit data res: %llx %x\n",
|
|
||||||
(long long)res->start, (int)resource_size(res));
|
|
||||||
|
|
||||||
res = platform_get_resource(pdev, IORESOURCE_MEM,
|
res = platform_get_resource(pdev, IORESOURCE_MEM,
|
||||||
PLAT_RESOURCE_PUNIT_INTER_INDEX);
|
PLAT_RESOURCE_BIOS_IFACE_INDEX);
|
||||||
if (!res) {
|
if (!res) {
|
||||||
dev_err(&pdev->dev, "Failed to get punit inter resource\n");
|
dev_err(&pdev->dev, "Failed to get res of punit BIOS iface\n");
|
||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
}
|
}
|
||||||
size = resource_size(res);
|
/* This is index 1 to cover BIOS interface register */
|
||||||
ipcdev.punit_base2 = res->start;
|
*++punit_res = *res;
|
||||||
ipcdev.punit_size2 = size;
|
dev_info(&pdev->dev, "punit BIOS interface res: %pR\n", res);
|
||||||
dev_info(&pdev->dev, "punit interface res: %llx %x\n",
|
|
||||||
(long long)res->start, (int)resource_size(res));
|
res = platform_get_resource(pdev, IORESOURCE_MEM,
|
||||||
|
PLAT_RESOURCE_ISP_DATA_INDEX);
|
||||||
|
if (!res) {
|
||||||
|
dev_err(&pdev->dev, "Failed to get res of punit ISP data\n");
|
||||||
|
return -ENXIO;
|
||||||
|
}
|
||||||
|
/* This is index 2 to cover ISP data register */
|
||||||
|
*++punit_res = *res;
|
||||||
|
dev_info(&pdev->dev, "punit ISP data res: %pR\n", res);
|
||||||
|
|
||||||
|
res = platform_get_resource(pdev, IORESOURCE_MEM,
|
||||||
|
PLAT_RESOURCE_ISP_IFACE_INDEX);
|
||||||
|
if (!res) {
|
||||||
|
dev_err(&pdev->dev, "Failed to get res of punit ISP iface\n");
|
||||||
|
return -ENXIO;
|
||||||
|
}
|
||||||
|
/* This is index 3 to cover ISP interface register */
|
||||||
|
*++punit_res = *res;
|
||||||
|
dev_info(&pdev->dev, "punit ISP interface res: %pR\n", res);
|
||||||
|
|
||||||
|
res = platform_get_resource(pdev, IORESOURCE_MEM,
|
||||||
|
PLAT_RESOURCE_GTD_DATA_INDEX);
|
||||||
|
if (!res) {
|
||||||
|
dev_err(&pdev->dev, "Failed to get res of punit GTD data\n");
|
||||||
|
return -ENXIO;
|
||||||
|
}
|
||||||
|
/* This is index 4 to cover GTD data register */
|
||||||
|
*++punit_res = *res;
|
||||||
|
dev_info(&pdev->dev, "punit GTD data res: %pR\n", res);
|
||||||
|
|
||||||
|
res = platform_get_resource(pdev, IORESOURCE_MEM,
|
||||||
|
PLAT_RESOURCE_GTD_IFACE_INDEX);
|
||||||
|
if (!res) {
|
||||||
|
dev_err(&pdev->dev, "Failed to get res of punit GTD iface\n");
|
||||||
|
return -ENXIO;
|
||||||
|
}
|
||||||
|
/* This is index 5 to cover GTD interface register */
|
||||||
|
*++punit_res = *res;
|
||||||
|
dev_info(&pdev->dev, "punit GTD interface res: %pR\n", res);
|
||||||
|
|
||||||
res = platform_get_resource(pdev, IORESOURCE_MEM,
|
res = platform_get_resource(pdev, IORESOURCE_MEM,
|
||||||
PLAT_RESOURCE_IPC_INDEX);
|
PLAT_RESOURCE_IPC_INDEX);
|
||||||
@ -651,8 +690,7 @@ static int ipc_plat_get_res(struct platform_device *pdev)
|
|||||||
|
|
||||||
ipcdev.gcr_base = res->start + size;
|
ipcdev.gcr_base = res->start + size;
|
||||||
ipcdev.gcr_size = PLAT_RESOURCE_GCR_SIZE;
|
ipcdev.gcr_size = PLAT_RESOURCE_GCR_SIZE;
|
||||||
dev_info(&pdev->dev, "ipc res: %llx %x\n",
|
dev_info(&pdev->dev, "ipc res: %pR\n", res);
|
||||||
(long long)res->start, (int)resource_size(res));
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user