Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
[safe/jmp/linux-2.6] / arch / powerpc / platforms / iseries / viopath.c
index fe97bfb..9baa4ee 100644 (file)
@@ -41,8 +41,8 @@
 
 #include <asm/system.h>
 #include <asm/uaccess.h>
+#include <asm/prom.h>
 #include <asm/iseries/hv_types.h>
-#include <asm/iseries/it_exp_vpd_panel.h>
 #include <asm/iseries/hv_lp_event.h>
 #include <asm/iseries/hv_lp_config.h>
 #include <asm/iseries/mf.h>
@@ -68,7 +68,8 @@ static DEFINE_SPINLOCK(statuslock);
  * For each kind of event we allocate a buffer that is
  * guaranteed not to cross a page boundary
  */
-static unsigned char event_buffer[VIO_MAX_SUBTYPES * 256] __page_aligned;
+static unsigned char event_buffer[VIO_MAX_SUBTYPES * 256]
+       __attribute__((__aligned__(4096)));
 static atomic_t event_buffer_available[VIO_MAX_SUBTYPES];
 static int event_buffer_initialised;
 
@@ -115,13 +116,15 @@ static int proc_viopath_show(struct seq_file *m, void *v)
        dma_addr_t handle;
        HvLpEvent_Rc hvrc;
        DECLARE_MUTEX_LOCKED(Semaphore);
+       struct device_node *node;
+       const char *sysid;
 
-       buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
+       buf = kmalloc(HW_PAGE_SIZE, GFP_KERNEL);
        if (!buf)
                return 0;
-       memset(buf, 0, PAGE_SIZE);
+       memset(buf, 0, HW_PAGE_SIZE);
 
-       handle = dma_map_single(iSeries_vio_dev, buf, PAGE_SIZE,
+       handle = dma_map_single(iSeries_vio_dev, buf, HW_PAGE_SIZE,
                                DMA_FROM_DEVICE);
 
        hvrc = HvCallEvent_signalLpEventFast(viopath_hostLp,
@@ -131,7 +134,7 @@ static int proc_viopath_show(struct seq_file *m, void *v)
                        viopath_sourceinst(viopath_hostLp),
                        viopath_targetinst(viopath_hostLp),
                        (u64)(unsigned long)&Semaphore, VIOVERSION << 16,
-                       ((u64)handle) << 32, PAGE_SIZE, 0, 0);
+                       ((u64)handle) << 32, HW_PAGE_SIZE, 0, 0);
 
        if (hvrc != HvLpEvent_Rc_Good)
                printk(VIOPATH_KERN_WARN "hv error on op %d\n", (int)hvrc);
@@ -140,21 +143,28 @@ static int proc_viopath_show(struct seq_file *m, void *v)
 
        vlanMap = HvLpConfig_getVirtualLanIndexMap();
 
-       buf[PAGE_SIZE-1] = '\0';
+       buf[HW_PAGE_SIZE-1] = '\0';
        seq_printf(m, "%s", buf);
-       seq_printf(m, "AVAILABLE_VETH=%x\n", vlanMap);
-       seq_printf(m, "SRLNBR=%c%c%c%c%c%c%c\n",
-                  e2a(xItExtVpdPanel.mfgID[2]),
-                  e2a(xItExtVpdPanel.mfgID[3]),
-                  e2a(xItExtVpdPanel.systemSerial[1]),
-                  e2a(xItExtVpdPanel.systemSerial[2]),
-                  e2a(xItExtVpdPanel.systemSerial[3]),
-                  e2a(xItExtVpdPanel.systemSerial[4]),
-                  e2a(xItExtVpdPanel.systemSerial[5]));
-
-       dma_unmap_single(iSeries_vio_dev, handle, PAGE_SIZE, DMA_FROM_DEVICE);
+
+       dma_unmap_single(iSeries_vio_dev, handle, HW_PAGE_SIZE,
+                        DMA_FROM_DEVICE);
        kfree(buf);
 
+       seq_printf(m, "AVAILABLE_VETH=%x\n", vlanMap);
+
+       node = of_find_node_by_path("/");
+       sysid = NULL;
+       if (node != NULL)
+               sysid = get_property(node, "system-id", NULL);
+
+       if (sysid == NULL)
+               seq_printf(m, "SRLNBR=<UNKNOWN>\n");
+       else
+               /* Skip "IBM," on front of serial number, see dt.c */
+               seq_printf(m, "SRLNBR=%s\n", sysid + 4);
+
+       of_node_put(node);
+
        return 0;
 }
 
@@ -268,7 +278,7 @@ static void handleMonitorEvent(struct HvLpEvent *event)
         * First see if this is just a normal monitor message from the
         * other partition
         */
-       if (event->xFlags.xFunction == HvLpEvent_Function_Int) {
+       if (hvlpevent_is_int(event)) {
                remoteLp = event->xSourceLp;
                if (!viopathStatus[remoteLp].isActive)
                        sendMonMsg(remoteLp);
@@ -329,13 +339,12 @@ static void handleConfig(struct HvLpEvent *event)
 {
        if (!event)
                return;
-       if (event->xFlags.xFunction == HvLpEvent_Function_Int) {
+       if (hvlpevent_is_int(event)) {
                printk(VIOPATH_KERN_WARN
                       "unexpected config request from partition %d",
                       event->xSourceLp);
 
-               if ((event->xFlags.xFunction == HvLpEvent_Function_Int) &&
-                   (event->xFlags.xAckInd == HvLpEvent_AckInd_DoAck)) {
+               if (hvlpevent_need_ack(event)) {
                        event->xRc = HvLpEvent_Rc_InvalidSubtype;
                        HvCallEvent_ackLpEvent(event);
                }
@@ -375,7 +384,7 @@ static void vio_handleEvent(struct HvLpEvent *event, struct pt_regs *regs)
        int subtype = (event->xSubtype & VIOMAJOR_SUBTYPE_MASK)
                >> VIOMAJOR_SUBTYPE_SHIFT;
 
-       if (event->xFlags.xFunction == HvLpEvent_Function_Int) {
+       if (hvlpevent_is_int(event)) {
                remoteLp = event->xSourceLp;
                /*
                 * The isActive is checked because if the hosting partition
@@ -434,8 +443,7 @@ static void vio_handleEvent(struct HvLpEvent *event, struct pt_regs *regs)
                       "unexpected virtual io event subtype %d from partition %d\n",
                       event->xSubtype, remoteLp);
                /* No handler.  Ack if necessary */
-               if ((event->xFlags.xFunction == HvLpEvent_Function_Int) &&
-                   (event->xFlags.xAckInd == HvLpEvent_AckInd_DoAck)) {
+               if (hvlpevent_is_int(event) && hvlpevent_need_ack(event)) {
                        event->xRc = HvLpEvent_Rc_InvalidSubtype;
                        HvCallEvent_ackLpEvent(event);
                }