rpms/kernel/devel linux-2.6-bcm43xx-revert-breakage.patch, NONE, 1.1 linux-2.6-powerpc-generic-suspend-1-remove-dead-code.patch, NONE, 1.1 linux-2.6-powerpc-generic-suspend-2-remove-adb-sleep-notifier.patch, NONE, 1.1 linux-2.6-powerpc-generic-suspend-3-remove-dmasound.patch, NONE, 1.1 linux-2.6-powerpc-generic-suspend-4-kill-pmu-sleep-notifier.patch, NONE, 1.1 linux-2.6-powerpc-generic-suspend-5-pmu-pm_ops.patch, NONE, 1.1 linux-2.6-ps3-gelic-wireless.patch, 1.2, 1.3 linux-2.6-ps3-legacy-bootloader-hack.patch, NONE, 1.1 linux-2.6-ps3-storage-alias.patch, NONE, 1.1 kernel.spec, 1.37, 1.38 linux-2.6-ibmvscsi-schizo.patch, 1.2, 1.3

David Woodhouse (dwmw2) fedora-extras-commits at redhat.com
Tue Jul 31 11:33:27 UTC 2007


Author: dwmw2

Update of /cvs/pkgs/rpms/kernel/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv12805

Modified Files:
	kernel.spec linux-2.6-ibmvscsi-schizo.patch 
Added Files:
	linux-2.6-bcm43xx-revert-breakage.patch 
	linux-2.6-powerpc-generic-suspend-1-remove-dead-code.patch 
	linux-2.6-powerpc-generic-suspend-2-remove-adb-sleep-notifier.patch 
	linux-2.6-powerpc-generic-suspend-3-remove-dmasound.patch 
	linux-2.6-powerpc-generic-suspend-4-kill-pmu-sleep-notifier.patch 
	linux-2.6-powerpc-generic-suspend-5-pmu-pm_ops.patch 
	linux-2.6-ps3-gelic-wireless.patch 
	linux-2.6-ps3-legacy-bootloader-hack.patch 
	linux-2.6-ps3-storage-alias.patch 
Log Message:
* Tue Jul 31 2007 David Woodhouse <dwmw2 at infradead.org>
- Fix bcm43xx regression
- Restore PowerMac suspend via /sys/power/state
- PS3 fixes
- Restore ibmvscsi support on iSeries
- Re-enable CONFIG_IDE_PROC_FS to fix ybin


linux-2.6-bcm43xx-revert-breakage.patch:

--- NEW FILE linux-2.6-bcm43xx-revert-breakage.patch ---
REVERT:

commit 77548f58070894cf5970a110981e511ffe793369
Author: Larry Finger <Larry.Finger at lwfinger.net>
Date:   Sat May 26 22:21:29 2007 -0500

    [PATCH] bcm43xx: Fix deviation from specifications in set_baseband_attenuation
    
    A disagreement between the specifications and the bcm43xx code has just
    been discovered and is hereby fixed.
    
    Signed-off-by: Larry Finger <Larry.Finger at lwfinger.net>
    Signed-off-by: John W. Linville <linville at tuxdriver.com>

diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c
index b37f1e3..d779199 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c
@@ -1638,7 +1638,7 @@ void bcm43xx_phy_set_baseband_attenuation(struct bcm43xx_private *bcm,
 		return;
 	}
 
-	if (phy->analog == 1) {
+	if (phy->analog > 1) {
 		value = bcm43xx_phy_read(bcm, 0x0060) & ~0x003C;
 		value |= (baseband_attenuation << 2) & 0x003C;
 	} else {

linux-2.6-powerpc-generic-suspend-1-remove-dead-code.patch:

--- NEW FILE linux-2.6-powerpc-generic-suspend-1-remove-dead-code.patch ---
Subject: remove dead code in via-pmu68k

When suspend is ever implemented for pmu68k it really should follow the
generic pm_ops concept and not mirror the platform-specific /dev/pmu
device with ioctls on it. Hence, this patch removes the unused code there;
should the implementors need it they can look at via-pmu.c and/or the
history of the file.

Signed-off-by: Johannes Berg <johannes at sipsolutions.net
Cc: linux-m68k at vger.kernel.org
Cc: Benjamin Herrenschmidt <benh at kernel.crashing.org>

---
 drivers/macintosh/via-pmu68k.c |  240 -----------------------------------------
 1 file changed, 240 deletions(-)

--- wireless-dev.orig/drivers/macintosh/via-pmu68k.c	2007-07-18 14:25:25.372900849 +0200
+++ wireless-dev/drivers/macintosh/via-pmu68k.c	2007-07-18 14:25:38.672900849 +0200
@@ -818,243 +818,3 @@ pmu_present(void)
 {
 	return (pmu_kind != PMU_UNKNOWN);
 }
-
-#if 0 /* needs some work for 68K */
-
-/*
- * This struct is used to store config register values for
- * PCI devices which may get powered off when we sleep.
- */
-static struct pci_save {
-	u16	command;
-	u16	cache_lat;
-	u16	intr;
-} *pbook_pci_saves;
-static int n_pbook_pci_saves;
-
-static inline void
-pbook_pci_save(void)
-{
-	int npci;
-	struct pci_dev *pd = NULL;
-	struct pci_save *ps;
-
-	npci = 0;
-	while ((pd = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pd)) != NULL)
-		++npci;
-	n_pbook_pci_saves = npci;
-	if (npci == 0)
-		return;
-	ps = kmalloc(npci * sizeof(*ps), GFP_KERNEL);
-	pbook_pci_saves = ps;
-	if (ps == NULL)
-		return;
-
-	pd = NULL;
-	while ((pd = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pd)) != NULL) {
-		pci_read_config_word(pd, PCI_COMMAND, &ps->command);
-		pci_read_config_word(pd, PCI_CACHE_LINE_SIZE, &ps->cache_lat);
-		pci_read_config_word(pd, PCI_INTERRUPT_LINE, &ps->intr);
-		++ps;
-		--npci;
-	}
-}
-
-static inline void
-pbook_pci_restore(void)
-{
-	u16 cmd;
-	struct pci_save *ps = pbook_pci_saves;
-	struct pci_dev *pd = NULL;
-	int j;
-
-	while ((pd = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pd)) != NULL) {
-		if (ps->command == 0)
-			continue;
-		pci_read_config_word(pd, PCI_COMMAND, &cmd);
-		if ((ps->command & ~cmd) == 0)
-			continue;
-		switch (pd->hdr_type) {
-		case PCI_HEADER_TYPE_NORMAL:
-			for (j = 0; j < 6; ++j)
-				pci_write_config_dword(pd,
-					PCI_BASE_ADDRESS_0 + j*4,
-					pd->resource[j].start);
-			pci_write_config_dword(pd, PCI_ROM_ADDRESS,
-			       pd->resource[PCI_ROM_RESOURCE].start);
-			pci_write_config_word(pd, PCI_CACHE_LINE_SIZE,
-				ps->cache_lat);
-			pci_write_config_word(pd, PCI_INTERRUPT_LINE,
-				ps->intr);
-			pci_write_config_word(pd, PCI_COMMAND, ps->command);
-			break;
-			/* other header types not restored at present */
-		}
-	}
-}
-
-/*
- * Put the powerbook to sleep.
- */
-#define IRQ_ENABLE	((unsigned int *)0xf3000024)
-#define MEM_CTRL	((unsigned int *)0xf8000070)
-
-int powerbook_sleep(void)
-{
-	int ret, i, x;
-	static int save_backlight;
-	static unsigned int save_irqen;
-	unsigned long msr;
-	unsigned int hid0;
-	unsigned long p, wait;
-	struct adb_request sleep_req;
-
-	/* Notify device drivers */
-	ret = blocking_notifier_call_chain(&sleep_notifier_list,
-			PBOOK_SLEEP, NULL);
-	if (ret & NOTIFY_STOP_MASK)
-		return -EBUSY;
-
-	/* Sync the disks. */
-	/* XXX It would be nice to have some way to ensure that
-	 * nobody is dirtying any new buffers while we wait. */
-	sys_sync();
-
-	/* Turn off the display backlight */
-	save_backlight = backlight_enabled;
-	if (save_backlight)
-		pmu_enable_backlight(0);
-
-	/* Give the disks a little time to actually finish writing */
-	for (wait = jiffies + (HZ/4); time_before(jiffies, wait); )
-		mb();
-
-	/* Disable all interrupts except pmu */
-	save_irqen = in_le32(IRQ_ENABLE);
-	for (i = 0; i < 32; ++i)
-		if (i != vias->intrs[0].line && (save_irqen & (1 << i)))
-			disable_irq(i);
-	asm volatile("mtdec %0" : : "r" (0x7fffffff));
-
-	/* Save the state of PCI config space for some slots */
-	pbook_pci_save();
-
-	/* Set the memory controller to keep the memory refreshed
-	   while we're asleep */
-	for (i = 0x403f; i >= 0x4000; --i) {
-		out_be32(MEM_CTRL, i);
-		do {
-			x = (in_be32(MEM_CTRL) >> 16) & 0x3ff;
-		} while (x == 0);
-		if (x >= 0x100)
-			break;
-	}
-
-	/* Ask the PMU to put us to sleep */
-	pmu_request(&sleep_req, NULL, 5, PMU_SLEEP, 'M', 'A', 'T', 'T');
-	while (!sleep_req.complete)
-		mb();
-	/* displacement-flush the L2 cache - necessary? */
-	for (p = KERNELBASE; p < KERNELBASE + 0x100000; p += 0x1000)
-		i = *(volatile int *)p;
-	asleep = 1;
-
-	/* Put the CPU into sleep mode */
-	asm volatile("mfspr %0,1008" : "=r" (hid0) :);
-	hid0 = (hid0 & ~(HID0_NAP | HID0_DOZE)) | HID0_SLEEP;
-	asm volatile("mtspr 1008,%0" : : "r" (hid0));
-	local_save_flags(msr);
-	msr |= MSR_POW | MSR_EE;
-	local_irq_restore(msr);
-	udelay(10);
-
-	/* OK, we're awake again, start restoring things */
-	out_be32(MEM_CTRL, 0x3f);
-	pbook_pci_restore();
-
-	/* wait for the PMU interrupt sequence to complete */
-	while (asleep)
-		mb();
-
-	/* reenable interrupts */
-	for (i = 0; i < 32; ++i)
-		if (i != vias->intrs[0].line && (save_irqen & (1 << i)))
-			enable_irq(i);
-
-	/* Notify drivers */
-	blocking_notifier_call_chain(&sleep_notifier_list, PBOOK_WAKE, NULL);
-
-	/* reenable ADB autopoll */
-	pmu_adb_autopoll(adb_dev_map);
-
-	/* Turn on the screen backlight, if it was on before */
-	if (save_backlight)
-		pmu_enable_backlight(1);
-
-	/* Wait for the hard disk to spin up */
-
-	return 0;
-}
-
-/*
- * Support for /dev/pmu device
- */
-static int pmu_open(struct inode *inode, struct file *file)
-{
-	return 0;
-}
-
-static ssize_t pmu_read(struct file *file, char *buf,
-			size_t count, loff_t *ppos)
-{
-	return 0;
-}
-
-static ssize_t pmu_write(struct file *file, const char *buf,
-			 size_t count, loff_t *ppos)
-{
-	return 0;
-}
-
-static int pmu_ioctl(struct inode * inode, struct file *filp,
-		     u_int cmd, u_long arg)
-{
-	int error;
-	__u32 value;
-
-	switch (cmd) {
-	    case PMU_IOC_SLEEP:
-	    	return -ENOSYS;
-	    case PMU_IOC_GET_BACKLIGHT:
-		return put_user(backlight_level, (__u32 *)arg);
-	    case PMU_IOC_SET_BACKLIGHT:
-		error = get_user(value, (__u32 *)arg);
-		if (!error)
-			pmu_set_brightness(value);
-		return error;
-	    case PMU_IOC_GET_MODEL:
-	    	return put_user(pmu_kind, (__u32 *)arg);
-	}
-	return -EINVAL;
-}
-
-static const struct file_operations pmu_device_fops = {
-	.read		= pmu_read,
-	.write		= pmu_write,
-	.ioctl		= pmu_ioctl,
-	.open		= pmu_open,
-};
-
-static struct miscdevice pmu_device = {
-	PMU_MINOR, "pmu", &pmu_device_fops
-};
-
-void pmu_device_init(void)
-{
-	if (!via)
-		return;
-	if (misc_register(&pmu_device) < 0)
-		printk(KERN_ERR "via-pmu68k: cannot register misc device.\n");
-}
-#endif /* CONFIG_PMAC_PBOOK */
-

linux-2.6-powerpc-generic-suspend-2-remove-adb-sleep-notifier.patch:

--- NEW FILE linux-2.6-powerpc-generic-suspend-2-remove-adb-sleep-notifier.patch ---
Subject: adb: replace sleep notifier with platform driver suspend/resume hooks

This patch replaces the pmu sleep notifier that adb had with
suspend/resume hooks in a new platform driver/device.

Signed-off-by: Johannes Berg <johannes at sipsolutions.net>
Cc: Benjamin Herrenschmidt <benh at kernel.crashing.org>

---
Yes, it's more a hack. But the whole code is such a mess that I could
work for days fixing it. Don't feel like doing that right now.

 drivers/macintosh/adb.c |   96 ++++++++++++++++++++++++++++--------------------
 1 file changed, 57 insertions(+), 39 deletions(-)

--- wireless-dev.orig/drivers/macintosh/adb.c	2007-07-18 14:25:25.202900849 +0200
+++ wireless-dev/drivers/macintosh/adb.c	2007-07-18 14:25:39.252900849 +0200
@@ -89,14 +89,6 @@ static int sleepy_trackpad;
 static int autopoll_devs;
 int __adb_probe_sync;
 
-#ifdef CONFIG_PM
-static void adb_notify_sleep(struct pmu_sleep_notifier *self, int when);
-static struct pmu_sleep_notifier adb_sleep_notifier = {
-	adb_notify_sleep,
-	SLEEP_LEVEL_ADB,
-};
-#endif
-
 static int adb_scan_bus(void);
 static int do_adb_reset_bus(void);
 static void adbdev_init(void);
@@ -281,6 +273,36 @@ adb_reset_bus(void)
 	return 0;
 }
 
+#ifdef CONFIG_PM
+/*
+ * notify clients before sleep
+ */
+static int adb_suspend(struct platform_device *dev, pm_message_t state)
+{
+	adb_got_sleep = 1;
+	/* We need to get a lock on the probe thread */
+	down(&adb_probe_mutex);
+	/* Stop autopoll */
+	if (adb_controller->autopoll)
+		adb_controller->autopoll(0);
+	blocking_notifier_call_chain(&adb_client_list, ADB_MSG_POWERDOWN, NULL);
+
+	return 0;
+}
+
+/*
+ * reset bus after sleep
+ */
+static int adb_resume(struct platform_device *dev)
+{
+	adb_got_sleep = 0;
+	up(&adb_probe_mutex);
+	adb_reset_bus();
+
+	return 0;
+}
+#endif /* CONFIG_PM */
+
 int __init adb_init(void)
 {
 	struct adb_driver *driver;
@@ -313,14 +335,12 @@ int __init adb_init(void)
 		printk(KERN_WARNING "Warning: no ADB interface detected\n");
 		adb_controller = NULL;
 	} else {
-#ifdef CONFIG_PM
-		pmu_register_sleep_notifier(&adb_sleep_notifier);
-#endif /* CONFIG_PM */
 #ifdef CONFIG_PPC
 		if (machine_is_compatible("AAPL,PowerBook1998") ||
 			machine_is_compatible("PowerBook1,1"))
 			sleepy_trackpad = 1;
 #endif /* CONFIG_PPC */
+
 		init_completion(&adb_probe_task_comp);
 		adbdev_init();
 		adb_reset_bus();
@@ -330,33 +350,6 @@ int __init adb_init(void)
 
 __initcall(adb_init);
 
-#ifdef CONFIG_PM
-/*
- * notify clients before sleep and reset bus afterwards
- */
-void
-adb_notify_sleep(struct pmu_sleep_notifier *self, int when)
-{
-	switch (when) {
-	case PBOOK_SLEEP_REQUEST:
-		adb_got_sleep = 1;
-		/* We need to get a lock on the probe thread */
-		down(&adb_probe_mutex);
-		/* Stop autopoll */
-		if (adb_controller->autopoll)
-			adb_controller->autopoll(0);
-		blocking_notifier_call_chain(&adb_client_list,
-			ADB_MSG_POWERDOWN, NULL);
-		break;
-	case PBOOK_WAKE:
-		adb_got_sleep = 0;
-		up(&adb_probe_mutex);
-		adb_reset_bus();
-		break;
-	}
-}
-#endif /* CONFIG_PM */
-
 static int
 do_adb_reset_bus(void)
 {
@@ -864,7 +857,29 @@ static const struct file_operations adb_
 	.release	= adb_release,
 };
 
-static void
+static struct platform_driver adb_pfdrv = {
+	.driver = {
+		.name = "adb",
+	},
+#ifdef CONFIG_PM
+	.suspend = adb_suspend,
+	.resume = adb_resume,
+#endif
+};
+
+static struct platform_device adb_pfdev = {
+	.name = "adb",
+};
+
+static int __init
+adb_dummy_probe(struct platform_device *dev)
+{
+	if (dev == &adb_pfdev)
+		return 0;
+	return -ENODEV;
+}
+
+static void __init
 adbdev_init(void)
 {
 	if (register_chrdev(ADB_MAJOR, "adb", &adb_fops)) {
@@ -876,4 +891,7 @@ adbdev_init(void)
 	if (IS_ERR(adb_dev_class))
 		return;
 	class_device_create(adb_dev_class, NULL, MKDEV(ADB_MAJOR, 0), NULL, "adb");
+
+	platform_device_register(&adb_pfdev);
+	platform_driver_probe(&adb_pfdrv, adb_dummy_probe);
 }

linux-2.6-powerpc-generic-suspend-3-remove-dmasound.patch:

--- NEW FILE linux-2.6-powerpc-generic-suspend-3-remove-dmasound.patch ---
Subject: remove awacs dmasound

This patch kills the obsolete awacs dmasound because it is in
the way of doing power management improvements since it uses
ancient API.

Signed-off-by: Johannes Berg <johannes at sipsolutions.net>
Cc: Benjamin Herrenschmidt <benh at kernel.crashing.org>
Cc: Adrian Bunk <bunk at stusta.de>

---
 sound/oss/dmasound/Makefile          |    6 
 sound/oss/dmasound/awacs_defs.h      |  251 --
 sound/oss/dmasound/dac3550a.c        |  209 --
 sound/oss/dmasound/dmasound_awacs.c  | 3215 -----------------------------------
 sound/oss/dmasound/tas3001c.c        |  849 ---------
 sound/oss/dmasound/tas3001c.h        |   64 
 sound/oss/dmasound/tas3001c_tables.c |  375 ----
 sound/oss/dmasound/tas3004.c         | 1138 ------------
 sound/oss/dmasound/tas3004.h         |   77 
 sound/oss/dmasound/tas3004_tables.c  |  301 ---
 sound/oss/dmasound/tas_common.c      |  214 --
 sound/oss/dmasound/tas_common.h      |  284 ---
 sound/oss/dmasound/tas_eq_prefs.h    |   24 
 sound/oss/dmasound/tas_ioctl.h       |   23 
 sound/oss/dmasound/trans_16.c        |  898 ---------
 15 files changed, 7928 deletions(-)

--- wireless-dev.orig/sound/oss/dmasound/Makefile	2007-07-18 14:25:24.662900849 +0200
+++ wireless-dev/sound/oss/dmasound/Makefile	2007-07-18 14:25:39.812900849 +0200
@@ -2,12 +2,6 @@
 # Makefile for the DMA sound driver
 #
 
-dmasound_pmac-y			+= dmasound_awacs.o \
-				   trans_16.o dac3550a.o tas_common.o \
-				   tas3001c.o tas3001c_tables.o \
-				   tas3004.o tas3004_tables.o
-
 obj-$(CONFIG_DMASOUND_ATARI)	+= dmasound_core.o dmasound_atari.o
-obj-$(CONFIG_DMASOUND_PMAC)	+= dmasound_core.o dmasound_pmac.o
 obj-$(CONFIG_DMASOUND_PAULA)	+= dmasound_core.o dmasound_paula.o
 obj-$(CONFIG_DMASOUND_Q40)	+= dmasound_core.o dmasound_q40.o
--- wireless-dev.orig/sound/oss/dmasound/awacs_defs.h	2007-07-18 14:25:24.722900849 +0200
+++ /dev/null	1970-01-01 00:00:00.000000000 +0000
@@ -1,251 +0,0 @@
-/*********************************************************/
-/* This file was written by someone, somewhere, sometime */
-/* And is released into the Public Domain                */
-/*********************************************************/
-
-#ifndef _AWACS_DEFS_H_
-#define _AWACS_DEFS_H_
-
-/*******************************/
-/* AWACs Audio Register Layout */
-/*******************************/
-
-struct awacs_regs {
-    unsigned	control;	/* Audio control register */
-    unsigned	pad0[3];
-    unsigned	codec_ctrl;	/* Codec control register */
-    unsigned	pad1[3];
-    unsigned	codec_stat;	/* Codec status register */
-    unsigned	pad2[3];
-    unsigned	clip_count;	/* Clipping count register */
-    unsigned	pad3[3];
-    unsigned	byteswap;	/* Data is little-endian if 1 */
-};
-
-/*******************/
-/* Audio Bit Masks */
-/*******************/
-
-/* Audio Control Reg Bit Masks */
-/* ----- ------- --- --- ----- */
-#define MASK_ISFSEL	(0xf)		/* Input SubFrame Select */
-#define MASK_OSFSEL	(0xf << 4)	/* Output SubFrame Select */
-#define MASK_RATE	(0x7 << 8)	/* Sound Rate */
-#define MASK_CNTLERR	(0x1 << 11)	/* Error */
-#define MASK_PORTCHG	(0x1 << 12)	/* Port Change */
-#define MASK_IEE	(0x1 << 13)	/* Enable Interrupt on Error */
-#define MASK_IEPC	(0x1 << 14)	/* Enable Interrupt on Port Change */
-#define MASK_SSFSEL	(0x3 << 15)	/* Status SubFrame Select */
-
-/* Audio Codec Control Reg Bit Masks */
-/* ----- ----- ------- --- --- ----- */
-#define MASK_NEWECMD	(0x1 << 24)	/* Lock: don't write to reg when 1 */
-#define MASK_EMODESEL	(0x3 << 22)	/* Send info out on which frame? */
-#define MASK_EXMODEADDR	(0x3ff << 12)	/* Extended Mode Address -- 10 bits */
-#define MASK_EXMODEDATA	(0xfff)		/* Extended Mode Data -- 12 bits */
-
-/* Audio Codec Control Address Values / Masks */
-/* ----- ----- ------- ------- ------ - ----- */
-#define MASK_ADDR0	(0x0 << 12)	/* Expanded Data Mode Address 0 */
-#define MASK_ADDR_MUX	MASK_ADDR0	/* Mux Control */
-#define MASK_ADDR_GAIN	MASK_ADDR0
-
-#define MASK_ADDR1	(0x1 << 12)	/* Expanded Data Mode Address 1 */
-#define MASK_ADDR_MUTE	MASK_ADDR1
-#define MASK_ADDR_RATE	MASK_ADDR1
-
-#define MASK_ADDR2	(0x2 << 12)	/* Expanded Data Mode Address 2 */
-#define MASK_ADDR_VOLA	MASK_ADDR2	/* Volume Control A -- Headphones */
-#define MASK_ADDR_VOLHD MASK_ADDR2
-
-#define MASK_ADDR4	(0x4 << 12)	/* Expanded Data Mode Address 4 */
-#define MASK_ADDR_VOLC	MASK_ADDR4	/* Volume Control C -- Speaker */
-#define MASK_ADDR_VOLSPK MASK_ADDR4
-
-/* additional registers of screamer */
-#define MASK_ADDR5	(0x5 << 12)	/* Expanded Data Mode Address 5 */
-#define MASK_ADDR6	(0x6 << 12)	/* Expanded Data Mode Address 6 */
-#define MASK_ADDR7	(0x7 << 12)	/* Expanded Data Mode Address 7 */
-
-/* Address 0 Bit Masks & Macros */
-/* ------- - --- ----- - ------ */
-#define MASK_GAINRIGHT	(0xf)		/* Gain Right Mask */
-#define MASK_GAINLEFT	(0xf << 4)	/* Gain Left Mask */
-#define MASK_GAINLINE	(0x1 << 8)	/* Disable Mic preamp */
-#define MASK_GAINMIC	(0x0 << 8)	/* Enable Mic preamp */
-
-#define MASK_MUX_CD	(0x1 << 9)	/* Select CD in MUX */
-#define MASK_MUX_MIC	(0x1 << 10)	/* Select Mic in MUX */
-#define MASK_MUX_AUDIN	(0x1 << 11)	/* Select Audio In in MUX */
-#define MASK_MUX_LINE	MASK_MUX_AUDIN
-
-#define GAINRIGHT(x)	((x) & MASK_GAINRIGHT)
-#define GAINLEFT(x)	(((x) << 4) & MASK_GAINLEFT)
-
-#define DEF_CD_GAIN 0x00bb
-#define DEF_MIC_GAIN 0x00cc
-
-/* Address 1 Bit Masks */
-/* ------- - --- ----- */
-#define MASK_ADDR1RES1	(0x3)		/* Reserved */
-#define MASK_RECALIBRATE (0x1 << 2)	/* Recalibrate */
-#define MASK_SAMPLERATE	(0x7 << 3)	/* Sample Rate: */
-#define MASK_LOOPTHRU	(0x1 << 6)	/* Loopthrough Enable */
-#define MASK_CMUTE	(0x1 << 7)	/* Output C (Speaker) Mute when 1 */
-#define MASK_SPKMUTE	MASK_CMUTE
-#define MASK_ADDR1RES2	(0x1 << 8)	/* Reserved */
-#define MASK_AMUTE	(0x1 << 9)	/* Output A (Headphone) Mute when 1 */
-#define MASK_HDMUTE	MASK_AMUTE
-#define MASK_PAROUT0	(0x1 << 10)	/* Parallel Output 0 */
-#define MASK_PAROUT1	(0x2 << 10)	/* Parallel Output 1 */
-
-#define MASK_MIC_BOOST  (0x4)           /* screamer mic boost */
-
-#define SAMPLERATE_48000	(0x0 << 3)	/* 48 or 44.1 kHz */
-#define SAMPLERATE_32000	(0x1 << 3)	/* 32 or 29.4 kHz */
-#define SAMPLERATE_24000	(0x2 << 3)	/* 24 or 22.05 kHz */
-#define SAMPLERATE_19200	(0x3 << 3)	/* 19.2 or 17.64 kHz */
-#define SAMPLERATE_16000	(0x4 << 3)	/* 16 or 14.7 kHz */
-#define SAMPLERATE_12000	(0x5 << 3)	/* 12 or 11.025 kHz */
-#define SAMPLERATE_9600		(0x6 << 3)	/* 9.6 or 8.82 kHz */
-#define SAMPLERATE_8000		(0x7 << 3)	/* 8 or 7.35 kHz */
-
-/* Address 2 & 4 Bit Masks & Macros */
-/* ------- - - - --- ----- - ------ */
-#define MASK_OUTVOLRIGHT (0xf)		/* Output Right Volume */
-#define MASK_ADDR2RES1	(0x2 << 4)	/* Reserved */
-#define MASK_ADDR4RES1	MASK_ADDR2RES1
-#define MASK_OUTVOLLEFT	(0xf << 6)	/* Output Left Volume */
-#define MASK_ADDR2RES2	(0x2 << 10)	/* Reserved */
-#define MASK_ADDR4RES2	MASK_ADDR2RES2
-
-#define VOLRIGHT(x)	(((~(x)) & MASK_OUTVOLRIGHT))
-#define VOLLEFT(x)	(((~(x)) << 6) & MASK_OUTVOLLEFT)
-
-/* Audio Codec Status Reg Bit Masks */
-/* ----- ----- ------ --- --- ----- */
-#define MASK_EXTEND	(0x1 << 23)	/* Extend */
-#define MASK_VALID	(0x1 << 22)	/* Valid Data? */
-#define MASK_OFLEFT	(0x1 << 21)	/* Overflow Left */
-#define MASK_OFRIGHT	(0x1 << 20)	/* Overflow Right */
-#define MASK_ERRCODE	(0xf << 16)	/* Error Code */
-#define MASK_REVISION	(0xf << 12)	/* Revision Number */
-#define MASK_MFGID	(0xf << 8)	/* Mfg. ID */
-#define MASK_CODSTATRES	(0xf << 4)	/* bits 4 - 7 reserved */
-#define MASK_INPPORT	(0xf)		/* Input Port */
-#define MASK_HDPCONN	8		/* headphone plugged in */
-
-/* Clipping Count Reg Bit Masks */
-/* -------- ----- --- --- ----- */
-#define MASK_CLIPLEFT	(0xff << 7)	/* Clipping Count, Left Channel */
-#define MASK_CLIPRIGHT	(0xff)		/* Clipping Count, Right Channel */
-
-/* DBDMA ChannelStatus Bit Masks */
-/* ----- ------------- --- ----- */
-#define MASK_CSERR	(0x1 << 7)	/* Error */
-#define MASK_EOI	(0x1 << 6)	/* End of Input -- only for Input Channel */
-#define MASK_CSUNUSED	(0x1f << 1)	/* bits 1-5 not used */
-#define MASK_WAIT	(0x1)		/* Wait */
-
-/* Various Rates */
-/* ------- ----- */
-#define RATE_48000	(0x0 << 8)	/* 48 kHz */
-#define RATE_44100	(0x0 << 8)	/* 44.1 kHz */
[...7608 lines suppressed...]
-	userCount >>= (stereo? 2: 1);
-	ftotal = frameLeft;
-	utotal = userCount;
-	while (frameLeft) {
-		int datal,datar;
-
-		if (bal<0 && userCount == 0)
-			break;
-
-		datal = *fp++;
-		datal = (datal * software_input_volume) >> 7;
-		if (stereo) {
-			datar = *fp;
-			datar = (datar * software_input_volume) >> 7;
-		}
-		fp++;
-		if (bal < 0) {
-			if (put_user(datal, up++))
-				return -EFAULT;
-			if (stereo) {
-				if (put_user(datar, up++))
-					return -EFAULT;
-			}
-			userCount--;
-			bal += hSpeed;
-		}
-		frameLeft--;
-		bal -= sSpeed;
-	}
-	expand_read_bal=bal;
-	*frameUsed += (ftotal - frameLeft) * 4;
-	utotal -= userCount;
-	return stereo? utotal * 4: utotal * 2;
-}
-
-static ssize_t pmac_ctx_u16_read(const u_char __user *userPtr, size_t userCount,
-			   u_char frame[], ssize_t *frameUsed,
-			   ssize_t frameLeft)
-{
-	int bal = expand_read_bal;
-	int mask = (dmasound.soft.format == AFMT_U16_LE? 0x0080: 0x8000);
-	short *fp = (short *) &frame[*frameUsed];
-	short __user *up = (short __user *) userPtr;
-	int stereo = dmasound.soft.stereo;
-	int hSpeed = dmasound.hard.speed, sSpeed = dmasound.soft.speed;
-	int utotal, ftotal;
-
-	frameLeft >>= 2;
-	userCount >>= (stereo? 2: 1);
-	ftotal = frameLeft;
-	utotal = userCount;
-	while (frameLeft) {
-		int datal,datar;
-
-		if (bal<0 && userCount == 0)
-			break;
-
-		datal = *fp++;
-		datal = (datal * software_input_volume) >> 7;
-		datal ^= mask;
-		if (stereo) {
-			datar = *fp;
-			datar = (datar * software_input_volume) >> 7;
-			datar ^= mask;
-		}
-		fp++;
-		if (bal < 0) {
-			if (put_user(datal, up++))
-				return -EFAULT;
-			if (stereo) {
-				if (put_user(datar, up++))
-					return -EFAULT;
-			}
-			userCount--;
-			bal += hSpeed;
-		}
-		frameLeft--;
-		bal -= sSpeed;
-	}
-	expand_read_bal=bal;
-	*frameUsed += (ftotal - frameLeft) * 4;
-	utotal -= userCount;
-	return stereo? utotal * 4: utotal * 2;
-}
-
-
-TRANS transAwacsNormal = {
-	.ct_ulaw=	pmac_ct_law,
-	.ct_alaw=	pmac_ct_law,
-	.ct_s8=		pmac_ct_s8,
-	.ct_u8=		pmac_ct_u8,
-	.ct_s16be=	pmac_ct_s16,
-	.ct_u16be=	pmac_ct_u16,
-	.ct_s16le=	pmac_ct_s16,
-	.ct_u16le=	pmac_ct_u16,
-};
-
-TRANS transAwacsExpand = {
-	.ct_ulaw=	pmac_ctx_law,
-	.ct_alaw=	pmac_ctx_law,
-	.ct_s8=		pmac_ctx_s8,
-	.ct_u8=		pmac_ctx_u8,
-	.ct_s16be=	pmac_ctx_s16,
-	.ct_u16be=	pmac_ctx_u16,
-	.ct_s16le=	pmac_ctx_s16,
-	.ct_u16le=	pmac_ctx_u16,
-};
-
-TRANS transAwacsNormalRead = {
-	.ct_s8=		pmac_ct_s8_read,
-	.ct_u8=		pmac_ct_u8_read,
-	.ct_s16be=	pmac_ct_s16_read,
-	.ct_u16be=	pmac_ct_u16_read,
-	.ct_s16le=	pmac_ct_s16_read,
-	.ct_u16le=	pmac_ct_u16_read,
-};
-
-TRANS transAwacsExpandRead = {
-	.ct_s8=		pmac_ctx_s8_read,
-	.ct_u8=		pmac_ctx_u8_read,
-	.ct_s16be=	pmac_ctx_s16_read,
-	.ct_u16be=	pmac_ctx_u16_read,
-	.ct_s16le=	pmac_ctx_s16_read,
-	.ct_u16le=	pmac_ctx_u16_read,
-};
-
-/* translation tables */
-/* 16 bit mu-law */
-
-static short dmasound_ulaw2dma16[] = {
-	-32124,	-31100,	-30076,	-29052,	-28028,	-27004,	-25980,	-24956,
-	-23932,	-22908,	-21884,	-20860,	-19836,	-18812,	-17788,	-16764,
-	-15996,	-15484,	-14972,	-14460,	-13948,	-13436,	-12924,	-12412,
-	-11900,	-11388,	-10876,	-10364,	-9852,	-9340,	-8828,	-8316,
-	-7932,	-7676,	-7420,	-7164,	-6908,	-6652,	-6396,	-6140,
-	-5884,	-5628,	-5372,	-5116,	-4860,	-4604,	-4348,	-4092,
-	-3900,	-3772,	-3644,	-3516,	-3388,	-3260,	-3132,	-3004,
-	-2876,	-2748,	-2620,	-2492,	-2364,	-2236,	-2108,	-1980,
-	-1884,	-1820,	-1756,	-1692,	-1628,	-1564,	-1500,	-1436,
-	-1372,	-1308,	-1244,	-1180,	-1116,	-1052,	-988,	-924,
-	-876,	-844,	-812,	-780,	-748,	-716,	-684,	-652,
-	-620,	-588,	-556,	-524,	-492,	-460,	-428,	-396,
-	-372,	-356,	-340,	-324,	-308,	-292,	-276,	-260,
-	-244,	-228,	-212,	-196,	-180,	-164,	-148,	-132,
-	-120,	-112,	-104,	-96,	-88,	-80,	-72,	-64,
-	-56,	-48,	-40,	-32,	-24,	-16,	-8,	0,
-	32124,	31100,	30076,	29052,	28028,	27004,	25980,	24956,
-	23932,	22908,	21884,	20860,	19836,	18812,	17788,	16764,
-	15996,	15484,	14972,	14460,	13948,	13436,	12924,	12412,
-	11900,	11388,	10876,	10364,	9852,	9340,	8828,	8316,
-	7932,	7676,	7420,	7164,	6908,	6652,	6396,	6140,
-	5884,	5628,	5372,	5116,	4860,	4604,	4348,	4092,
-	3900,	3772,	3644,	3516,	3388,	3260,	3132,	3004,
-	2876,	2748,	2620,	2492,	2364,	2236,	2108,	1980,
-	1884,	1820,	1756,	1692,	1628,	1564,	1500,	1436,
-	1372,	1308,	1244,	1180,	1116,	1052,	988,	924,
-	876,	844,	812,	780,	748,	716,	684,	652,
-	620,	588,	556,	524,	492,	460,	428,	396,
-	372,	356,	340,	324,	308,	292,	276,	260,
-	244,	228,	212,	196,	180,	164,	148,	132,
-	120,	112,	104,	96,	88,	80,	72,	64,
-	56,	48,	40,	32,	24,	16,	8,	0,
-};
-
-/* 16 bit A-law */
-
-static short dmasound_alaw2dma16[] = {
-	-5504,	-5248,	-6016,	-5760,	-4480,	-4224,	-4992,	-4736,
-	-7552,	-7296,	-8064,	-7808,	-6528,	-6272,	-7040,	-6784,
-	-2752,	-2624,	-3008,	-2880,	-2240,	-2112,	-2496,	-2368,
-	-3776,	-3648,	-4032,	-3904,	-3264,	-3136,	-3520,	-3392,
-	-22016,	-20992,	-24064,	-23040,	-17920,	-16896,	-19968,	-18944,
-	-30208,	-29184,	-32256,	-31232,	-26112,	-25088,	-28160,	-27136,
-	-11008,	-10496,	-12032,	-11520,	-8960,	-8448,	-9984,	-9472,
-	-15104,	-14592,	-16128,	-15616,	-13056,	-12544,	-14080,	-13568,
-	-344,	-328,	-376,	-360,	-280,	-264,	-312,	-296,
-	-472,	-456,	-504,	-488,	-408,	-392,	-440,	-424,
-	-88,	-72,	-120,	-104,	-24,	-8,	-56,	-40,
-	-216,	-200,	-248,	-232,	-152,	-136,	-184,	-168,
-	-1376,	-1312,	-1504,	-1440,	-1120,	-1056,	-1248,	-1184,
-	-1888,	-1824,	-2016,	-1952,	-1632,	-1568,	-1760,	-1696,
-	-688,	-656,	-752,	-720,	-560,	-528,	-624,	-592,
-	-944,	-912,	-1008,	-976,	-816,	-784,	-880,	-848,
-	5504,	5248,	6016,	5760,	4480,	4224,	4992,	4736,
-	7552,	7296,	8064,	7808,	6528,	6272,	7040,	6784,
-	2752,	2624,	3008,	2880,	2240,	2112,	2496,	2368,
-	3776,	3648,	4032,	3904,	3264,	3136,	3520,	3392,
-	22016,	20992,	24064,	23040,	17920,	16896,	19968,	18944,
-	30208,	29184,	32256,	31232,	26112,	25088,	28160,	27136,
-	11008,	10496,	12032,	11520,	8960,	8448,	9984,	9472,
-	15104,	14592,	16128,	15616,	13056,	12544,	14080,	13568,
-	344,	328,	376,	360,	280,	264,	312,	296,
-	472,	456,	504,	488,	408,	392,	440,	424,
-	88,	72,	120,	104,	24,	8,	56,	40,
-	216,	200,	248,	232,	152,	136,	184,	168,
-	1376,	1312,	1504,	1440,	1120,	1056,	1248,	1184,
-	1888,	1824,	2016,	1952,	1632,	1568,	1760,	1696,
-	688,	656,	752,	720,	560,	528,	624,	592,
-	944,	912,	1008,	976,	816,	784,	880,	848,
-};

linux-2.6-powerpc-generic-suspend-4-kill-pmu-sleep-notifier.patch:

--- NEW FILE linux-2.6-powerpc-generic-suspend-4-kill-pmu-sleep-notifier.patch ---
Subject: via-pmu: kill sleep notifiers completely

This patch kills off the remnants of the ancient sleep notifiers.

Signed-off-by: Johannes Berg <johannes at sipsolutions.net>
Cc: Benjamin Herrenschmidt <benh at kernel.crashing.org>

---
 drivers/macintosh/via-pmu.c |   71 --------------------------------------------
 include/linux/pmu.h         |   36 ----------------------
 2 files changed, 107 deletions(-)

--- wireless-dev.orig/drivers/macintosh/via-pmu.c	2007-07-18 14:25:24.522900849 +0200
+++ wireless-dev/drivers/macintosh/via-pmu.c	2007-07-18 14:25:40.812900849 +0200
@@ -177,7 +177,6 @@ static struct proc_dir_entry *proc_pmu_b
 
 int __fake_sleep;
 int asleep;
-BLOCKING_NOTIFIER_HEAD(sleep_notifier_list);
 
 #ifdef CONFIG_ADB
 static int adb_dev_map;
@@ -1738,67 +1737,7 @@ pmu_present(void)
 	return via != 0;
 }
 
-#ifdef CONFIG_PM
-
-static LIST_HEAD(sleep_notifiers);
-
-int
-pmu_register_sleep_notifier(struct pmu_sleep_notifier *n)
-{
-	struct list_head *list;
-	struct pmu_sleep_notifier *notifier;
-
-	for (list = sleep_notifiers.next; list != &sleep_notifiers;
-	     list = list->next) {
-		notifier = list_entry(list, struct pmu_sleep_notifier, list);
-		if (n->priority > notifier->priority)
-			break;
-	}
-	__list_add(&n->list, list->prev, list);
-	return 0;
-}
-EXPORT_SYMBOL(pmu_register_sleep_notifier);
-
-int
-pmu_unregister_sleep_notifier(struct pmu_sleep_notifier* n)
-{
-	if (n->list.next == 0)
-		return -ENOENT;
-	list_del(&n->list);
-	n->list.next = NULL;
-	return 0;
-}
-EXPORT_SYMBOL(pmu_unregister_sleep_notifier);
-#endif /* CONFIG_PM */
-
 #if defined(CONFIG_PM) && defined(CONFIG_PPC32)
-
-/* Sleep is broadcast last-to-first */
-static void broadcast_sleep(int when)
-{
-	struct list_head *list;
-	struct pmu_sleep_notifier *notifier;
-
-	for (list = sleep_notifiers.prev; list != &sleep_notifiers;
-	     list = list->prev) {
-		notifier = list_entry(list, struct pmu_sleep_notifier, list);
-		notifier->notifier_call(notifier, when);
-	}
-}
-
-/* Wake is broadcast first-to-last */
-static void broadcast_wake(void)
-{
-	struct list_head *list;
-	struct pmu_sleep_notifier *notifier;
-
-	for (list = sleep_notifiers.next; list != &sleep_notifiers;
-	     list = list->next) {
-		notifier = list_entry(list, struct pmu_sleep_notifier, list);
-		notifier->notifier_call(notifier, PBOOK_WAKE);
-	}
-}
-
 /*
  * This struct is used to store config register values for
  * PCI devices which may get powered off when we sleep.
@@ -2003,9 +1942,6 @@ pmac_suspend_devices(void)
 
 	pm_prepare_console();
 	
-	/* Notify old-style device drivers */
-	broadcast_sleep(PBOOK_SLEEP_REQUEST);
-
 	/* Sync the disks. */
 	/* XXX It would be nice to have some way to ensure that
 	 * nobody is dirtying any new buffers while we wait. That
@@ -2014,12 +1950,9 @@ pmac_suspend_devices(void)
 	 */
 	sys_sync();
 
-	broadcast_sleep(PBOOK_SLEEP_NOW);
-
 	/* Send suspend call to devices, hold the device core's dpm_sem */
 	ret = device_suspend(PMSG_SUSPEND);
 	if (ret) {
-		broadcast_wake();
 		printk(KERN_ERR "Driver sleep failed\n");
 		return -EBUSY;
 	}
@@ -2060,7 +1993,6 @@ pmac_suspend_devices(void)
 		local_irq_enable();
 		preempt_enable();
 		device_resume();
-		broadcast_wake();
 		printk(KERN_ERR "Driver powerdown failed\n");
 		return -EBUSY;
 	}
@@ -2114,9 +2046,6 @@ pmac_wakeup_devices(void)
 	/* Resume devices */
 	device_resume();
 
-	/* Notify old style drivers */
-	broadcast_wake();
-
 	pm_restore_console();
 
 	return 0;
--- wireless-dev.orig/include/linux/pmu.h	2007-07-18 14:25:24.562900849 +0200
+++ wireless-dev/include/linux/pmu.h	2007-07-18 14:25:40.812900849 +0200
@@ -159,42 +159,6 @@ extern void pmu_unlock(void);
 extern int pmu_present(void);
 extern int pmu_get_model(void);
 
-#ifdef CONFIG_PM
-/*
- * Stuff for putting the powerbook to sleep and waking it again.
- *
- */
-#include <linux/list.h>
-
-struct pmu_sleep_notifier
-{
-	void (*notifier_call)(struct pmu_sleep_notifier *self, int when);
-	int priority;
-	struct list_head list;
-};
-
-/* Code values for calling sleep/wakeup handlers
- */
-#define PBOOK_SLEEP_REQUEST	1
-#define PBOOK_SLEEP_NOW		2
-#define PBOOK_WAKE		3
-
-/* priority levels in notifiers */
-#define SLEEP_LEVEL_VIDEO	100	/* Video driver (first wake) */
-#define SLEEP_LEVEL_MEDIABAY	90	/* Media bay driver */
-#define SLEEP_LEVEL_BLOCK	80	/* IDE, SCSI */
-#define SLEEP_LEVEL_NET		70	/* bmac, gmac */
-#define SLEEP_LEVEL_MISC	60	/* Anything else */
-#define SLEEP_LEVEL_USERLAND	55	/* Reserved for apm_emu */
-#define SLEEP_LEVEL_ADB		50	/* ADB (async) */
-#define SLEEP_LEVEL_SOUND	40	/* Sound driver (blocking) */
-
-/* special register notifier functions */
-int pmu_register_sleep_notifier(struct pmu_sleep_notifier* notifier);
-int pmu_unregister_sleep_notifier(struct pmu_sleep_notifier* notifier);
-
-#endif /* CONFIG_PM */
-
 #define PMU_MAX_BATTERIES	2
 
 /* values for pmu_power_flags */

linux-2.6-powerpc-generic-suspend-5-pmu-pm_ops.patch:

--- NEW FILE linux-2.6-powerpc-generic-suspend-5-pmu-pm_ops.patch ---
Subject: [PATCH] powermac: proper sleep management

After having removed the power management ops from powermac completely, this
patch adds them back for PMU based machines, directly in the PMU driver.
This finally allows suspending via /sys/power/state on powerbooks.

The patch also replaces the PMU ioctl with a simple call to
pm_suspend(PM_SUSPEND_MEM) and puts the sleep-related PMU ioctls onto the
feature-removal schedule.

Signed-off-by: Johannes Berg <johannes at sipsolutions.net>
Cc: Benjamin Herrenschmidt <benh at kernel.crashing.org>

---
 Documentation/feature-removal-schedule.txt |   10 
 drivers/macintosh/via-pmu.c                |  343 +++++++++++++----------------
 2 files changed, 169 insertions(+), 184 deletions(-)

--- wireless-dev.orig/drivers/macintosh/via-pmu.c	2007-07-18 14:25:40.812900849 +0200
+++ wireless-dev/drivers/macintosh/via-pmu.c	2007-07-18 14:25:42.072900849 +0200
@@ -61,6 +61,7 @@
 #include <asm/cputable.h>
 #include <asm/time.h>
 #include <asm/backlight.h>
+#include <asm/suspend.h>
 
 #include "via-pmu-event.h"
 
@@ -155,9 +156,6 @@ static int drop_interrupts;
 #if defined(CONFIG_PM) && defined(CONFIG_PPC32)
 static int option_lid_wakeup = 1;
 #endif /* CONFIG_PM && CONFIG_PPC32 */
-#if (defined(CONFIG_PM)&&defined(CONFIG_PPC32))||defined(CONFIG_PMAC_BACKLIGHT_LEGACY)
-static int sleep_in_progress;
-#endif
 static unsigned long async_req_locks;
 static unsigned int pmu_irq_stats[11];
 
@@ -1935,122 +1933,6 @@ restore_via_state(void)
 
 extern void pmu_backlight_set_sleep(int sleep);
 
-static int
-pmac_suspend_devices(void)
-{
-	int ret;
-
-	pm_prepare_console();
-	
-	/* Sync the disks. */
-	/* XXX It would be nice to have some way to ensure that
-	 * nobody is dirtying any new buffers while we wait. That
-	 * could be achieved using the refrigerator for processes
-	 * that swsusp uses
-	 */
-	sys_sync();
-
-	/* Send suspend call to devices, hold the device core's dpm_sem */
-	ret = device_suspend(PMSG_SUSPEND);
-	if (ret) {
-		printk(KERN_ERR "Driver sleep failed\n");
-		return -EBUSY;
-	}
-
-#ifdef CONFIG_PMAC_BACKLIGHT
-	/* Tell backlight code not to muck around with the chip anymore */
-	pmu_backlight_set_sleep(1);
-#endif
-
-	/* Call platform functions marked "on sleep" */
-	pmac_pfunc_i2c_suspend();
-	pmac_pfunc_base_suspend();
-
-	/* Stop preemption */
-	preempt_disable();
-
-	/* Make sure the decrementer won't interrupt us */
-	asm volatile("mtdec %0" : : "r" (0x7fffffff));
-	/* Make sure any pending DEC interrupt occurring while we did
-	 * the above didn't re-enable the DEC */
-	mb();
-	asm volatile("mtdec %0" : : "r" (0x7fffffff));
-
-	/* We can now disable MSR_EE. This code of course works properly only
-	 * on UP machines... For SMP, if we ever implement sleep, we'll have to
-	 * stop the "other" CPUs way before we do all that stuff.
-	 */
-	local_irq_disable();
-
-	/* Broadcast power down irq
-	 * This isn't that useful in most cases (only directly wired devices can
-	 * use this but still... This will take care of sysdev's as well, so
-	 * we exit from here with local irqs disabled and PIC off.
-	 */
-	ret = device_power_down(PMSG_SUSPEND);
-	if (ret) {
-		wakeup_decrementer();
-		local_irq_enable();
-		preempt_enable();
-		device_resume();
-		printk(KERN_ERR "Driver powerdown failed\n");
-		return -EBUSY;
-	}
-
-	/* Wait for completion of async requests */
-	while (!batt_req.complete)
-		pmu_poll();
-
-	/* Giveup the lazy FPU & vec so we don't have to back them
-	 * up from the low level code
-	 */
-	enable_kernel_fp();
-
-#ifdef CONFIG_ALTIVEC
-	if (cpu_has_feature(CPU_FTR_ALTIVEC))
-		enable_kernel_altivec();
-#endif /* CONFIG_ALTIVEC */
-
-	return 0;
-}
-
-static int
-pmac_wakeup_devices(void)
-{
-	mdelay(100);
-
-#ifdef CONFIG_PMAC_BACKLIGHT
-	/* Tell backlight code it can use the chip again */
-	pmu_backlight_set_sleep(0);
-#endif
-
-	/* Power back up system devices (including the PIC) */
-	device_power_up();
-
-	/* Force a poll of ADB interrupts */
-	adb_int_pending = 1;
-	via_pmu_interrupt(0, NULL);
-
-	/* Restart jiffies & scheduling */
-	wakeup_decrementer();
-
-	/* Re-enable local CPU interrupts */
-	local_irq_enable();
-	mdelay(10);
-	preempt_enable();
-
-	/* Call platform functions marked "on wake" */
-	pmac_pfunc_base_resume();
-	pmac_pfunc_i2c_resume();
-
-	/* Resume devices */
-	device_resume();
-
-	pm_restore_console();
-
-	return 0;
-}
-
 #define	GRACKLE_PM	(1<<7)
 #define GRACKLE_DOZE	(1<<5)
 #define	GRACKLE_NAP	(1<<4)
@@ -2061,19 +1943,12 @@ static int powerbook_sleep_grackle(void)
 	unsigned long save_l2cr;
 	unsigned short pmcr1;
 	struct adb_request req;
-	int ret;
 	struct pci_dev *grackle;
 
 	grackle = pci_get_bus_and_slot(0, 0);
 	if (!grackle)
 		return -ENODEV;
 
-	ret = pmac_suspend_devices();
-	if (ret) {
-		printk(KERN_ERR "Sleep rejected by devices\n");
-		return ret;
-	}
-	
 	/* Turn off various things. Darwin does some retry tests here... */
 	pmu_request(&req, NULL, 2, PMU_POWER_CTRL0, PMU_POW0_OFF|PMU_POW0_HARD_DRIVE);
 	pmu_wait_complete(&req);
@@ -2136,8 +2011,6 @@ static int powerbook_sleep_grackle(void)
 			PMU_POW_ON|PMU_POW_BACKLIGHT|PMU_POW_CHARGER|PMU_POW_IRLED|PMU_POW_MEDIABAY);
 	pmu_wait_complete(&req);
 
-	pmac_wakeup_devices();
-
 	return 0;
 }
 
@@ -2147,7 +2020,6 @@ powerbook_sleep_Core99(void)
 	unsigned long save_l2cr;
 	unsigned long save_l3cr;
 	struct adb_request req;
-	int ret;
 	
 	if (pmac_call_feature(PMAC_FTR_SLEEP_STATE,NULL,0,-1) < 0) {
 		printk(KERN_ERR "Sleep mode not supported on this machine\n");
@@ -2157,12 +2029,6 @@ powerbook_sleep_Core99(void)
 	if (num_online_cpus() > 1 || cpu_is_offline(0))
 		return -EAGAIN;
 
-	ret = pmac_suspend_devices();
-	if (ret) {
-		printk(KERN_ERR "Sleep rejected by devices\n");
-		return ret;
-	}
-
 	/* Stop environment and ADB interrupts */
 	pmu_request(&req, NULL, 2, PMU_SET_INTR_MASK, 0);
 	pmu_wait_complete(&req);
@@ -2233,41 +2099,24 @@ powerbook_sleep_Core99(void)
 	/* Restore LPJ, cpufreq will adjust the cpu frequency */
 	loops_per_jiffy /= 2;
 
-	pmac_wakeup_devices();
-
 	return 0;
 }
 
 #define PB3400_MEM_CTRL		0xf8000000
 #define PB3400_MEM_CTRL_SLEEP	0x70
 
+static void __iomem *pb3400_mem_ctrl;
+
 static int
 powerbook_sleep_3400(void)
 {
-	int ret, i, x;
+	int i, x;
 	unsigned int hid0;
 	unsigned long p;
 	struct adb_request sleep_req;
-	void __iomem *mem_ctrl;
 	unsigned int __iomem *mem_ctrl_sleep;
 
-	/* first map in the memory controller registers */
-	mem_ctrl = ioremap(PB3400_MEM_CTRL, 0x100);
-	if (mem_ctrl == NULL) {
-		printk("powerbook_sleep_3400: ioremap failed\n");
-		return -ENOMEM;
-	}
-	mem_ctrl_sleep = mem_ctrl + PB3400_MEM_CTRL_SLEEP;
-
-	/* Allocate room for PCI save */
-	pbook_alloc_pci_save();
-
-	ret = pmac_suspend_devices();
-	if (ret) {
-		pbook_free_pci_save();
-		printk(KERN_ERR "Sleep rejected by devices\n");
-		return ret;
-	}
+	mem_ctrl_sleep = pb3400_mem_ctrl + PB3400_MEM_CTRL_SLEEP;
 
 	/* Save the state of PCI config space for some slots */
 	pbook_pci_save();
@@ -2312,10 +2161,6 @@ powerbook_sleep_3400(void)
 	while (asleep)
 		mb();
 
-	pmac_wakeup_devices();
-	pbook_free_pci_save();
-	iounmap(mem_ctrl);
-
 	return 0;
 }
 
@@ -2494,6 +2339,152 @@ pmu_release(struct inode *inode, struct 
 	return 0;
 }
 
+#if defined(CONFIG_PM) && defined(CONFIG_PPC32)
+static int powerbook_prepare_sleep(suspend_state_t state)
+{
+	if (pmu_kind == PMU_OHARE_BASED) {
+		/* first map in the memory controller registers */
+		pb3400_mem_ctrl = ioremap(PB3400_MEM_CTRL, 0x100);
+		if (!pb3400_mem_ctrl) {
+			printk("powerbook_sleep_3400: ioremap failed\n");
+			return -ENOMEM;
+		}
+
+		/* Allocate room for PCI save */
+		pbook_alloc_pci_save();
+	}
+
+	return 0;
+}
+
+/*
+ * overrides the weak arch_suspend_disable_irqs in kernel/power/main.c
+ */
+void arch_suspend_disable_irqs(void)
+{
+#ifdef CONFIG_PMAC_BACKLIGHT
+	/* Tell backlight code not to muck around with the chip anymore */
+	pmu_backlight_set_sleep(1);
+#endif
+
+	/* Call platform functions marked "on sleep" */
+	pmac_pfunc_i2c_suspend();
+	pmac_pfunc_base_suspend();
+
+	/* Stop preemption */
+	preempt_disable();
+
+	/* Make sure the decrementer won't interrupt us */
+	asm volatile("mtdec %0" : : "r" (0x7fffffff));
+	/* Make sure any pending DEC interrupt occurring while we did
+	 * the above didn't re-enable the DEC */
+	mb();
+	asm volatile("mtdec %0" : : "r" (0x7fffffff));
+
+	local_irq_disable();
+}
+
+static int powerbook_sleep(suspend_state_t state)
+{
+	int error = 0;
+
+	/* Wait for completion of async requests */
+	while (!batt_req.complete)
+		pmu_poll();
+
+	/* Giveup the lazy FPU & vec so we don't have to back them
+	 * up from the low level code
+	 */
+	enable_kernel_fp();
+
+#ifdef CONFIG_ALTIVEC
+	if (cpu_has_feature(CPU_FTR_ALTIVEC))
+		enable_kernel_altivec();
+#endif /* CONFIG_ALTIVEC */
+
+	switch (pmu_kind) {
+	case PMU_OHARE_BASED:
+		error = powerbook_sleep_3400();
+		break;
+	case PMU_HEATHROW_BASED:
+	case PMU_PADDINGTON_BASED:
+		error = powerbook_sleep_grackle();
+		break;
+	case PMU_KEYLARGO_BASED:
+		error = powerbook_sleep_Core99();
+		break;
+	default:
+		return -ENOSYS;
+	}
+
+	if (error)
+		return error;
+
+	mdelay(100);
+
+#ifdef CONFIG_PMAC_BACKLIGHT
+	/* Tell backlight code it can use the chip again */
+	pmu_backlight_set_sleep(0);
+#endif
+
+	return 0;
+}
+
+/*
+ * overrides the weak arch_suspend_enable_irqs in kernel/power/main.c
+ */
+void arch_suspend_enable_irqs(void)
+{
+	/* Force a poll of ADB interrupts */
+	adb_int_pending = 1;
+	via_pmu_interrupt(0, NULL);
+
+	/* Restart jiffies & scheduling */
+	wakeup_decrementer();
+
+	/* Re-enable local CPU interrupts */
+	local_irq_enable();
+	mdelay(10);
+	preempt_enable();
+
+	/* Call platform functions marked "on wake" */
+	pmac_pfunc_base_resume();
+	pmac_pfunc_i2c_resume();
+}
+
+static int powerbook_finish_sleep(suspend_state_t state)
+{
+	if (pmu_kind == PMU_OHARE_BASED) {
+		pbook_free_pci_save();
+		iounmap(pb3400_mem_ctrl);
+	}
+
+	return 0;
+}
+
+static int pmu_sleep_valid(suspend_state_t state)
+{
+	return state == PM_SUSPEND_MEM
+		&& (pmac_call_feature(PMAC_FTR_SLEEP_STATE, NULL, 0, -1) >= 0);
+}
+
+static struct pm_ops pmu_pm_ops = {
+	.prepare = powerbook_prepare_sleep,
+	.enter = powerbook_sleep,
+	.finish = powerbook_finish_sleep,
+	.valid = pmu_sleep_valid,
+};
+
+static int register_pmu_pm_ops(void)
+{
+	pm_set_ops(&pmu_pm_ops);
+
+	return 0;
+}
+
+device_initcall(register_pmu_pm_ops);
+#endif
+
 static int
 pmu_ioctl(struct inode * inode, struct file *filp,
 		     u_int cmd, u_long arg)
@@ -2503,29 +2494,19 @@ pmu_ioctl(struct inode * inode, struct f
 
 	switch (cmd) {
 #if defined(CONFIG_PM) && defined(CONFIG_PPC32)
+	/* just provided for compatibility */
 	case PMU_IOC_SLEEP:
 		if (!capable(CAP_SYS_ADMIN))
 			return -EACCES;
-		if (sleep_in_progress)
-			return -EBUSY;
-		sleep_in_progress = 1;
-		switch (pmu_kind) {
-		case PMU_OHARE_BASED:
-			error = powerbook_sleep_3400();
-			break;
-		case PMU_HEATHROW_BASED:
-		case PMU_PADDINGTON_BASED:
-			error = powerbook_sleep_grackle();
-			break;
-		case PMU_KEYLARGO_BASED:
-			error = powerbook_sleep_Core99();
-			break;
-		default:
-			error = -ENOSYS;
-		}
-		sleep_in_progress = 0;
+		printk(KERN_INFO "via-pmu: the PMU_IOC_SLEEP ioctl is deprecated.\n");
+		printk(KERN_INFO "via-pmu: use \"echo mem > /sys/power/state\" instead!\n");
+		printk(KERN_INFO "via-pmu: this ioctl will be removed soon.\n");
+		error = pm_suspend(PM_SUSPEND_MEM);
 		break;
 	case PMU_IOC_CAN_SLEEP:
+		printk(KERN_INFO "via-pmu: the PMU_IOC_CAN_SLEEP ioctl is deprecated.\n");
+		printk(KERN_INFO "via-pmu: use \"grep mem /sys/power/state\" instead!\n");
+		printk(KERN_INFO "via-pmu: this ioctl will be removed soon.\n");
 		if (pmac_call_feature(PMAC_FTR_SLEEP_STATE,NULL,0,-1) < 0)
 			return put_user(0, argp);
 		else
@@ -2538,9 +2519,6 @@ pmu_ioctl(struct inode * inode, struct f
 	{
 		int brightness;
 
-		if (sleep_in_progress)
-			return -EBUSY;
-
 		brightness = pmac_backlight_get_legacy_brightness();
 		if (brightness < 0)
 			return brightness;
@@ -2552,9 +2530,6 @@ pmu_ioctl(struct inode * inode, struct f
 	{
 		int brightness;
 
-		if (sleep_in_progress)
-			return -EBUSY;
-
 		error = get_user(brightness, argp);
 		if (error)
 			return error;
--- wireless-dev.orig/Documentation/feature-removal-schedule.txt	2007-07-18 14:25:24.082900849 +0200
+++ wireless-dev/Documentation/feature-removal-schedule.txt	2007-07-18 14:25:42.072900849 +0200
@@ -310,3 +310,13 @@ Why:  The arch/powerpc tree is the merge
 Who:  linuxppc-dev at ozlabs.org
 
 ---------------------------
+
+What:	/dev/pmu suspend/can-suspend ioctls
+When:	August 2009
+Files:	drivers/macintosh/via-pmu.c
+Why:	powermac supports proper generic pm_ops now and can suspend with
+	"echo mem > /sys/power/state" instead of the ioctl, checking if
+	it can suspend can be done by reading /sys/power/state.
+Who:	Johannes Berg <johannes at sipsolutions.net>
+
+---------------------------

linux-2.6-ps3-gelic-wireless.patch:

View full diff with command:
/usr/bin/cvs -f diff  -kk -u -N -r 1.2 -r 1.3 linux-2.6-ps3-gelic-wireless.patch
Index: linux-2.6-ps3-gelic-wireless.patch
===================================================================
RCS file: linux-2.6-ps3-gelic-wireless.patch
diff -N linux-2.6-ps3-gelic-wireless.patch
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ linux-2.6-ps3-gelic-wireless.patch	31 Jul 2007 11:33:24 -0000	1.3
@@ -0,0 +1,2502 @@
+Subject: ps3: wireless LAN driver
+
+Add support of the internal wireless LAN of PS3.
+ 
+Signed-off-by: Masakazu Mokuno <mokuno at sm.sony.co.jp>
+---
+ drivers/net/Kconfig              |    8 
+ drivers/net/Makefile             |    3 
+ drivers/net/ps3_gelic_net.c      |   29 
+ drivers/net/ps3_gelic_net.h      |  226 ++++
+ drivers/net/ps3_gelic_wireless.c | 2125 +++++++++++++++++++++++++++++++++++++++
+ 5 files changed, 2388 insertions(+), 3 deletions(-)
+
+--- a/drivers/net/Kconfig
++++ b/drivers/net/Kconfig
+@@ -2262,6 +2262,14 @@ config GELIC_NET
+ 	  To compile this driver as a module, choose M here: the
+ 	  module will be called ps3_gelic.
+ 
++config GELIC_WIRELESS
++	bool "PS3 Wireless support"
++	depends on GELIC_NET
++	select WIRELESS_EXT
++	help
++	  This option enables the wireless networking support of
++	  the PS3 network driver.
++
+ config GIANFAR
+ 	tristate "Gianfar Ethernet"
+ 	depends on 85xx || 83xx || PPC_86xx
+--- a/drivers/net/Makefile
++++ b/drivers/net/Makefile
+@@ -62,7 +62,8 @@ obj-$(CONFIG_BNX2) += bnx2.o
+ spidernet-y += spider_net.o spider_net_ethtool.o
+ obj-$(CONFIG_SPIDER_NET) += spidernet.o sungem_phy.o
+ obj-$(CONFIG_GELIC_NET) += ps3_gelic.o
+-ps3_gelic-objs += ps3_gelic_net.o
++gelic_wireless-$(CONFIG_GELIC_WIRELESS) += ps3_gelic_wireless.o
++ps3_gelic-objs += ps3_gelic_net.o $(gelic_wireless-y)
+ obj-$(CONFIG_TC35815) += tc35815.o
+ obj-$(CONFIG_SKGE) += skge.o
+ obj-$(CONFIG_SKY2) += sky2.o
+--- a/drivers/net/ps3_gelic_net.c
++++ b/drivers/net/ps3_gelic_net.c
+@@ -556,6 +556,9 @@ static int gelic_net_stop(struct net_dev
+ {
+ 	struct gelic_net_card *card = netdev_priv(netdev);
+ 
++#ifdef CONFIG_GELIC_WIRELESS
++	gelicw_down(netdev);
++#endif
+ 	netif_poll_disable(netdev);
+ 	netif_stop_queue(netdev);
+ 
+@@ -1067,6 +1070,9 @@ static irqreturn_t gelic_net_interrupt(i
+ 		gelic_net_kick_txdma(card, card->tx_chain.tail);
+ 		spin_unlock_irqrestore(&card->tx_dma_lock, flags);
+ 	}
++#ifdef CONFIG_GELIC_WIRELESS
++	gelicw_interrupt(netdev, status);
++#endif
+ 	return IRQ_HANDLED;
+ }
+ 
+@@ -1162,12 +1168,18 @@ static int gelic_net_open(struct net_dev
+ 
+ 	card->tx_dma_progress = 0;
+ 	card->ghiintmask = GELIC_NET_RXINT | GELIC_NET_TXINT;
++#ifdef CONFIG_GELIC_WIRELESS
++	card->ghiintmask |= GELICW_DEVICE_CMD_COMP | GELICW_DEVICE_EVENT_RECV;
++#endif
+ 
+ 	gelic_net_set_irq_mask(card, card->ghiintmask);
+ 	gelic_net_enable_rxdmac(card);
+ 
+ 	netif_start_queue(netdev);
+ 	netif_carrier_on(netdev);
++#ifdef CONFIG_GELIC_WIRELESS
++ 	gelicw_up(netdev);
++#endif
+ 
+ 	return 0;
+ 
+@@ -1245,7 +1257,12 @@ static u32 gelic_net_get_link(struct net
+ 		link = 1;
+ 	else
+ 		link = 0;
+-
++#ifdef CONFIG_GELIC_WIRELESS
++	/* (v1 & GELIC_NET_LINK_UP) is always 0 in wireless mode */
++	if (gelicw_is_associated(netdev)) {
++		link = 1;
++	}
++#endif
+ 	return link;
+ }
+ 
+@@ -1433,7 +1450,12 @@ static int gelic_net_setup_netdev(struct
+ 	}
+ 	if (card->vlan_id[GELIC_NET_VLAN_WIRED - 1])
+ 		card->vlan_index = GELIC_NET_VLAN_WIRED - 1;
+-
++#ifdef CONFIG_GELIC_WIRELESS
++	card->w.card = card;
++	/* init wireless extension */
++	/* No wireless vlan_index:-1 */
++	gelicw_setup_netdev(netdev, card->vlan_index);
++#endif
+ 	status = register_netdev(netdev);
+ 	if (status) {
+ 		dev_err(ctodev(card), "%s:Couldn't register net_device: %d\n",
+@@ -1563,6 +1585,9 @@ static int ps3_gelic_driver_remove (stru
+ {
+ 	struct gelic_net_card *card = ps3_system_bus_get_driver_data(dev);
+ 
++#ifdef CONFIG_GELIC_WIRELESS
++	gelicw_remove(card->netdev);
++#endif
+ 	wait_event(card->waitq,
+ 		   atomic_read(&card->tx_timeout_task_counter) == 0);
+ 
+--- a/drivers/net/ps3_gelic_net.h
++++ b/drivers/net/ps3_gelic_net.h
+@@ -28,6 +28,9 @@
+ #ifndef _GELIC_NET_H
+ #define _GELIC_NET_H
+ 
++#include <linux/wireless.h>
++#include <net/ieee80211.h>
++
+ /* descriptors */
+ #define GELIC_NET_RX_DESCRIPTORS        128 /* num of descriptors */
+ #define GELIC_NET_TX_DESCRIPTORS        128 /* num of descriptors */
+@@ -166,6 +169,220 @@ enum gelic_net_descr_status {
+ 
+ #define GELIC_NET_PORT                          2 /* for port status */
+ 
++/* wireless */
++#define GELICW_WIRELESS_NOT_EXIST	0
++#define GELICW_WIRELESS_SUPPORTED	1
++#define GELICW_WIRELESS_ON		2
++#define GELICW_WIRELESS_SHUTDOWN	3
++/* state */
++#define GELICW_STATE_DOWN		0
++#define GELICW_STATE_UP			1
++#define GELICW_STATE_SCANNING		2
++#define GELICW_STATE_SCAN_DONE		3
++#define GELICW_STATE_ASSOCIATED		4
++
++/* cmd_send_flg */
++#define GELICW_CMD_SEND_NONE		0x00
++#define GELICW_CMD_SEND_COMMON		0x01
++#define GELICW_CMD_SEND_ENCODE		0x02
++#define GELICW_CMD_SEND_SCAN		0x04
++#define GELICW_CMD_SEND_ALL		(GELICW_CMD_SEND_COMMON \
++					| GELICW_CMD_SEND_ENCODE \
++					| GELICW_CMD_SEND_SCAN)
++
++#define GELICW_SCAN_INTERVAL		(HZ)
++
++#ifdef DEBUG
++#define CH_INFO_FAIL 0x0600 /* debug */
++#else
++#define CH_INFO_FAIL 0
++#endif
++
++
++/* net_control command */
++#define GELICW_SET_PORT			3 /* control Ether port */
++#define GELICW_GET_INFO			6 /* get supported channels */
++#define GELICW_SET_CMD			9 /* set configuration */
++#define GELICW_GET_RES			10 /* get command response */
++#define GELICW_GET_EVENT		11 /* get event from device */
++/* net_control command data buffer */
++#define GELICW_DATA_BUF_SIZE		0x1000
++
++/* GELICW_SET_CMD params */
++#define GELICW_CMD_START		1
++#define GELICW_CMD_STOP			2
++#define GELICW_CMD_SCAN			3
++#define GELICW_CMD_GET_SCAN		4
++#define GELICW_CMD_SET_CONFIG		5
++#define GELICW_CMD_GET_CONFIG		6
++#define GELICW_CMD_SET_WEP		7
++#define GELICW_CMD_GET_WEP		8
++#define GELICW_CMD_SET_WPA		9
++#define GELICW_CMD_GET_WPA		10
++#define GELICW_CMD_GET_RSSI		11
++
++/* GELICW_SET_PORT params */
++#define GELICW_ETHER_PORT		2
++#define GELICW_PORT_DOWN		0 /* Ether port off */
++#define GELICW_PORT_UP			4 /* Ether port on (auto neg) */
[...2109 lines suppressed...]
++	return 0;
++}
++
++static int gelicw_get_encodeext(struct net_device *netdev,
++			   struct iw_request_info *info,
++			   union iwreq_data *wrqu, char *extra)
++{
++	struct gelic_wireless *w = gelicw_priv(netdev);
++	struct iw_point *enc = &wrqu->encoding;
++	struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
++	int index, key_index, key_len;
++
++	dev_dbg(ntodev(netdev), "wx:get_encodeext\n");
++	key_len = enc->length - sizeof(*ext);
++	if (key_len < 0)
++		return -EINVAL;
++
++	index = enc->flags & IW_ENCODE_INDEX;
++	if (index < 0 || index > WEP_KEYS)
++		return -EINVAL;
++
++	index--;
++	key_index = (index == -1 ? w->key_index : index);
++
++	memset(ext, 0, sizeof(*ext));
++	enc->flags = key_index + 1;
++
++	if (w->key_alg == IW_ENCODE_ALG_NONE || !w->key_len[key_index]) {
++		/* no encryption */
++		enc->flags |= IW_ENCODE_DISABLED;
++		ext->alg = IW_ENCODE_ALG_NONE;
++		ext->key_len = 0;
++	} else {
++		enc->flags |= IW_ENCODE_NOKEY;
++		ext->alg = w->key_alg;
++		ext->key_len = w->key_len[key_index];
++	}
++
++	return 0;
++}
++
++/*
++ * wireless stats
++ */
++static struct iw_statistics *gelicw_get_wireless_stats(struct net_device *netdev)
++{
++	static struct iw_statistics wstats;
++	struct gelic_wireless *w = gelicw_priv(netdev);
++
++	dev_dbg(ntodev(netdev), "wx:wireless_stats\n");
++	if (w->state < GELICW_STATE_ASSOCIATED) {
++		wstats.qual.updated  = IW_QUAL_QUAL_UPDATED |
++				IW_QUAL_LEVEL_UPDATED | IW_QUAL_NOISE_INVALID;
++		wstats.qual.qual = 0;
++		wstats.qual.level = 0;
++		return &wstats;
++	}
++	init_completion(&w->rssi_done);
++	schedule_delayed_work(&w->work_rssi, 0);
++
++	wait_for_completion_interruptible(&w->rssi_done);
++	wstats.qual.updated  = IW_QUAL_QUAL_UPDATED |
++			IW_QUAL_LEVEL_UPDATED | IW_QUAL_NOISE_INVALID;
++	wstats.qual.qual = w->rssi;
++	wstats.qual.level = gelicw_qual2level(w->rssi);
++
++	return &wstats;
++}
++
++/*
++ * private handler
++ */
++static int gelicw_priv_set_alg_mode(struct net_device *netdev,
++			   struct iw_request_info *info,
++			   union iwreq_data *wrqu, char *extra)
++{
++	struct gelic_wireless *w = gelicw_priv(netdev);
++	int mode = *(int *)extra;
++
++	dev_dbg(ntodev(netdev), "wx:priv_set_alg\n");
++	switch (mode) {
++	case IW_ENCODE_ALG_NONE:
++	case IW_ENCODE_ALG_WEP:
++	case IW_ENCODE_ALG_TKIP:
++	case IW_ENCODE_ALG_CCMP:
++		break;
++	default:
++		return -EINVAL;
++	}
++	/* send common config */
++	gelicw_send_common_config(netdev, &w->key_alg, (u8)mode);
++
++	return 0;
++}
++
++static int gelicw_priv_get_alg_mode(struct net_device *netdev,
++			   struct iw_request_info *info,
++			   union iwreq_data *wrqu, char *extra)
++{
++	struct gelic_wireless *w = gelicw_priv(netdev);
++	char *p;
++
++	dev_dbg(ntodev(netdev), "wx:priv_get_alg\n");
++	switch (w->key_alg) {
++	case IW_ENCODE_ALG_NONE:
++		strncpy(extra, "OFF", MAX_IW_PRIV_SIZE);
++		break;
++	case IW_ENCODE_ALG_WEP:
++		strncpy(extra, "WEP", MAX_IW_PRIV_SIZE);
++		break;
++	case IW_ENCODE_ALG_TKIP:
++		strncpy(extra, "TKIP", MAX_IW_PRIV_SIZE);
++		break;
++	case IW_ENCODE_ALG_CCMP:
++		strncpy(extra, "AES-CCMP", MAX_IW_PRIV_SIZE);
++		break;
++	default:
++		break;
++	}
++	p = extra + strlen(extra);
++
++	if (w->key_alg == IW_ENCODE_ALG_TKIP ||
++	    w->key_alg == IW_ENCODE_ALG_CCMP) {
++		if (w->key_len[w->key_index] == 64) /* current key index */
++			strncpy(p, " hex", MAX_IW_PRIV_SIZE);
++		else
++			strncpy(p, " passphrase", MAX_IW_PRIV_SIZE);
++	}
++	wrqu->data.length = strlen(extra);
++
++	return 0;
++}
++
++
++/*
++ * Wireless handlers
++ */
++static const iw_handler gelicw_handler[] =
++{
++	[IW_IOCTL_IDX(SIOCGIWNAME)]      = gelicw_get_name,
++	[IW_IOCTL_IDX(SIOCSIWFREQ)]      = gelicw_set_freq,
++	[IW_IOCTL_IDX(SIOCGIWFREQ)]      = gelicw_get_freq,
++	[IW_IOCTL_IDX(SIOCSIWMODE)]      = gelicw_set_mode,
++	[IW_IOCTL_IDX(SIOCGIWMODE)]      = gelicw_get_mode,
++	[IW_IOCTL_IDX(SIOCGIWRANGE)]     = gelicw_get_range,
++	[IW_IOCTL_IDX(SIOCSIWAP)]        = gelicw_set_wap,
++	[IW_IOCTL_IDX(SIOCGIWAP)]        = gelicw_get_wap,
++	[IW_IOCTL_IDX(SIOCSIWSCAN)]      = gelicw_set_scan,
++	[IW_IOCTL_IDX(SIOCGIWSCAN)]      = gelicw_get_scan,
++	[IW_IOCTL_IDX(SIOCSIWESSID)]     = gelicw_set_essid,
++	[IW_IOCTL_IDX(SIOCGIWESSID)]     = gelicw_get_essid,
++	[IW_IOCTL_IDX(SIOCSIWNICKN)]     = gelicw_set_nick,
++	[IW_IOCTL_IDX(SIOCGIWNICKN)]     = gelicw_get_nick,
++	[IW_IOCTL_IDX(SIOCSIWRATE)]      = gelicw_set_rate,
++	[IW_IOCTL_IDX(SIOCGIWRATE)]      = gelicw_get_rate,
++	[IW_IOCTL_IDX(SIOCSIWENCODE)]    = gelicw_set_encode,
++	[IW_IOCTL_IDX(SIOCGIWENCODE)]    = gelicw_get_encode,
++	[IW_IOCTL_IDX(SIOCSIWAUTH)]      = gelicw_set_auth,
++	[IW_IOCTL_IDX(SIOCGIWAUTH)]      = gelicw_get_auth,
++	[IW_IOCTL_IDX(SIOCSIWENCODEEXT)] = gelicw_set_encodeext,
++	[IW_IOCTL_IDX(SIOCGIWENCODEEXT)] = gelicw_get_encodeext,
++};
++
++/*
++ * Private wireless handlers
++ */
++enum {
++	GELICW_PRIV_SET_AUTH  = SIOCIWFIRSTPRIV,
++	GELICW_PRIV_GET_AUTH
++};
++
++static struct iw_priv_args gelicw_private_args[] = {
++	{
++	 .cmd = GELICW_PRIV_SET_AUTH,
++	 .set_args = IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
++	 .name = "set_alg"
++	},
++	{
++	 .cmd = GELICW_PRIV_GET_AUTH,
++	 .get_args = IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | MAX_IW_PRIV_SIZE,
++	 .name = "get_alg"
++	},
++};
++
++static const iw_handler gelicw_private_handler[] =
++{
++	gelicw_priv_set_alg_mode,
++	gelicw_priv_get_alg_mode,
++};
++
++static struct iw_handler_def gelicw_handler_def =
++{
++	.num_standard	= ARRAY_SIZE(gelicw_handler),
++	.num_private	= ARRAY_SIZE(gelicw_private_handler),
++	.num_private_args = ARRAY_SIZE(gelicw_private_args),
++	.standard	= (iw_handler *)gelicw_handler,
++	.private	= (iw_handler *)gelicw_private_handler,
++	.private_args	= (struct iw_priv_args *)gelicw_private_args,
++	.get_wireless_stats = gelicw_get_wireless_stats
++};

linux-2.6-ps3-legacy-bootloader-hack.patch:

--- NEW FILE linux-2.6-ps3-legacy-bootloader-hack.patch ---
A temporary hack to support the legacy 2.6.16 bootloader.  This will be
removed as soon as a 2.6.22 bootloader is ready.

Hacked-by: Geoff Levand <geoffrey.levand at am.sony.com>
---
 arch/powerpc/kernel/prom.c         |    6 ++++++
 arch/powerpc/platforms/ps3/setup.c |    4 +++-
 2 files changed, 9 insertions(+), 1 deletion(-)

--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -939,6 +939,12 @@ static int __init early_init_dt_scan_mem
 				size = 0x80000000ul - base;
 		}
 #endif
+#ifdef CONFIG_PPC_PS3
+	/* temporary hack for the legacy bootloader */
+	if (of_flat_dt_is_compatible(of_get_flat_dt_root(), "PS3PF")) {
+		size = 0x8000000;
+	}
+#endif
 		lmb_add(base, size);
 	}
 	return 0;
--- a/arch/powerpc/platforms/ps3/setup.c
+++ b/arch/powerpc/platforms/ps3/setup.c
@@ -210,7 +210,9 @@ static int __init ps3_probe(void)
 	DBG(" -> %s:%d\n", __func__, __LINE__);
 
 	dt_root = of_get_flat_dt_root();
-	if (!of_flat_dt_is_compatible(dt_root, "sony,ps3"))
+	if (!of_flat_dt_is_compatible(dt_root, "sony,ps3")
+		/* temporary hack for the legacy bootloader */
+		&& !of_flat_dt_is_compatible(dt_root, "PS3PF"))
 		return 0;
 
 	powerpc_firmware_features |= FW_FEATURE_PS3_POSSIBLE;

linux-2.6-ps3-storage-alias.patch:

--- NEW FILE linux-2.6-ps3-storage-alias.patch ---
--- linux-2.6.22.ppc64/drivers/block/ps3disk.c~	2007-07-25 16:06:16.000000000 +0100
+++ linux-2.6.22.ppc64/drivers/block/ps3disk.c	2007-07-26 08:49:44.000000000 +0100
@@ -628,3 +628,4 @@ MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("PS3 Disk Storage Driver");
 MODULE_AUTHOR("Sony Corporation");
 MODULE_ALIAS(PS3_MODULE_ALIAS_STOR_DISK);
+MODULE_ALIAS("ps3_storage");


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/kernel.spec,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- kernel.spec	30 Jul 2007 01:56:18 -0000	1.37
+++ kernel.spec	31 Jul 2007 11:33:24 -0000	1.38
@@ -542,6 +542,11 @@
 Patch100: linux-2.6-g5-therm-shutdown.patch
 Patch120: linux-2.6-ppc32-ucmpdi2.patch
 Patch130: linux-2.6-ibmvscsi-schizo.patch
+Patch131: linux-2.6-powerpc-generic-suspend-1-remove-dead-code.patch
+Patch132: linux-2.6-powerpc-generic-suspend-2-remove-adb-sleep-notifier.patch
+Patch133: linux-2.6-powerpc-generic-suspend-3-remove-dmasound.patch
+Patch134: linux-2.6-powerpc-generic-suspend-4-kill-pmu-sleep-notifier.patch
+Patch135: linux-2.6-powerpc-generic-suspend-5-pmu-pm_ops.patch
 Patch140: linux-2.6-pmac-zilog.patch
 Patch150: linux-2.6-build-nonintconfig.patch
 Patch160: linux-2.6-execshield.patch
@@ -579,6 +584,7 @@
 Patch680: git-wireless-dev.patch
 Patch690: linux-2.6-e1000-ich9.patch
 Patch700: linux-2.6-bcm43xx-pci-neuter.patch
+Patch701: linux-2.6-bcm43xx-revert-breakage.patch
 Patch710: linux-2.6-iwlwifi-fw-name-compat.patch
 #Patch780: linux-2.6-clockevents-fix-resume-logic.patch
 Patch780: linux-2.6-highres-timers.patch
@@ -586,7 +592,9 @@
 Patch801: linux-2.6-wakeups.patch
 Patch820: linux-2.6-compile-fixes.patch
 Patch1100: linux-2.6-elf-core-sysctl.patch
-
+Patch1200: linux-2.6-ps3-gelic-wireless.patch
+Patch1210: linux-2.6-ps3-storage-alias.patch
+Patch1220: linux-2.6-ps3-legacy-bootloader-hack.patch
 %endif
 
 BuildRoot: %{_tmppath}/kernel-%{KVERREL}-root-%{_target_cpu}
@@ -1093,9 +1101,20 @@
 # Temporary hack to work around GCC PR #25724 / #21237
 ApplyPatch linux-2.6-ppc32-ucmpdi2.patch
 # Fix up ibmvscsi for combined pSeries/iSeries build
-#ApplyPatch linux-2.6-ibmvscsi-schizo.patch
+ApplyPatch linux-2.6-ibmvscsi-schizo.patch
 # Move pmac_zilog to its newly-registered device number
 ApplyPatch linux-2.6-pmac-zilog.patch
+# PlayStation support
+ApplyPatch linux-2.6-ps3-gelic-wireless.patch
+ApplyPatch linux-2.6-ps3-storage-alias.patch
+ApplyPatch linux-2.6-ps3-legacy-bootloader-hack.patch
+# Suspend through /sys/power/state
+ApplyPatch linux-2.6-powerpc-generic-suspend-1-remove-dead-code.patch
+ApplyPatch linux-2.6-powerpc-generic-suspend-2-remove-adb-sleep-notifier.patch
+ApplyPatch linux-2.6-powerpc-generic-suspend-3-remove-dmasound.patch
+ApplyPatch linux-2.6-powerpc-generic-suspend-4-kill-pmu-sleep-notifier.patch
+ApplyPatch linux-2.6-powerpc-generic-suspend-5-pmu-pm_ops.patch
+
 
 # Exec shield
 ApplyPatch linux-2.6-execshield.patch
@@ -1189,6 +1208,9 @@
 ApplyPatch linux-2.6-e1000-ich9.patch
 # avoid bcm3xx vs bcm43xx-mac80211 PCI ID conflicts
 ApplyPatch linux-2.6-bcm43xx-pci-neuter.patch
+# commit 77548f58070894cf5970a110981e511ffe793369 broke transmission on some dev
+ices
+ApplyPatch linux-2.6-bcm43xx-revert-breakage.patch
 # temp compat patch for iwlwifi firmware filenames
 ApplyPatch linux-2.6-iwlwifi-fw-name-compat.patch
 
@@ -2136,6 +2158,13 @@
 %endif
 
 %changelog
+* Tue Jul 31 2007 David Woodhouse <dwmw2 at infradead.org>
+- Fix bcm43xx regression
+- Restore PowerMac suspend via /sys/power/state
+- PS3 fixes
+- Restore ibmvscsi support on iSeries
+- Re-enable CONFIG_IDE_PROC_FS to fix ybin
+
 * Sun Jul 29 2007 Dave Jones <davej at redhat.com>
 - 2.6.23-rc1-git6
 

linux-2.6-ibmvscsi-schizo.patch:

Index: linux-2.6-ibmvscsi-schizo.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/linux-2.6-ibmvscsi-schizo.patch,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- linux-2.6-ibmvscsi-schizo.patch	1 Jan 2007 20:07:14 -0000	1.2
+++ linux-2.6-ibmvscsi-schizo.patch	31 Jul 2007 11:33:24 -0000	1.3
@@ -1,6 +1,8 @@
---- linux-2.6.19.ppc64/drivers/scsi/ibmvscsi/rpa_vscsi.c~	2006-11-29 21:57:37.000000000 +0000
-+++ linux-2.6.19.ppc64/drivers/scsi/ibmvscsi/rpa_vscsi.c	2006-12-19 15:42:57.000000000 +0000
-@@ -42,14 +42,14 @@ static unsigned int partition_number = -
+diff --git a/drivers/scsi/ibmvscsi/rpa_vscsi.c b/drivers/scsi/ibmvscsi/rpa_vscsi.c
+index 9c14e78..1821461 100644
+--- a/drivers/scsi/ibmvscsi/rpa_vscsi.c
++++ b/drivers/scsi/ibmvscsi/rpa_vscsi.c
+@@ -42,14 +42,14 @@ static unsigned int partition_number = -1;
   * Routines for managing the command/response queue
   */
  /**
@@ -17,7 +19,7 @@
  {
  	struct ibmvscsi_host_data *hostdata =
  	    (struct ibmvscsi_host_data *)dev_instance;
-@@ -66,9 +66,9 @@ static irqreturn_t ibmvscsi_handle_event
+@@ -66,9 +66,9 @@ static irqreturn_t ibmvscsi_handle_event(int irq, void *dev_instance)
   * Frees irq, deallocates a page for messages, unmaps dma, and unregisters
   * the crq with the hypervisor.
   */
@@ -30,7 +32,7 @@
  {
  	long rc;
  	struct vio_dev *vdev = to_vio_dev(hostdata->dev);
-@@ -108,12 +108,13 @@ static struct viosrp_crq *crq_queue_next
+@@ -108,12 +108,13 @@ static struct viosrp_crq *crq_queue_next_crq(struct crq_queue *queue)
  }
  
  /**
@@ -46,7 +48,7 @@
  {
  	struct vio_dev *vdev = to_vio_dev(hostdata->dev);
  
-@@ -121,10 +122,10 @@ int ibmvscsi_send_crq(struct ibmvscsi_ho
+@@ -121,10 +122,10 @@ int ibmvscsi_send_crq(struct ibmvscsi_host_data *hostdata, u64 word1, u64 word2)
  }
  
  /**
@@ -59,7 +61,7 @@
  {
  	struct ibmvscsi_host_data *hostdata = (struct ibmvscsi_host_data *)data;
  	struct vio_dev *vdev = to_vio_dev(hostdata->dev);
-@@ -189,6 +190,42 @@ static void set_adapter_info(struct ibmv
+@@ -190,6 +191,42 @@ static void set_adapter_info(struct ibmvscsi_host_data *hostdata)
  }
  
  /**
@@ -91,18 +93,18 @@
 +				queue->msg_token, PAGE_SIZE);
 +	if (rc == 2) {
 +		/* Adapter is good, but other end is not ready */
-+		printk(KERN_WARNING "ibmvscsi: Partner adapter not ready\n");
++		dev_warn(hostdata->dev, "Partner adapter not ready\n");
 +	} else if (rc != 0) {
-+		printk(KERN_WARNING
-+		       "ibmvscsi: couldn't register crq--rc 0x%x\n", rc);
++		dev_warn(hostdata->dev, "couldn't register crq--rc 0x%x\n", rc);
 +	}
 +	return rc;
 +}
++
 +/**
   * initialize_crq_queue: - Initializes and registers CRQ with hypervisor
   * @queue:	crq_queue to initialize and register
   * @hostdata:	ibmvscsi_host_data of host
-@@ -197,9 +234,9 @@ static void set_adapter_info(struct ibmv
+@@ -198,9 +235,9 @@ static void set_adapter_info(struct ibmvscsi_host_data *hostdata)
   * the crq with the hypervisor.
   * Returns zero on success.
   */
@@ -115,7 +117,7 @@
  {
  	int rc;
  	int retrc;
-@@ -226,7 +263,7 @@ int ibmvscsi_init_crq_queue(struct crq_q
+@@ -227,7 +264,7 @@ int ibmvscsi_init_crq_queue(struct crq_queue *queue,
  				queue->msg_token, PAGE_SIZE);
  	if (rc == H_RESOURCE)
  		/* maybe kexecing and resource is busy. try a reset */
@@ -124,16 +126,16 @@
  					      hostdata);
  
  	if (rc == 2) {
-@@ -239,7 +276,7 @@ int ibmvscsi_init_crq_queue(struct crq_q
+@@ -240,7 +277,7 @@ int ibmvscsi_init_crq_queue(struct crq_queue *queue,
  	}
  
  	if (request_irq(vdev->irq,
 -			ibmvscsi_handle_event,
 +			rpavscsi_handle_event,
  			0, "ibmvscsi", (void *)hostdata) != 0) {
- 		printk(KERN_ERR "ibmvscsi: couldn't register irq 0x%x\n",
- 		       vdev->irq);
-@@ -256,7 +293,7 @@ int ibmvscsi_init_crq_queue(struct crq_q
+ 		dev_err(hostdata->dev, "couldn't register irq 0x%x\n",
+ 			vdev->irq);
+@@ -256,7 +293,7 @@ int ibmvscsi_init_crq_queue(struct crq_queue *queue,
  	queue->cur = 0;
  	spin_lock_init(&queue->lock);
  
@@ -142,7 +144,7 @@
  		     (unsigned long)hostdata);
  
  	return retrc;
-@@ -281,8 +318,8 @@ int ibmvscsi_init_crq_queue(struct crq_q
+@@ -281,8 +318,8 @@ int ibmvscsi_init_crq_queue(struct crq_queue *queue,
   * @hostdata:	ibmvscsi_host_data of host
   *
   */
@@ -153,7 +155,7 @@
  {
  	int rc;
  	struct vio_dev *vdev = to_vio_dev(hostdata->dev);
-@@ -297,39 +334,10 @@ int ibmvscsi_reenable_crq_queue(struct c
+@@ -297,38 +334,10 @@ int ibmvscsi_reenable_crq_queue(struct crq_queue *queue,
  	return rc;
  }
  
@@ -186,10 +188,9 @@
 -				queue->msg_token, PAGE_SIZE);
 -	if (rc == 2) {
 -		/* Adapter is good, but other end is not ready */
--		printk(KERN_WARNING "ibmvscsi: Partner adapter not ready\n");
+-		dev_warn(hostdata->dev, "Partner adapter not ready\n");
 -	} else if (rc != 0) {
--		printk(KERN_WARNING
--		       "ibmvscsi: couldn't register crq--rc 0x%x\n", rc);
+-		dev_warn(hostdata->dev, "couldn't register crq--rc 0x%x\n", rc);
 -	}
 -	return rc;
 -}
@@ -200,9 +201,19 @@
 +	.reenable_crq_queue = rpavscsi_reenable_crq_queue,
 +	.send_crq = rpavscsi_send_crq,
 +};
---- linux-2.6.19.ppc64/drivers/scsi/ibmvscsi/ibmvscsi.c~	2006-11-29 21:57:37.000000000 +0000
-+++ linux-2.6.19.ppc64/drivers/scsi/ibmvscsi/ibmvscsi.c	2006-12-19 15:53:59.000000000 +0000
-@@ -89,6 +89,8 @@ static int max_requests = 50;
+diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
+index 5870866..ed9b675 100644
+--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
++++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
+@@ -70,6 +70,7 @@
+ #include <linux/moduleparam.h>
+ #include <linux/dma-mapping.h>
+ #include <linux/delay.h>
++#include <asm/firmware.h>
+ #include <asm/vio.h>
+ #include <scsi/scsi.h>
+ #include <scsi/scsi_cmnd.h>
+@@ -89,6 +90,8 @@ static int max_requests = IBMVSCSI_MAX_REQUESTS_DEFAULT;
  
  #define IBMVSCSI_VERSION "1.5.8"
  
@@ -211,29 +222,40 @@
  MODULE_DESCRIPTION("IBM Virtual SCSI");
  MODULE_AUTHOR("Dave Boutcher");
  MODULE_LICENSE("GPL");
-@@ -567,7 +569,7 @@ static int ibmvscsi_send_srp_event(struc
- 	list_add_tail(&evt_struct->list, &hostdata->sent);
+@@ -512,8 +515,8 @@ static void ibmvscsi_reset_host(struct ibmvscsi_host_data *hostdata)
+ 	atomic_set(&hostdata->request_limit, 0);
+ 
+ 	purge_requests(hostdata, DID_ERROR);
+-	if ((ibmvscsi_reset_crq_queue(&hostdata->queue, hostdata)) ||
+-	    (ibmvscsi_send_crq(hostdata, 0xC001000000000000LL, 0)) ||
++	if ((ibmvscsi_ops->reset_crq_queue(&hostdata->queue, hostdata)) ||
++	    (ibmvscsi_ops->send_crq(hostdata, 0xC001000000000000LL, 0)) ||
+ 	    (vio_enable_interrupts(to_vio_dev(hostdata->dev)))) {
+ 		atomic_set(&hostdata->request_limit, -1);
+ 		dev_err(hostdata->dev, "error after reset\n");
+@@ -618,7 +621,7 @@ static int ibmvscsi_send_srp_event(struct srp_event_struct *evt_struct,
+ 	}
  
  	if ((rc =
 -	     ibmvscsi_send_crq(hostdata, crq_as_u64[0], crq_as_u64[1])) != 0) {
 +	     ibmvscsi_ops->send_crq(hostdata, crq_as_u64[0], crq_as_u64[1])) != 0) {
  		list_del(&evt_struct->list);
+ 		del_timer(&evt_struct->timer);
  
- 		printk(KERN_ERR "ibmvscsi: send error %d\n",
-@@ -1183,8 +1185,8 @@ void ibmvscsi_handle_crq(struct viosrp_c
+@@ -1222,8 +1225,8 @@ void ibmvscsi_handle_crq(struct viosrp_crq *crq,
  		case 0x01:	/* Initialization message */
- 			printk(KERN_INFO "ibmvscsi: partner initialized\n");
+ 			dev_info(hostdata->dev, "partner initialized\n");
  			/* Send back a response */
--			if (ibmvscsi_send_crq(hostdata,
--					      0xC002000000000000LL, 0) == 0) {
-+			if (ibmvscsi_ops->send_crq(hostdata,
-+						   0xC002000000000000LL, 0) == 0) {
+-			if ((rc = ibmvscsi_send_crq(hostdata,
+-						    0xC002000000000000LL, 0)) == 0) {
++			if ((rc = ibmvscsi_ops->send_crq(hostdata,
++							 0xC002000000000000LL, 0)) == 0) {
  				/* Now login */
  				send_srp_login(hostdata);
  			} else {
-@@ -1212,10 +1214,10 @@ void ibmvscsi_handle_crq(struct viosrp_c
- 			printk(KERN_INFO
- 			       "ibmvscsi: Re-enabling adapter!\n");
+@@ -1248,10 +1251,10 @@ void ibmvscsi_handle_crq(struct viosrp_crq *crq,
+ 			/* We need to re-setup the interpartition connection */
+ 			dev_info(hostdata->dev, "Re-enabling adapter!\n");
  			purge_requests(hostdata, DID_REQUEUE);
 -			if ((ibmvscsi_reenable_crq_queue(&hostdata->queue,
 -							hostdata)) ||
@@ -245,9 +267,9 @@
 +						    0xC001000000000000LL, 0))) {
  					atomic_set(&hostdata->request_limit,
  						   -1);
- 					printk(KERN_ERR
-@@ -1228,10 +1230,10 @@ void ibmvscsi_handle_crq(struct viosrp_c
- 			       crq->format);
+ 					dev_err(hostdata->dev, "error after enable\n");
+@@ -1261,10 +1264,10 @@ void ibmvscsi_handle_crq(struct viosrp_crq *crq,
+ 				crq->format);
  
  			purge_requests(hostdata, DID_ERROR);
 -			if ((ibmvscsi_reset_crq_queue(&hostdata->queue,
@@ -260,17 +282,17 @@
 +						    0xC001000000000000LL, 0))) {
  					atomic_set(&hostdata->request_limit,
  						   -1);
- 					printk(KERN_ERR
-@@ -1517,7 +1519,7 @@ static int ibmvscsi_probe(struct vio_dev
+ 					dev_err(hostdata->dev, "error after reset\n");
+@@ -1590,7 +1593,7 @@ static int ibmvscsi_probe(struct vio_dev *vdev, const struct vio_device_id *id)
  	atomic_set(&hostdata->request_limit, -1);
  	hostdata->host->max_sectors = 32 * 8; /* default max I/O 32 pages */
  
 -	rc = ibmvscsi_init_crq_queue(&hostdata->queue, hostdata, max_requests);
 +	rc = ibmvscsi_ops->init_crq_queue(&hostdata->queue, hostdata, max_requests);
  	if (rc != 0 && rc != H_RESOURCE) {
- 		printk(KERN_ERR "ibmvscsi: couldn't initialize crq\n");
+ 		dev_err(&vdev->dev, "couldn't initialize crq. rc=%d\n", rc);
  		goto init_crq_failed;
-@@ -1538,7 +1540,7 @@ static int ibmvscsi_probe(struct vio_dev
+@@ -1611,7 +1614,7 @@ static int ibmvscsi_probe(struct vio_dev *vdev, const struct vio_device_id *id)
  	 * to fail if the other end is not acive.  In that case we don't
  	 * want to scan
  	 */
@@ -279,7 +301,7 @@
  	    || rc == H_RESOURCE) {
  		/*
  		 * Wait around max init_timeout secs for the adapter to finish
-@@ -1564,7 +1566,7 @@ static int ibmvscsi_probe(struct vio_dev
+@@ -1637,7 +1640,7 @@ static int ibmvscsi_probe(struct vio_dev *vdev, const struct vio_device_id *id)
        add_host_failed:
  	release_event_pool(&hostdata->pool, hostdata);
        init_pool_failed:
@@ -288,7 +310,7 @@
        init_crq_failed:
  	scsi_host_put(host);
        scsi_host_alloc_failed:
-@@ -1575,8 +1577,8 @@ static int ibmvscsi_remove(struct vio_de
+@@ -1648,8 +1651,8 @@ static int ibmvscsi_remove(struct vio_dev *vdev)
  {
  	struct ibmvscsi_host_data *hostdata = vdev->dev.driver_data;
  	release_event_pool(&hostdata->pool, hostdata);
@@ -299,21 +321,25 @@
  	
  	scsi_remove_host(hostdata->host);
  	scsi_host_put(hostdata->host);
-@@ -1606,6 +1608,11 @@ static struct vio_driver ibmvscsi_driver
+@@ -1679,6 +1682,13 @@ static struct vio_driver ibmvscsi_driver = {
  
  int __init ibmvscsi_module_init(void)
  {
 +	if (firmware_has_feature(FW_FEATURE_ISERIES))
 +		ibmvscsi_ops = &iseriesvscsi_ops;
-+	else
++	else if (firmware_has_feature(FW_FEATURE_VIO))
 +		ibmvscsi_ops = &rpavscsi_ops;
++	else
++		return -ENODEV;
 +
  	return vio_register_driver(&ibmvscsi_driver);
  }
  
---- linux-2.6.19.ppc64/drivers/scsi/ibmvscsi/ibmvscsi.h~	2006-11-29 21:57:37.000000000 +0000
-+++ linux-2.6.19.ppc64/drivers/scsi/ibmvscsi/ibmvscsi.h	2006-12-19 15:54:18.000000000 +0000
-@@ -94,21 +94,25 @@ struct ibmvscsi_host_data {
+diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.h b/drivers/scsi/ibmvscsi/ibmvscsi.h
+index b19c2e2..46e850e 100644
+--- a/drivers/scsi/ibmvscsi/ibmvscsi.h
++++ b/drivers/scsi/ibmvscsi/ibmvscsi.h
+@@ -98,21 +98,25 @@ struct ibmvscsi_host_data {
  };
  
  /* routines for managing a command/response queue */
@@ -353,8 +379,10 @@
 +extern struct ibmvscsi_ops rpavscsi_ops;
  
  #endif				/* IBMVSCSI_H */
---- linux-2.6.19.ppc64/drivers/scsi/ibmvscsi/iseries_vscsi.c~	2006-11-29 21:57:37.000000000 +0000
-+++ linux-2.6.19.ppc64/drivers/scsi/ibmvscsi/iseries_vscsi.c	2006-12-19 15:47:03.000000000 +0000
+diff --git a/drivers/scsi/ibmvscsi/iseries_vscsi.c b/drivers/scsi/ibmvscsi/iseries_vscsi.c
+index 6aeb5f0..0775fde 100644
+--- a/drivers/scsi/ibmvscsi/iseries_vscsi.c
++++ b/drivers/scsi/ibmvscsi/iseries_vscsi.c
 @@ -53,7 +53,7 @@ struct srp_lp_event {
  /** 
   * standard interface for handling logical partition events.
@@ -364,7 +392,7 @@
  {
  	struct srp_lp_event *evt = (struct srp_lp_event *)lpevt;
  
-@@ -74,9 +74,9 @@ static void ibmvscsi_handle_event(struct
+@@ -74,9 +74,9 @@ static void ibmvscsi_handle_event(struct HvLpEvent *lpevt)
  /* ------------------------------------------------------------
   * Routines for driver initialization
   */
@@ -377,7 +405,7 @@
  {
  	int rc;
  
-@@ -88,7 +88,7 @@ int ibmvscsi_init_crq_queue(struct crq_q
+@@ -88,7 +88,7 @@ int ibmvscsi_init_crq_queue(struct crq_queue *queue,
  		goto viopath_open_failed;
  	}
  
@@ -386,7 +414,7 @@
  	if (rc < 0) {
  		printk("vio_setHandler failed with rc %d in open_event_path\n",
  		       rc);
-@@ -102,9 +102,9 @@ int ibmvscsi_init_crq_queue(struct crq_q
+@@ -102,9 +102,9 @@ int ibmvscsi_init_crq_queue(struct crq_queue *queue,
  	return -1;
  }
  
@@ -399,7 +427,7 @@
  {
  	vio_clearHandler(viomajorsubtype_scsi);
  	viopath_close(viopath_hostLp, viomajorsubtype_scsi, max_requests);
-@@ -117,8 +117,8 @@ void ibmvscsi_release_crq_queue(struct c
+@@ -117,8 +117,8 @@ void ibmvscsi_release_crq_queue(struct crq_queue *queue,
   *
   * no-op for iSeries
   */
@@ -410,7 +438,7 @@
  {
  	return 0;
  }
-@@ -130,19 +130,20 @@ int ibmvscsi_reset_crq_queue(struct crq_
+@@ -130,19 +130,20 @@ int ibmvscsi_reset_crq_queue(struct crq_queue *queue,
   *
   * no-op for iSeries
   */
@@ -435,7 +463,7 @@
  {
  	single_host_data = hostdata;
  	return HvCallEvent_signalLpEventFast(viopath_hostLp,
-@@ -156,3 +157,11 @@ int ibmvscsi_send_crq(struct ibmvscsi_ho
+@@ -156,3 +157,11 @@ int ibmvscsi_send_crq(struct ibmvscsi_host_data *hostdata, u64 word1, u64 word2)
  					     VIOVERSION << 16, word1, word2, 0,
  					     0);
  }
@@ -447,8 +475,10 @@
 +	.reenable_crq_queue = iseriesvscsi_reenable_crq_queue,
 +	.send_crq = iseriesvscsi_send_crq,
 +};
---- linux-2.6.19.ppc64/drivers/scsi/ibmvscsi/Makefile.orig	2007-01-01 20:06:26.000000000 +0000
-+++ linux-2.6.19.ppc64/drivers/scsi/ibmvscsi/Makefile	2007-01-01 20:06:35.000000000 +0000
+diff --git a/drivers/scsi/ibmvscsi/Makefile b/drivers/scsi/ibmvscsi/Makefile
+index f67d9ef..6ac0633 100644
+--- a/drivers/scsi/ibmvscsi/Makefile
++++ b/drivers/scsi/ibmvscsi/Makefile
 @@ -1,9 +1,7 @@
  obj-$(CONFIG_SCSI_IBMVSCSI)	+= ibmvscsic.o
  




More information about the fedora-extras-commits mailing list