Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 28575
b: refs/heads/master
c: fd58e55
h: refs/heads/master
i:
  28573: 4be8a67
  28571: ff02fa4
  28567: ef85065
  28559: e11612c
  28543: 027412a
v: v3
  • Loading branch information
Mark Maule authored and Greg Kroah-Hartman committed Jun 21, 2006
1 parent a14e42f commit f4422a4
Show file tree
Hide file tree
Showing 11 changed files with 368 additions and 145 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c34b4c734482dda750deb6089521f7c891b48736
refs/heads/master: fd58e55fcf5568e51da2ed54d7acd049c3fdb184
6 changes: 5 additions & 1 deletion trunk/drivers/pci/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ obj-$(CONFIG_PPC32) += setup-irq.o
obj-$(CONFIG_PPC64) += setup-bus.o
obj-$(CONFIG_MIPS) += setup-bus.o setup-irq.o
obj-$(CONFIG_X86_VISWS) += setup-irq.o
obj-$(CONFIG_PCI_MSI) += msi.o

msiobj-y := msi.o msi-apic.o
msiobj-$(CONFIG_IA64_GENERIC) += msi-altix.o
msiobj-$(CONFIG_IA64_SGI_SN2) += msi-altix.o
obj-$(CONFIG_PCI_MSI) += $(msiobj-y)

#
# ACPI Related PCI FW Functions
Expand Down
18 changes: 18 additions & 0 deletions trunk/drivers/pci/msi-altix.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (C) 2006 Silicon Graphics, Inc. All Rights Reserved.
*/

#include <asm/errno.h>

int
sn_msi_init(void)
{
/*
* return error until MSI is supported on altix platforms
*/
return -EINVAL;
}
100 changes: 100 additions & 0 deletions trunk/drivers/pci/msi-apic.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
/*
* MSI hooks for standard x86 apic
*/

#include <linux/pci.h>
#include <linux/irq.h>

#include "msi.h"

/*
* Shifts for APIC-based data
*/

#define MSI_DATA_VECTOR_SHIFT 0
#define MSI_DATA_VECTOR(v) (((u8)v) << MSI_DATA_VECTOR_SHIFT)

#define MSI_DATA_DELIVERY_SHIFT 8
#define MSI_DATA_DELIVERY_FIXED (0 << MSI_DATA_DELIVERY_SHIFT)
#define MSI_DATA_DELIVERY_LOWPRI (1 << MSI_DATA_DELIVERY_SHIFT)

#define MSI_DATA_LEVEL_SHIFT 14
#define MSI_DATA_LEVEL_DEASSERT (0 << MSI_DATA_LEVEL_SHIFT)
#define MSI_DATA_LEVEL_ASSERT (1 << MSI_DATA_LEVEL_SHIFT)

#define MSI_DATA_TRIGGER_SHIFT 15
#define MSI_DATA_TRIGGER_EDGE (0 << MSI_DATA_TRIGGER_SHIFT)
#define MSI_DATA_TRIGGER_LEVEL (1 << MSI_DATA_TRIGGER_SHIFT)

/*
* Shift/mask fields for APIC-based bus address
*/

#define MSI_ADDR_HEADER 0xfee00000

#define MSI_ADDR_DESTID_MASK 0xfff0000f
#define MSI_ADDR_DESTID_CPU(cpu) ((cpu) << MSI_TARGET_CPU_SHIFT)

#define MSI_ADDR_DESTMODE_SHIFT 2
#define MSI_ADDR_DESTMODE_PHYS (0 << MSI_ADDR_DESTMODE_SHIFT)
#define MSI_ADDR_DESTMODE_LOGIC (1 << MSI_ADDR_DESTMODE_SHIFT)

#define MSI_ADDR_REDIRECTION_SHIFT 3
#define MSI_ADDR_REDIRECTION_CPU (0 << MSI_ADDR_REDIRECTION_SHIFT)
#define MSI_ADDR_REDIRECTION_LOWPRI (1 << MSI_ADDR_REDIRECTION_SHIFT)


static void
msi_target_apic(unsigned int vector,
unsigned int dest_cpu,
u32 *address_hi, /* in/out */
u32 *address_lo) /* in/out */
{
u32 addr = *address_lo;

addr &= MSI_ADDR_DESTID_MASK;
addr |= MSI_ADDR_DESTID_CPU(cpu_physical_id(dest_cpu));

*address_lo = addr;
}

static int
msi_setup_apic(struct pci_dev *pdev, /* unused in generic */
unsigned int vector,
u32 *address_hi,
u32 *address_lo,
u32 *data)
{
unsigned long dest_phys_id;

dest_phys_id = cpu_physical_id(first_cpu(cpu_online_map));

*address_hi = 0;
*address_lo = MSI_ADDR_HEADER |
MSI_ADDR_DESTMODE_PHYS |
MSI_ADDR_REDIRECTION_CPU |
MSI_ADDR_DESTID_CPU(dest_phys_id);

*data = MSI_DATA_TRIGGER_EDGE |
MSI_DATA_LEVEL_ASSERT |
MSI_DATA_DELIVERY_FIXED |
MSI_DATA_VECTOR(vector);

return 0;
}

static void
msi_teardown_apic(unsigned int vector)
{
return; /* no-op */
}

/*
* Generic ops used on most IA archs/platforms. Set with msi_register()
*/

struct msi_ops msi_apic_ops = {
.setup = msi_setup_apic,
.teardown = msi_teardown_apic,
.target = msi_target_apic,
};
Loading

0 comments on commit f4422a4

Please sign in to comment.