Merge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc

* 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc:
[POWERPC] Minor comment fix for misc_64.S
[POWERPC] Use H_CEDE on non-SMT
[POWERPC] force 64bit mode in fwnmi handlers to workaround firmware bugs
[POWERPC] PMAC_APM_EMU should depend on ADB_PMU
[POWERPC] Fix new interrupt code (MPIC detection)
[POWERPC] Fix new interrupt code (MPIC endianness)
[POWERPC] Add cpufreq support for Xserve G5
[POWERPC] Xserve G5 thermal control fixes
[POWERPC] Fix mem= handling when the memory limit is > RMO size
[POWERPC] More offb/bootx fixes
[POWERPC] Fix legacy_serial.c error handling on 32 bits
[POWERPC] Fix default clock for udbg_16550
[POWERPC] Fix non-MPIC CHRPs with CONFIG_SMP set
[POWERPC] Fix 32 bits warning in prom_init.c
[POWERPC] Workaround Pegasos incorrect ISA "ranges"
[POWERPC] fix up front-LED Kconfig

+703 -263
+1 -1
arch/powerpc/Kconfig
··· 504 504 505 505 config CPU_FREQ_PMAC64 506 506 bool "Support for some Apple G5s" 507 - depends on CPU_FREQ && PMAC_SMU && PPC64 507 + depends on CPU_FREQ && PPC64 508 508 select CPU_FREQ_TABLE 509 509 help 510 510 This adds support for frequency switching on Apple iMac G5,
+96 -16
arch/powerpc/configs/pmac32_defconfig
··· 1 1 # 2 2 # Automatically generated make config: don't edit 3 - # Linux kernel version: 2.6.17-rc5 4 - # Mon May 29 14:47:49 2006 3 + # Linux kernel version: 2.6.17 4 + # Mon Jul 3 14:20:49 2006 5 5 # 6 6 # CONFIG_PPC64 is not set 7 7 CONFIG_PPC32=y 8 8 CONFIG_PPC_MERGE=y 9 9 CONFIG_MMU=y 10 10 CONFIG_GENERIC_HARDIRQS=y 11 + CONFIG_IRQ_PER_CPU=y 11 12 CONFIG_RWSEM_XCHGADD_ALGORITHM=y 12 13 CONFIG_GENERIC_HWEIGHT=y 13 14 CONFIG_GENERIC_CALIBRATE_DELAY=y 15 + CONFIG_GENERIC_FIND_NEXT_BIT=y 14 16 CONFIG_PPC=y 15 17 CONFIG_EARLY_PRINTK=y 16 18 CONFIG_GENERIC_NVRAM=y ··· 31 29 # CONFIG_PPC_82xx is not set 32 30 # CONFIG_PPC_83xx is not set 33 31 # CONFIG_PPC_85xx is not set 32 + # CONFIG_PPC_86xx is not set 34 33 # CONFIG_40x is not set 35 34 # CONFIG_44x is not set 36 35 # CONFIG_8xx is not set ··· 42 39 CONFIG_PPC_STD_MMU=y 43 40 CONFIG_PPC_STD_MMU_32=y 44 41 # CONFIG_SMP is not set 42 + CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 45 43 46 44 # 47 45 # Code maturity level options ··· 76 72 CONFIG_BUG=y 77 73 CONFIG_ELF_CORE=y 78 74 CONFIG_BASE_FULL=y 75 + CONFIG_RT_MUTEXES=y 79 76 CONFIG_FUTEX=y 80 77 CONFIG_EPOLL=y 81 78 CONFIG_SHMEM=y 82 79 CONFIG_SLAB=y 80 + CONFIG_VM_EVENT_COUNTERS=y 83 81 # CONFIG_TINY_SHMEM is not set 84 82 CONFIG_BASE_SMALL=0 85 83 # CONFIG_SLOB is not set ··· 125 119 # CONFIG_APUS is not set 126 120 # CONFIG_PPC_CHRP is not set 127 121 CONFIG_PPC_PMAC=y 122 + # CONFIG_PPC_CELL is not set 123 + # CONFIG_PPC_CELL_NATIVE is not set 124 + # CONFIG_UDBG_RTAS_CONSOLE is not set 128 125 CONFIG_MPIC=y 129 126 # CONFIG_PPC_RTAS is not set 130 127 # CONFIG_MMIO_NVRAM is not set ··· 163 154 # CONFIG_PREEMPT is not set 164 155 CONFIG_BINFMT_ELF=y 165 156 CONFIG_BINFMT_MISC=m 157 + CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y 166 158 # CONFIG_KEXEC is not set 167 159 CONFIG_ARCH_FLATMEM_ENABLE=y 168 160 CONFIG_SELECT_MEMORY_MODEL=y ··· 174 164 CONFIG_FLAT_NODE_MEM_MAP=y 175 165 # CONFIG_SPARSEMEM_STATIC is not set 176 166 CONFIG_SPLIT_PTLOCK_CPUS=4 167 + # CONFIG_RESOURCES_64BIT is not set 177 168 CONFIG_PROC_DEVICETREE=y 178 169 # CONFIG_CMDLINE_BOOL is not set 179 170 CONFIG_PM=y ··· 193 182 CONFIG_PPC_INDIRECT_PCI=y 194 183 CONFIG_PCI=y 195 184 CONFIG_PCI_DOMAINS=y 185 + # CONFIG_PCIEPORTBUS is not set 196 186 # CONFIG_PCI_DEBUG is not set 197 187 198 188 # ··· 268 256 # CONFIG_INET_IPCOMP is not set 269 257 # CONFIG_INET_XFRM_TUNNEL is not set 270 258 # CONFIG_INET_TUNNEL is not set 259 + # CONFIG_INET_XFRM_MODE_TRANSPORT is not set 260 + # CONFIG_INET_XFRM_MODE_TUNNEL is not set 271 261 CONFIG_INET_DIAG=y 272 262 CONFIG_INET_TCP_DIAG=y 273 263 # CONFIG_TCP_CONG_ADVANCED is not set ··· 282 268 # CONFIG_IPV6 is not set 283 269 # CONFIG_INET6_XFRM_TUNNEL is not set 284 270 # CONFIG_INET6_TUNNEL is not set 271 + # CONFIG_NETWORK_SECMARK is not set 285 272 CONFIG_NETFILTER=y 286 273 # CONFIG_NETFILTER_DEBUG is not set 287 274 ··· 307 292 CONFIG_NETFILTER_XT_MATCH_POLICY=m 308 293 CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m 309 294 CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m 295 + # CONFIG_NETFILTER_XT_MATCH_QUOTA is not set 310 296 CONFIG_NETFILTER_XT_MATCH_REALM=m 311 297 CONFIG_NETFILTER_XT_MATCH_SCTP=m 312 298 CONFIG_NETFILTER_XT_MATCH_STATE=m 299 + # CONFIG_NETFILTER_XT_MATCH_STATISTIC is not set 313 300 CONFIG_NETFILTER_XT_MATCH_STRING=m 314 301 CONFIG_NETFILTER_XT_MATCH_TCPMSS=m 315 302 ··· 330 313 CONFIG_IP_NF_AMANDA=m 331 314 CONFIG_IP_NF_PPTP=m 332 315 CONFIG_IP_NF_H323=m 316 + # CONFIG_IP_NF_SIP is not set 333 317 # CONFIG_IP_NF_QUEUE is not set 334 318 CONFIG_IP_NF_IPTABLES=m 335 319 CONFIG_IP_NF_MATCH_IPRANGE=m ··· 475 457 # CONFIG_ALI_FIR is not set 476 458 # CONFIG_VLSI_FIR is not set 477 459 # CONFIG_VIA_FIR is not set 460 + # CONFIG_MCS_FIR is not set 478 461 CONFIG_BT=m 479 462 CONFIG_BT_L2CAP=m 480 463 CONFIG_BT_SCO=m ··· 519 500 CONFIG_PREVENT_FIRMWARE_BUILD=y 520 501 CONFIG_FW_LOADER=y 521 502 # CONFIG_DEBUG_DRIVER is not set 503 + # CONFIG_SYS_HYPERVISOR is not set 522 504 523 505 # 524 506 # Connector - unified userspace <-> kernelspace linker ··· 620 600 CONFIG_BLK_DEV_IDE_PMAC=y 621 601 CONFIG_BLK_DEV_IDE_PMAC_ATA100FIRST=y 622 602 CONFIG_BLK_DEV_IDEDMA_PMAC=y 623 - CONFIG_BLK_DEV_IDE_PMAC_BLINK=y 624 603 # CONFIG_IDE_ARM is not set 625 604 CONFIG_BLK_DEV_IDEDMA=y 626 605 # CONFIG_IDEDMA_IVB is not set ··· 680 661 # CONFIG_MEGARAID_LEGACY is not set 681 662 # CONFIG_MEGARAID_SAS is not set 682 663 # CONFIG_SCSI_SATA is not set 664 + # CONFIG_SCSI_HPTIOP is not set 683 665 # CONFIG_SCSI_BUSLOGIC is not set 684 666 # CONFIG_SCSI_DMX3191D is not set 685 667 # CONFIG_SCSI_EATA is not set ··· 725 705 CONFIG_MD_RAID0=m 726 706 CONFIG_MD_RAID1=m 727 707 CONFIG_MD_RAID10=m 728 - CONFIG_MD_RAID5=m 729 - CONFIG_MD_RAID5_RESHAPE=y 730 - CONFIG_MD_RAID6=m 708 + # CONFIG_MD_RAID456 is not set 731 709 CONFIG_MD_MULTIPATH=m 732 710 CONFIG_MD_FAULTY=m 733 711 CONFIG_BLK_DEV_DM=m ··· 768 750 # 769 751 CONFIG_IEEE1394_VIDEO1394=m 770 752 CONFIG_IEEE1394_SBP2=m 771 - # CONFIG_IEEE1394_SBP2_PHYS_DMA is not set 772 753 # CONFIG_IEEE1394_ETH1394 is not set 773 754 CONFIG_IEEE1394_DV1394=m 774 755 CONFIG_IEEE1394_RAWIO=m ··· 783 766 CONFIG_ADB=y 784 767 CONFIG_ADB_CUDA=y 785 768 CONFIG_ADB_PMU=y 769 + CONFIG_ADB_PMU_LED=y 770 + CONFIG_ADB_PMU_LED_IDE=y 786 771 CONFIG_PMAC_APM_EMU=m 787 772 CONFIG_PMAC_MEDIABAY=y 788 773 CONFIG_PMAC_BACKLIGHT=y 774 + CONFIG_PMAC_BACKLIGHT_LEGACY=y 789 775 CONFIG_INPUT_ADBHID=y 790 776 CONFIG_MAC_EMUMOUSEBTN=y 791 777 CONFIG_THERM_WINDTUNNEL=m ··· 878 858 # CONFIG_CHELSIO_T1 is not set 879 859 # CONFIG_IXGB is not set 880 860 # CONFIG_S2IO is not set 861 + # CONFIG_MYRI10GE is not set 881 862 882 863 # 883 864 # Token Ring devices ··· 929 908 # Prism GT/Duette 802.11(a/b/g) PCI/Cardbus support 930 909 # 931 910 CONFIG_PRISM54=m 911 + # CONFIG_USB_ZD1201 is not set 932 912 # CONFIG_HOSTAP is not set 933 913 CONFIG_NET_WIRELESS=y 934 914 ··· 1020 998 CONFIG_VT=y 1021 999 CONFIG_VT_CONSOLE=y 1022 1000 CONFIG_HW_CONSOLE=y 1001 + # CONFIG_VT_HW_CONSOLE_BINDING is not set 1023 1002 # CONFIG_SERIAL_NONSTANDARD is not set 1024 1003 1025 1004 # ··· 1052 1029 # Watchdog Cards 1053 1030 # 1054 1031 # CONFIG_WATCHDOG is not set 1032 + # CONFIG_HW_RANDOM is not set 1055 1033 CONFIG_NVRAM=y 1056 1034 CONFIG_GEN_RTC=y 1057 1035 # CONFIG_GEN_RTC_X is not set ··· 1064 1040 # Ftape, the floppy tape device driver 1065 1041 # 1066 1042 CONFIG_AGP=m 1043 + # CONFIG_AGP_SIS is not set 1067 1044 # CONFIG_AGP_VIA is not set 1068 1045 CONFIG_AGP_UNINORTH=m 1069 1046 CONFIG_DRM=m ··· 1117 1092 CONFIG_I2C_POWERMAC=y 1118 1093 # CONFIG_I2C_MPC is not set 1119 1094 # CONFIG_I2C_NFORCE2 is not set 1095 + # CONFIG_I2C_OCORES is not set 1120 1096 # CONFIG_I2C_PARPORT_LIGHT is not set 1121 1097 # CONFIG_I2C_PROSAVAGE is not set 1122 1098 # CONFIG_I2C_SAVAGE4 is not set ··· 1182 1156 # 1183 1157 # Graphics support 1184 1158 # 1159 + # CONFIG_FIRMWARE_EDID is not set 1185 1160 CONFIG_FB=y 1186 1161 CONFIG_FB_CFB_FILLRECT=y 1187 1162 CONFIG_FB_CFB_COPYAREA=y 1188 1163 CONFIG_FB_CFB_IMAGEBLIT=y 1189 1164 CONFIG_FB_MACMODES=y 1190 - CONFIG_FB_FIRMWARE_EDID=y 1165 + CONFIG_FB_BACKLIGHT=y 1191 1166 CONFIG_FB_MODE_HELPERS=y 1192 1167 CONFIG_FB_TILEBLITTING=y 1193 1168 # CONFIG_FB_CIRRUS is not set ··· 1205 1178 # CONFIG_FB_S1D13XXX is not set 1206 1179 CONFIG_FB_NVIDIA=y 1207 1180 CONFIG_FB_NVIDIA_I2C=y 1181 + CONFIG_FB_NVIDIA_BACKLIGHT=y 1208 1182 # CONFIG_FB_RIVA is not set 1209 1183 CONFIG_FB_MATROX=y 1210 1184 CONFIG_FB_MATROX_MILLENIUM=y ··· 1215 1187 # CONFIG_FB_MATROX_MULTIHEAD is not set 1216 1188 CONFIG_FB_RADEON=y 1217 1189 CONFIG_FB_RADEON_I2C=y 1190 + CONFIG_FB_RADEON_BACKLIGHT=y 1218 1191 # CONFIG_FB_RADEON_DEBUG is not set 1219 1192 CONFIG_FB_ATY128=y 1193 + CONFIG_FB_ATY128_BACKLIGHT=y 1220 1194 CONFIG_FB_ATY=y 1221 1195 CONFIG_FB_ATY_CT=y 1222 1196 # CONFIG_FB_ATY_GENERIC_LCD is not set 1223 1197 CONFIG_FB_ATY_GX=y 1198 + CONFIG_FB_ATY_BACKLIGHT=y 1224 1199 # CONFIG_FB_SAVAGE is not set 1225 1200 # CONFIG_FB_SIS is not set 1226 1201 # CONFIG_FB_NEOMAGIC is not set ··· 1252 1221 CONFIG_LOGO_LINUX_MONO=y 1253 1222 CONFIG_LOGO_LINUX_VGA16=y 1254 1223 CONFIG_LOGO_LINUX_CLUT224=y 1255 - # CONFIG_BACKLIGHT_LCD_SUPPORT is not set 1224 + CONFIG_BACKLIGHT_LCD_SUPPORT=y 1225 + CONFIG_BACKLIGHT_CLASS_DEVICE=y 1226 + CONFIG_BACKLIGHT_DEVICE=y 1227 + CONFIG_LCD_CLASS_DEVICE=m 1228 + CONFIG_LCD_DEVICE=y 1256 1229 1257 1230 # 1258 1231 # Sound ··· 1313 1278 # CONFIG_SND_CMIPCI is not set 1314 1279 # CONFIG_SND_CS4281 is not set 1315 1280 # CONFIG_SND_CS46XX is not set 1281 + # CONFIG_SND_DARLA20 is not set 1282 + # CONFIG_SND_GINA20 is not set 1283 + # CONFIG_SND_LAYLA20 is not set 1284 + # CONFIG_SND_DARLA24 is not set 1285 + # CONFIG_SND_GINA24 is not set 1286 + # CONFIG_SND_LAYLA24 is not set 1287 + # CONFIG_SND_MONA is not set 1288 + # CONFIG_SND_MIA is not set 1289 + # CONFIG_SND_ECHO3G is not set 1290 + # CONFIG_SND_INDIGO is not set 1291 + # CONFIG_SND_INDIGOIO is not set 1292 + # CONFIG_SND_INDIGODJ is not set 1316 1293 # CONFIG_SND_EMU10K1 is not set 1317 1294 # CONFIG_SND_EMU10K1X is not set 1318 1295 # CONFIG_SND_ENS1370 is not set ··· 1360 1313 # 1361 1314 CONFIG_SND_POWERMAC=m 1362 1315 CONFIG_SND_POWERMAC_AUTO_DRC=y 1316 + 1317 + # 1318 + # Apple Onboard Audio driver 1319 + # 1320 + CONFIG_SND_AOA=m 1321 + CONFIG_SND_AOA_FABRIC_LAYOUT=m 1322 + CONFIG_SND_AOA_ONYX=m 1323 + CONFIG_SND_AOA_TAS=m 1324 + CONFIG_SND_AOA_TOONIE=m 1325 + CONFIG_SND_AOA_SOUNDBUS=m 1326 + CONFIG_SND_AOA_SOUNDBUS_I2S=m 1363 1327 1364 1328 # 1365 1329 # USB devices ··· 1413 1355 CONFIG_USB_EHCI_HCD=m 1414 1356 CONFIG_USB_EHCI_SPLIT_ISO=y 1415 1357 CONFIG_USB_EHCI_ROOT_HUB_TT=y 1358 + # CONFIG_USB_EHCI_TT_NEWSCHED is not set 1416 1359 # CONFIG_USB_ISP116X_HCD is not set 1417 1360 CONFIG_USB_OHCI_HCD=y 1418 1361 # CONFIG_USB_OHCI_BIG_ENDIAN is not set ··· 1490 1431 # CONFIG_USB_NET_RNDIS_HOST is not set 1491 1432 # CONFIG_USB_NET_CDC_SUBSET is not set 1492 1433 CONFIG_USB_NET_ZAURUS=m 1493 - # CONFIG_USB_ZD1201 is not set 1494 1434 CONFIG_USB_MON=y 1495 1435 1496 1436 # ··· 1557 1499 # CONFIG_USB_LEGOTOWER is not set 1558 1500 # CONFIG_USB_LCD is not set 1559 1501 # CONFIG_USB_LED is not set 1502 + # CONFIG_USB_CY7C63 is not set 1560 1503 # CONFIG_USB_CYTHERM is not set 1561 1504 # CONFIG_USB_PHIDGETKIT is not set 1562 1505 # CONFIG_USB_PHIDGETSERVO is not set 1563 1506 # CONFIG_USB_IDMOUSE is not set 1507 + CONFIG_USB_APPLEDISPLAY=m 1564 1508 # CONFIG_USB_SISUSBVGA is not set 1565 1509 # CONFIG_USB_LD is not set 1566 1510 # CONFIG_USB_TEST is not set ··· 1584 1524 # 1585 1525 # LED devices 1586 1526 # 1587 - # CONFIG_NEW_LEDS is not set 1527 + CONFIG_NEW_LEDS=y 1528 + CONFIG_LEDS_CLASS=y 1588 1529 1589 1530 # 1590 1531 # LED drivers ··· 1594 1533 # 1595 1534 # LED Triggers 1596 1535 # 1536 + CONFIG_LEDS_TRIGGERS=y 1537 + # CONFIG_LEDS_TRIGGER_TIMER is not set 1538 + CONFIG_LEDS_TRIGGER_IDE_DISK=y 1539 + # CONFIG_LEDS_TRIGGER_HEARTBEAT is not set 1597 1540 1598 1541 # 1599 1542 # InfiniBand support ··· 1612 1547 # Real Time Clock 1613 1548 # 1614 1549 # CONFIG_RTC_CLASS is not set 1550 + 1551 + # 1552 + # DMA Engine support 1553 + # 1554 + # CONFIG_DMA_ENGINE is not set 1555 + 1556 + # 1557 + # DMA Clients 1558 + # 1559 + 1560 + # 1561 + # DMA Devices 1562 + # 1615 1563 1616 1564 # 1617 1565 # File systems ··· 1647 1569 # CONFIG_MINIX_FS is not set 1648 1570 # CONFIG_ROMFS_FS is not set 1649 1571 CONFIG_INOTIFY=y 1572 + CONFIG_INOTIFY_USER=y 1650 1573 # CONFIG_QUOTA is not set 1651 1574 CONFIG_DNOTIFY=y 1652 1575 # CONFIG_AUTOFS_FS is not set ··· 1728 1649 CONFIG_SMB_FS=m 1729 1650 # CONFIG_SMB_NLS_DEFAULT is not set 1730 1651 # CONFIG_CIFS is not set 1652 + # CONFIG_CIFS_DEBUG2 is not set 1731 1653 # CONFIG_NCP_FS is not set 1732 1654 # CONFIG_CODA_FS is not set 1733 1655 # CONFIG_AFS_FS is not set ··· 1812 1732 CONFIG_TEXTSEARCH_KMP=m 1813 1733 CONFIG_TEXTSEARCH_BM=m 1814 1734 CONFIG_TEXTSEARCH_FSM=m 1735 + CONFIG_PLIST=y 1815 1736 1816 1737 # 1817 1738 # Instrumentation Support ··· 1825 1744 # 1826 1745 # CONFIG_PRINTK_TIME is not set 1827 1746 # CONFIG_MAGIC_SYSRQ is not set 1747 + # CONFIG_UNUSED_SYMBOLS is not set 1828 1748 CONFIG_DEBUG_KERNEL=y 1829 1749 CONFIG_LOG_BUF_SHIFT=14 1830 1750 CONFIG_DETECT_SOFTLOCKUP=y 1831 1751 # CONFIG_SCHEDSTATS is not set 1832 1752 # CONFIG_DEBUG_SLAB is not set 1833 1753 # CONFIG_DEBUG_MUTEXES is not set 1754 + # CONFIG_DEBUG_RT_MUTEXES is not set 1755 + # CONFIG_RT_MUTEX_TESTER is not set 1834 1756 # CONFIG_DEBUG_SPINLOCK is not set 1835 1757 # CONFIG_DEBUG_SPINLOCK_SLEEP is not set 1836 1758 # CONFIG_DEBUG_KOBJECT is not set ··· 1847 1763 CONFIG_XMON_DEFAULT=y 1848 1764 # CONFIG_BDI_SWITCH is not set 1849 1765 CONFIG_BOOTX_TEXT=y 1850 - # CONFIG_PPC_EARLY_DEBUG_LPAR is not set 1851 - # CONFIG_PPC_EARLY_DEBUG_G5 is not set 1852 - # CONFIG_PPC_EARLY_DEBUG_RTAS is not set 1853 - # CONFIG_PPC_EARLY_DEBUG_MAPLE is not set 1854 - # CONFIG_PPC_EARLY_DEBUG_ISERIES is not set 1766 + # CONFIG_PPC_EARLY_DEBUG is not set 1855 1767 1856 1768 # 1857 1769 # Security options
+33 -2
arch/powerpc/kernel/head_64.S
··· 191 191 ori reg,reg,(label)@l; /* virt addr of handler ... */ 192 192 #endif 193 193 194 + /* 195 + * Equal to EXCEPTION_PROLOG_PSERIES, except that it forces 64bit mode. 196 + * The firmware calls the registered system_reset_fwnmi and 197 + * machine_check_fwnmi handlers in 32bit mode if the cpu happens to run 198 + * a 32bit application at the time of the event. 199 + * This firmware bug is present on POWER4 and JS20. 200 + */ 201 + #define EXCEPTION_PROLOG_PSERIES_FORCE_64BIT(area, label) \ 202 + mfspr r13,SPRN_SPRG3; /* get paca address into r13 */ \ 203 + std r9,area+EX_R9(r13); /* save r9 - r12 */ \ 204 + std r10,area+EX_R10(r13); \ 205 + std r11,area+EX_R11(r13); \ 206 + std r12,area+EX_R12(r13); \ 207 + mfspr r9,SPRN_SPRG1; \ 208 + std r9,area+EX_R13(r13); \ 209 + mfcr r9; \ 210 + clrrdi r12,r13,32; /* get high part of &label */ \ 211 + mfmsr r10; \ 212 + /* force 64bit mode */ \ 213 + li r11,5; /* MSR_SF_LG|MSR_ISF_LG */ \ 214 + rldimi r10,r11,61,0; /* insert into top 3 bits */ \ 215 + /* done 64bit mode */ \ 216 + mfspr r11,SPRN_SRR0; /* save SRR0 */ \ 217 + LOAD_HANDLER(r12,label) \ 218 + ori r10,r10,MSR_IR|MSR_DR|MSR_RI; \ 219 + mtspr SPRN_SRR0,r12; \ 220 + mfspr r12,SPRN_SRR1; /* and SRR1 */ \ 221 + mtspr SPRN_SRR1,r10; \ 222 + rfid; \ 223 + b . /* prevent speculative execution */ 224 + 194 225 #define EXCEPTION_PROLOG_PSERIES(area, label) \ 195 226 mfspr r13,SPRN_SPRG3; /* get paca address into r13 */ \ 196 227 std r9,area+EX_R9(r13); /* save r9 - r12 */ \ ··· 635 604 system_reset_fwnmi: 636 605 HMT_MEDIUM 637 606 mtspr SPRN_SPRG1,r13 /* save r13 */ 638 - EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, system_reset_common) 607 + EXCEPTION_PROLOG_PSERIES_FORCE_64BIT(PACA_EXGEN, system_reset_common) 639 608 640 609 .globl machine_check_fwnmi 641 610 .align 7 642 611 machine_check_fwnmi: 643 612 HMT_MEDIUM 644 613 mtspr SPRN_SPRG1,r13 /* save r13 */ 645 - EXCEPTION_PROLOG_PSERIES(PACA_EXMC, machine_check_common) 614 + EXCEPTION_PROLOG_PSERIES_FORCE_64BIT(PACA_EXMC, machine_check_common) 646 615 647 616 #ifdef CONFIG_PPC_ISERIES 648 617 /*** ISeries-LPAR interrupt handlers ***/
+8 -5
arch/powerpc/kernel/legacy_serial.c
··· 112 112 static int __init add_legacy_soc_port(struct device_node *np, 113 113 struct device_node *soc_dev) 114 114 { 115 - phys_addr_t addr; 115 + u64 addr; 116 116 u32 *addrp; 117 117 upf_t flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_SHARE_IRQ; 118 118 ··· 143 143 u32 *reg; 144 144 char *typep; 145 145 int index = -1; 146 - phys_addr_t taddr; 146 + u64 taddr; 147 147 148 148 DBG(" -> add_legacy_isa_port(%s)\n", np->full_name); 149 149 ··· 165 165 if (typep && *typep == 'S') 166 166 index = simple_strtol(typep+1, NULL, 0) - 1; 167 167 168 - /* Translate ISA address */ 168 + /* Translate ISA address. If it fails, we still register the port 169 + * with no translated address so that it can be picked up as an IO 170 + * port later by the serial driver 171 + */ 169 172 taddr = of_translate_address(np, reg); 170 173 if (taddr == OF_BAD_ADDR) 171 - return -1; 174 + taddr = 0; 172 175 173 176 /* Add port, irq will be dealt with later */ 174 177 return add_legacy_port(np, index, UPIO_PORT, reg[1], taddr, ··· 183 180 static int __init add_legacy_pci_port(struct device_node *np, 184 181 struct device_node *pci_dev) 185 182 { 186 - phys_addr_t addr, base; 183 + u64 addr, base; 187 184 u32 *addrp; 188 185 unsigned int flags; 189 186 int iotype, index = -1, lindex = 0;
+1 -1
arch/powerpc/kernel/misc_64.S
··· 687 687 /* clear out hardware hash page table and tlb */ 688 688 ld r5,0(r27) /* deref function descriptor */ 689 689 mtctr r5 690 - bctrl /* ppc_md.hash_clear_all(void); */ 690 + bctrl /* ppc_md.hpte_clear_all(void); */ 691 691 692 692 /* 693 693 * kexec image calling is:
+36
arch/powerpc/kernel/prom_init.c
··· 557 557 static void __init early_cmdline_parse(void) 558 558 { 559 559 struct prom_t *_prom = &RELOC(prom); 560 + #ifdef CONFIG_PPC64 560 561 const char *opt; 562 + #endif 561 563 char *p; 562 564 int l = 0; 563 565 ··· 2032 2030 #define fixup_device_tree_maple() 2033 2031 #endif 2034 2032 2033 + #ifdef CONFIG_PPC_CHRP 2034 + /* Pegasos lacks the "ranges" property in the isa node */ 2035 + static void __init fixup_device_tree_chrp(void) 2036 + { 2037 + phandle isa; 2038 + u32 isa_ranges[6]; 2039 + char *name; 2040 + int rc; 2041 + 2042 + name = "/pci@80000000/isa@c"; 2043 + isa = call_prom("finddevice", 1, 1, ADDR(name)); 2044 + if (!PHANDLE_VALID(isa)) 2045 + return; 2046 + 2047 + rc = prom_getproplen(isa, "ranges"); 2048 + if (rc != 0 && rc != PROM_ERROR) 2049 + return; 2050 + 2051 + prom_printf("Fixing up missing ISA range on Pegasos...\n"); 2052 + 2053 + isa_ranges[0] = 0x1; 2054 + isa_ranges[1] = 0x0; 2055 + isa_ranges[2] = 0x01006000; 2056 + isa_ranges[3] = 0x0; 2057 + isa_ranges[4] = 0x0; 2058 + isa_ranges[5] = 0x00010000; 2059 + prom_setprop(isa, name, "ranges", 2060 + isa_ranges, sizeof(isa_ranges)); 2061 + } 2062 + #else 2063 + #define fixup_device_tree_chrp() 2064 + #endif 2065 + 2035 2066 #if defined(CONFIG_PPC64) && defined(CONFIG_PPC_PMAC) 2036 2067 static void __init fixup_device_tree_pmac(void) 2037 2068 { ··· 2112 2077 static void __init fixup_device_tree(void) 2113 2078 { 2114 2079 fixup_device_tree_maple(); 2080 + fixup_device_tree_chrp(); 2115 2081 fixup_device_tree_pmac(); 2116 2082 } 2117 2083
+17 -7
arch/powerpc/kernel/smp.c
··· 144 144 145 145 void smp_send_reschedule(int cpu) 146 146 { 147 - smp_ops->message_pass(cpu, PPC_MSG_RESCHEDULE); 147 + if (likely(smp_ops)) 148 + smp_ops->message_pass(cpu, PPC_MSG_RESCHEDULE); 148 149 } 149 150 150 151 #ifdef CONFIG_DEBUGGER 151 152 void smp_send_debugger_break(int cpu) 152 153 { 153 - smp_ops->message_pass(cpu, PPC_MSG_DEBUGGER_BREAK); 154 + if (likely(smp_ops)) 155 + smp_ops->message_pass(cpu, PPC_MSG_DEBUGGER_BREAK); 154 156 } 155 157 #endif 156 158 ··· 160 158 void crash_send_ipi(void (*crash_ipi_callback)(struct pt_regs *)) 161 159 { 162 160 crash_ipi_function_ptr = crash_ipi_callback; 163 - if (crash_ipi_callback) { 161 + if (crash_ipi_callback && smp_ops) { 164 162 mb(); 165 163 smp_ops->message_pass(MSG_ALL_BUT_SELF, PPC_MSG_DEBUGGER_BREAK); 166 164 } ··· 221 219 222 220 /* Can deadlock when called with interrupts disabled */ 223 221 WARN_ON(irqs_disabled()); 222 + 223 + if (unlikely(smp_ops == NULL)) 224 + return -1; 224 225 225 226 data.func = func; 226 227 data.info = info; ··· 362 357 smp_store_cpu_info(boot_cpuid); 363 358 cpu_callin_map[boot_cpuid] = 1; 364 359 365 - max_cpus = smp_ops->probe(); 360 + if (smp_ops) 361 + max_cpus = smp_ops->probe(); 362 + else 363 + max_cpus = 1; 366 364 367 365 smp_space_timers(max_cpus); 368 366 ··· 461 453 462 454 static int __devinit cpu_enable(unsigned int cpu) 463 455 { 464 - if (smp_ops->cpu_enable) 456 + if (smp_ops && smp_ops->cpu_enable) 465 457 return smp_ops->cpu_enable(cpu); 466 458 467 459 return -ENOSYS; ··· 475 467 if (!cpu_enable(cpu)) 476 468 return 0; 477 469 478 - if (smp_ops->cpu_bootable && !smp_ops->cpu_bootable(cpu)) 470 + if (smp_ops == NULL || 471 + (smp_ops->cpu_bootable && !smp_ops->cpu_bootable(cpu))) 479 472 return -EINVAL; 480 473 481 474 /* Make sure callin-map entry is 0 (can be leftover a CPU ··· 577 568 old_mask = current->cpus_allowed; 578 569 set_cpus_allowed(current, cpumask_of_cpu(boot_cpuid)); 579 570 580 - smp_ops->setup_cpu(boot_cpuid); 571 + if (smp_ops) 572 + smp_ops->setup_cpu(boot_cpuid); 581 573 582 574 set_cpus_allowed(current, old_mask); 583 575
+5 -1
arch/powerpc/kernel/udbg_16550.c
··· 81 81 void udbg_init_uart(void __iomem *comport, unsigned int speed, 82 82 unsigned int clock) 83 83 { 84 - unsigned int dll, base_bauds = clock / 16; 84 + unsigned int dll, base_bauds; 85 85 86 + if (clock == 0) 87 + clock = 1843200; 86 88 if (speed == 0) 87 89 speed = 9600; 90 + 91 + base_bauds = clock / 16; 88 92 dll = base_bauds / speed; 89 93 90 94 if (comport) {
+2 -1
arch/powerpc/mm/lmb.c
··· 320 320 break; 321 321 } 322 322 323 - lmb.rmo_size = lmb.memory.region[0].size; 323 + if (lmb.memory.region[0].size < lmb.rmo_size) 324 + lmb.rmo_size = lmb.memory.region[0].size; 324 325 325 326 /* And truncate any reserves above the limit also. */ 326 327 for (i = 0; i < lmb.reserved.cnt; i++) {
+8 -4
arch/powerpc/platforms/chrp/setup.c
··· 291 291 292 292 pci_create_OF_bus_map(); 293 293 294 - #ifdef CONFIG_SMP 295 - smp_ops = &chrp_smp_ops; 296 - #endif /* CONFIG_SMP */ 297 - 298 294 /* 299 295 * Print the banner, then scroll down so boot progress 300 296 * can be printed. -- Cort ··· 474 478 #endif 475 479 chrp_find_openpic(); 476 480 chrp_find_8259(); 481 + 482 + #ifdef CONFIG_SMP 483 + /* Pegasos has no MPIC, those ops would make it crash. It might be an 484 + * option to move setting them to after we probe the PIC though 485 + */ 486 + if (chrp_mpic != NULL) 487 + smp_ops = &chrp_smp_ops; 488 + #endif /* CONFIG_SMP */ 477 489 478 490 if (_chrp_type == _CHRP_Pegasos) 479 491 ppc_md.get_irq = i8259_irq;
+13 -4
arch/powerpc/platforms/maple/setup.c
··· 221 221 * in Maple device-tree where the type of the controller is 222 222 * open-pic and not interrupt-controller 223 223 */ 224 - for_each_node_by_type(np, "open-pic") { 225 - mpic_node = np; 226 - break; 227 - } 224 + 225 + for_each_node_by_type(np, "interrupt-controller") 226 + if (device_is_compatible(np, "open-pic")) { 227 + mpic_node = np; 228 + break; 229 + } 230 + if (mpic_node == NULL) 231 + for_each_node_by_type(np, "open-pic") { 232 + mpic_node = np; 233 + break; 234 + } 228 235 if (mpic_node == NULL) { 229 236 printk(KERN_ERR 230 237 "Failed to locate the MPIC interrupt controller\n"); ··· 259 252 260 253 /* XXX Maple specific bits */ 261 254 flags |= MPIC_BROKEN_U3 | MPIC_WANTS_RESET; 255 + /* All U3/U4 are big-endian, older SLOF firmware doesn't encode this */ 256 + flags |= MPIC_BIG_ENDIAN; 262 257 263 258 /* Setup the openpic driver. More device-tree junks, we hard code no 264 259 * ISUs for now. I'll have to revisit some stuffs with the folks doing
+24 -11
arch/powerpc/platforms/powermac/bootx_init.c
··· 181 181 } 182 182 183 183 static void __init bootx_add_display_props(unsigned long base, 184 - unsigned long *mem_end) 184 + unsigned long *mem_end, 185 + int has_real_node) 185 186 { 186 187 boot_infos_t *bi = bootx_info; 187 188 u32 tmp; 188 189 189 - bootx_dt_add_prop("linux,boot-display", NULL, 0, mem_end); 190 - bootx_dt_add_prop("linux,opened", NULL, 0, mem_end); 190 + if (has_real_node) { 191 + bootx_dt_add_prop("linux,boot-display", NULL, 0, mem_end); 192 + bootx_dt_add_prop("linux,opened", NULL, 0, mem_end); 193 + } else 194 + bootx_dt_add_prop("linux,bootx-noscreen", NULL, 0, mem_end); 195 + 191 196 tmp = bi->dispDeviceDepth; 192 197 bootx_dt_add_prop("linux,bootx-depth", &tmp, 4, mem_end); 193 198 tmp = bi->dispDeviceRect[2] - bi->dispDeviceRect[0]; ··· 246 241 DBG(" detected display ! adding properties names !\n"); 247 242 bootx_dt_add_string("linux,boot-display", mem_end); 248 243 bootx_dt_add_string("linux,opened", mem_end); 249 - bootx_dt_add_string("linux,bootx-depth", mem_end); 250 - bootx_dt_add_string("linux,bootx-width", mem_end); 251 - bootx_dt_add_string("linux,bootx-height", mem_end); 252 - bootx_dt_add_string("linux,bootx-linebytes", mem_end); 253 - bootx_dt_add_string("linux,bootx-addr", mem_end); 254 244 strncpy(bootx_disp_path, namep, 255); 255 245 } 256 246 ··· 329 329 ppp = &pp->next; 330 330 } 331 331 332 - if (node == bootx_node_chosen) 332 + if (node == bootx_node_chosen) { 333 333 bootx_add_chosen_props(base, mem_end); 334 - if (node == bootx_info->dispDeviceRegEntryOffset) 335 - bootx_add_display_props(base, mem_end); 334 + if (bootx_info->dispDeviceRegEntryOffset == 0) 335 + bootx_add_display_props(base, mem_end, 0); 336 + } 337 + else if (node == bootx_info->dispDeviceRegEntryOffset) 338 + bootx_add_display_props(base, mem_end, 1); 336 339 337 340 /* do all our children */ 338 341 cpp = &np->child; ··· 377 374 mem_end += 4; 378 375 bootx_dt_strend = mem_end; 379 376 bootx_scan_dt_build_strings(base, 4, &mem_end); 377 + /* Add some strings */ 378 + bootx_dt_add_string("linux,bootx-noscreen", &mem_end); 379 + bootx_dt_add_string("linux,bootx-depth", &mem_end); 380 + bootx_dt_add_string("linux,bootx-width", &mem_end); 381 + bootx_dt_add_string("linux,bootx-height", &mem_end); 382 + bootx_dt_add_string("linux,bootx-linebytes", &mem_end); 383 + bootx_dt_add_string("linux,bootx-addr", &mem_end); 384 + /* Wrap up strings */ 380 385 hdr->off_dt_strings = bootx_dt_strbase - mem_start; 381 386 hdr->dt_strings_size = bootx_dt_strend - bootx_dt_strbase; 382 387 ··· 482 471 if (bi->dispDeviceDepth == 16) 483 472 bi->dispDeviceDepth = 15; 484 473 474 + 485 475 #ifdef CONFIG_BOOTX_TEXT 486 476 ptr = (unsigned long)bi->logicalDisplayBase; 487 477 ptr += bi->dispDeviceRect[1] * bi->dispDeviceRowBytes; ··· 520 508 #ifdef CONFIG_BOOTX_TEXT 521 509 btext_welcome(bi); 522 510 #endif 511 + 523 512 /* New BootX enters kernel with MMU off, i/os are not allowed 524 513 * here. This hack will have been done by the boostrap anyway. 525 514 */
+49 -29
arch/powerpc/platforms/powermac/cpufreq_64.c
··· 10 10 * that is iMac G5 and latest single CPU desktop. 11 11 */ 12 12 13 + #undef DEBUG 14 + 13 15 #include <linux/module.h> 14 16 #include <linux/types.h> 15 17 #include <linux/errno.h> ··· 32 30 #include <asm/smu.h> 33 31 #include <asm/pmac_pfunc.h> 34 32 35 - #undef DEBUG 36 - 37 - #ifdef DEBUG 38 - #define DBG(fmt...) printk(fmt) 39 - #else 40 - #define DBG(fmt...) 41 - #endif 33 + #define DBG(fmt...) pr_debug(fmt) 42 34 43 35 /* see 970FX user manual */ 44 36 ··· 78 82 /* Power mode data is an array of the 32 bits PCR values to use for 79 83 * the various frequencies, retrieved from the device-tree 80 84 */ 81 - static u32 *g5_pmode_data; 82 - static int g5_pmode_max; 83 85 static int g5_pmode_cur; 84 86 85 87 static void (*g5_switch_volt)(int speed_mode); ··· 86 92 87 93 static DEFINE_MUTEX(g5_switch_mutex); 88 94 95 + 96 + #ifdef CONFIG_PMAC_SMU 97 + 98 + static u32 *g5_pmode_data; 99 + static int g5_pmode_max; 89 100 90 101 static struct smu_sdbp_fvt *g5_fvt_table; /* table of op. points */ 91 102 static int g5_fvt_count; /* number of op. points */ ··· 209 210 } 210 211 211 212 /* 213 + * Fake voltage switching for platforms with missing support 214 + */ 215 + 216 + static void g5_dummy_switch_volt(int speed_mode) 217 + { 218 + } 219 + 220 + #endif /* CONFIG_PMAC_SMU */ 221 + 222 + /* 212 223 * Platform function based voltage switching for PowerMac7,2 & 7,3 213 224 */ 214 225 ··· 257 248 struct pmf_args args; 258 249 u32 done = 0; 259 250 unsigned long timeout; 251 + int rc; 252 + 253 + DBG("g5_pfunc_switch_freq(%d)\n", speed_mode); 260 254 261 255 /* If frequency is going up, first ramp up the voltage */ 262 256 if (speed_mode < g5_pmode_cur) ··· 267 255 268 256 /* Do it */ 269 257 if (speed_mode == CPUFREQ_HIGH) 270 - pmf_call_one(pfunc_cpu_setfreq_high, NULL); 258 + rc = pmf_call_one(pfunc_cpu_setfreq_high, NULL); 271 259 else 272 - pmf_call_one(pfunc_cpu_setfreq_low, NULL); 260 + rc = pmf_call_one(pfunc_cpu_setfreq_low, NULL); 261 + 262 + if (rc) 263 + printk(KERN_WARNING "cpufreq: pfunc switch error %d\n", rc); 273 264 274 265 /* It's an irq GPIO so we should be able to just block here, 275 266 * I'll do that later after I've properly tested the IRQ code for ··· 311 296 return val ? CPUFREQ_HIGH : CPUFREQ_LOW; 312 297 } 313 298 314 - /* 315 - * Fake voltage switching for platforms with missing support 316 - */ 317 - 318 - static void g5_dummy_switch_volt(int speed_mode) 319 - { 320 - } 321 299 322 300 /* 323 301 * Common interface to the cpufreq core ··· 382 374 .attr = g5_cpu_freqs_attr, 383 375 }; 384 376 377 + 378 + #ifdef CONFIG_PMAC_SMU 385 379 386 380 static int __init g5_neo2_cpufreq_init(struct device_node *cpus) 387 381 { ··· 535 525 return rc; 536 526 } 537 527 528 + #endif /* CONFIG_PMAC_SMU */ 529 + 530 + 538 531 static int __init g5_pm72_cpufreq_init(struct device_node *cpus) 539 532 { 540 533 struct device_node *cpuid = NULL, *hwclock = NULL, *cpunode = NULL; ··· 545 532 u32 *valp; 546 533 u64 max_freq, min_freq, ih, il; 547 534 int has_volt = 1, rc = 0; 535 + 536 + DBG("cpufreq: Initializing for PowerMac7,2, PowerMac7,3 and" 537 + " RackMac3,1...\n"); 548 538 549 539 /* Get first CPU node */ 550 540 for (cpunode = NULL; ··· 652 636 */ 653 637 ih = *((u32 *)(eeprom + 0x10)); 654 638 il = *((u32 *)(eeprom + 0x20)); 639 + 640 + /* Check for machines with no useful settings */ 641 + if (il == ih) { 642 + printk(KERN_WARNING "cpufreq: No low frequency mode available" 643 + " on this model !\n"); 644 + rc = -ENODEV; 645 + goto bail; 646 + } 647 + 655 648 min_freq = 0; 656 649 if (ih != 0 && il != 0) 657 650 min_freq = (max_freq * il) / ih; ··· 668 643 /* Sanity check */ 669 644 if (min_freq >= max_freq || min_freq < 1000) { 670 645 printk(KERN_ERR "cpufreq: Can't calculate low frequency !\n"); 671 - rc = -ENODEV; 646 + rc = -ENXIO; 672 647 goto bail; 673 648 } 674 649 g5_cpu_freqs[0].frequency = max_freq; ··· 715 690 return rc; 716 691 } 717 692 718 - static int __init g5_rm31_cpufreq_init(struct device_node *cpus) 719 - { 720 - /* NYI */ 721 - return 0; 722 - } 723 - 724 693 static int __init g5_cpufreq_init(void) 725 694 { 726 695 struct device_node *cpus; 727 - int rc; 696 + int rc = 0; 728 697 729 698 cpus = of_find_node_by_path("/cpus"); 730 699 if (cpus == NULL) { ··· 727 708 } 728 709 729 710 if (machine_is_compatible("PowerMac7,2") || 730 - machine_is_compatible("PowerMac7,3")) 711 + machine_is_compatible("PowerMac7,3") || 712 + machine_is_compatible("RackMac3,1")) 731 713 rc = g5_pm72_cpufreq_init(cpus); 732 - else if (machine_is_compatible("RackMac3,1")) 733 - rc = g5_rm31_cpufreq_init(cpus); 714 + #ifdef CONFIG_PMAC_SMU 734 715 else 735 716 rc = g5_neo2_cpufreq_init(cpus); 717 + #endif /* CONFIG_PMAC_SMU */ 736 718 737 719 of_node_put(cpus); 738 720 return rc;
+4 -2
arch/powerpc/platforms/pseries/setup.c
··· 501 501 } 502 502 503 503 /* 504 - * Cede if the other thread is not idle, so that it can 504 + * If not SMT, cede processor. If CPU is running SMT 505 + * cede if the other thread is not idle, so that it can 505 506 * go single-threaded. If the other thread is idle, 506 507 * we ask the hypervisor if it has pending work it 507 508 * wants to do and cede if it does. Otherwise we keep ··· 515 514 * very low priority. The cede enables interrupts, which 516 515 * doesn't matter here. 517 516 */ 518 - if (!lppaca[cpu ^ 1].idle || poll_pending() == H_PENDING) 517 + if (!cpu_has_feature(CPU_FTR_SMT) || !lppaca[cpu ^ 1].idle 518 + || poll_pending() == H_PENDING) 519 519 cede_processor(); 520 520 521 521 out:
-14
drivers/ide/Kconfig
··· 774 774 to transfer data to and from memory. Saying Y is safe and improves 775 775 performance. 776 776 777 - config BLK_DEV_IDE_PMAC_BLINK 778 - bool "Blink laptop LED on drive activity (DEPRECATED)" 779 - depends on BLK_DEV_IDE_PMAC && ADB_PMU 780 - select ADB_PMU_LED 781 - select LEDS_TRIGGERS 782 - select LEDS_TRIGGER_IDE_DISK 783 - help 784 - This option enables the use of the sleep LED as a hard drive 785 - activity LED. 786 - This option is deprecated, it only selects ADB_PMU_LED and 787 - LEDS_TRIGGER_IDE_DISK and changes the code in the new led class 788 - device to default to the ide-disk trigger (which should be set 789 - from userspace via sysfs). 790 - 791 777 config BLK_DEV_IDE_SWARM 792 778 tristate "IDE for Sibyte evaluation boards" 793 779 depends on SIBYTE_SB1xxx_SOC
+10 -1
drivers/macintosh/Kconfig
··· 90 90 and the ide-disk LED trigger and configure appropriately through 91 91 sysfs. 92 92 93 + config ADB_PMU_LED_IDE 94 + bool "Use front LED as IDE LED by default" 95 + depends on ADB_PMU_LED 96 + select LEDS_TRIGGERS 97 + select LEDS_TRIGGER_IDE_DISK 98 + help 99 + This option makes the front LED default to the IDE trigger 100 + so that it blinks on IDE activity. 101 + 93 102 config PMAC_SMU 94 103 bool "Support for SMU based PowerMacs" 95 104 depends on PPC_PMAC64 ··· 109 100 110 101 config PMAC_APM_EMU 111 102 tristate "APM emulation" 112 - depends on PPC_PMAC && PPC32 && PM 103 + depends on PPC_PMAC && PPC32 && PM && ADB_PMU 113 104 114 105 config PMAC_MEDIABAY 115 106 bool "Support PowerBook hotswap media bay"
+203 -15
drivers/macintosh/therm_pm72.c
··· 95 95 * - Use min/max macros here or there 96 96 * - Latest darwin updated U3H min fan speed to 20% PWM 97 97 * 98 + * July. 06, 2006 : 1.3 99 + * - Fix setting of RPM fans on Xserve G5 (they were going too fast) 100 + * - Add missing slots fan control loop for Xserve G5 101 + * - Lower fixed slots fan speed from 50% to 40% on desktop G5s. We 102 + * still can't properly implement the control loop for these, so let's 103 + * reduce the noise a little bit, it appears that 40% still gives us 104 + * a pretty good air flow 105 + * - Add code to "tickle" the FCU regulary so it doesn't think that 106 + * we are gone while in fact, the machine just didn't need any fan 107 + * speed change lately 108 + * 98 109 */ 99 110 100 111 #include <linux/types.h> ··· 132 121 133 122 #include "therm_pm72.h" 134 123 135 - #define VERSION "1.2b2" 124 + #define VERSION "1.3" 136 125 137 126 #undef DEBUG 138 127 ··· 157 146 static struct backside_pid_state backside_state; 158 147 static struct drives_pid_state drives_state; 159 148 static struct dimm_pid_state dimms_state; 149 + static struct slots_pid_state slots_state; 160 150 static int state; 161 151 static int cpu_count; 162 152 static int cpu_pid_type; ··· 166 154 static int critical_state; 167 155 static int rackmac; 168 156 static s32 dimm_output_clamp; 169 - 157 + static int fcu_rpm_shift; 158 + static int fcu_tickle_ticks; 170 159 static DECLARE_MUTEX(driver_lock); 171 160 172 161 /* ··· 508 495 rc = fan_write_reg(0x2e, &buf, 1); 509 496 if (rc < 0) 510 497 return -EIO; 498 + rc = fan_read_reg(0, &buf, 1); 499 + if (rc < 0) 500 + return -EIO; 501 + fcu_rpm_shift = (buf == 1) ? 2 : 3; 502 + printk(KERN_DEBUG "FCU Initialized, RPM fan shift is %d\n", 503 + fcu_rpm_shift); 504 + 511 505 return 0; 512 506 } 513 507 514 508 static int set_rpm_fan(int fan_index, int rpm) 515 509 { 516 510 unsigned char buf[2]; 517 - int rc, id; 511 + int rc, id, min, max; 518 512 519 513 if (fcu_fans[fan_index].type != FCU_FAN_RPM) 520 514 return -EINVAL; ··· 529 509 if (id == FCU_FAN_ABSENT_ID) 530 510 return -EINVAL; 531 511 532 - if (rpm < 300) 533 - rpm = 300; 534 - else if (rpm > 8191) 535 - rpm = 8191; 536 - buf[0] = rpm >> 5; 537 - buf[1] = rpm << 3; 512 + min = 2400 >> fcu_rpm_shift; 513 + max = 56000 >> fcu_rpm_shift; 514 + 515 + if (rpm < min) 516 + rpm = min; 517 + else if (rpm > max) 518 + rpm = max; 519 + buf[0] = rpm >> (8 - fcu_rpm_shift); 520 + buf[1] = rpm << fcu_rpm_shift; 538 521 rc = fan_write_reg(0x10 + (id * 2), buf, 2); 539 522 if (rc < 0) 540 523 return -EIO; ··· 574 551 if (rc != 2) 575 552 return -EIO; 576 553 577 - return (buf[0] << 5) | buf[1] >> 3; 554 + return (buf[0] << (8 - fcu_rpm_shift)) | buf[1] >> fcu_rpm_shift; 578 555 } 579 556 580 557 static int set_pwm_fan(int fan_index, int pwm) ··· 631 608 632 609 return (buf[0] * 1000) / 2559; 633 610 } 611 + 612 + static void tickle_fcu(void) 613 + { 614 + int pwm; 615 + 616 + pwm = get_pwm_fan(SLOTS_FAN_PWM_INDEX); 617 + 618 + DBG("FCU Tickle, slots fan is: %d\n", pwm); 619 + if (pwm < 0) 620 + pwm = 100; 621 + 622 + if (!rackmac) { 623 + pwm = SLOTS_FAN_DEFAULT_PWM; 624 + } else if (pwm < SLOTS_PID_OUTPUT_MIN) 625 + pwm = SLOTS_PID_OUTPUT_MIN; 626 + 627 + /* That is hopefully enough to make the FCU happy */ 628 + set_pwm_fan(SLOTS_FAN_PWM_INDEX, pwm); 629 + } 630 + 634 631 635 632 /* 636 633 * Utility routine to read the CPU calibration EEPROM data ··· 758 715 BUILD_SHOW_FUNC_FIX(drives_temperature, drives_state.last_temp) 759 716 BUILD_SHOW_FUNC_INT(drives_fan_rpm, drives_state.rpm) 760 717 718 + BUILD_SHOW_FUNC_FIX(slots_temperature, slots_state.last_temp) 719 + BUILD_SHOW_FUNC_INT(slots_fan_pwm, slots_state.pwm) 720 + 761 721 BUILD_SHOW_FUNC_FIX(dimms_temperature, dimms_state.last_temp) 762 722 763 723 static DEVICE_ATTR(cpu0_temperature,S_IRUGO,show_cpu0_temperature,NULL); ··· 780 734 781 735 static DEVICE_ATTR(drives_temperature,S_IRUGO,show_drives_temperature,NULL); 782 736 static DEVICE_ATTR(drives_fan_rpm,S_IRUGO,show_drives_fan_rpm,NULL); 737 + 738 + static DEVICE_ATTR(slots_temperature,S_IRUGO,show_slots_temperature,NULL); 739 + static DEVICE_ATTR(slots_fan_pwm,S_IRUGO,show_slots_fan_pwm,NULL); 783 740 784 741 static DEVICE_ATTR(dimms_temperature,S_IRUGO,show_dimms_temperature,NULL); 785 742 ··· 1125 1076 fan_min = dimm_output_clamp; 1126 1077 fan_min = max(fan_min, (int)state->mpu.rminn_intake_fan); 1127 1078 1079 + DBG(" CPU min mpu = %d, min dimm = %d\n", 1080 + state->mpu.rminn_intake_fan, dimm_output_clamp); 1081 + 1128 1082 state->rpm = max(state->rpm, (int)fan_min); 1129 1083 state->rpm = min(state->rpm, (int)state->mpu.rmaxn_intake_fan); 1130 1084 state->intake_rpm = state->rpm; ··· 1426 1374 DBG(" current rpm: %d\n", state->rpm); 1427 1375 1428 1376 /* Get some sensor readings */ 1429 - temp = le16_to_cpu(i2c_smbus_read_word_data(state->monitor, DS1775_TEMP)) << 8; 1377 + temp = le16_to_cpu(i2c_smbus_read_word_data(state->monitor, 1378 + DS1775_TEMP)) << 8; 1430 1379 state->last_temp = temp; 1431 1380 DBG(" temp: %d.%03d, target: %d.%03d\n", FIX32TOPRINT(temp), 1432 1381 FIX32TOPRINT(DRIVES_PID_INPUT_TARGET)); ··· 1628 1575 } 1629 1576 1630 1577 /* 1631 - * Dispose of the state data for the drives control loop 1578 + * Dispose of the state data for the DIMM control loop 1632 1579 */ 1633 1580 static void dispose_dimms_state(struct dimm_pid_state *state) 1634 1581 { ··· 1640 1587 detach_i2c_chip(state->monitor); 1641 1588 state->monitor = NULL; 1642 1589 } 1590 + 1591 + /* 1592 + * Slots fan control loop 1593 + */ 1594 + static void do_monitor_slots(struct slots_pid_state *state) 1595 + { 1596 + s32 temp, integral, derivative; 1597 + s64 integ_p, deriv_p, prop_p, sum; 1598 + int i, rc; 1599 + 1600 + if (--state->ticks != 0) 1601 + return; 1602 + state->ticks = SLOTS_PID_INTERVAL; 1603 + 1604 + DBG("slots:\n"); 1605 + 1606 + /* Check fan status */ 1607 + rc = get_pwm_fan(SLOTS_FAN_PWM_INDEX); 1608 + if (rc < 0) { 1609 + printk(KERN_WARNING "Error %d reading slots fan !\n", rc); 1610 + /* XXX What do we do now ? */ 1611 + } else 1612 + state->pwm = rc; 1613 + DBG(" current pwm: %d\n", state->pwm); 1614 + 1615 + /* Get some sensor readings */ 1616 + temp = le16_to_cpu(i2c_smbus_read_word_data(state->monitor, 1617 + DS1775_TEMP)) << 8; 1618 + state->last_temp = temp; 1619 + DBG(" temp: %d.%03d, target: %d.%03d\n", FIX32TOPRINT(temp), 1620 + FIX32TOPRINT(SLOTS_PID_INPUT_TARGET)); 1621 + 1622 + /* Store temperature and error in history array */ 1623 + state->cur_sample = (state->cur_sample + 1) % SLOTS_PID_HISTORY_SIZE; 1624 + state->sample_history[state->cur_sample] = temp; 1625 + state->error_history[state->cur_sample] = temp - SLOTS_PID_INPUT_TARGET; 1626 + 1627 + /* If first loop, fill the history table */ 1628 + if (state->first) { 1629 + for (i = 0; i < (SLOTS_PID_HISTORY_SIZE - 1); i++) { 1630 + state->cur_sample = (state->cur_sample + 1) % 1631 + SLOTS_PID_HISTORY_SIZE; 1632 + state->sample_history[state->cur_sample] = temp; 1633 + state->error_history[state->cur_sample] = 1634 + temp - SLOTS_PID_INPUT_TARGET; 1635 + } 1636 + state->first = 0; 1637 + } 1638 + 1639 + /* Calculate the integral term */ 1640 + sum = 0; 1641 + integral = 0; 1642 + for (i = 0; i < SLOTS_PID_HISTORY_SIZE; i++) 1643 + integral += state->error_history[i]; 1644 + integral *= SLOTS_PID_INTERVAL; 1645 + DBG(" integral: %08x\n", integral); 1646 + integ_p = ((s64)SLOTS_PID_G_r) * (s64)integral; 1647 + DBG(" integ_p: %d\n", (int)(integ_p >> 36)); 1648 + sum += integ_p; 1649 + 1650 + /* Calculate the derivative term */ 1651 + derivative = state->error_history[state->cur_sample] - 1652 + state->error_history[(state->cur_sample + SLOTS_PID_HISTORY_SIZE - 1) 1653 + % SLOTS_PID_HISTORY_SIZE]; 1654 + derivative /= SLOTS_PID_INTERVAL; 1655 + deriv_p = ((s64)SLOTS_PID_G_d) * (s64)derivative; 1656 + DBG(" deriv_p: %d\n", (int)(deriv_p >> 36)); 1657 + sum += deriv_p; 1658 + 1659 + /* Calculate the proportional term */ 1660 + prop_p = ((s64)SLOTS_PID_G_p) * (s64)(state->error_history[state->cur_sample]); 1661 + DBG(" prop_p: %d\n", (int)(prop_p >> 36)); 1662 + sum += prop_p; 1663 + 1664 + /* Scale sum */ 1665 + sum >>= 36; 1666 + 1667 + DBG(" sum: %d\n", (int)sum); 1668 + state->pwm = (s32)sum; 1669 + 1670 + state->pwm = max(state->pwm, SLOTS_PID_OUTPUT_MIN); 1671 + state->pwm = min(state->pwm, SLOTS_PID_OUTPUT_MAX); 1672 + 1673 + DBG("** DRIVES PWM: %d\n", (int)state->pwm); 1674 + set_pwm_fan(SLOTS_FAN_PWM_INDEX, state->pwm); 1675 + } 1676 + 1677 + /* 1678 + * Initialize the state structure for the slots bay fan control loop 1679 + */ 1680 + static int init_slots_state(struct slots_pid_state *state) 1681 + { 1682 + state->ticks = 1; 1683 + state->first = 1; 1684 + state->pwm = 50; 1685 + 1686 + state->monitor = attach_i2c_chip(XSERVE_SLOTS_LM75, "slots_temp"); 1687 + if (state->monitor == NULL) 1688 + return -ENODEV; 1689 + 1690 + device_create_file(&of_dev->dev, &dev_attr_slots_temperature); 1691 + device_create_file(&of_dev->dev, &dev_attr_slots_fan_pwm); 1692 + 1693 + return 0; 1694 + } 1695 + 1696 + /* 1697 + * Dispose of the state data for the slots control loop 1698 + */ 1699 + static void dispose_slots_state(struct slots_pid_state *state) 1700 + { 1701 + if (state->monitor == NULL) 1702 + return; 1703 + 1704 + device_remove_file(&of_dev->dev, &dev_attr_slots_temperature); 1705 + device_remove_file(&of_dev->dev, &dev_attr_slots_fan_pwm); 1706 + 1707 + detach_i2c_chip(state->monitor); 1708 + state->monitor = NULL; 1709 + } 1710 + 1643 1711 1644 1712 static int call_critical_overtemp(void) 1645 1713 { ··· 1791 1617 goto out; 1792 1618 } 1793 1619 1794 - /* Set the PCI fan once for now */ 1795 - set_pwm_fan(SLOTS_FAN_PWM_INDEX, SLOTS_FAN_DEFAULT_PWM); 1620 + /* Set the PCI fan once for now on non-RackMac */ 1621 + if (!rackmac) 1622 + set_pwm_fan(SLOTS_FAN_PWM_INDEX, SLOTS_FAN_DEFAULT_PWM); 1796 1623 1797 1624 /* Initialize ADCs */ 1798 1625 initialize_adc(&cpu_state[0]); 1799 1626 if (cpu_state[1].monitor != NULL) 1800 1627 initialize_adc(&cpu_state[1]); 1628 + 1629 + fcu_tickle_ticks = FCU_TICKLE_TICKS; 1801 1630 1802 1631 up(&driver_lock); 1803 1632 ··· 1810 1633 start = jiffies; 1811 1634 1812 1635 down(&driver_lock); 1636 + 1637 + /* Tickle the FCU just in case */ 1638 + if (--fcu_tickle_ticks < 0) { 1639 + fcu_tickle_ticks = FCU_TICKLE_TICKS; 1640 + tickle_fcu(); 1641 + } 1813 1642 1814 1643 /* First, we always calculate the new DIMMs state on an Xserve */ 1815 1644 if (rackmac) ··· 1837 1654 } 1838 1655 /* Then, the rest */ 1839 1656 do_monitor_backside(&backside_state); 1840 - if (!rackmac) 1657 + if (rackmac) 1658 + do_monitor_slots(&slots_state); 1659 + else 1841 1660 do_monitor_drives(&drives_state); 1842 1661 up(&driver_lock); 1843 1662 ··· 1881 1696 dispose_cpu_state(&cpu_state[1]); 1882 1697 dispose_backside_state(&backside_state); 1883 1698 dispose_drives_state(&drives_state); 1699 + dispose_slots_state(&slots_state); 1884 1700 dispose_dimms_state(&dimms_state); 1885 1701 } 1886 1702 ··· 1930 1744 if (init_backside_state(&backside_state)) 1931 1745 goto fail; 1932 1746 if (rackmac && init_dimms_state(&dimms_state)) 1747 + goto fail; 1748 + if (rackmac && init_slots_state(&slots_state)) 1933 1749 goto fail; 1934 1750 if (!rackmac && init_drives_state(&drives_state)) 1935 1751 goto fail;
+31 -2
drivers/macintosh/therm_pm72.h
··· 105 105 #define DRIVES_DALLAS_ID 0x94 106 106 #define BACKSIDE_MAX_ID 0x98 107 107 #define XSERVE_DIMMS_LM87 0x25a 108 + #define XSERVE_SLOTS_LM75 0x290 108 109 109 110 /* 110 111 * Some MAX6690, DS1775, LM87 register definitions ··· 199 198 200 199 #define SLOTS_FAN_PWM_DEFAULT_ID 2 201 200 #define SLOTS_FAN_PWM_INDEX 2 202 - #define SLOTS_FAN_DEFAULT_PWM 50 /* Do better here ! */ 201 + #define SLOTS_FAN_DEFAULT_PWM 40 /* Do better here ! */ 203 202 204 203 205 204 /* ··· 207 206 */ 208 207 #define DIMM_PID_G_d 0 209 208 #define DIMM_PID_G_p 0 210 - #define DIMM_PID_G_r 0x6553600 209 + #define DIMM_PID_G_r 0x06553600 211 210 #define DIMM_PID_INPUT_TARGET 3276800 212 211 #define DIMM_PID_INTERVAL 1 213 212 #define DIMM_PID_OUTPUT_MAX 14000 ··· 224 223 s32 last_temp; 225 224 int first; 226 225 int output; 226 + }; 227 + 228 + 229 + /* 230 + * PID factors for the Xserve Slots control loop 231 + */ 232 + #define SLOTS_PID_G_d 0 233 + #define SLOTS_PID_G_p 0 234 + #define SLOTS_PID_G_r 0x00100000 235 + #define SLOTS_PID_INPUT_TARGET 3200000 236 + #define SLOTS_PID_INTERVAL 1 237 + #define SLOTS_PID_OUTPUT_MAX 100 238 + #define SLOTS_PID_OUTPUT_MIN 20 239 + #define SLOTS_PID_HISTORY_SIZE 20 240 + 241 + struct slots_pid_state 242 + { 243 + int ticks; 244 + struct i2c_client * monitor; 245 + s32 sample_history[SLOTS_PID_HISTORY_SIZE]; 246 + s32 error_history[SLOTS_PID_HISTORY_SIZE]; 247 + int cur_sample; 248 + s32 last_temp; 249 + int first; 250 + int pwm; 227 251 }; 228 252 229 253 ··· 308 282 s32 pump_min; 309 283 s32 pump_max; 310 284 }; 285 + 286 + /* Tickle FCU every 10 seconds */ 287 + #define FCU_TICKLE_TICKS 10 311 288 312 289 /* 313 290 * Driver state
+1 -1
drivers/macintosh/via-pmu-led.c
··· 74 74 75 75 static struct led_classdev pmu_led = { 76 76 .name = "pmu-front-led", 77 - #ifdef CONFIG_BLK_DEV_IDE_PMAC_BLINK 77 + #ifdef CONFIG_ADB_PMU_LED_IDE 78 78 .default_trigger = "ide-disk", 79 79 #endif 80 80 .brightness_set = pmu_led_set,
+161 -146
drivers/video/offb.c
··· 62 62 * Interface used by the world 63 63 */ 64 64 65 - int offb_init(void); 66 - 67 65 static int offb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, 68 66 u_int transp, struct fb_info *info); 69 67 static int offb_blank(int blank, struct fb_info *info); ··· 69 71 #ifdef CONFIG_PPC32 70 72 extern boot_infos_t *boot_infos; 71 73 #endif 72 - 73 - static void offb_init_nodriver(struct device_node *); 74 - static void offb_init_fb(const char *name, const char *full_name, 75 - int width, int height, int depth, int pitch, 76 - unsigned long address, struct device_node *dp); 77 74 78 75 static struct fb_ops offb_ops = { 79 76 .owner = THIS_MODULE, ··· 222 229 return 0; 223 230 } 224 231 225 - /* 226 - * Initialisation 227 - */ 228 232 229 - int __init offb_init(void) 233 + static void __iomem *offb_map_reg(struct device_node *np, int index, 234 + unsigned long offset, unsigned long size) 230 235 { 231 - struct device_node *dp = NULL, *boot_disp = NULL; 236 + struct resource r; 232 237 233 - if (fb_get_options("offb", NULL)) 234 - return -ENODEV; 235 - 236 - for (dp = NULL; (dp = of_find_node_by_type(dp, "display"));) { 237 - if (get_property(dp, "linux,opened", NULL) && 238 - get_property(dp, "linux,boot-display", NULL)) { 239 - boot_disp = dp; 240 - offb_init_nodriver(dp); 241 - } 242 - } 243 - for (dp = NULL; (dp = of_find_node_by_type(dp, "display"));) { 244 - if (get_property(dp, "linux,opened", NULL) && 245 - dp != boot_disp) 246 - offb_init_nodriver(dp); 247 - } 248 - 249 - return 0; 250 - } 251 - 252 - 253 - static void __init offb_init_nodriver(struct device_node *dp) 254 - { 255 - unsigned int len; 256 - int i, width = 640, height = 480, depth = 8, pitch = 640; 257 - unsigned int flags, rsize, addr_prop = 0; 258 - unsigned long max_size = 0; 259 - u64 rstart, address = OF_BAD_ADDR; 260 - u32 *pp, *addrp, *up; 261 - u64 asize; 262 - 263 - pp = (u32 *)get_property(dp, "linux,bootx-depth", &len); 264 - if (pp == NULL) 265 - pp = (u32 *)get_property(dp, "depth", &len); 266 - if (pp && len == sizeof(u32)) 267 - depth = *pp; 268 - 269 - pp = (u32 *)get_property(dp, "linux,bootx-width", &len); 270 - if (pp == NULL) 271 - pp = (u32 *)get_property(dp, "width", &len); 272 - if (pp && len == sizeof(u32)) 273 - width = *pp; 274 - 275 - pp = (u32 *)get_property(dp, "linux,bootx-height", &len); 276 - if (pp == NULL) 277 - pp = (u32 *)get_property(dp, "height", &len); 278 - if (pp && len == sizeof(u32)) 279 - height = *pp; 280 - 281 - pp = (u32 *)get_property(dp, "linux,bootx-linebytes", &len); 282 - if (pp == NULL) 283 - pp = (u32 *)get_property(dp, "linebytes", &len); 284 - if (pp && len == sizeof(u32)) 285 - pitch = *pp; 286 - else 287 - pitch = width * ((depth + 7) / 8); 288 - 289 - rsize = (unsigned long)pitch * (unsigned long)height; 290 - 291 - /* Ok, now we try to figure out the address of the framebuffer. 292 - * 293 - * Unfortunately, Open Firmware doesn't provide a standard way to do 294 - * so. All we can do is a dodgy heuristic that happens to work in 295 - * practice. On most machines, the "address" property contains what 296 - * we need, though not on Matrox cards found in IBM machines. What I've 297 - * found that appears to give good results is to go through the PCI 298 - * ranges and pick one that is both big enough and if possible encloses 299 - * the "address" property. If none match, we pick the biggest 300 - */ 301 - up = (u32 *)get_property(dp, "linux,bootx-addr", &len); 302 - if (up == NULL) 303 - up = (u32 *)get_property(dp, "address", &len); 304 - if (up && len == sizeof(u32)) 305 - addr_prop = *up; 306 - 307 - for (i = 0; (addrp = of_get_address(dp, i, &asize, &flags)) 308 - != NULL; i++) { 309 - int match_addrp = 0; 310 - 311 - if (!(flags & IORESOURCE_MEM)) 312 - continue; 313 - if (asize < rsize) 314 - continue; 315 - rstart = of_translate_address(dp, addrp); 316 - if (rstart == OF_BAD_ADDR) 317 - continue; 318 - if (addr_prop && (rstart <= addr_prop) && 319 - ((rstart + asize) >= (addr_prop + rsize))) 320 - match_addrp = 1; 321 - if (match_addrp) { 322 - address = addr_prop; 323 - break; 324 - } 325 - if (rsize > max_size) { 326 - max_size = rsize; 327 - address = OF_BAD_ADDR; 328 - } 329 - 330 - if (address == OF_BAD_ADDR) 331 - address = rstart; 332 - } 333 - if (address == OF_BAD_ADDR && addr_prop) 334 - address = (u64)addr_prop; 335 - if (address != OF_BAD_ADDR) { 336 - /* kludge for valkyrie */ 337 - if (strcmp(dp->name, "valkyrie") == 0) 338 - address += 0x1000; 339 - offb_init_fb(dp->name, dp->full_name, width, height, depth, 340 - pitch, address, dp); 341 - } 238 + if (of_address_to_resource(np, index, &r)) 239 + return 0; 240 + if ((r.start + offset + size) > r.end) 241 + return 0; 242 + return ioremap(r.start + offset, size); 342 243 } 343 244 344 245 static void __init offb_init_fb(const char *name, const char *full_name, ··· 289 402 290 403 par->cmap_type = cmap_unknown; 291 404 if (depth == 8) { 292 - 293 405 /* Palette hacks disabled for now */ 294 - #if 0 295 406 if (dp && !strncmp(name, "ATY,Rage128", 11)) { 296 - unsigned long regbase = dp->addrs[2].address; 297 - par->cmap_adr = ioremap(regbase, 0x1FFF); 298 - par->cmap_type = cmap_r128; 407 + par->cmap_adr = offb_map_reg(dp, 2, 0, 0x1fff); 408 + if (par->cmap_adr) 409 + par->cmap_type = cmap_r128; 299 410 } else if (dp && (!strncmp(name, "ATY,RageM3pA", 12) 300 411 || !strncmp(name, "ATY,RageM3p12A", 14))) { 301 - unsigned long regbase = 302 - dp->parent->addrs[2].address; 303 - par->cmap_adr = ioremap(regbase, 0x1FFF); 304 - par->cmap_type = cmap_M3A; 412 + par->cmap_adr = offb_map_reg(dp, 2, 0, 0x1fff); 413 + if (par->cmap_adr) 414 + par->cmap_type = cmap_M3A; 305 415 } else if (dp && !strncmp(name, "ATY,RageM3pB", 12)) { 306 - unsigned long regbase = 307 - dp->parent->addrs[2].address; 308 - par->cmap_adr = ioremap(regbase, 0x1FFF); 309 - par->cmap_type = cmap_M3B; 416 + par->cmap_adr = offb_map_reg(dp, 2, 0, 0x1fff); 417 + if (par->cmap_adr) 418 + par->cmap_type = cmap_M3B; 310 419 } else if (dp && !strncmp(name, "ATY,Rage6", 9)) { 311 - unsigned long regbase = dp->addrs[1].address; 312 - par->cmap_adr = ioremap(regbase, 0x1FFF); 313 - par->cmap_type = cmap_radeon; 420 + par->cmap_adr = offb_map_reg(dp, 1, 0, 0x1fff); 421 + if (par->cmap_adr) 422 + par->cmap_type = cmap_radeon; 314 423 } else if (!strncmp(name, "ATY,", 4)) { 315 424 unsigned long base = address & 0xff000000UL; 316 425 par->cmap_adr = 317 426 ioremap(base + 0x7ff000, 0x1000) + 0xcc0; 318 427 par->cmap_data = par->cmap_adr + 1; 319 428 par->cmap_type = cmap_m64; 320 - } else if (device_is_compatible(dp, "pci1014,b7")) { 321 - unsigned long regbase = dp->addrs[0].address; 322 - par->cmap_adr = ioremap(regbase + 0x6000, 0x1000); 323 - par->cmap_type = cmap_gxt2000; 429 + } else if (dp && device_is_compatible(dp, "pci1014,b7")) { 430 + par->cmap_adr = offb_map_reg(dp, 0, 0x6000, 0x1000); 431 + if (par->cmap_adr) 432 + par->cmap_type = cmap_gxt2000; 324 433 } 325 - #endif 326 - fix->visual = par->cmap_adr ? FB_VISUAL_PSEUDOCOLOR 327 - : FB_VISUAL_STATIC_PSEUDOCOLOR; 434 + fix->visual = (par->cmap_type != cmap_unknown) ? 435 + FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_STATIC_PSEUDOCOLOR; 328 436 } else 329 - fix->visual = /* par->cmap_adr ? FB_VISUAL_DIRECTCOLOR 330 - : */ FB_VISUAL_TRUECOLOR; 437 + fix->visual = FB_VISUAL_TRUECOLOR; 331 438 332 439 var->xoffset = var->yoffset = 0; 333 440 switch (depth) { ··· 400 519 printk(KERN_INFO "fb%d: Open Firmware frame buffer device on %s\n", 401 520 info->node, full_name); 402 521 } 522 + 523 + 524 + static void __init offb_init_nodriver(struct device_node *dp, int no_real_node) 525 + { 526 + unsigned int len; 527 + int i, width = 640, height = 480, depth = 8, pitch = 640; 528 + unsigned int flags, rsize, addr_prop = 0; 529 + unsigned long max_size = 0; 530 + u64 rstart, address = OF_BAD_ADDR; 531 + u32 *pp, *addrp, *up; 532 + u64 asize; 533 + 534 + pp = (u32 *)get_property(dp, "linux,bootx-depth", &len); 535 + if (pp == NULL) 536 + pp = (u32 *)get_property(dp, "depth", &len); 537 + if (pp && len == sizeof(u32)) 538 + depth = *pp; 539 + 540 + pp = (u32 *)get_property(dp, "linux,bootx-width", &len); 541 + if (pp == NULL) 542 + pp = (u32 *)get_property(dp, "width", &len); 543 + if (pp && len == sizeof(u32)) 544 + width = *pp; 545 + 546 + pp = (u32 *)get_property(dp, "linux,bootx-height", &len); 547 + if (pp == NULL) 548 + pp = (u32 *)get_property(dp, "height", &len); 549 + if (pp && len == sizeof(u32)) 550 + height = *pp; 551 + 552 + pp = (u32 *)get_property(dp, "linux,bootx-linebytes", &len); 553 + if (pp == NULL) 554 + pp = (u32 *)get_property(dp, "linebytes", &len); 555 + if (pp && len == sizeof(u32)) 556 + pitch = *pp; 557 + else 558 + pitch = width * ((depth + 7) / 8); 559 + 560 + rsize = (unsigned long)pitch * (unsigned long)height; 561 + 562 + /* Ok, now we try to figure out the address of the framebuffer. 563 + * 564 + * Unfortunately, Open Firmware doesn't provide a standard way to do 565 + * so. All we can do is a dodgy heuristic that happens to work in 566 + * practice. On most machines, the "address" property contains what 567 + * we need, though not on Matrox cards found in IBM machines. What I've 568 + * found that appears to give good results is to go through the PCI 569 + * ranges and pick one that is both big enough and if possible encloses 570 + * the "address" property. If none match, we pick the biggest 571 + */ 572 + up = (u32 *)get_property(dp, "linux,bootx-addr", &len); 573 + if (up == NULL) 574 + up = (u32 *)get_property(dp, "address", &len); 575 + if (up && len == sizeof(u32)) 576 + addr_prop = *up; 577 + 578 + /* Hack for when BootX is passing us */ 579 + if (no_real_node) 580 + goto skip_addr; 581 + 582 + for (i = 0; (addrp = of_get_address(dp, i, &asize, &flags)) 583 + != NULL; i++) { 584 + int match_addrp = 0; 585 + 586 + if (!(flags & IORESOURCE_MEM)) 587 + continue; 588 + if (asize < rsize) 589 + continue; 590 + rstart = of_translate_address(dp, addrp); 591 + if (rstart == OF_BAD_ADDR) 592 + continue; 593 + if (addr_prop && (rstart <= addr_prop) && 594 + ((rstart + asize) >= (addr_prop + rsize))) 595 + match_addrp = 1; 596 + if (match_addrp) { 597 + address = addr_prop; 598 + break; 599 + } 600 + if (rsize > max_size) { 601 + max_size = rsize; 602 + address = OF_BAD_ADDR; 603 + } 604 + 605 + if (address == OF_BAD_ADDR) 606 + address = rstart; 607 + } 608 + skip_addr: 609 + if (address == OF_BAD_ADDR && addr_prop) 610 + address = (u64)addr_prop; 611 + if (address != OF_BAD_ADDR) { 612 + /* kludge for valkyrie */ 613 + if (strcmp(dp->name, "valkyrie") == 0) 614 + address += 0x1000; 615 + offb_init_fb(no_real_node ? "bootx" : dp->name, 616 + no_real_node ? "display" : dp->full_name, 617 + width, height, depth, pitch, address, 618 + no_real_node ? dp : NULL); 619 + } 620 + } 621 + 622 + static int __init offb_init(void) 623 + { 624 + struct device_node *dp = NULL, *boot_disp = NULL; 625 + 626 + if (fb_get_options("offb", NULL)) 627 + return -ENODEV; 628 + 629 + /* Check if we have a MacOS display without a node spec */ 630 + if (get_property(of_chosen, "linux,bootx-noscreen", NULL) != NULL) { 631 + /* The old code tried to work out which node was the MacOS 632 + * display based on the address. I'm dropping that since the 633 + * lack of a node spec only happens with old BootX versions 634 + * (users can update) and with this code, they'll still get 635 + * a display (just not the palette hacks). 636 + */ 637 + offb_init_nodriver(of_chosen, 1); 638 + } 639 + 640 + for (dp = NULL; (dp = of_find_node_by_type(dp, "display"));) { 641 + if (get_property(dp, "linux,opened", NULL) && 642 + get_property(dp, "linux,boot-display", NULL)) { 643 + boot_disp = dp; 644 + offb_init_nodriver(dp, 0); 645 + } 646 + } 647 + for (dp = NULL; (dp = of_find_node_by_type(dp, "display"));) { 648 + if (get_property(dp, "linux,opened", NULL) && 649 + dp != boot_disp) 650 + offb_init_nodriver(dp, 0); 651 + } 652 + 653 + return 0; 654 + } 655 + 403 656 404 657 module_init(offb_init); 405 658 MODULE_LICENSE("GPL");