parisc: Add wrapper for pdc_instr() firmware function
authorHelge Deller <deller@gmx.de>
Sun, 17 Sep 2017 19:15:09 +0000 (21:15 +0200)
committerHelge Deller <deller@gmx.de>
Fri, 22 Sep 2017 17:46:44 +0000 (19:46 +0200)
Signed-off-by: Helge Deller <deller@gmx.de>
arch/parisc/include/asm/pdc.h
arch/parisc/kernel/firmware.c

index 26b4455baa8370560bb572d7cb550cdbd17f1101..510341f62d979e0ced75108c4b771380e0866c57 100644 (file)
@@ -280,6 +280,7 @@ void setup_pdc(void);               /* in inventory.c */
 /* wrapper-functions from pdc.c */
 
 int pdc_add_valid(unsigned long address);
+int pdc_instr(unsigned int *instr);
 int pdc_chassis_info(struct pdc_chassis_info *chassis_info, void *led_info, unsigned long len);
 int pdc_chassis_disp(unsigned long disp);
 int pdc_chassis_warn(unsigned long *warn);
index ab80e5c6f6517c4f165ab9ce8c3863b2d94e7c05..6d471c00c71af12f6a48c4deebb5d260071d5dd3 100644 (file)
@@ -232,6 +232,26 @@ int pdc_add_valid(unsigned long address)
 }
 EXPORT_SYMBOL(pdc_add_valid);
 
+/**
+ * pdc_instr - Get instruction that invokes PDCE_CHECK in HPMC handler.
+ * @instr: Pointer to variable which will get instruction opcode.
+ *
+ * The return value is PDC_OK (0) in case call succeeded.
+ */
+int __init pdc_instr(unsigned int *instr)
+{
+       int retval;
+       unsigned long flags;
+
+       spin_lock_irqsave(&pdc_lock, flags);
+       retval = mem_pdc_call(PDC_INSTR, 0UL, __pa(pdc_result));
+       convert_to_wide(pdc_result);
+       *instr = pdc_result[0];
+       spin_unlock_irqrestore(&pdc_lock, flags);
+
+       return retval;
+}
+
 /**
  * pdc_chassis_info - Return chassis information.
  * @result: The return buffer.