aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/parisc
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/parisc')
-rw-r--r--drivers/parisc/Kconfig33
-rw-r--r--drivers/parisc/pdc_stable.c223
-rw-r--r--drivers/parisc/sba_iommu.c17
3 files changed, 237 insertions, 36 deletions
diff --git a/drivers/parisc/Kconfig b/drivers/parisc/Kconfig
index 3f5de867acd7..1d3b84b4af3f 100644
--- a/drivers/parisc/Kconfig
+++ b/drivers/parisc/Kconfig
@@ -140,18 +140,37 @@ config CHASSIS_LCD_LED
140 If unsure, say Y. 140 If unsure, say Y.
141 141
142config PDC_CHASSIS 142config PDC_CHASSIS
143 bool "PDC chassis State Panel support" 143 bool "PDC chassis state codes support"
144 default y 144 default y
145 help 145 help
146 Say Y here if you want to enable support for the LED State front 146 Say Y here if you want to enable support for Chassis codes.
147 panel as found on E class, and support for the GSP Virtual Front 147 That includes support for LED State front panel as found on E
148 Panel (LED State and message logging) as found on high end 148 class, and support for the GSP Virtual Front Panel (LED State and
149 servers such as A, L and N-class. 149 message logging) as found on high end servers such as A, L and
150 150 N-class.
151 This has nothing to do with Chassis LCD and LED support. 151 This driver will also display progress messages on LCD display,
152 such as "INI", "RUN" and "FLT", and might thus clobber messages
153 shown by the LED/LCD driver.
154 This driver updates the state panel (LED and/or LCD) upon system
155 state change (eg: boot, shutdown or panic).
152 156
153 If unsure, say Y. 157 If unsure, say Y.
154 158
159
160config PDC_CHASSIS_WARN
161 bool "PDC chassis warnings support"
162 depends on PROC_FS
163 default y
164 help
165 Say Y here if you want to enable support for Chassis warnings.
166 This will add a proc entry '/proc/chassis' giving some information
167 about the overall health state of the system.
168 This includes NVRAM battery level, overtemp or failures such as
169 fans or power units.
170
171 If unsure, say Y.
172
173
155config PDC_STABLE 174config PDC_STABLE
156 tristate "PDC Stable Storage support" 175 tristate "PDC Stable Storage support"
157 depends on SYSFS 176 depends on SYSFS
diff --git a/drivers/parisc/pdc_stable.c b/drivers/parisc/pdc_stable.c
index bbeabe3fc4c6..ea1b7a63598e 100644
--- a/drivers/parisc/pdc_stable.c
+++ b/drivers/parisc/pdc_stable.c
@@ -28,8 +28,15 @@
28 * following code can deal with just 96 bytes of Stable Storage, and all 28 * following code can deal with just 96 bytes of Stable Storage, and all
29 * sizes between 96 and 192 bytes (provided they are multiple of struct 29 * sizes between 96 and 192 bytes (provided they are multiple of struct
30 * device_path size, eg: 128, 160 and 192) to provide full information. 30 * device_path size, eg: 128, 160 and 192) to provide full information.
31 * The code makes no use of data above 192 bytes. One last word: there's one 31 * One last word: there's one path we can always count on: the primary path.
32 * path we can always count on: the primary path. 32 * Anything above 224 bytes is used for 'osdep2' OS-dependent storage area.
33 *
34 * The first OS-dependent area should always be available. Obviously, this is
35 * not true for the other one. Also bear in mind that reading/writing from/to
36 * osdep2 is much more expensive than from/to osdep1.
37 * NOTE: We do not handle the 2 bytes OS-dep area at 0x5D, nor the first
38 * 2 bytes of storage available right after OSID. That's a total of 4 bytes
39 * sacrificed: -ETOOLAZY :P
33 * 40 *
34 * The current policy wrt file permissions is: 41 * The current policy wrt file permissions is:
35 * - write: root only 42 * - write: root only
@@ -64,15 +71,18 @@
64#include <asm/uaccess.h> 71#include <asm/uaccess.h>
65#include <asm/hardware.h> 72#include <asm/hardware.h>
66 73
67#define PDCS_VERSION "0.22" 74#define PDCS_VERSION "0.30"
68#define PDCS_PREFIX "PDC Stable Storage" 75#define PDCS_PREFIX "PDC Stable Storage"
69 76
70#define PDCS_ADDR_PPRI 0x00 77#define PDCS_ADDR_PPRI 0x00
71#define PDCS_ADDR_OSID 0x40 78#define PDCS_ADDR_OSID 0x40
79#define PDCS_ADDR_OSD1 0x48
80#define PDCS_ADDR_DIAG 0x58
72#define PDCS_ADDR_FSIZ 0x5C 81#define PDCS_ADDR_FSIZ 0x5C
73#define PDCS_ADDR_PCON 0x60 82#define PDCS_ADDR_PCON 0x60
74#define PDCS_ADDR_PALT 0x80 83#define PDCS_ADDR_PALT 0x80
75#define PDCS_ADDR_PKBD 0xA0 84#define PDCS_ADDR_PKBD 0xA0
85#define PDCS_ADDR_OSD2 0xE0
76 86
77MODULE_AUTHOR("Thibaut VARENE <varenet@parisc-linux.org>"); 87MODULE_AUTHOR("Thibaut VARENE <varenet@parisc-linux.org>");
78MODULE_DESCRIPTION("sysfs interface to HP PDC Stable Storage data"); 88MODULE_DESCRIPTION("sysfs interface to HP PDC Stable Storage data");
@@ -82,6 +92,9 @@ MODULE_VERSION(PDCS_VERSION);
82/* holds Stable Storage size. Initialized once and for all, no lock needed */ 92/* holds Stable Storage size. Initialized once and for all, no lock needed */
83static unsigned long pdcs_size __read_mostly; 93static unsigned long pdcs_size __read_mostly;
84 94
95/* holds OS ID. Initialized once and for all, hopefully to 0x0006 */
96static u16 pdcs_osid __read_mostly;
97
85/* This struct defines what we need to deal with a parisc pdc path entry */ 98/* This struct defines what we need to deal with a parisc pdc path entry */
86struct pdcspath_entry { 99struct pdcspath_entry {
87 rwlock_t rw_lock; /* to protect path entry access */ 100 rwlock_t rw_lock; /* to protect path entry access */
@@ -609,27 +622,64 @@ static ssize_t
609pdcs_osid_read(struct subsystem *entry, char *buf) 622pdcs_osid_read(struct subsystem *entry, char *buf)
610{ 623{
611 char *out = buf; 624 char *out = buf;
612 __u32 result;
613 char *tmpstr = NULL;
614 625
615 if (!entry || !buf) 626 if (!entry || !buf)
616 return -EINVAL; 627 return -EINVAL;
617 628
618 /* get OSID */ 629 out += sprintf(out, "%s dependent data (0x%.4x)\n",
619 if (pdc_stable_read(PDCS_ADDR_OSID, &result, sizeof(result)) != PDC_OK) 630 os_id_to_string(pdcs_osid), pdcs_osid);
631
632 return out - buf;
633}
634
635/**
636 * pdcs_osdep1_read - Stable Storage OS-Dependent data area 1 output.
637 * @entry: An allocated and populated subsytem struct. We don't use it tho.
638 * @buf: The output buffer to write to.
639 *
640 * This can hold 16 bytes of OS-Dependent data.
641 */
642static ssize_t
643pdcs_osdep1_read(struct subsystem *entry, char *buf)
644{
645 char *out = buf;
646 u32 result[4];
647
648 if (!entry || !buf)
649 return -EINVAL;
650
651 if (pdc_stable_read(PDCS_ADDR_OSD1, &result, sizeof(result)) != PDC_OK)
620 return -EIO; 652 return -EIO;
621 653
622 /* the actual result is 16 bits away */ 654 out += sprintf(out, "0x%.8x\n", result[0]);
623 switch (result >> 16) { 655 out += sprintf(out, "0x%.8x\n", result[1]);
624 case 0x0000: tmpstr = "No OS-dependent data"; break; 656 out += sprintf(out, "0x%.8x\n", result[2]);
625 case 0x0001: tmpstr = "HP-UX dependent data"; break; 657 out += sprintf(out, "0x%.8x\n", result[3]);
626 case 0x0002: tmpstr = "MPE-iX dependent data"; break; 658
627 case 0x0003: tmpstr = "OSF dependent data"; break; 659 return out - buf;
628 case 0x0004: tmpstr = "HP-RT dependent data"; break; 660}
629 case 0x0005: tmpstr = "Novell Netware dependent data"; break; 661
630 default: tmpstr = "Unknown"; break; 662/**
631 } 663 * pdcs_diagnostic_read - Stable Storage Diagnostic register output.
632 out += sprintf(out, "%s (0x%.4x)\n", tmpstr, (result >> 16)); 664 * @entry: An allocated and populated subsytem struct. We don't use it tho.
665 * @buf: The output buffer to write to.
666 *
667 * I have NFC how to interpret the content of that register ;-).
668 */
669static ssize_t
670pdcs_diagnostic_read(struct subsystem *entry, char *buf)
671{
672 char *out = buf;
673 u32 result;
674
675 if (!entry || !buf)
676 return -EINVAL;
677
678 /* get diagnostic */
679 if (pdc_stable_read(PDCS_ADDR_DIAG, &result, sizeof(result)) != PDC_OK)
680 return -EIO;
681
682 out += sprintf(out, "0x%.4x\n", (result >> 16));
633 683
634 return out - buf; 684 return out - buf;
635} 685}
@@ -645,7 +695,7 @@ static ssize_t
645pdcs_fastsize_read(struct subsystem *entry, char *buf) 695pdcs_fastsize_read(struct subsystem *entry, char *buf)
646{ 696{
647 char *out = buf; 697 char *out = buf;
648 __u32 result; 698 u32 result;
649 699
650 if (!entry || !buf) 700 if (!entry || !buf)
651 return -EINVAL; 701 return -EINVAL;
@@ -664,6 +714,39 @@ pdcs_fastsize_read(struct subsystem *entry, char *buf)
664} 714}
665 715
666/** 716/**
717 * pdcs_osdep2_read - Stable Storage OS-Dependent data area 2 output.
718 * @entry: An allocated and populated subsytem struct. We don't use it tho.
719 * @buf: The output buffer to write to.
720 *
721 * This can hold pdcs_size - 224 bytes of OS-Dependent data, when available.
722 */
723static ssize_t
724pdcs_osdep2_read(struct subsystem *entry, char *buf)
725{
726 char *out = buf;
727 unsigned long size;
728 unsigned short i;
729 u32 result;
730
731 if (unlikely(pdcs_size <= 224))
732 return -ENODATA;
733
734 size = pdcs_size - 224;
735
736 if (!entry || !buf)
737 return -EINVAL;
738
739 for (i=0; i<size; i+=4) {
740 if (unlikely(pdc_stable_read(PDCS_ADDR_OSD2 + i, &result,
741 sizeof(result)) != PDC_OK))
742 return -EIO;
743 out += sprintf(out, "0x%.8x\n", result);
744 }
745
746 return out - buf;
747}
748
749/**
667 * pdcs_auto_write - This function handles autoboot/search flag modifying. 750 * pdcs_auto_write - This function handles autoboot/search flag modifying.
668 * @entry: An allocated and populated subsytem struct. We don't use it tho. 751 * @entry: An allocated and populated subsytem struct. We don't use it tho.
669 * @buf: The input buffer to read from. 752 * @buf: The input buffer to read from.
@@ -770,13 +853,100 @@ pdcs_autosearch_write(struct subsystem *entry, const char *buf, size_t count)
770 return pdcs_auto_write(entry, buf, count, PF_AUTOSEARCH); 853 return pdcs_auto_write(entry, buf, count, PF_AUTOSEARCH);
771} 854}
772 855
856/**
857 * pdcs_osdep1_write - Stable Storage OS-Dependent data area 1 input.
858 * @entry: An allocated and populated subsytem struct. We don't use it tho.
859 * @buf: The input buffer to read from.
860 * @count: The number of bytes to be read.
861 *
862 * This can store 16 bytes of OS-Dependent data. We use a byte-by-byte
863 * write approach. It's up to userspace to deal with it when constructing
864 * its input buffer.
865 */
866static ssize_t
867pdcs_osdep1_write(struct subsystem *entry, const char *buf, size_t count)
868{
869 u8 in[16];
870
871 if (!capable(CAP_SYS_ADMIN))
872 return -EACCES;
873
874 if (!entry || !buf || !count)
875 return -EINVAL;
876
877 if (unlikely(pdcs_osid != OS_ID_LINUX))
878 return -EPERM;
879
880 if (count > 16)
881 return -EMSGSIZE;
882
883 /* We'll use a local copy of buf */
884 memset(in, 0, 16);
885 memcpy(in, buf, count);
886
887 if (pdc_stable_write(PDCS_ADDR_OSD1, &in, sizeof(in)) != PDC_OK)
888 return -EIO;
889
890 return count;
891}
892
893/**
894 * pdcs_osdep2_write - Stable Storage OS-Dependent data area 2 input.
895 * @entry: An allocated and populated subsytem struct. We don't use it tho.
896 * @buf: The input buffer to read from.
897 * @count: The number of bytes to be read.
898 *
899 * This can store pdcs_size - 224 bytes of OS-Dependent data. We use a
900 * byte-by-byte write approach. It's up to userspace to deal with it when
901 * constructing its input buffer.
902 */
903static ssize_t
904pdcs_osdep2_write(struct subsystem *entry, const char *buf, size_t count)
905{
906 unsigned long size;
907 unsigned short i;
908 u8 in[4];
909
910 if (!capable(CAP_SYS_ADMIN))
911 return -EACCES;
912
913 if (!entry || !buf || !count)
914 return -EINVAL;
915
916 if (unlikely(pdcs_size <= 224))
917 return -ENOSYS;
918
919 if (unlikely(pdcs_osid != OS_ID_LINUX))
920 return -EPERM;
921
922 size = pdcs_size - 224;
923
924 if (count > size)
925 return -EMSGSIZE;
926
927 /* We'll use a local copy of buf */
928
929 for (i=0; i<count; i+=4) {
930 memset(in, 0, 4);
931 memcpy(in, buf+i, (count-i < 4) ? count-i : 4);
932 if (unlikely(pdc_stable_write(PDCS_ADDR_OSD2 + i, &in,
933 sizeof(in)) != PDC_OK))
934 return -EIO;
935 }
936
937 return count;
938}
939
773/* The remaining attributes. */ 940/* The remaining attributes. */
774static PDCS_ATTR(size, 0444, pdcs_size_read, NULL); 941static PDCS_ATTR(size, 0444, pdcs_size_read, NULL);
775static PDCS_ATTR(autoboot, 0644, pdcs_autoboot_read, pdcs_autoboot_write); 942static PDCS_ATTR(autoboot, 0644, pdcs_autoboot_read, pdcs_autoboot_write);
776static PDCS_ATTR(autosearch, 0644, pdcs_autosearch_read, pdcs_autosearch_write); 943static PDCS_ATTR(autosearch, 0644, pdcs_autosearch_read, pdcs_autosearch_write);
777static PDCS_ATTR(timer, 0444, pdcs_timer_read, NULL); 944static PDCS_ATTR(timer, 0444, pdcs_timer_read, NULL);
778static PDCS_ATTR(osid, 0400, pdcs_osid_read, NULL); 945static PDCS_ATTR(osid, 0444, pdcs_osid_read, NULL);
946static PDCS_ATTR(osdep1, 0600, pdcs_osdep1_read, pdcs_osdep1_write);
947static PDCS_ATTR(diagnostic, 0400, pdcs_diagnostic_read, NULL);
779static PDCS_ATTR(fastsize, 0400, pdcs_fastsize_read, NULL); 948static PDCS_ATTR(fastsize, 0400, pdcs_fastsize_read, NULL);
949static PDCS_ATTR(osdep2, 0600, pdcs_osdep2_read, pdcs_osdep2_write);
780 950
781static struct subsys_attribute *pdcs_subsys_attrs[] = { 951static struct subsys_attribute *pdcs_subsys_attrs[] = {
782 &pdcs_attr_size, 952 &pdcs_attr_size,
@@ -784,7 +954,10 @@ static struct subsys_attribute *pdcs_subsys_attrs[] = {
784 &pdcs_attr_autosearch, 954 &pdcs_attr_autosearch,
785 &pdcs_attr_timer, 955 &pdcs_attr_timer,
786 &pdcs_attr_osid, 956 &pdcs_attr_osid,
957 &pdcs_attr_osdep1,
958 &pdcs_attr_diagnostic,
787 &pdcs_attr_fastsize, 959 &pdcs_attr_fastsize,
960 &pdcs_attr_osdep2,
788 NULL, 961 NULL,
789}; 962};
790 963
@@ -865,6 +1038,7 @@ pdc_stable_init(void)
865{ 1038{
866 struct subsys_attribute *attr; 1039 struct subsys_attribute *attr;
867 int i, rc = 0, error = 0; 1040 int i, rc = 0, error = 0;
1041 u32 result;
868 1042
869 /* find the size of the stable storage */ 1043 /* find the size of the stable storage */
870 if (pdc_stable_get_size(&pdcs_size) != PDC_OK) 1044 if (pdc_stable_get_size(&pdcs_size) != PDC_OK)
@@ -876,6 +1050,13 @@ pdc_stable_init(void)
876 1050
877 printk(KERN_INFO PDCS_PREFIX " facility v%s\n", PDCS_VERSION); 1051 printk(KERN_INFO PDCS_PREFIX " facility v%s\n", PDCS_VERSION);
878 1052
1053 /* get OSID */
1054 if (pdc_stable_read(PDCS_ADDR_OSID, &result, sizeof(result)) != PDC_OK)
1055 return -EIO;
1056
1057 /* the actual result is 16 bits away */
1058 pdcs_osid = (u16)(result >> 16);
1059
879 /* For now we'll register the stable subsys within this driver */ 1060 /* For now we'll register the stable subsys within this driver */
880 if ((rc = firmware_register(&stable_subsys))) 1061 if ((rc = firmware_register(&stable_subsys)))
881 goto fail_firmreg; 1062 goto fail_firmreg;
@@ -887,7 +1068,7 @@ pdc_stable_init(void)
887 1068
888 /* register the paths subsys as a subsystem of stable subsys */ 1069 /* register the paths subsys as a subsystem of stable subsys */
889 kset_set_kset_s(&paths_subsys, stable_subsys); 1070 kset_set_kset_s(&paths_subsys, stable_subsys);
890 if ((rc= subsystem_register(&paths_subsys))) 1071 if ((rc = subsystem_register(&paths_subsys)))
891 goto fail_subsysreg; 1072 goto fail_subsysreg;
892 1073
893 /* now we create all "files" for the paths subsys */ 1074 /* now we create all "files" for the paths subsys */
diff --git a/drivers/parisc/sba_iommu.c b/drivers/parisc/sba_iommu.c
index 278f325021ee..d09e39e39c60 100644
--- a/drivers/parisc/sba_iommu.c
+++ b/drivers/parisc/sba_iommu.c
@@ -316,10 +316,10 @@ static int reserve_sba_gart = 1;
316** 316**
317** Superdome (in particular, REO) allows only 64-bit CSR accesses. 317** Superdome (in particular, REO) allows only 64-bit CSR accesses.
318*/ 318*/
319#define READ_REG32(addr) le32_to_cpu(__raw_readl(addr)) 319#define READ_REG32(addr) readl(addr)
320#define READ_REG64(addr) le64_to_cpu(__raw_readq(addr)) 320#define READ_REG64(addr) readq(addr)
321#define WRITE_REG32(val, addr) __raw_writel(cpu_to_le32(val), addr) 321#define WRITE_REG32(val, addr) writel((val), (addr))
322#define WRITE_REG64(val, addr) __raw_writeq(cpu_to_le64(val), addr) 322#define WRITE_REG64(val, addr) writeq((val), (addr))
323 323
324#ifdef CONFIG_64BIT 324#ifdef CONFIG_64BIT
325#define READ_REG(addr) READ_REG64(addr) 325#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)
1427 iov_order = get_order(iova_space_size >> (IOVP_SHIFT - PAGE_SHIFT)); 1427 iov_order = get_order(iova_space_size >> (IOVP_SHIFT - PAGE_SHIFT));
1428 ioc->pdir_size = (iova_space_size / IOVP_SIZE) * sizeof(u64); 1428 ioc->pdir_size = (iova_space_size / IOVP_SIZE) * sizeof(u64);
1429 1429
1430 DBG_INIT("%s() hpa 0x%lx IOV %dMB (%d bits)\n", 1430 DBG_INIT("%s() hpa 0x%p IOV %dMB (%d bits)\n",
1431 __FUNCTION__, ioc->ioc_hpa, iova_space_size >> 20, 1431 __FUNCTION__, ioc->ioc_hpa, iova_space_size >> 20,
1432 iov_order + PAGE_SHIFT); 1432 iov_order + PAGE_SHIFT);
1433 1433
@@ -1764,7 +1764,7 @@ printk("sba_hw_init(): mem_boot 0x%x 0x%x 0x%x 0x%x\n", PAGE0->mem_boot.hpa,
1764 1764
1765 sba_dev->num_ioc = num_ioc; 1765 sba_dev->num_ioc = num_ioc;
1766 for (i = 0; i < num_ioc; i++) { 1766 for (i = 0; i < num_ioc; i++) {
1767 unsigned long ioc_hpa = sba_dev->ioc[i].ioc_hpa; 1767 void __iomem *ioc_hpa = sba_dev->ioc[i].ioc_hpa;
1768 unsigned int j; 1768 unsigned int j;
1769 1769
1770 for (j=0; j < sizeof(u64) * ROPES_PER_IOC; j+=sizeof(u64)) { 1770 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,
1776 * Improves netperf UDP_STREAM by ~10% for bcm5701. 1776 * Improves netperf UDP_STREAM by ~10% for bcm5701.
1777 */ 1777 */
1778 if (IS_PLUTO(sba_dev->iodc)) { 1778 if (IS_PLUTO(sba_dev->iodc)) {
1779 unsigned long rope_cfg, cfg_val; 1779 void __iomem *rope_cfg;
1780 unsigned long cfg_val;
1780 1781
1781 rope_cfg = ioc_hpa + IOC_ROPE0_CFG + j; 1782 rope_cfg = ioc_hpa + IOC_ROPE0_CFG + j;
1782 cfg_val = READ_REG(rope_cfg); 1783 cfg_val = READ_REG(rope_cfg);
@@ -1902,7 +1903,7 @@ sba_common_init(struct sba_device *sba_dev)
1902 * (bit #61, big endian), we have to flush and sync every time 1903 * (bit #61, big endian), we have to flush and sync every time
1903 * IO-PDIR is changed in Ike/Astro. 1904 * IO-PDIR is changed in Ike/Astro.
1904 */ 1905 */
1905 if (boot_cpu_data.pdc.capabilities & PDC_MODEL_IOPDIR_FDC) { 1906 if (ioc_needs_fdc) {
1906 printk(KERN_INFO MODULE_NAME " FDC/SYNC required.\n"); 1907 printk(KERN_INFO MODULE_NAME " FDC/SYNC required.\n");
1907 } else { 1908 } else {
1908 printk(KERN_INFO MODULE_NAME " IOC has cache coherent PDIR.\n"); 1909 printk(KERN_INFO MODULE_NAME " IOC has cache coherent PDIR.\n");