Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2000 Mike Corrigan <mikejc@us.ibm.com> |
| 3 | * Copyright (c) 1999-2000 Grant Erickson <grant@lcse.umn.edu> |
| 4 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5 | * Description: |
| 6 | * Architecture- / platform-specific boot-time initialization code for |
| 7 | * the IBM iSeries LPAR. Adapted from original code by Grant Erickson and |
| 8 | * code by Gary Thomas, Cort Dougan <cort@fsmlabs.com>, and Dan Malek |
| 9 | * <dan@net4x.com>. |
| 10 | * |
| 11 | * This program is free software; you can redistribute it and/or |
| 12 | * modify it under the terms of the GNU General Public License |
| 13 | * as published by the Free Software Foundation; either version |
| 14 | * 2 of the License, or (at your option) any later version. |
| 15 | */ |
| 16 | |
| 17 | #undef DEBUG |
| 18 | |
| 19 | #include <linux/config.h> |
| 20 | #include <linux/init.h> |
| 21 | #include <linux/threads.h> |
| 22 | #include <linux/smp.h> |
| 23 | #include <linux/param.h> |
| 24 | #include <linux/string.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 25 | #include <linux/initrd.h> |
| 26 | #include <linux/seq_file.h> |
| 27 | #include <linux/kdev_t.h> |
| 28 | #include <linux/major.h> |
| 29 | #include <linux/root_dev.h> |
Stephen Rothwell | bec7c45 | 2005-11-01 11:45:19 +1100 | [diff] [blame] | 30 | #include <linux/kernel.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | |
| 32 | #include <asm/processor.h> |
| 33 | #include <asm/machdep.h> |
| 34 | #include <asm/page.h> |
| 35 | #include <asm/mmu.h> |
| 36 | #include <asm/pgtable.h> |
| 37 | #include <asm/mmu_context.h> |
| 38 | #include <asm/cputable.h> |
| 39 | #include <asm/sections.h> |
| 40 | #include <asm/iommu.h> |
Stephen Rothwell | aed3135 | 2005-08-03 14:43:21 +1000 | [diff] [blame] | 41 | #include <asm/firmware.h> |
Paul Mackerras | 49b0985 | 2005-11-10 15:53:40 +1100 | [diff] [blame] | 42 | #include <asm/system.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | #include <asm/time.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | #include <asm/paca.h> |
| 45 | #include <asm/cache.h> |
| 46 | #include <asm/sections.h> |
Stephen Rothwell | 0bc0ffd | 2005-06-21 17:15:36 -0700 | [diff] [blame] | 47 | #include <asm/abs_addr.h> |
Kelly Daly | 15b1718 | 2005-11-02 11:55:28 +1100 | [diff] [blame] | 48 | #include <asm/iseries/hv_lp_config.h> |
Kelly Daly | c0a8d05 | 2005-11-02 11:11:11 +1100 | [diff] [blame] | 49 | #include <asm/iseries/hv_call_event.h> |
Kelly Daly | 8021b8a | 2005-11-02 11:41:12 +1100 | [diff] [blame] | 50 | #include <asm/iseries/hv_call_xm.h> |
Kelly Daly | 8875ccf | 2005-11-02 14:13:34 +1100 | [diff] [blame] | 51 | #include <asm/iseries/it_lp_queue.h> |
Kelly Daly | bbc8b62 | 2005-11-02 15:10:38 +1100 | [diff] [blame] | 52 | #include <asm/iseries/mf.h> |
Kelly Daly | e45423e | 2005-11-02 12:08:31 +1100 | [diff] [blame] | 53 | #include <asm/iseries/hv_lp_event.h> |
Kelly Daly | c43a55f | 2005-11-02 15:02:47 +1100 | [diff] [blame] | 54 | #include <asm/iseries/lpar_map.h> |
Michael Ellerman | bf6a711 | 2006-01-11 11:54:08 +1100 | [diff] [blame] | 55 | #include <asm/udbg.h> |
Stephen Rothwell | 7d01c88 | 2006-04-04 14:49:48 +1000 | [diff] [blame] | 56 | #include <asm/irq.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 57 | |
David Gibson | f11b7bd | 2005-11-01 15:30:26 +1100 | [diff] [blame] | 58 | #include "naca.h" |
Stephen Rothwell | c8b8497 | 2005-09-27 18:44:42 +1000 | [diff] [blame] | 59 | #include "setup.h" |
Stephen Rothwell | b08567cb | 2005-09-28 23:37:01 +1000 | [diff] [blame] | 60 | #include "irq.h" |
| 61 | #include "vpd_areas.h" |
| 62 | #include "processor_vpd.h" |
| 63 | #include "main_store.h" |
| 64 | #include "call_sm.h" |
Stephen Rothwell | 0e29bb1 | 2005-10-14 17:09:16 +1000 | [diff] [blame] | 65 | #include "call_hpt.h" |
Stephen Rothwell | c8b8497 | 2005-09-27 18:44:42 +1000 | [diff] [blame] | 66 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 67 | #ifdef DEBUG |
Michael Ellerman | bf6a711 | 2006-01-11 11:54:08 +1100 | [diff] [blame] | 68 | #define DBG(fmt...) udbg_printf(fmt) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 69 | #else |
| 70 | #define DBG(fmt...) |
| 71 | #endif |
| 72 | |
| 73 | /* Function Prototypes */ |
Paul Mackerras | 799d604 | 2005-11-10 13:37:51 +1100 | [diff] [blame] | 74 | static unsigned long build_iSeries_Memory_Map(void); |
Paul Mackerras | 143a1de | 2005-10-19 23:11:21 +1000 | [diff] [blame] | 75 | static void iseries_shared_idle(void); |
| 76 | static void iseries_dedicated_idle(void); |
Stephen Rothwell | 145d01e | 2005-06-21 17:15:52 -0700 | [diff] [blame] | 77 | #ifdef CONFIG_PCI |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 78 | extern void iSeries_pci_final_fixup(void); |
Stephen Rothwell | 145d01e | 2005-06-21 17:15:52 -0700 | [diff] [blame] | 79 | #else |
| 80 | static void iSeries_pci_final_fixup(void) { } |
| 81 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 82 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 83 | extern int rd_size; /* Defined in drivers/block/rd.c */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 84 | extern unsigned long embedded_sysmap_start; |
| 85 | extern unsigned long embedded_sysmap_end; |
| 86 | |
| 87 | extern unsigned long iSeries_recal_tb; |
| 88 | extern unsigned long iSeries_recal_titan; |
| 89 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 90 | struct MemoryBlock { |
| 91 | unsigned long absStart; |
| 92 | unsigned long absEnd; |
| 93 | unsigned long logicalStart; |
| 94 | unsigned long logicalEnd; |
| 95 | }; |
| 96 | |
| 97 | /* |
| 98 | * Process the main store vpd to determine where the holes in memory are |
| 99 | * and return the number of physical blocks and fill in the array of |
| 100 | * block data. |
| 101 | */ |
| 102 | static unsigned long iSeries_process_Condor_mainstore_vpd( |
| 103 | struct MemoryBlock *mb_array, unsigned long max_entries) |
| 104 | { |
| 105 | unsigned long holeFirstChunk, holeSizeChunks; |
| 106 | unsigned long numMemoryBlocks = 1; |
| 107 | struct IoHriMainStoreSegment4 *msVpd = |
| 108 | (struct IoHriMainStoreSegment4 *)xMsVpd; |
| 109 | unsigned long holeStart = msVpd->nonInterleavedBlocksStartAdr; |
| 110 | unsigned long holeEnd = msVpd->nonInterleavedBlocksEndAdr; |
| 111 | unsigned long holeSize = holeEnd - holeStart; |
| 112 | |
| 113 | printk("Mainstore_VPD: Condor\n"); |
| 114 | /* |
| 115 | * Determine if absolute memory has any |
| 116 | * holes so that we can interpret the |
| 117 | * access map we get back from the hypervisor |
| 118 | * correctly. |
| 119 | */ |
| 120 | mb_array[0].logicalStart = 0; |
| 121 | mb_array[0].logicalEnd = 0x100000000; |
| 122 | mb_array[0].absStart = 0; |
| 123 | mb_array[0].absEnd = 0x100000000; |
| 124 | |
| 125 | if (holeSize) { |
| 126 | numMemoryBlocks = 2; |
| 127 | holeStart = holeStart & 0x000fffffffffffff; |
| 128 | holeStart = addr_to_chunk(holeStart); |
| 129 | holeFirstChunk = holeStart; |
| 130 | holeSize = addr_to_chunk(holeSize); |
| 131 | holeSizeChunks = holeSize; |
| 132 | printk( "Main store hole: start chunk = %0lx, size = %0lx chunks\n", |
| 133 | holeFirstChunk, holeSizeChunks ); |
| 134 | mb_array[0].logicalEnd = holeFirstChunk; |
| 135 | mb_array[0].absEnd = holeFirstChunk; |
| 136 | mb_array[1].logicalStart = holeFirstChunk; |
| 137 | mb_array[1].logicalEnd = 0x100000000 - holeSizeChunks; |
| 138 | mb_array[1].absStart = holeFirstChunk + holeSizeChunks; |
| 139 | mb_array[1].absEnd = 0x100000000; |
| 140 | } |
| 141 | return numMemoryBlocks; |
| 142 | } |
| 143 | |
| 144 | #define MaxSegmentAreas 32 |
| 145 | #define MaxSegmentAdrRangeBlocks 128 |
| 146 | #define MaxAreaRangeBlocks 4 |
| 147 | |
| 148 | static unsigned long iSeries_process_Regatta_mainstore_vpd( |
| 149 | struct MemoryBlock *mb_array, unsigned long max_entries) |
| 150 | { |
| 151 | struct IoHriMainStoreSegment5 *msVpdP = |
| 152 | (struct IoHriMainStoreSegment5 *)xMsVpd; |
| 153 | unsigned long numSegmentBlocks = 0; |
| 154 | u32 existsBits = msVpdP->msAreaExists; |
| 155 | unsigned long area_num; |
| 156 | |
| 157 | printk("Mainstore_VPD: Regatta\n"); |
| 158 | |
| 159 | for (area_num = 0; area_num < MaxSegmentAreas; ++area_num ) { |
| 160 | unsigned long numAreaBlocks; |
| 161 | struct IoHriMainStoreArea4 *currentArea; |
| 162 | |
| 163 | if (existsBits & 0x80000000) { |
| 164 | unsigned long block_num; |
| 165 | |
| 166 | currentArea = &msVpdP->msAreaArray[area_num]; |
| 167 | numAreaBlocks = currentArea->numAdrRangeBlocks; |
| 168 | printk("ms_vpd: processing area %2ld blocks=%ld", |
| 169 | area_num, numAreaBlocks); |
| 170 | for (block_num = 0; block_num < numAreaBlocks; |
| 171 | ++block_num ) { |
| 172 | /* Process an address range block */ |
| 173 | struct MemoryBlock tempBlock; |
| 174 | unsigned long i; |
| 175 | |
| 176 | tempBlock.absStart = |
| 177 | (unsigned long)currentArea->xAdrRangeBlock[block_num].blockStart; |
| 178 | tempBlock.absEnd = |
| 179 | (unsigned long)currentArea->xAdrRangeBlock[block_num].blockEnd; |
| 180 | tempBlock.logicalStart = 0; |
| 181 | tempBlock.logicalEnd = 0; |
| 182 | printk("\n block %ld absStart=%016lx absEnd=%016lx", |
| 183 | block_num, tempBlock.absStart, |
| 184 | tempBlock.absEnd); |
| 185 | |
| 186 | for (i = 0; i < numSegmentBlocks; ++i) { |
| 187 | if (mb_array[i].absStart == |
| 188 | tempBlock.absStart) |
| 189 | break; |
| 190 | } |
| 191 | if (i == numSegmentBlocks) { |
| 192 | if (numSegmentBlocks == max_entries) |
| 193 | panic("iSeries_process_mainstore_vpd: too many memory blocks"); |
| 194 | mb_array[numSegmentBlocks] = tempBlock; |
| 195 | ++numSegmentBlocks; |
| 196 | } else |
| 197 | printk(" (duplicate)"); |
| 198 | } |
| 199 | printk("\n"); |
| 200 | } |
| 201 | existsBits <<= 1; |
| 202 | } |
| 203 | /* Now sort the blocks found into ascending sequence */ |
| 204 | if (numSegmentBlocks > 1) { |
| 205 | unsigned long m, n; |
| 206 | |
| 207 | for (m = 0; m < numSegmentBlocks - 1; ++m) { |
| 208 | for (n = numSegmentBlocks - 1; m < n; --n) { |
| 209 | if (mb_array[n].absStart < |
| 210 | mb_array[n-1].absStart) { |
| 211 | struct MemoryBlock tempBlock; |
| 212 | |
| 213 | tempBlock = mb_array[n]; |
| 214 | mb_array[n] = mb_array[n-1]; |
| 215 | mb_array[n-1] = tempBlock; |
| 216 | } |
| 217 | } |
| 218 | } |
| 219 | } |
| 220 | /* |
| 221 | * Assign "logical" addresses to each block. These |
| 222 | * addresses correspond to the hypervisor "bitmap" space. |
| 223 | * Convert all addresses into units of 256K chunks. |
| 224 | */ |
| 225 | { |
| 226 | unsigned long i, nextBitmapAddress; |
| 227 | |
| 228 | printk("ms_vpd: %ld sorted memory blocks\n", numSegmentBlocks); |
| 229 | nextBitmapAddress = 0; |
| 230 | for (i = 0; i < numSegmentBlocks; ++i) { |
| 231 | unsigned long length = mb_array[i].absEnd - |
| 232 | mb_array[i].absStart; |
| 233 | |
| 234 | mb_array[i].logicalStart = nextBitmapAddress; |
| 235 | mb_array[i].logicalEnd = nextBitmapAddress + length; |
| 236 | nextBitmapAddress += length; |
| 237 | printk(" Bitmap range: %016lx - %016lx\n" |
| 238 | " Absolute range: %016lx - %016lx\n", |
| 239 | mb_array[i].logicalStart, |
| 240 | mb_array[i].logicalEnd, |
| 241 | mb_array[i].absStart, mb_array[i].absEnd); |
| 242 | mb_array[i].absStart = addr_to_chunk(mb_array[i].absStart & |
| 243 | 0x000fffffffffffff); |
| 244 | mb_array[i].absEnd = addr_to_chunk(mb_array[i].absEnd & |
| 245 | 0x000fffffffffffff); |
| 246 | mb_array[i].logicalStart = |
| 247 | addr_to_chunk(mb_array[i].logicalStart); |
| 248 | mb_array[i].logicalEnd = addr_to_chunk(mb_array[i].logicalEnd); |
| 249 | } |
| 250 | } |
| 251 | |
| 252 | return numSegmentBlocks; |
| 253 | } |
| 254 | |
| 255 | static unsigned long iSeries_process_mainstore_vpd(struct MemoryBlock *mb_array, |
| 256 | unsigned long max_entries) |
| 257 | { |
| 258 | unsigned long i; |
| 259 | unsigned long mem_blocks = 0; |
| 260 | |
| 261 | if (cpu_has_feature(CPU_FTR_SLB)) |
| 262 | mem_blocks = iSeries_process_Regatta_mainstore_vpd(mb_array, |
| 263 | max_entries); |
| 264 | else |
| 265 | mem_blocks = iSeries_process_Condor_mainstore_vpd(mb_array, |
| 266 | max_entries); |
| 267 | |
| 268 | printk("Mainstore_VPD: numMemoryBlocks = %ld \n", mem_blocks); |
| 269 | for (i = 0; i < mem_blocks; ++i) { |
| 270 | printk("Mainstore_VPD: block %3ld logical chunks %016lx - %016lx\n" |
| 271 | " abs chunks %016lx - %016lx\n", |
| 272 | i, mb_array[i].logicalStart, mb_array[i].logicalEnd, |
| 273 | mb_array[i].absStart, mb_array[i].absEnd); |
| 274 | } |
| 275 | return mem_blocks; |
| 276 | } |
| 277 | |
| 278 | static void __init iSeries_get_cmdline(void) |
| 279 | { |
| 280 | char *p, *q; |
| 281 | |
| 282 | /* copy the command line parameter from the primary VSP */ |
| 283 | HvCallEvent_dmaToSp(cmd_line, 2 * 64* 1024, 256, |
| 284 | HvLpDma_Direction_RemoteToLocal); |
| 285 | |
| 286 | p = cmd_line; |
| 287 | q = cmd_line + 255; |
| 288 | while(p < q) { |
| 289 | if (!*p || *p == '\n') |
| 290 | break; |
| 291 | ++p; |
| 292 | } |
| 293 | *p = 0; |
| 294 | } |
| 295 | |
| 296 | static void __init iSeries_init_early(void) |
| 297 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 298 | DBG(" -> iSeries_init_early()\n"); |
| 299 | |
Michael Ellerman | ba293ff | 2005-09-23 14:43:22 +1000 | [diff] [blame] | 300 | ppc64_interrupt_controller = IC_ISERIES; |
| 301 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 302 | #if defined(CONFIG_BLK_DEV_INITRD) |
| 303 | /* |
| 304 | * If the init RAM disk has been configured and there is |
| 305 | * a non-zero starting address for it, set it up |
| 306 | */ |
| 307 | if (naca.xRamDisk) { |
| 308 | initrd_start = (unsigned long)__va(naca.xRamDisk); |
Benjamin Herrenschmidt | 3c726f8 | 2005-11-07 11:06:55 +1100 | [diff] [blame] | 309 | initrd_end = initrd_start + naca.xRamDiskSize * HW_PAGE_SIZE; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 310 | initrd_below_start_ok = 1; // ramdisk in kernel space |
| 311 | ROOT_DEV = Root_RAM0; |
Benjamin Herrenschmidt | 3c726f8 | 2005-11-07 11:06:55 +1100 | [diff] [blame] | 312 | if (((rd_size * 1024) / HW_PAGE_SIZE) < naca.xRamDiskSize) |
| 313 | rd_size = (naca.xRamDiskSize * HW_PAGE_SIZE) / 1024; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 314 | } else |
| 315 | #endif /* CONFIG_BLK_DEV_INITRD */ |
| 316 | { |
| 317 | /* ROOT_DEV = MKDEV(VIODASD_MAJOR, 1); */ |
| 318 | } |
| 319 | |
| 320 | iSeries_recal_tb = get_tb(); |
| 321 | iSeries_recal_titan = HvCallXm_loadTod(); |
| 322 | |
| 323 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 324 | * Initialize the hash table management pointers |
| 325 | */ |
| 326 | hpte_init_iSeries(); |
| 327 | |
| 328 | /* |
| 329 | * Initialize the DMA/TCE management |
| 330 | */ |
| 331 | iommu_init_early_iSeries(); |
| 332 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 333 | /* Initialize machine-dependency vectors */ |
| 334 | #ifdef CONFIG_SMP |
| 335 | smp_init_iSeries(); |
| 336 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 337 | |
| 338 | /* Associate Lp Event Queue 0 with processor 0 */ |
| 339 | HvCallEvent_setLpEventQueueInterruptProc(0, 0); |
| 340 | |
| 341 | mf_init(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 342 | |
| 343 | /* If we were passed an initrd, set the ROOT_DEV properly if the values |
| 344 | * look sensible. If not, clear initrd reference. |
| 345 | */ |
| 346 | #ifdef CONFIG_BLK_DEV_INITRD |
| 347 | if (initrd_start >= KERNELBASE && initrd_end >= KERNELBASE && |
| 348 | initrd_end > initrd_start) |
| 349 | ROOT_DEV = Root_RAM0; |
| 350 | else |
| 351 | initrd_start = initrd_end = 0; |
| 352 | #endif /* CONFIG_BLK_DEV_INITRD */ |
| 353 | |
| 354 | DBG(" <- iSeries_init_early()\n"); |
| 355 | } |
| 356 | |
Michael Ellerman | 56e97b7 | 2005-08-03 20:21:23 +1000 | [diff] [blame] | 357 | struct mschunks_map mschunks_map = { |
Michael Ellerman | 34c8f69 | 2005-08-03 20:21:23 +1000 | [diff] [blame] | 358 | /* XXX We don't use these, but Piranha might need them. */ |
| 359 | .chunk_size = MSCHUNKS_CHUNK_SIZE, |
| 360 | .chunk_shift = MSCHUNKS_CHUNK_SHIFT, |
| 361 | .chunk_mask = MSCHUNKS_OFFSET_MASK, |
| 362 | }; |
Michael Ellerman | 56e97b7 | 2005-08-03 20:21:23 +1000 | [diff] [blame] | 363 | EXPORT_SYMBOL(mschunks_map); |
Michael Ellerman | 34c8f69 | 2005-08-03 20:21:23 +1000 | [diff] [blame] | 364 | |
Michael Ellerman | 56e97b7 | 2005-08-03 20:21:23 +1000 | [diff] [blame] | 365 | void mschunks_alloc(unsigned long num_chunks) |
Michael Ellerman | 34c8f69 | 2005-08-03 20:21:23 +1000 | [diff] [blame] | 366 | { |
| 367 | klimit = _ALIGN(klimit, sizeof(u32)); |
Michael Ellerman | 56e97b7 | 2005-08-03 20:21:23 +1000 | [diff] [blame] | 368 | mschunks_map.mapping = (u32 *)klimit; |
Michael Ellerman | 34c8f69 | 2005-08-03 20:21:23 +1000 | [diff] [blame] | 369 | klimit += num_chunks * sizeof(u32); |
Michael Ellerman | 56e97b7 | 2005-08-03 20:21:23 +1000 | [diff] [blame] | 370 | mschunks_map.num_chunks = num_chunks; |
Michael Ellerman | 34c8f69 | 2005-08-03 20:21:23 +1000 | [diff] [blame] | 371 | } |
| 372 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 373 | /* |
| 374 | * The iSeries may have very large memories ( > 128 GB ) and a partition |
| 375 | * may get memory in "chunks" that may be anywhere in the 2**52 real |
| 376 | * address space. The chunks are 256K in size. To map this to the |
| 377 | * memory model Linux expects, the AS/400 specific code builds a |
| 378 | * translation table to translate what Linux thinks are "physical" |
| 379 | * addresses to the actual real addresses. This allows us to make |
| 380 | * it appear to Linux that we have contiguous memory starting at |
| 381 | * physical address zero while in fact this could be far from the truth. |
| 382 | * To avoid confusion, I'll let the words physical and/or real address |
| 383 | * apply to the Linux addresses while I'll use "absolute address" to |
| 384 | * refer to the actual hardware real address. |
| 385 | * |
| 386 | * build_iSeries_Memory_Map gets information from the Hypervisor and |
| 387 | * looks at the Main Store VPD to determine the absolute addresses |
| 388 | * of the memory that has been assigned to our partition and builds |
| 389 | * a table used to translate Linux's physical addresses to these |
| 390 | * absolute addresses. Absolute addresses are needed when |
| 391 | * communicating with the hypervisor (e.g. to build HPT entries) |
Paul Mackerras | 799d604 | 2005-11-10 13:37:51 +1100 | [diff] [blame] | 392 | * |
| 393 | * Returns the physical memory size |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 394 | */ |
| 395 | |
Paul Mackerras | 799d604 | 2005-11-10 13:37:51 +1100 | [diff] [blame] | 396 | static unsigned long __init build_iSeries_Memory_Map(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 397 | { |
| 398 | u32 loadAreaFirstChunk, loadAreaLastChunk, loadAreaSize; |
| 399 | u32 nextPhysChunk; |
| 400 | u32 hptFirstChunk, hptLastChunk, hptSizeChunks, hptSizePages; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 401 | u32 totalChunks,moreChunks; |
| 402 | u32 currChunk, thisChunk, absChunk; |
| 403 | u32 currDword; |
| 404 | u32 chunkBit; |
| 405 | u64 map; |
| 406 | struct MemoryBlock mb[32]; |
| 407 | unsigned long numMemoryBlocks, curBlock; |
| 408 | |
| 409 | /* Chunk size on iSeries is 256K bytes */ |
| 410 | totalChunks = (u32)HvLpConfig_getMsChunks(); |
Michael Ellerman | 56e97b7 | 2005-08-03 20:21:23 +1000 | [diff] [blame] | 411 | mschunks_alloc(totalChunks); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 412 | |
| 413 | /* |
| 414 | * Get absolute address of our load area |
| 415 | * and map it to physical address 0 |
| 416 | * This guarantees that the loadarea ends up at physical 0 |
| 417 | * otherwise, it might not be returned by PLIC as the first |
| 418 | * chunks |
| 419 | */ |
| 420 | |
| 421 | loadAreaFirstChunk = (u32)addr_to_chunk(itLpNaca.xLoadAreaAddr); |
| 422 | loadAreaSize = itLpNaca.xLoadAreaChunks; |
| 423 | |
| 424 | /* |
| 425 | * Only add the pages already mapped here. |
| 426 | * Otherwise we might add the hpt pages |
| 427 | * The rest of the pages of the load area |
| 428 | * aren't in the HPT yet and can still |
| 429 | * be assigned an arbitrary physical address |
| 430 | */ |
| 431 | if ((loadAreaSize * 64) > HvPagesToMap) |
| 432 | loadAreaSize = HvPagesToMap / 64; |
| 433 | |
| 434 | loadAreaLastChunk = loadAreaFirstChunk + loadAreaSize - 1; |
| 435 | |
| 436 | /* |
| 437 | * TODO Do we need to do something if the HPT is in the 64MB load area? |
| 438 | * This would be required if the itLpNaca.xLoadAreaChunks includes |
| 439 | * the HPT size |
| 440 | */ |
| 441 | |
| 442 | printk("Mapping load area - physical addr = 0000000000000000\n" |
| 443 | " absolute addr = %016lx\n", |
| 444 | chunk_to_addr(loadAreaFirstChunk)); |
| 445 | printk("Load area size %dK\n", loadAreaSize * 256); |
| 446 | |
| 447 | for (nextPhysChunk = 0; nextPhysChunk < loadAreaSize; ++nextPhysChunk) |
Michael Ellerman | 56e97b7 | 2005-08-03 20:21:23 +1000 | [diff] [blame] | 448 | mschunks_map.mapping[nextPhysChunk] = |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 449 | loadAreaFirstChunk + nextPhysChunk; |
| 450 | |
| 451 | /* |
| 452 | * Get absolute address of our HPT and remember it so |
| 453 | * we won't map it to any physical address |
| 454 | */ |
| 455 | hptFirstChunk = (u32)addr_to_chunk(HvCallHpt_getHptAddress()); |
| 456 | hptSizePages = (u32)HvCallHpt_getHptPages(); |
Benjamin Herrenschmidt | 3c726f8 | 2005-11-07 11:06:55 +1100 | [diff] [blame] | 457 | hptSizeChunks = hptSizePages >> |
| 458 | (MSCHUNKS_CHUNK_SHIFT - HW_PAGE_SHIFT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 459 | hptLastChunk = hptFirstChunk + hptSizeChunks - 1; |
| 460 | |
| 461 | printk("HPT absolute addr = %016lx, size = %dK\n", |
| 462 | chunk_to_addr(hptFirstChunk), hptSizeChunks * 256); |
| 463 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 464 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 465 | * Determine if absolute memory has any |
| 466 | * holes so that we can interpret the |
| 467 | * access map we get back from the hypervisor |
| 468 | * correctly. |
| 469 | */ |
| 470 | numMemoryBlocks = iSeries_process_mainstore_vpd(mb, 32); |
| 471 | |
| 472 | /* |
| 473 | * Process the main store access map from the hypervisor |
| 474 | * to build up our physical -> absolute translation table |
| 475 | */ |
| 476 | curBlock = 0; |
| 477 | currChunk = 0; |
| 478 | currDword = 0; |
| 479 | moreChunks = totalChunks; |
| 480 | |
| 481 | while (moreChunks) { |
| 482 | map = HvCallSm_get64BitsOfAccessMap(itLpNaca.xLpIndex, |
| 483 | currDword); |
| 484 | thisChunk = currChunk; |
| 485 | while (map) { |
| 486 | chunkBit = map >> 63; |
| 487 | map <<= 1; |
| 488 | if (chunkBit) { |
| 489 | --moreChunks; |
| 490 | while (thisChunk >= mb[curBlock].logicalEnd) { |
| 491 | ++curBlock; |
| 492 | if (curBlock >= numMemoryBlocks) |
| 493 | panic("out of memory blocks"); |
| 494 | } |
| 495 | if (thisChunk < mb[curBlock].logicalStart) |
| 496 | panic("memory block error"); |
| 497 | |
| 498 | absChunk = mb[curBlock].absStart + |
| 499 | (thisChunk - mb[curBlock].logicalStart); |
| 500 | if (((absChunk < hptFirstChunk) || |
| 501 | (absChunk > hptLastChunk)) && |
| 502 | ((absChunk < loadAreaFirstChunk) || |
| 503 | (absChunk > loadAreaLastChunk))) { |
Michael Ellerman | 56e97b7 | 2005-08-03 20:21:23 +1000 | [diff] [blame] | 504 | mschunks_map.mapping[nextPhysChunk] = |
| 505 | absChunk; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 506 | ++nextPhysChunk; |
| 507 | } |
| 508 | } |
| 509 | ++thisChunk; |
| 510 | } |
| 511 | ++currDword; |
| 512 | currChunk += 64; |
| 513 | } |
| 514 | |
| 515 | /* |
| 516 | * main store size (in chunks) is |
| 517 | * totalChunks - hptSizeChunks |
| 518 | * which should be equal to |
| 519 | * nextPhysChunk |
| 520 | */ |
Paul Mackerras | 799d604 | 2005-11-10 13:37:51 +1100 | [diff] [blame] | 521 | return chunk_to_addr(nextPhysChunk); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 522 | } |
| 523 | |
| 524 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 525 | * Document me. |
| 526 | */ |
| 527 | static void __init iSeries_setup_arch(void) |
| 528 | { |
David Gibson | 3356bb9 | 2006-01-13 10:26:42 +1100 | [diff] [blame] | 529 | if (get_lppaca()->shared_proc) { |
Michael Ellerman | 9f49758 | 2005-09-23 14:10:59 +1000 | [diff] [blame] | 530 | ppc_md.idle_loop = iseries_shared_idle; |
Olof Johansson | 4baaf0c | 2006-04-12 15:23:22 -0500 | [diff] [blame] | 531 | printk(KERN_DEBUG "Using shared processor idle loop\n"); |
Michael Ellerman | 9f49758 | 2005-09-23 14:10:59 +1000 | [diff] [blame] | 532 | } else { |
| 533 | ppc_md.idle_loop = iseries_dedicated_idle; |
Olof Johansson | 4baaf0c | 2006-04-12 15:23:22 -0500 | [diff] [blame] | 534 | printk(KERN_DEBUG "Using dedicated idle loop\n"); |
Michael Ellerman | 9f49758 | 2005-09-23 14:10:59 +1000 | [diff] [blame] | 535 | } |
| 536 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 537 | /* Setup the Lp Event Queue */ |
Michael Ellerman | 512d31d | 2005-06-30 15:08:27 +1000 | [diff] [blame] | 538 | setup_hvlpevent_queue(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 539 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 540 | printk("Max logical processors = %d\n", |
| 541 | itVpdAreas.xSlicMaxLogicalProcs); |
| 542 | printk("Max physical processors = %d\n", |
| 543 | itVpdAreas.xSlicMaxPhysicalProcs); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 544 | } |
| 545 | |
Paul Mackerras | d8699e6 | 2005-10-20 17:02:01 +1000 | [diff] [blame] | 546 | static void iSeries_show_cpuinfo(struct seq_file *m) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 547 | { |
| 548 | seq_printf(m, "machine\t\t: 64-bit iSeries Logical Partition\n"); |
| 549 | } |
| 550 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 551 | static void __init iSeries_progress(char * st, unsigned short code) |
| 552 | { |
| 553 | printk("Progress: [%04x] - %s\n", (unsigned)code, st); |
Michael Ellerman | 260de22 | 2006-03-21 20:46:02 +1100 | [diff] [blame] | 554 | mf_display_progress(code); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 555 | } |
| 556 | |
| 557 | static void __init iSeries_fixup_klimit(void) |
| 558 | { |
| 559 | /* |
| 560 | * Change klimit to take into account any ram disk |
| 561 | * that may be included |
| 562 | */ |
| 563 | if (naca.xRamDisk) |
| 564 | klimit = KERNELBASE + (u64)naca.xRamDisk + |
Benjamin Herrenschmidt | 3c726f8 | 2005-11-07 11:06:55 +1100 | [diff] [blame] | 565 | (naca.xRamDiskSize * HW_PAGE_SIZE); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 566 | else { |
| 567 | /* |
| 568 | * No ram disk was included - check and see if there |
| 569 | * was an embedded system map. Change klimit to take |
| 570 | * into account any embedded system map |
| 571 | */ |
| 572 | if (embedded_sysmap_end) |
| 573 | klimit = KERNELBASE + ((embedded_sysmap_end + 4095) & |
| 574 | 0xfffffffffffff000); |
| 575 | } |
| 576 | } |
| 577 | |
| 578 | static int __init iSeries_src_init(void) |
| 579 | { |
| 580 | /* clear the progress line */ |
| 581 | ppc_md.progress(" ", 0xffff); |
| 582 | return 0; |
| 583 | } |
| 584 | |
| 585 | late_initcall(iSeries_src_init); |
| 586 | |
Michael Ellerman | d200903 | 2005-07-07 17:56:29 -0700 | [diff] [blame] | 587 | static inline void process_iSeries_events(void) |
| 588 | { |
| 589 | asm volatile ("li 0,0x5555; sc" : : : "r0", "r3"); |
| 590 | } |
| 591 | |
| 592 | static void yield_shared_processor(void) |
| 593 | { |
| 594 | unsigned long tb; |
Michael Ellerman | d200903 | 2005-07-07 17:56:29 -0700 | [diff] [blame] | 595 | |
| 596 | HvCall_setEnabledInterrupts(HvCall_MaskIPI | |
| 597 | HvCall_MaskLpEvent | |
| 598 | HvCall_MaskLpProd | |
| 599 | HvCall_MaskTimeout); |
| 600 | |
| 601 | tb = get_tb(); |
| 602 | /* Compute future tb value when yield should expire */ |
| 603 | HvCall_yieldProcessor(HvCall_YieldTimed, tb+tb_ticks_per_jiffy); |
| 604 | |
Michael Ellerman | d200903 | 2005-07-07 17:56:29 -0700 | [diff] [blame] | 605 | /* |
| 606 | * The decrementer stops during the yield. Force a fake decrementer |
| 607 | * here and let the timer_interrupt code sort out the actual time. |
| 608 | */ |
David Gibson | 3356bb9 | 2006-01-13 10:26:42 +1100 | [diff] [blame] | 609 | get_lppaca()->int_dword.fields.decr_int = 1; |
Anton Blanchard | cb2c9b2 | 2006-02-13 14:48:35 +1100 | [diff] [blame] | 610 | ppc64_runlatch_on(); |
Michael Ellerman | d200903 | 2005-07-07 17:56:29 -0700 | [diff] [blame] | 611 | process_iSeries_events(); |
| 612 | } |
| 613 | |
Paul Mackerras | 143a1de | 2005-10-19 23:11:21 +1000 | [diff] [blame] | 614 | static void iseries_shared_idle(void) |
Michael Ellerman | d200903 | 2005-07-07 17:56:29 -0700 | [diff] [blame] | 615 | { |
Anton Blanchard | 3c57bb9 | 2005-07-07 17:56:32 -0700 | [diff] [blame] | 616 | while (1) { |
| 617 | while (!need_resched() && !hvlpevent_is_pending()) { |
| 618 | local_irq_disable(); |
| 619 | ppc64_runlatch_off(); |
| 620 | |
| 621 | /* Recheck with irqs off */ |
| 622 | if (!need_resched() && !hvlpevent_is_pending()) |
| 623 | yield_shared_processor(); |
| 624 | |
| 625 | HMT_medium(); |
| 626 | local_irq_enable(); |
| 627 | } |
| 628 | |
| 629 | ppc64_runlatch_on(); |
| 630 | |
| 631 | if (hvlpevent_is_pending()) |
| 632 | process_iSeries_events(); |
| 633 | |
Nick Piggin | 5bfb5d6 | 2005-11-08 21:39:01 -0800 | [diff] [blame] | 634 | preempt_enable_no_resched(); |
Anton Blanchard | 3c57bb9 | 2005-07-07 17:56:32 -0700 | [diff] [blame] | 635 | schedule(); |
Nick Piggin | 5bfb5d6 | 2005-11-08 21:39:01 -0800 | [diff] [blame] | 636 | preempt_disable(); |
Anton Blanchard | 3c57bb9 | 2005-07-07 17:56:32 -0700 | [diff] [blame] | 637 | } |
Anton Blanchard | 3c57bb9 | 2005-07-07 17:56:32 -0700 | [diff] [blame] | 638 | } |
| 639 | |
Paul Mackerras | 143a1de | 2005-10-19 23:11:21 +1000 | [diff] [blame] | 640 | static void iseries_dedicated_idle(void) |
Anton Blanchard | 3c57bb9 | 2005-07-07 17:56:32 -0700 | [diff] [blame] | 641 | { |
Nick Piggin | 64c7c8f | 2005-11-08 21:39:04 -0800 | [diff] [blame] | 642 | set_thread_flag(TIF_POLLING_NRFLAG); |
Michael Ellerman | d200903 | 2005-07-07 17:56:29 -0700 | [diff] [blame] | 643 | |
Michael Ellerman | d200903 | 2005-07-07 17:56:29 -0700 | [diff] [blame] | 644 | while (1) { |
Nick Piggin | 64c7c8f | 2005-11-08 21:39:04 -0800 | [diff] [blame] | 645 | if (!need_resched()) { |
Anton Blanchard | 3c57bb9 | 2005-07-07 17:56:32 -0700 | [diff] [blame] | 646 | while (!need_resched()) { |
| 647 | ppc64_runlatch_off(); |
| 648 | HMT_low(); |
| 649 | |
| 650 | if (hvlpevent_is_pending()) { |
Michael Ellerman | d200903 | 2005-07-07 17:56:29 -0700 | [diff] [blame] | 651 | HMT_medium(); |
Anton Blanchard | 3c57bb9 | 2005-07-07 17:56:32 -0700 | [diff] [blame] | 652 | ppc64_runlatch_on(); |
| 653 | process_iSeries_events(); |
Michael Ellerman | d200903 | 2005-07-07 17:56:29 -0700 | [diff] [blame] | 654 | } |
Michael Ellerman | d200903 | 2005-07-07 17:56:29 -0700 | [diff] [blame] | 655 | } |
Anton Blanchard | 3c57bb9 | 2005-07-07 17:56:32 -0700 | [diff] [blame] | 656 | |
| 657 | HMT_medium(); |
Michael Ellerman | d200903 | 2005-07-07 17:56:29 -0700 | [diff] [blame] | 658 | } |
| 659 | |
| 660 | ppc64_runlatch_on(); |
Nick Piggin | 5bfb5d6 | 2005-11-08 21:39:01 -0800 | [diff] [blame] | 661 | preempt_enable_no_resched(); |
Michael Ellerman | d200903 | 2005-07-07 17:56:29 -0700 | [diff] [blame] | 662 | schedule(); |
Nick Piggin | 5bfb5d6 | 2005-11-08 21:39:01 -0800 | [diff] [blame] | 663 | preempt_disable(); |
Michael Ellerman | d200903 | 2005-07-07 17:56:29 -0700 | [diff] [blame] | 664 | } |
Michael Ellerman | d200903 | 2005-07-07 17:56:29 -0700 | [diff] [blame] | 665 | } |
| 666 | |
Stephen Rothwell | 145d01e | 2005-06-21 17:15:52 -0700 | [diff] [blame] | 667 | #ifndef CONFIG_PCI |
| 668 | void __init iSeries_init_IRQ(void) { } |
| 669 | #endif |
| 670 | |
Benjamin Herrenschmidt | e822250 | 2006-03-28 23:15:54 +1100 | [diff] [blame] | 671 | static int __init iseries_probe(void) |
Michael Ellerman | 4762713 | 2005-09-23 14:59:04 +1000 | [diff] [blame] | 672 | { |
Benjamin Herrenschmidt | e822250 | 2006-03-28 23:15:54 +1100 | [diff] [blame] | 673 | unsigned long root = of_get_flat_dt_root(); |
| 674 | if (!of_flat_dt_is_compatible(root, "IBM,iSeries")) |
Michael Ellerman | 57cfb81 | 2006-03-21 20:45:59 +1100 | [diff] [blame] | 675 | return 0; |
| 676 | |
Michael Ellerman | d0160bf | 2006-03-27 14:26:25 +1100 | [diff] [blame] | 677 | powerpc_firmware_features |= FW_FEATURE_ISERIES; |
| 678 | powerpc_firmware_features |= FW_FEATURE_LPAR; |
Michael Ellerman | 57cfb81 | 2006-03-21 20:45:59 +1100 | [diff] [blame] | 679 | |
Stephen Rothwell | 7d01c88 | 2006-04-04 14:49:48 +1000 | [diff] [blame] | 680 | /* |
| 681 | * The Hypervisor only allows us up to 256 interrupt |
| 682 | * sources (the irq number is passed in a u8). |
| 683 | */ |
| 684 | virt_irq_max = 255; |
| 685 | |
Michael Ellerman | 57cfb81 | 2006-03-21 20:45:59 +1100 | [diff] [blame] | 686 | return 1; |
Michael Ellerman | 4762713 | 2005-09-23 14:59:04 +1000 | [diff] [blame] | 687 | } |
| 688 | |
Benjamin Herrenschmidt | e822250 | 2006-03-28 23:15:54 +1100 | [diff] [blame] | 689 | define_machine(iseries) { |
| 690 | .name = "iSeries", |
Michael Ellerman | 9f49758 | 2005-09-23 14:10:59 +1000 | [diff] [blame] | 691 | .setup_arch = iSeries_setup_arch, |
Paul Mackerras | d8699e6 | 2005-10-20 17:02:01 +1000 | [diff] [blame] | 692 | .show_cpuinfo = iSeries_show_cpuinfo, |
Michael Ellerman | 9f49758 | 2005-09-23 14:10:59 +1000 | [diff] [blame] | 693 | .init_IRQ = iSeries_init_IRQ, |
| 694 | .get_irq = iSeries_get_irq, |
| 695 | .init_early = iSeries_init_early, |
| 696 | .pcibios_fixup = iSeries_pci_final_fixup, |
Michael Ellerman | a9ea210 | 2006-03-21 20:46:04 +1100 | [diff] [blame] | 697 | .restart = mf_reboot, |
| 698 | .power_off = mf_power_off, |
| 699 | .halt = mf_power_off, |
Michael Ellerman | 9f49758 | 2005-09-23 14:10:59 +1000 | [diff] [blame] | 700 | .get_boot_time = iSeries_get_boot_time, |
| 701 | .set_rtc_time = iSeries_set_rtc_time, |
| 702 | .get_rtc_time = iSeries_get_rtc_time, |
Michael Ellerman | 95b2938 | 2005-09-23 15:03:10 +1000 | [diff] [blame] | 703 | .calibrate_decr = generic_calibrate_decr, |
Michael Ellerman | 9f49758 | 2005-09-23 14:10:59 +1000 | [diff] [blame] | 704 | .progress = iSeries_progress, |
Michael Ellerman | 4762713 | 2005-09-23 14:59:04 +1000 | [diff] [blame] | 705 | .probe = iseries_probe, |
Michael Ellerman | 9f49758 | 2005-09-23 14:10:59 +1000 | [diff] [blame] | 706 | /* XXX Implement enable_pmcs for iSeries */ |
| 707 | }; |
| 708 | |
Michael Ellerman | 4762713 | 2005-09-23 14:59:04 +1000 | [diff] [blame] | 709 | void * __init iSeries_early_setup(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 710 | { |
Paul Mackerras | 799d604 | 2005-11-10 13:37:51 +1100 | [diff] [blame] | 711 | unsigned long phys_mem_size; |
| 712 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 713 | iSeries_fixup_klimit(); |
Michael Ellerman | c0a5949 | 2005-09-23 14:56:09 +1000 | [diff] [blame] | 714 | |
Michael Ellerman | 4762713 | 2005-09-23 14:59:04 +1000 | [diff] [blame] | 715 | /* |
| 716 | * Initialize the table which translate Linux physical addresses to |
| 717 | * AS/400 absolute addresses |
| 718 | */ |
Paul Mackerras | 799d604 | 2005-11-10 13:37:51 +1100 | [diff] [blame] | 719 | phys_mem_size = build_iSeries_Memory_Map(); |
Michael Ellerman | 4762713 | 2005-09-23 14:59:04 +1000 | [diff] [blame] | 720 | |
Stephen Rothwell | bec7c45 | 2005-11-01 11:45:19 +1100 | [diff] [blame] | 721 | iSeries_get_cmdline(); |
| 722 | |
Stephen Rothwell | c81014f | 2006-05-19 17:00:04 +1000 | [diff] [blame^] | 723 | return (void *) __pa(build_flat_dt(phys_mem_size)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 724 | } |
Stephen Rothwell | bec7c45 | 2005-11-01 11:45:19 +1100 | [diff] [blame] | 725 | |
Michael Ellerman | bf6a711 | 2006-01-11 11:54:08 +1100 | [diff] [blame] | 726 | static void hvputc(char c) |
| 727 | { |
| 728 | if (c == '\n') |
| 729 | hvputc('\r'); |
| 730 | |
| 731 | HvCall_writeLogBuffer(&c, 1); |
| 732 | } |
| 733 | |
| 734 | void __init udbg_init_iseries(void) |
| 735 | { |
| 736 | udbg_putc = hvputc; |
| 737 | } |