From patchwork Tue Nov 30 22:25:35 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Bogendoerfer X-Patchwork-Id: 368921 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oAUMQ8bU022857 for ; Tue, 30 Nov 2010 22:26:10 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754403Ab0K3WZ7 (ORCPT ); Tue, 30 Nov 2010 17:25:59 -0500 Received: from elvis.franken.de ([193.175.24.41]:52509 "EHLO elvis.franken.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753907Ab0K3WZ7 (ORCPT ); Tue, 30 Nov 2010 17:25:59 -0500 Received: from uucp (helo=solo.franken.de) by elvis.franken.de with local-bsmtp (Exim 3.36 #1) id 1PNYe5-0008LW-00; Tue, 30 Nov 2010 23:25:57 +0100 Received: by solo.franken.de (Postfix, from userid 1000) id 909F81D4BD; Tue, 30 Nov 2010 23:25:35 +0100 (CET) From: Thomas Bogendoerfer Subject: [PATCH] BMC support for PARISC machines To: openipmi-developer@lists.sourceforge.net, linux-parisc@vger.kernel.org cc: minyard@acm.org Message-Id: <20101130222535.909F81D4BD@solo.franken.de> Date: Tue, 30 Nov 2010 23:25:35 +0100 (CET) Sender: linux-parisc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Tue, 30 Nov 2010 22:26:10 +0000 (UTC) diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c index 035da9e..1599a45 100644 --- a/drivers/char/ipmi/ipmi_si_intf.c +++ b/drivers/char/ipmi/ipmi_si_intf.c @@ -71,6 +71,11 @@ #include #endif +#ifdef CONFIG_PARISC +#include /* for register_parisc_driver() stuff */ +#include +#endif + #define PFX "ipmi_si: " /* Measure times between events in the driver. */ @@ -311,6 +316,9 @@ static int pnp_registered; #ifdef CONFIG_PPC_OF static int of_registered; #endif +#ifdef CONFIG_PARISC +static int parisc_registered; +#endif static unsigned int kipmid_max_busy_us[SI_MAX_PARMS]; static int num_max_busy_us; @@ -2648,6 +2656,64 @@ static struct of_platform_driver ipmi_of_platform_driver = { }; #endif /* CONFIG_PPC_OF */ +#ifdef CONFIG_PARISC +static int __devinit ipmi_parisc_probe(struct parisc_device *dev) +{ + struct smi_info *info; + + info = kzalloc(sizeof(*info), GFP_KERNEL); + + if (!info) { + dev_err(&dev->dev, + "could not allocate memory for PARISC probe\n"); + return -ENOMEM; + } + + info->si_type = SI_KCS; + info->addr_source = SI_DEVICETREE; + info->io_setup = mem_setup; + info->io.addr_type = IPMI_MEM_ADDR_SPACE; + info->io.addr_data = dev->hpa.start; + info->io.regsize = 1; + info->io.regspacing = 1; + info->io.regshift = 0; + info->irq = 0; /* no interrup */ + info->irq_setup = NULL; + info->dev = &dev->dev; + + dev_dbg(&dev->dev, "addr 0x%lx regsize %d spacing %d irq %d\n", + info->io.addr_data, info->io.regsize, info->io.regspacing, + info->irq); + + dev_set_drvdata(&dev->dev, info); + + if (add_smi(info)) { + kfree(info); + return -EBUSY; + } + + return 0; +} + +static int __devexit ipmi_parisc_remove(struct parisc_device *dev) +{ + cleanup_one_si(dev_get_drvdata(&dev->dev)); + return 0; +} + +static struct parisc_device_id ipmi_parisc_tbl[] = { + { HPHW_MC, HVERSION_REV_ANY_ID, 0x004, 0xC0 }, + { 0, } +}; + +static struct parisc_driver ipmi_parisc_driver = { + .name = "ipmi", + .id_table = ipmi_parisc_tbl, + .probe = ipmi_parisc_probe, + .remove = ipmi_parisc_remove, +}; +#endif /* CONFIG_PARISC */ + static int wait_for_msg_done(struct smi_info *smi_info) { enum si_sm_result smi_result; @@ -3385,6 +3451,13 @@ static int __devinit init_ipmi_si(void) of_registered = 1; #endif +#ifdef CONFIG_PARISC + register_parisc_driver(&ipmi_parisc_driver); + parisc_registered = 1; + /* poking PC IO addresses will crash machine, don't do it */ + si_trydefaults = 0; +#endif + /* We prefer devices with interrupts, but in the case of a machine with multiple BMCs we assume that there will be several instances of a given type so if we succeed in registering a type then also @@ -3444,6 +3517,11 @@ static int __devinit init_ipmi_si(void) if (of_registered) of_unregister_platform_driver(&ipmi_of_platform_driver); #endif + +#ifdef CONFIG_PARISC + if (parisc_registered) + unregister_parisc_driver(&ipmi_parisc_driver); +#endif driver_unregister(&ipmi_driver.driver); printk(KERN_WARNING PFX "Unable to find any System Interface(s)\n");