[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] x86/IO-APIC: consolidate / complete #define-s



Drop redundant ones from apic.h. Add delivery mode mask. Use them in
place of open coded hex numbers.

Take the opportunity and modify a helper function's parameters to be
just unsigned int. Also drop the bogus double underscore from its name,
as it and all its callers get touched anyway.

No functional change.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -410,7 +410,8 @@ void free_ioapic_entries(struct IO_APIC_
     xfree(ioapic_entries);
 }
 
-static void __modify_IO_APIC_irq (unsigned int irq, unsigned long enable, 
unsigned long disable)
+static void modify_IO_APIC_irq(unsigned int irq, unsigned int enable,
+                               unsigned int disable)
 {
     struct irq_pin_list *entry = irq_2_pin + irq;
     unsigned int pin, reg;
@@ -432,25 +433,25 @@ static void __modify_IO_APIC_irq (unsign
 /* mask = 1 */
 static void __mask_IO_APIC_irq (unsigned int irq)
 {
-    __modify_IO_APIC_irq(irq, 0x00010000, 0);
+    modify_IO_APIC_irq(irq, IO_APIC_REDIR_MASKED, 0);
 }
 
 /* mask = 0 */
 static void __unmask_IO_APIC_irq (unsigned int irq)
 {
-    __modify_IO_APIC_irq(irq, 0, 0x00010000);
+    modify_IO_APIC_irq(irq, 0, IO_APIC_REDIR_MASKED);
 }
 
 /* trigger = 0 */
 static void __edge_IO_APIC_irq (unsigned int irq)
 {
-    __modify_IO_APIC_irq(irq, 0, 0x00008000);
+    modify_IO_APIC_irq(irq, 0, IO_APIC_REDIR_LEVEL_TRIGGER);
 }
 
 /* trigger = 1 */
 static void __level_IO_APIC_irq (unsigned int irq)
 {
-    __modify_IO_APIC_irq(irq, 0x00008000, 0);
+    modify_IO_APIC_irq(irq, IO_APIC_REDIR_LEVEL_TRIGGER, 0);
 }
 
 static void mask_IO_APIC_irq(struct irq_desc *desc)
@@ -571,7 +572,7 @@ set_ioapic_affinity_irq(struct irq_desc
             io_apic_write(entry->apic, 0x10 + 1 + pin*2, dest);
             data = io_apic_read(entry->apic, 0x10 + pin*2);
             data &= ~IO_APIC_REDIR_VECTOR_MASK;
-            data |= desc->arch.vector & 0xFF;
+            data |= MASK_INSR(desc->arch.vector, IO_APIC_REDIR_VECTOR_MASK);
             io_apic_modify(entry->apic, 0x10 + pin*2, data);
 
             if (!entry->next)
--- a/xen/include/asm-x86/apic.h
+++ b/xen/include/asm-x86/apic.h
@@ -16,10 +16,6 @@
 
 #define        SET_APIC_LOGICAL_ID(x)  (((x)<<24))
 
-#define IO_APIC_REDIR_VECTOR_MASK      0x000FF
-#define IO_APIC_REDIR_DEST_LOGICAL     0x00800
-#define IO_APIC_REDIR_DEST_PHYSICAL    0x00000
-
 /* Possible APIC states */
 enum apic_mode {
     APIC_MODE_INVALID,  /* Not set yet */
--- a/xen/include/asm-x86/io_apic.h
+++ b/xen/include/asm-x86/io_apic.h
@@ -21,6 +21,7 @@
 
 /* I/O Unit Redirection Table */
 #define IO_APIC_REDIR_VECTOR_MASK   0x000FF
+#define IO_APIC_REDIR_DELIV_MODE_MASK 0x00700
 #define IO_APIC_REDIR_DEST_LOGICAL  0x00800
 #define IO_APIC_REDIR_DEST_PHYSICAL 0x00000
 #define IO_APIC_REDIR_SEND_PENDING  (1 << 12)





_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.