From 40d78de1aced7e0f3ce112698d847adcc643efdf Mon Sep 17 00:00:00 2001 From: Grant Grundler Date: Thu, 11 May 2006 00:31:31 -0600 Subject: [PARISC] Fix gcc 4.1 warnings in sba_iommu.c Clean up gcc 4.1 warnings noted by Joel Soete. Kyle McMartin gets kudos for pointing out the issues. Matthew Wilcox noticed sba_iommu was using open coded versions of (read|write)X. Signed-off-by: Grant Grundler Signed-off-by: Matthew Wilcox Signed-off-by: Kyle McMartin --- drivers/parisc/sba_iommu.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'drivers/parisc') diff --git a/drivers/parisc/sba_iommu.c b/drivers/parisc/sba_iommu.c index 278f325021e..49b61755119 100644 --- a/drivers/parisc/sba_iommu.c +++ b/drivers/parisc/sba_iommu.c @@ -316,10 +316,10 @@ static int reserve_sba_gart = 1; ** ** Superdome (in particular, REO) allows only 64-bit CSR accesses. */ -#define READ_REG32(addr) le32_to_cpu(__raw_readl(addr)) -#define READ_REG64(addr) le64_to_cpu(__raw_readq(addr)) -#define WRITE_REG32(val, addr) __raw_writel(cpu_to_le32(val), addr) -#define WRITE_REG64(val, addr) __raw_writeq(cpu_to_le64(val), addr) +#define READ_REG32(addr) readl(addr) +#define READ_REG64(addr) readq(addr) +#define WRITE_REG32(val, addr) writel((val), (addr)) +#define WRITE_REG64(val, addr) writeq((val), (addr)) #ifdef CONFIG_64BIT #define READ_REG(addr) READ_REG64(addr) @@ -1427,7 +1427,7 @@ sba_ioc_init_pluto(struct parisc_device *sba, struct ioc *ioc, int ioc_num) iov_order = get_order(iova_space_size >> (IOVP_SHIFT - PAGE_SHIFT)); ioc->pdir_size = (iova_space_size / IOVP_SIZE) * sizeof(u64); - DBG_INIT("%s() hpa 0x%lx IOV %dMB (%d bits)\n", + DBG_INIT("%s() hpa 0x%p IOV %dMB (%d bits)\n", __FUNCTION__, ioc->ioc_hpa, iova_space_size >> 20, iov_order + PAGE_SHIFT); @@ -1764,7 +1764,7 @@ printk("sba_hw_init(): mem_boot 0x%x 0x%x 0x%x 0x%x\n", PAGE0->mem_boot.hpa, sba_dev->num_ioc = num_ioc; for (i = 0; i < num_ioc; i++) { - unsigned long ioc_hpa = sba_dev->ioc[i].ioc_hpa; + void __iomem *ioc_hpa = sba_dev->ioc[i].ioc_hpa; unsigned int j; for (j=0; j < sizeof(u64) * ROPES_PER_IOC; j+=sizeof(u64)) { @@ -1776,7 +1776,8 @@ printk("sba_hw_init(): mem_boot 0x%x 0x%x 0x%x 0x%x\n", PAGE0->mem_boot.hpa, * Improves netperf UDP_STREAM by ~10% for bcm5701. */ if (IS_PLUTO(sba_dev->iodc)) { - unsigned long rope_cfg, cfg_val; + void __iomem *rope_cfg; + unsigned long cfg_val; rope_cfg = ioc_hpa + IOC_ROPE0_CFG + j; cfg_val = READ_REG(rope_cfg); -- cgit v1.2.3 From 692086e0b3ca9a6cb876b901bfa87717044cb20f Mon Sep 17 00:00:00 2001 From: Kyle McMartin Date: Tue, 30 May 2006 17:50:29 +0000 Subject: [PARISC] Test ioc_needs_fdc variable instead of open coding Some debugging code in sba_iommu.c should be testing ioc_needs_fdc, not directly testing boot_cpu_data. Signed-off-by: Kyle McMartin --- drivers/parisc/sba_iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/parisc') diff --git a/drivers/parisc/sba_iommu.c b/drivers/parisc/sba_iommu.c index 49b61755119..d09e39e39c6 100644 --- a/drivers/parisc/sba_iommu.c +++ b/drivers/parisc/sba_iommu.c @@ -1903,7 +1903,7 @@ sba_common_init(struct sba_device *sba_dev) * (bit #61, big endian), we have to flush and sync every time * IO-PDIR is changed in Ike/Astro. */ - if (boot_cpu_data.pdc.capabilities & PDC_MODEL_IOPDIR_FDC) { + if (ioc_needs_fdc) { printk(KERN_INFO MODULE_NAME " FDC/SYNC required.\n"); } else { printk(KERN_INFO MODULE_NAME " IOC has cache coherent PDIR.\n"); -- cgit v1.2.3 From 8ffaeaf42e91930888df09d696a8a6ebe056d0e0 Mon Sep 17 00:00:00 2001 From: Thibaut Varene Date: Wed, 3 May 2006 17:27:35 -0600 Subject: [PARISC] PDC_CHASSIS is implemented on all machines This patch removes a limitation of the original code, so that CHASSIS codes can be sent to all machines. On machines with a LCD panel, this code displays "INI" during bootup, "RUN" when the system is booted and running, "FLT" when a panic occurs, etc. This part of the code can be enabled/disabled through CONFIG_PDC_CHASSIS This patch also adds minimalistic support for Chassis warnings, through a proc entry '/proc/chassis', which will reflect the warnings status (PSU or fans failure when they happen, NVRAM battery level and temperature thresholds overflows). This part of the code can be enabled/disabled through CONFIG_PDC_CHASSIS_WARN Signed-off-by: Thibaut VARENE Signed-off-by: Kyle McMartin --- drivers/parisc/Kconfig | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) (limited to 'drivers/parisc') diff --git a/drivers/parisc/Kconfig b/drivers/parisc/Kconfig index 3f5de867acd..1d3b84b4af3 100644 --- a/drivers/parisc/Kconfig +++ b/drivers/parisc/Kconfig @@ -140,18 +140,37 @@ config CHASSIS_LCD_LED If unsure, say Y. config PDC_CHASSIS - bool "PDC chassis State Panel support" + bool "PDC chassis state codes support" default y help - Say Y here if you want to enable support for the LED State front - panel as found on E class, and support for the GSP Virtual Front - Panel (LED State and message logging) as found on high end - servers such as A, L and N-class. - - This has nothing to do with Chassis LCD and LED support. + Say Y here if you want to enable support for Chassis codes. + That includes support for LED State front panel as found on E + class, and support for the GSP Virtual Front Panel (LED State and + message logging) as found on high end servers such as A, L and + N-class. + This driver will also display progress messages on LCD display, + such as "INI", "RUN" and "FLT", and might thus clobber messages + shown by the LED/LCD driver. + This driver updates the state panel (LED and/or LCD) upon system + state change (eg: boot, shutdown or panic). If unsure, say Y. + +config PDC_CHASSIS_WARN + bool "PDC chassis warnings support" + depends on PROC_FS + default y + help + Say Y here if you want to enable support for Chassis warnings. + This will add a proc entry '/proc/chassis' giving some information + about the overall health state of the system. + This includes NVRAM battery level, overtemp or failures such as + fans or power units. + + If unsure, say Y. + + config PDC_STABLE tristate "PDC Stable Storage support" depends on SYSFS -- cgit v1.2.3 From 3f9edb53f74b4e18f92783da7b6f5ad1d36e05b2 Mon Sep 17 00:00:00 2001 From: Thibaut Varene Date: Thu, 4 May 2006 18:43:34 -0600 Subject: [PARISC] pdc_stable version 0.30 pdc_stable v0.30: This patch introduces 3 more files to the /sys/firmware/stable tree: - diagnostic, which contains a cryptic hex string - osdep1, a 16 bytes os-dependent storage area always available - osdep2, another os-dependent storage area which existence/size depends on hversion. This patch also adds code to setup the "Linux" signature in stable storage. That is to say that starting with this patch, the kernel will now sign its OSID (0x0006, thx LaMont) in Stable Storage upon boot, whether pdc_stable is enabled or not. Signed-off-by: Thibaut VARENE Signed-off-by: Kyle McMartin --- drivers/parisc/pdc_stable.c | 219 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 205 insertions(+), 14 deletions(-) (limited to 'drivers/parisc') diff --git a/drivers/parisc/pdc_stable.c b/drivers/parisc/pdc_stable.c index bbeabe3fc4c..4b991d50e57 100644 --- a/drivers/parisc/pdc_stable.c +++ b/drivers/parisc/pdc_stable.c @@ -28,8 +28,15 @@ * following code can deal with just 96 bytes of Stable Storage, and all * sizes between 96 and 192 bytes (provided they are multiple of struct * device_path size, eg: 128, 160 and 192) to provide full information. - * The code makes no use of data above 192 bytes. One last word: there's one - * path we can always count on: the primary path. + * One last word: there's one path we can always count on: the primary path. + * Anything above 224 bytes is used for 'osdep2' OS-dependent storage area. + * + * The first OS-dependent area should always be available. Obviously, this is + * not true for the other one. Also bear in mind that reading/writing from/to + * osdep2 is much more expensive than from/to osdep1. + * NOTE: We do not handle the 2 bytes OS-dep area at 0x5D, nor the first + * 2 bytes of storage available right after OSID. That's a total of 4 bytes + * sacrificed: -ETOOLAZY :P * * The current policy wrt file permissions is: * - write: root only @@ -64,15 +71,18 @@ #include #include -#define PDCS_VERSION "0.22" +#define PDCS_VERSION "0.30" #define PDCS_PREFIX "PDC Stable Storage" #define PDCS_ADDR_PPRI 0x00 #define PDCS_ADDR_OSID 0x40 +#define PDCS_ADDR_OSD1 0x48 +#define PDCS_ADDR_DIAG 0x58 #define PDCS_ADDR_FSIZ 0x5C #define PDCS_ADDR_PCON 0x60 #define PDCS_ADDR_PALT 0x80 #define PDCS_ADDR_PKBD 0xA0 +#define PDCS_ADDR_OSD2 0xE0 MODULE_AUTHOR("Thibaut VARENE "); MODULE_DESCRIPTION("sysfs interface to HP PDC Stable Storage data"); @@ -82,6 +92,9 @@ MODULE_VERSION(PDCS_VERSION); /* holds Stable Storage size. Initialized once and for all, no lock needed */ static unsigned long pdcs_size __read_mostly; +/* holds OS ID. Initialized once and for all, hopefully to 0x0006 */ +static u16 pdcs_osid __read_mostly; + /* This struct defines what we need to deal with a parisc pdc path entry */ struct pdcspath_entry { rwlock_t rw_lock; /* to protect path entry access */ @@ -609,27 +622,74 @@ static ssize_t pdcs_osid_read(struct subsystem *entry, char *buf) { char *out = buf; - __u32 result; char *tmpstr = NULL; if (!entry || !buf) return -EINVAL; - /* get OSID */ - if (pdc_stable_read(PDCS_ADDR_OSID, &result, sizeof(result)) != PDC_OK) - return -EIO; - - /* the actual result is 16 bits away */ - switch (result >> 16) { + switch (pdcs_osid) { case 0x0000: tmpstr = "No OS-dependent data"; break; case 0x0001: tmpstr = "HP-UX dependent data"; break; case 0x0002: tmpstr = "MPE-iX dependent data"; break; case 0x0003: tmpstr = "OSF dependent data"; break; case 0x0004: tmpstr = "HP-RT dependent data"; break; case 0x0005: tmpstr = "Novell Netware dependent data"; break; + case 0x0006: tmpstr = "Linux dependent data"; break; default: tmpstr = "Unknown"; break; } - out += sprintf(out, "%s (0x%.4x)\n", tmpstr, (result >> 16)); + out += sprintf(out, "%s (0x%.4x)\n", tmpstr, pdcs_osid); + + return out - buf; +} + +/** + * pdcs_osdep1_read - Stable Storage OS-Dependent data area 1 output. + * @entry: An allocated and populated subsytem struct. We don't use it tho. + * @buf: The output buffer to write to. + * + * This can hold 16 bytes of OS-Dependent data. + */ +static ssize_t +pdcs_osdep1_read(struct subsystem *entry, char *buf) +{ + char *out = buf; + u32 result[4]; + + if (!entry || !buf) + return -EINVAL; + + if (pdc_stable_read(PDCS_ADDR_OSD1, &result, sizeof(result)) != PDC_OK) + return -EIO; + + out += sprintf(out, "0x%.8x\n", result[0]); + out += sprintf(out, "0x%.8x\n", result[1]); + out += sprintf(out, "0x%.8x\n", result[2]); + out += sprintf(out, "0x%.8x\n", result[3]); + + return out - buf; +} + +/** + * pdcs_diagnostic_read - Stable Storage Diagnostic register output. + * @entry: An allocated and populated subsytem struct. We don't use it tho. + * @buf: The output buffer to write to. + * + * I have NFC how to interpret the content of that register ;-). + */ +static ssize_t +pdcs_diagnostic_read(struct subsystem *entry, char *buf) +{ + char *out = buf; + u32 result; + + if (!entry || !buf) + return -EINVAL; + + /* get diagnostic */ + if (pdc_stable_read(PDCS_ADDR_DIAG, &result, sizeof(result)) != PDC_OK) + return -EIO; + + out += sprintf(out, "0x%.4x\n", (result >> 16)); return out - buf; } @@ -645,7 +705,7 @@ static ssize_t pdcs_fastsize_read(struct subsystem *entry, char *buf) { char *out = buf; - __u32 result; + u32 result; if (!entry || !buf) return -EINVAL; @@ -663,6 +723,39 @@ pdcs_fastsize_read(struct subsystem *entry, char *buf) return out - buf; } +/** + * pdcs_osdep2_read - Stable Storage OS-Dependent data area 2 output. + * @entry: An allocated and populated subsytem struct. We don't use it tho. + * @buf: The output buffer to write to. + * + * This can hold pdcs_size - 224 bytes of OS-Dependent data, when available. + */ +static ssize_t +pdcs_osdep2_read(struct subsystem *entry, char *buf) +{ + char *out = buf; + unsigned long size; + unsigned short i; + u32 result; + + if (unlikely(pdcs_size <= 224)) + return -ENODATA; + + size = pdcs_size - 224; + + if (!entry || !buf) + return -EINVAL; + + for (i=0; i 16) + return -EMSGSIZE; + + /* We'll use a local copy of buf */ + memset(in, 0, 16); + memcpy(in, buf, count); + + if (pdc_stable_write(PDCS_ADDR_OSD1, &in, sizeof(in)) != PDC_OK) + return -EIO; + + return count; +} + +/** + * pdcs_osdep2_write - Stable Storage OS-Dependent data area 2 input. + * @entry: An allocated and populated subsytem struct. We don't use it tho. + * @buf: The input buffer to read from. + * @count: The number of bytes to be read. + * + * This can store pdcs_size - 224 bytes of OS-Dependent data. We use a + * byte-by-byte write approach. It's up to userspace to deal with it when + * constructing its input buffer. + */ +static ssize_t +pdcs_osdep2_write(struct subsystem *entry, const char *buf, size_t count) +{ + unsigned long size; + unsigned short i; + u8 in[4]; + + if (!capable(CAP_SYS_ADMIN)) + return -EACCES; + + if (!entry || !buf || !count) + return -EINVAL; + + if (unlikely(pdcs_size <= 224)) + return -ENOSYS; + + if (unlikely(pdcs_osid != 0x0006)) + return -EPERM; + + size = pdcs_size - 224; + + if (count > size) + return -EMSGSIZE; + + /* We'll use a local copy of buf */ + + for (i=0; i> 16); + /* For now we'll register the stable subsys within this driver */ if ((rc = firmware_register(&stable_subsys))) goto fail_firmreg; @@ -887,7 +1078,7 @@ pdc_stable_init(void) /* register the paths subsys as a subsystem of stable subsys */ kset_set_kset_s(&paths_subsys, stable_subsys); - if ((rc= subsystem_register(&paths_subsys))) + if ((rc = subsystem_register(&paths_subsys))) goto fail_subsysreg; /* now we create all "files" for the paths subsys */ -- cgit v1.2.3 From b0e8bfca2f6cdef6145e377ff0797fc42473b659 Mon Sep 17 00:00:00 2001 From: Thibaut Varene Date: Thu, 4 May 2006 18:43:34 -0600 Subject: [PARISC] Reduce data footprint in pdc_stable.c No code change - reduce data footprint. Signed-off-by: Thibaut VARENE Signed-off-by: Kyle McMartin --- drivers/parisc/pdc_stable.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'drivers/parisc') diff --git a/drivers/parisc/pdc_stable.c b/drivers/parisc/pdc_stable.c index 4b991d50e57..a1094210cd1 100644 --- a/drivers/parisc/pdc_stable.c +++ b/drivers/parisc/pdc_stable.c @@ -628,16 +628,16 @@ pdcs_osid_read(struct subsystem *entry, char *buf) return -EINVAL; switch (pdcs_osid) { - case 0x0000: tmpstr = "No OS-dependent data"; break; - case 0x0001: tmpstr = "HP-UX dependent data"; break; - case 0x0002: tmpstr = "MPE-iX dependent data"; break; - case 0x0003: tmpstr = "OSF dependent data"; break; - case 0x0004: tmpstr = "HP-RT dependent data"; break; - case 0x0005: tmpstr = "Novell Netware dependent data"; break; - case 0x0006: tmpstr = "Linux dependent data"; break; + case 0x0000: tmpstr = "No OS"; break; + case 0x0001: tmpstr = "HP-UX"; break; + case 0x0002: tmpstr = "MPE-iX"; break; + case 0x0003: tmpstr = "OSF"; break; + case 0x0004: tmpstr = "HP-RT"; break; + case 0x0005: tmpstr = "Novell Netware"; break; + case 0x0006: tmpstr = "Linux"; break; default: tmpstr = "Unknown"; break; } - out += sprintf(out, "%s (0x%.4x)\n", tmpstr, pdcs_osid); + out += sprintf(out, "%s dependent data (0x%.4x)\n", tmpstr, pdcs_osid); return out - buf; } -- cgit v1.2.3 From ec1fdc24c2ae012b078ba0187ceef208e08a3aec Mon Sep 17 00:00:00 2001 From: Kyle McMartin Date: Wed, 21 Jun 2006 19:27:29 +0000 Subject: [PARISC] OS_ID_LINUX == 0x0006 We were assigned an OS_ID of 0x0006. Consistently use OS_ID_LINUX instead of using the magic number. Also update the OS_ID_ defines in asm/pdc.h to reflect this. Signed-off-by: Kyle McMartin --- drivers/parisc/pdc_stable.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/parisc') diff --git a/drivers/parisc/pdc_stable.c b/drivers/parisc/pdc_stable.c index a1094210cd1..97b34585804 100644 --- a/drivers/parisc/pdc_stable.c +++ b/drivers/parisc/pdc_stable.c @@ -884,7 +884,7 @@ pdcs_osdep1_write(struct subsystem *entry, const char *buf, size_t count) if (!entry || !buf || !count) return -EINVAL; - if (unlikely(pdcs_osid != 0x0006)) + if (unlikely(pdcs_osid != OS_ID_LINUX)) return -EPERM; if (count > 16) @@ -926,7 +926,7 @@ pdcs_osdep2_write(struct subsystem *entry, const char *buf, size_t count) if (unlikely(pdcs_size <= 224)) return -ENOSYS; - if (unlikely(pdcs_osid != 0x0006)) + if (unlikely(pdcs_osid != OS_ID_LINUX)) return -EPERM; size = pdcs_size - 224; -- cgit v1.2.3 From 67a061a191017f984a1ef0ff73ae988b9b15f6d3 Mon Sep 17 00:00:00 2001 From: Kyle McMartin Date: Sun, 25 Jun 2006 16:58:57 +0000 Subject: [PARISC] Add os_id_to_string helper Add a helper to asm/pdc.h to translate OS_ID values to strings and use it in the pdc_stable driver. Signed-off-by: Kyle McMartin --- drivers/parisc/pdc_stable.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'drivers/parisc') diff --git a/drivers/parisc/pdc_stable.c b/drivers/parisc/pdc_stable.c index 97b34585804..ea1b7a63598 100644 --- a/drivers/parisc/pdc_stable.c +++ b/drivers/parisc/pdc_stable.c @@ -622,22 +622,12 @@ static ssize_t pdcs_osid_read(struct subsystem *entry, char *buf) { char *out = buf; - char *tmpstr = NULL; if (!entry || !buf) return -EINVAL; - switch (pdcs_osid) { - case 0x0000: tmpstr = "No OS"; break; - case 0x0001: tmpstr = "HP-UX"; break; - case 0x0002: tmpstr = "MPE-iX"; break; - case 0x0003: tmpstr = "OSF"; break; - case 0x0004: tmpstr = "HP-RT"; break; - case 0x0005: tmpstr = "Novell Netware"; break; - case 0x0006: tmpstr = "Linux"; break; - default: tmpstr = "Unknown"; break; - } - out += sprintf(out, "%s dependent data (0x%.4x)\n", tmpstr, pdcs_osid); + out += sprintf(out, "%s dependent data (0x%.4x)\n", + os_id_to_string(pdcs_osid), pdcs_osid); return out - buf; } -- cgit v1.2.3