136 lines
5.2 KiB
Diff
136 lines
5.2 KiB
Diff
|
From 8660928fa01c363f1aa826d392de2c6ef4924dcf Mon Sep 17 00:00:00 2001
|
||
|
From: Shih-Yi Chen <shihyic@nvidia.com>
|
||
|
Date: Wed, 5 Apr 2023 14:41:27 -0400
|
||
|
Subject: [PATCH] UBUNTU: SAUCE: Add BF3 related ACPI config and Ring device
|
||
|
creation code
|
||
|
X-NVConfidentiality: public
|
||
|
|
||
|
BugLink: https://bugs.launchpad.net/bugs/2015292
|
||
|
|
||
|
Fixed Missing ACPI device info in mlxbf_pka module. Added configuration info
|
||
|
and associated code to provision PKA ring devices.
|
||
|
|
||
|
Signed-off-by: Shih-Yi Chen <shihyic@nvidia.com>
|
||
|
Reviewed-by: Khalil Blaiech <kblaiech@nvidia.com>
|
||
|
Acked-by: Bartlomiej Zolnierkiewicz <bartlomiej.zolnierkiewicz@canonical.com>
|
||
|
Acked-by: Andrei Gherzan <andrei.gherzan@canonical.com>
|
||
|
Signed-off-by: Bartlomiej Zolnierkiewicz <bartlomiej.zolnierkiewicz@canonical.com>
|
||
|
---
|
||
|
.../platform/mellanox/mlxbf_pka/mlxbf_pka_config.h | 9 ++++++---
|
||
|
.../platform/mellanox/mlxbf_pka/mlxbf_pka_drv.c | 23 +++++++++++++++++++---
|
||
|
2 files changed, 26 insertions(+), 6 deletions(-)
|
||
|
|
||
|
diff --git a/drivers/platform/mellanox/mlxbf_pka/mlxbf_pka_config.h b/drivers/platform/mellanox/mlxbf_pka/mlxbf_pka_config.h
|
||
|
index 5b69d55be..c9543416b 100644
|
||
|
--- a/drivers/platform/mellanox/mlxbf_pka/mlxbf_pka_config.h
|
||
|
+++ b/drivers/platform/mellanox/mlxbf_pka/mlxbf_pka_config.h
|
||
|
@@ -37,7 +37,7 @@
|
||
|
#include "mlxbf_pka_addrs.h"
|
||
|
|
||
|
// The maximum number of PKA shims refered to as IO blocks.
|
||
|
-#define PKA_MAX_NUM_IO_BLOCKS 8
|
||
|
+#define PKA_MAX_NUM_IO_BLOCKS 24
|
||
|
// The maximum number of Rings supported by IO block (shim).
|
||
|
#define PKA_MAX_NUM_IO_BLOCK_RINGS 4
|
||
|
|
||
|
@@ -72,8 +72,11 @@
|
||
|
#define PKA_WINDOW_RAM_RING_MEM_SIZE 0x0800 // 2KB
|
||
|
#define PKA_WINDOW_RAM_DATA_MEM_SIZE 0x3800 // 14KB
|
||
|
|
||
|
-// Offset mask, common to both Window and Alternate Window RAM.
|
||
|
-#define PKA_WINDOW_RAM_OFFSET_MASK1 0x730000
|
||
|
+// Window RAM/Alternate Window RAM offset mask for BF1 and BF2
|
||
|
+#define PKA_WINDOW_RAM_OFFSET_MASK1 0x730000
|
||
|
+//
|
||
|
+// Window RAM/Alternate Window RAM offset mask for BF3
|
||
|
+#define PKA_WINDOW_RAM_OFFSET_MASK2 0x70000
|
||
|
|
||
|
// Macro for mapping PKA Ring address into Window RAM address. It converts the
|
||
|
// ring address, either physical address or virtual address, to valid address
|
||
|
diff --git a/drivers/platform/mellanox/mlxbf_pka/mlxbf_pka_drv.c b/drivers/platform/mellanox/mlxbf_pka/mlxbf_pka_drv.c
|
||
|
index 9e26ccf21..6b171b2a6 100644
|
||
|
--- a/drivers/platform/mellanox/mlxbf_pka/mlxbf_pka_drv.c
|
||
|
+++ b/drivers/platform/mellanox/mlxbf_pka/mlxbf_pka_drv.c
|
||
|
@@ -34,6 +34,9 @@
|
||
|
#define PKA_DEVICE_ACPIHID_BF2 "MLNXBF20"
|
||
|
#define PKA_RING_DEVICE_ACPIHID_BF2 "MLNXBF21"
|
||
|
|
||
|
+#define PKA_DEVICE_ACPIHID_BF3 "MLNXBF51"
|
||
|
+#define PKA_RING_DEVICE_ACPIHID_BF3 "MLNXBF52"
|
||
|
+
|
||
|
#define PKA_DEVICE_ACCESS_MODE 0666
|
||
|
|
||
|
#define PKA_DEVICE_RES_CNT 7
|
||
|
@@ -49,7 +52,8 @@ enum pka_mem_res_idx {
|
||
|
|
||
|
enum pka_plat_type {
|
||
|
PKA_PLAT_TYPE_BF1 = 0, /* Platform type Bluefield-1 */
|
||
|
- PKA_PLAT_TYPE_BF2 /* Platform type Bluefield-2 */
|
||
|
+ PKA_PLAT_TYPE_BF2, /* Platform type Bluefield-2 */
|
||
|
+ PKA_PLAT_TYPE_BF3 /* Platform type Bluefield-3 */
|
||
|
};
|
||
|
|
||
|
static DEFINE_MUTEX(pka_drv_lock);
|
||
|
@@ -66,6 +70,9 @@ const char pka_ring_acpihid_bf1[] = PKA_RING_DEVICE_ACPIHID_BF1;
|
||
|
const char pka_acpihid_bf2[] = PKA_DEVICE_ACPIHID_BF2;
|
||
|
const char pka_ring_acpihid_bf2[] = PKA_RING_DEVICE_ACPIHID_BF2;
|
||
|
|
||
|
+const char pka_acpihid_bf3[] = PKA_DEVICE_ACPIHID_BF3;
|
||
|
+const char pka_ring_acpihid_bf3[] = PKA_RING_DEVICE_ACPIHID_BF3;
|
||
|
+
|
||
|
struct pka_drv_plat_info {
|
||
|
enum pka_plat_type type;
|
||
|
uint8_t fw_id;
|
||
|
@@ -79,6 +86,10 @@ static struct pka_drv_plat_info pka_drv_plat[] = {
|
||
|
[PKA_PLAT_TYPE_BF2] = {
|
||
|
.type = PKA_PLAT_TYPE_BF2,
|
||
|
.fw_id = PKA_FIRMWARE_IMAGE_2_ID
|
||
|
+ },
|
||
|
+ [PKA_PLAT_TYPE_BF3] = {
|
||
|
+ .type = PKA_PLAT_TYPE_BF3,
|
||
|
+ .fw_id = PKA_FIRMWARE_IMAGE_2_ID
|
||
|
}
|
||
|
};
|
||
|
|
||
|
@@ -87,6 +98,8 @@ static const struct acpi_device_id pka_drv_acpi_ids[] = {
|
||
|
{ PKA_RING_DEVICE_ACPIHID_BF1, 0 },
|
||
|
{ PKA_DEVICE_ACPIHID_BF2, (kernel_ulong_t)&pka_drv_plat[PKA_PLAT_TYPE_BF2] },
|
||
|
{ PKA_RING_DEVICE_ACPIHID_BF2, 0 },
|
||
|
+ { PKA_DEVICE_ACPIHID_BF3, (kernel_ulong_t)&pka_drv_plat[PKA_PLAT_TYPE_BF3] },
|
||
|
+ { PKA_RING_DEVICE_ACPIHID_BF3, 0 },
|
||
|
{},
|
||
|
};
|
||
|
|
||
|
@@ -967,6 +980,8 @@ static int pka_drv_probe_device(struct pka_info *info)
|
||
|
plat_info = (struct pka_drv_plat_info *)aid->driver_data;
|
||
|
if (plat_info->type <= PKA_PLAT_TYPE_BF2) {
|
||
|
wndw_ram_off_mask = PKA_WINDOW_RAM_OFFSET_MASK1;
|
||
|
+ } else if (plat_info->type <= PKA_PLAT_TYPE_BF3) {
|
||
|
+ wndw_ram_off_mask = PKA_WINDOW_RAM_OFFSET_MASK2;
|
||
|
} else {
|
||
|
PKA_ERROR(PKA_DRIVER, "Invalid platform type: %d\n",
|
||
|
(int)plat_info->type);
|
||
|
@@ -1210,7 +1225,8 @@ static int pka_drv_acpi_probe(struct platform_device *pdev,
|
||
|
return -EINVAL;
|
||
|
|
||
|
if (!strcmp(info->acpihid, pka_ring_acpihid_bf1)
|
||
|
- || !strcmp(info->acpihid, pka_ring_acpihid_bf2)) {
|
||
|
+ || !strcmp(info->acpihid, pka_ring_acpihid_bf2)
|
||
|
+ || !strcmp(info->acpihid, pka_ring_acpihid_bf3)) {
|
||
|
error = pka_drv_probe_ring_device(info);
|
||
|
if (error) {
|
||
|
PKA_DEBUG(PKA_DRIVER,
|
||
|
@@ -1222,7 +1238,8 @@ static int pka_drv_acpi_probe(struct platform_device *pdev,
|
||
|
pdev->name);
|
||
|
|
||
|
} else if (!strcmp(info->acpihid, pka_acpihid_bf1)
|
||
|
- || !strcmp(info->acpihid, pka_acpihid_bf2)) {
|
||
|
+ || !strcmp(info->acpihid, pka_acpihid_bf2)
|
||
|
+ || !strcmp(info->acpihid, pka_acpihid_bf3)) {
|
||
|
error = pka_drv_probe_device(info);
|
||
|
if (error) {
|
||
|
PKA_DEBUG(PKA_DRIVER,
|
||
|
--
|
||
|
2.14.1
|
||
|
|