Skip to content

Commit 4e3c96f

Browse files
sudeep-hollaJassiBrar
authored andcommitted
mailbox: pcc: Consolidate subspace doorbell register parsing
Extended PCC subspaces(Type 3 and 4) differ from generic(Type 0) and HW-Reduced Communication(Type 1 and 2) subspace structures. However some fields share same offsets and same type of structure can be use to extract the fields. In order to simplify that, let us move all the doorbell register parsing into pcc_parse_subspace_db_reg and consolidate there. It will be easier to extend it if required within the same. Reviewed-by: Cristian Marussi <[email protected]> Signed-off-by: Sudeep Holla <[email protected]> Signed-off-by: Jassi Brar <[email protected]>
1 parent 319bfb3 commit 4e3c96f

File tree

1 file changed

+23
-8
lines changed

1 file changed

+23
-8
lines changed

drivers/mailbox/pcc.c

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,28 @@ static int pcc_parse_subspace_irq(struct pcc_chan_info *pchan,
448448
return 0;
449449
}
450450

451+
/**
452+
* pcc_parse_subspace_db_reg - Parse the PCC doorbell register
453+
*
454+
* @pchan: Pointer to the PCC channel info structure.
455+
* @pcct_entry: Pointer to the ACPI subtable header.
456+
*
457+
*/
458+
static void pcc_parse_subspace_db_reg(struct pcc_chan_info *pchan,
459+
struct acpi_subtable_header *pcct_entry)
460+
{
461+
struct acpi_pcct_subspace *pcct_ss;
462+
struct acpi_generic_address *db_reg;
463+
464+
pcct_ss = (struct acpi_pcct_subspace *)pcct_entry;
465+
466+
/* If doorbell is in system memory cache the virt address */
467+
db_reg = &pcct_ss->doorbell_register;
468+
if (db_reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY)
469+
pchan->db_vaddr = acpi_os_ioremap(db_reg->address,
470+
db_reg->bit_width / 8);
471+
}
472+
451473
/**
452474
* acpi_pcc_probe - Parse the ACPI tree for the PCCT.
453475
*
@@ -513,22 +535,15 @@ static int __init acpi_pcc_probe(void)
513535

514536
for (i = 0; i < count; i++) {
515537
struct pcc_chan_info *pchan = chan_info + i;
516-
struct acpi_generic_address *db_reg;
517-
struct acpi_pcct_subspace *pcct_ss;
518538
pcc_mbox_channels[i].con_priv = pcct_entry;
519539

520540
if (pcc_mbox_ctrl.txdone_irq) {
521541
rc = pcc_parse_subspace_irq(pchan, pcct_entry);
522542
if (rc < 0)
523543
goto err;
524544
}
525-
pcct_ss = (struct acpi_pcct_subspace *) pcct_entry;
545+
pcc_parse_subspace_db_reg(pchan, pcct_entry);
526546

527-
/* If doorbell is in system memory cache the virt address */
528-
db_reg = &pcct_ss->doorbell_register;
529-
if (db_reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY)
530-
pchan->db_vaddr = acpi_os_ioremap(db_reg->address,
531-
db_reg->bit_width / 8);
532547
pcct_entry = (struct acpi_subtable_header *)
533548
((unsigned long) pcct_entry + pcct_entry->length);
534549
}

0 commit comments

Comments
 (0)