Skip to content

Commit 319bfb3

Browse files
sudeep-hollaJassiBrar
authored andcommitted
mailbox: pcc: Consolidate subspace interrupt information 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 IRQ related information parsing into pcc_parse_subspace_irq 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 80b2bdd commit 319bfb3

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

drivers/mailbox/pcc.c

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -405,18 +405,26 @@ static int parse_pcc_subspace(union acpi_subtable_headers *header,
405405

406406
/**
407407
* pcc_parse_subspace_irq - Parse the PCC IRQ and PCC ACK register
408-
* There should be one entry per PCC client.
409-
* @id: PCC subspace index.
410-
* @pcct_ss: Pointer to the ACPI subtable header under the PCCT.
408+
*
409+
* @pchan: Pointer to the PCC channel info structure.
410+
* @pcct_entry: Pointer to the ACPI subtable header.
411411
*
412412
* Return: 0 for Success, else errno.
413413
*
414-
* This gets called for each entry in the PCC table.
414+
* There should be one entry per PCC channel. This gets called for each
415+
* entry in the PCC table. This uses PCCY Type1 structure for all applicable
416+
* types(Type 1-4) to fetch irq
415417
*/
416-
static int pcc_parse_subspace_irq(int id, struct acpi_pcct_hw_reduced *pcct_ss)
418+
static int pcc_parse_subspace_irq(struct pcc_chan_info *pchan,
419+
struct acpi_subtable_header *pcct_entry)
417420
{
418-
struct pcc_chan_info *pchan = chan_info + id;
421+
struct acpi_pcct_hw_reduced *pcct_ss;
419422

423+
if (pcct_entry->type < ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE ||
424+
pcct_entry->type > ACPI_PCCT_TYPE_EXT_PCC_SLAVE_SUBSPACE)
425+
return 0;
426+
427+
pcct_ss = (struct acpi_pcct_hw_reduced *)pcct_entry;
420428
pchan->db_irq = pcc_map_interrupt(pcct_ss->platform_interrupt,
421429
(u32)pcct_ss->flags);
422430
if (pchan->db_irq <= 0) {
@@ -425,8 +433,7 @@ static int pcc_parse_subspace_irq(int id, struct acpi_pcct_hw_reduced *pcct_ss)
425433
return -EINVAL;
426434
}
427435

428-
if (pcct_ss->header.type
429-
== ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE_TYPE2) {
436+
if (pcct_ss->header.type == ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE_TYPE2) {
430437
struct acpi_pcct_hw_reduced_type2 *pcct2_ss = (void *)pcct_ss;
431438

432439
pchan->db_ack_vaddr =
@@ -510,17 +517,10 @@ static int __init acpi_pcc_probe(void)
510517
struct acpi_pcct_subspace *pcct_ss;
511518
pcc_mbox_channels[i].con_priv = pcct_entry;
512519

513-
if (pcct_entry->type == ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE ||
514-
pcct_entry->type == ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE_TYPE2) {
515-
struct acpi_pcct_hw_reduced *pcct_hrss;
516-
517-
pcct_hrss = (struct acpi_pcct_hw_reduced *) pcct_entry;
518-
519-
if (pcc_mbox_ctrl.txdone_irq) {
520-
rc = pcc_parse_subspace_irq(i, pcct_hrss);
521-
if (rc < 0)
522-
goto err;
523-
}
520+
if (pcc_mbox_ctrl.txdone_irq) {
521+
rc = pcc_parse_subspace_irq(pchan, pcct_entry);
522+
if (rc < 0)
523+
goto err;
524524
}
525525
pcct_ss = (struct acpi_pcct_subspace *) pcct_entry;
526526

0 commit comments

Comments
 (0)