Commit b9317d51 authored by Ohad Sharabi's avatar Ohad Sharabi Committed by Oded Gabbay

habanalabs: make set_pci_regions asic function

In order to better support variants of the same ASIC
the set_pci_regions function is now an ASIC function which
allows each ASIC to implement it internally, thus keeping
all definitions static to the file.
Signed-off-by: default avatarOhad Sharabi <osharabi@habana.ai>
Reviewed-by: default avatarOded Gabbay <ogabbay@kernel.org>
Signed-off-by: default avatarOded Gabbay <ogabbay@kernel.org>
parent 932adf16
...@@ -1159,6 +1159,7 @@ struct fw_load_mgr { ...@@ -1159,6 +1159,7 @@ struct fw_load_mgr {
* @init_cpu_scrambler_dram: Enable CPU specific DRAM scrambling * @init_cpu_scrambler_dram: Enable CPU specific DRAM scrambling
* @state_dump_init: initialize constants required for state dump * @state_dump_init: initialize constants required for state dump
* @get_sob_addr: get SOB base address offset. * @get_sob_addr: get SOB base address offset.
* @set_pci_memory_regions: setting properties of PCI memory regions
*/ */
struct hl_asic_funcs { struct hl_asic_funcs {
int (*early_init)(struct hl_device *hdev); int (*early_init)(struct hl_device *hdev);
...@@ -1287,6 +1288,7 @@ struct hl_asic_funcs { ...@@ -1287,6 +1288,7 @@ struct hl_asic_funcs {
void (*init_cpu_scrambler_dram)(struct hl_device *hdev); void (*init_cpu_scrambler_dram)(struct hl_device *hdev);
void (*state_dump_init)(struct hl_device *hdev); void (*state_dump_init)(struct hl_device *hdev);
u32 (*get_sob_addr)(struct hl_device *hdev, u32 sob_id); u32 (*get_sob_addr)(struct hl_device *hdev, u32 sob_id);
void (*set_pci_memory_regions)(struct hl_device *hdev);
}; };
......
...@@ -1857,7 +1857,7 @@ static int gaudi_sw_init(struct hl_device *hdev) ...@@ -1857,7 +1857,7 @@ static int gaudi_sw_init(struct hl_device *hdev)
hdev->supports_staged_submission = true; hdev->supports_staged_submission = true;
hdev->supports_wait_for_multi_cs = true; hdev->supports_wait_for_multi_cs = true;
gaudi_set_pci_memory_regions(hdev); hdev->asic_funcs->set_pci_memory_regions(hdev);
return 0; return 0;
...@@ -9377,7 +9377,8 @@ static const struct hl_asic_funcs gaudi_funcs = { ...@@ -9377,7 +9377,8 @@ static const struct hl_asic_funcs gaudi_funcs = {
.init_firmware_loader = gaudi_init_firmware_loader, .init_firmware_loader = gaudi_init_firmware_loader,
.init_cpu_scrambler_dram = gaudi_init_scrambler_hbm, .init_cpu_scrambler_dram = gaudi_init_scrambler_hbm,
.state_dump_init = gaudi_state_dump_init, .state_dump_init = gaudi_state_dump_init,
.get_sob_addr = gaudi_get_sob_addr .get_sob_addr = gaudi_get_sob_addr,
.set_pci_memory_regions = gaudi_set_pci_memory_regions
}; };
/** /**
......
...@@ -962,7 +962,7 @@ static int goya_sw_init(struct hl_device *hdev) ...@@ -962,7 +962,7 @@ static int goya_sw_init(struct hl_device *hdev)
hdev->allow_external_soft_reset = true; hdev->allow_external_soft_reset = true;
hdev->supports_wait_for_multi_cs = false; hdev->supports_wait_for_multi_cs = false;
goya_set_pci_memory_regions(hdev); hdev->asic_funcs->set_pci_memory_regions(hdev);
return 0; return 0;
...@@ -5669,7 +5669,8 @@ static const struct hl_asic_funcs goya_funcs = { ...@@ -5669,7 +5669,8 @@ static const struct hl_asic_funcs goya_funcs = {
.init_firmware_loader = goya_init_firmware_loader, .init_firmware_loader = goya_init_firmware_loader,
.init_cpu_scrambler_dram = goya_cpu_init_scrambler_dram, .init_cpu_scrambler_dram = goya_cpu_init_scrambler_dram,
.state_dump_init = goya_state_dump_init, .state_dump_init = goya_state_dump_init,
.get_sob_addr = &goya_get_sob_addr .get_sob_addr = &goya_get_sob_addr,
.set_pci_memory_regions = goya_set_pci_memory_regions,
}; };
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment