inventory.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. /*
  3. * inventory.c
  4. *
  5. * Copyright (c) 1999 The Puffin Group (David Kennedy and Alex deVries)
  6. * Copyright (c) 2001 Matthew Wilcox for Hewlett-Packard
  7. *
  8. * These are the routines to discover what hardware exists in this box.
  9. * This task is complicated by there being 3 different ways of
  10. * performing an inventory, depending largely on the age of the box.
  11. * The recommended way to do this is to check to see whether the machine
  12. * is a `Snake' first, then try System Map, then try PAT. We try System
  13. * Map before checking for a Snake -- this probably doesn't cause any
  14. * problems, but...
  15. */
  16. #include <linux/types.h>
  17. #include <linux/kernel.h>
  18. #include <linux/init.h>
  19. #include <linux/slab.h>
  20. #include <linux/mm.h>
  21. #include <linux/platform_device.h>
  22. #include <asm/hardware.h>
  23. #include <asm/io.h>
  24. #include <asm/mmzone.h>
  25. #include <asm/pdc.h>
  26. #include <asm/pdcpat.h>
  27. #include <asm/processor.h>
  28. #include <asm/page.h>
  29. #include <asm/parisc-device.h>
  30. #include <asm/tlbflush.h>
  31. /*
  32. ** Debug options
  33. ** DEBUG_PAT Dump details which PDC PAT provides about ranges/devices.
  34. */
  35. #undef DEBUG_PAT
  36. int pdc_type __ro_after_init = PDC_TYPE_ILLEGAL;
  37. /* cell number and location (PAT firmware only) */
  38. unsigned long parisc_cell_num __ro_after_init;
  39. unsigned long parisc_cell_loc __ro_after_init;
  40. unsigned long parisc_pat_pdc_cap __ro_after_init;
  41. void __init setup_pdc(void)
  42. {
  43. long status;
  44. unsigned int bus_id;
  45. struct pdc_system_map_mod_info module_result;
  46. struct pdc_module_path module_path;
  47. struct pdc_model model;
  48. #ifdef CONFIG_64BIT
  49. struct pdc_pat_cell_num cell_info;
  50. #endif
  51. /* Determine the pdc "type" used on this machine */
  52. printk(KERN_INFO "Determining PDC firmware type: ");
  53. status = pdc_system_map_find_mods(&module_result, &module_path, 0);
  54. if (status == PDC_OK) {
  55. pdc_type = PDC_TYPE_SYSTEM_MAP;
  56. pr_cont("System Map.\n");
  57. return;
  58. }
  59. /*
  60. * If the machine doesn't support PDC_SYSTEM_MAP then either it
  61. * is a pdc pat box, or it is an older box. All 64 bit capable
  62. * machines are either pdc pat boxes or they support PDC_SYSTEM_MAP.
  63. */
  64. /*
  65. * TODO: We should test for 64 bit capability and give a
  66. * clearer message.
  67. */
  68. #ifdef CONFIG_64BIT
  69. status = pdc_pat_cell_get_number(&cell_info);
  70. if (status == PDC_OK) {
  71. unsigned long legacy_rev, pat_rev;
  72. pdc_type = PDC_TYPE_PAT;
  73. pr_cont("64 bit PAT.\n");
  74. parisc_cell_num = cell_info.cell_num;
  75. parisc_cell_loc = cell_info.cell_loc;
  76. pr_info("PAT: Running on cell %lu and location %lu.\n",
  77. parisc_cell_num, parisc_cell_loc);
  78. status = pdc_pat_pd_get_pdc_revisions(&legacy_rev,
  79. &pat_rev, &parisc_pat_pdc_cap);
  80. pr_info("PAT: legacy revision 0x%lx, pat_rev 0x%lx, pdc_cap 0x%lx, S-PTLB %d, HPMC_RENDEZ %d.\n",
  81. legacy_rev, pat_rev, parisc_pat_pdc_cap,
  82. parisc_pat_pdc_cap
  83. & PDC_PAT_CAPABILITY_BIT_SIMULTANEOUS_PTLB ? 1:0,
  84. parisc_pat_pdc_cap
  85. & PDC_PAT_CAPABILITY_BIT_PDC_HPMC_RENDEZ ? 1:0);
  86. return;
  87. }
  88. #endif
  89. /* Check the CPU's bus ID. There's probably a better test. */
  90. status = pdc_model_info(&model);
  91. bus_id = (model.hversion >> (4 + 7)) & 0x1f;
  92. switch (bus_id) {
  93. case 0x4: /* 720, 730, 750, 735, 755 */
  94. case 0x6: /* 705, 710 */
  95. case 0x7: /* 715, 725 */
  96. case 0x8: /* 745, 747, 742 */
  97. case 0xA: /* 712 and similar */
  98. case 0xC: /* 715/64, at least */
  99. pdc_type = PDC_TYPE_SNAKE;
  100. pr_cont("Snake.\n");
  101. return;
  102. default: /* Everything else */
  103. pr_cont("Unsupported.\n");
  104. panic("If this is a 64-bit machine, please try a 64-bit kernel.\n");
  105. }
  106. }
  107. #define PDC_PAGE_ADJ_SHIFT (PAGE_SHIFT - 12) /* pdc pages are always 4k */
  108. static void __init
  109. set_pmem_entry(physmem_range_t *pmem_ptr, unsigned long start,
  110. unsigned long pages4k)
  111. {
  112. /* Rather than aligning and potentially throwing away
  113. * memory, we'll assume that any ranges are already
  114. * nicely aligned with any reasonable page size, and
  115. * panic if they are not (it's more likely that the
  116. * pdc info is bad in this case).
  117. */
  118. if (unlikely( ((start & (PAGE_SIZE - 1)) != 0)
  119. || ((pages4k & ((1UL << PDC_PAGE_ADJ_SHIFT) - 1)) != 0) )) {
  120. panic("Memory range doesn't align with page size!\n");
  121. }
  122. pmem_ptr->start_pfn = (start >> PAGE_SHIFT);
  123. pmem_ptr->pages = (pages4k >> PDC_PAGE_ADJ_SHIFT);
  124. }
  125. static void __init pagezero_memconfig(void)
  126. {
  127. unsigned long npages;
  128. /* Use the 32 bit information from page zero to create a single
  129. * entry in the pmem_ranges[] table.
  130. *
  131. * We currently don't support machines with contiguous memory
  132. * >= 4 Gb, who report that memory using 64 bit only fields
  133. * on page zero. It's not worth doing until it can be tested,
  134. * and it is not clear we can support those machines for other
  135. * reasons.
  136. *
  137. * If that support is done in the future, this is where it
  138. * should be done.
  139. */
  140. npages = (PAGE_ALIGN(PAGE0->imm_max_mem) >> PAGE_SHIFT);
  141. set_pmem_entry(pmem_ranges,0UL,npages);
  142. npmem_ranges = 1;
  143. }
  144. #ifdef CONFIG_64BIT
  145. /* All of the PDC PAT specific code is 64-bit only */
  146. /*
  147. ** The module object is filled via PDC_PAT_CELL[Return Cell Module].
  148. ** If a module is found, register module will get the IODC bytes via
  149. ** pdc_iodc_read() using the PA view of conf_base_addr for the hpa parameter.
  150. **
  151. ** The IO view can be used by PDC_PAT_CELL[Return Cell Module]
  152. ** only for SBAs and LBAs. This view will cause an invalid
  153. ** argument error for all other cell module types.
  154. **
  155. */
  156. static int __init
  157. pat_query_module(ulong pcell_loc, ulong mod_index)
  158. {
  159. pdc_pat_cell_mod_maddr_block_t *pa_pdc_cell;
  160. unsigned long bytecnt;
  161. unsigned long temp; /* 64-bit scratch value */
  162. long status; /* PDC return value status */
  163. struct parisc_device *dev;
  164. pa_pdc_cell = kmalloc(sizeof (*pa_pdc_cell), GFP_KERNEL);
  165. if (!pa_pdc_cell)
  166. panic("couldn't allocate memory for PDC_PAT_CELL!");
  167. /* return cell module (PA or Processor view) */
  168. status = pdc_pat_cell_module(&bytecnt, pcell_loc, mod_index,
  169. PA_VIEW, pa_pdc_cell);
  170. if (status != PDC_OK) {
  171. /* no more cell modules or error */
  172. kfree(pa_pdc_cell);
  173. return status;
  174. }
  175. temp = pa_pdc_cell->cba;
  176. dev = alloc_pa_dev(PAT_GET_CBA(temp), &(pa_pdc_cell->mod_path));
  177. if (!dev) {
  178. kfree(pa_pdc_cell);
  179. return PDC_OK;
  180. }
  181. /* alloc_pa_dev sets dev->hpa */
  182. /*
  183. ** save parameters in the parisc_device
  184. ** (The idea being the device driver will call pdc_pat_cell_module()
  185. ** and store the results in its own data structure.)
  186. */
  187. dev->pcell_loc = pcell_loc;
  188. dev->mod_index = mod_index;
  189. /* save generic info returned from the call */
  190. /* REVISIT: who is the consumer of this? not sure yet... */
  191. dev->mod_info = pa_pdc_cell->mod_info; /* pass to PAT_GET_ENTITY() */
  192. dev->pmod_loc = pa_pdc_cell->mod_location;
  193. dev->mod0 = pa_pdc_cell->mod[0];
  194. register_parisc_device(dev); /* advertise device */
  195. #ifdef DEBUG_PAT
  196. /* dump what we see so far... */
  197. switch (PAT_GET_ENTITY(dev->mod_info)) {
  198. pdc_pat_cell_mod_maddr_block_t io_pdc_cell;
  199. unsigned long i;
  200. case PAT_ENTITY_PROC:
  201. printk(KERN_DEBUG "PAT_ENTITY_PROC: id_eid 0x%lx\n",
  202. pa_pdc_cell->mod[0]);
  203. break;
  204. case PAT_ENTITY_MEM:
  205. printk(KERN_DEBUG
  206. "PAT_ENTITY_MEM: amount 0x%lx min_gni_base 0x%lx min_gni_len 0x%lx\n",
  207. pa_pdc_cell->mod[0], pa_pdc_cell->mod[1],
  208. pa_pdc_cell->mod[2]);
  209. break;
  210. case PAT_ENTITY_CA:
  211. printk(KERN_DEBUG "PAT_ENTITY_CA: %ld\n", pcell_loc);
  212. break;
  213. case PAT_ENTITY_PBC:
  214. printk(KERN_DEBUG "PAT_ENTITY_PBC: ");
  215. goto print_ranges;
  216. case PAT_ENTITY_SBA:
  217. printk(KERN_DEBUG "PAT_ENTITY_SBA: ");
  218. goto print_ranges;
  219. case PAT_ENTITY_LBA:
  220. printk(KERN_DEBUG "PAT_ENTITY_LBA: ");
  221. print_ranges:
  222. pdc_pat_cell_module(&bytecnt, pcell_loc, mod_index,
  223. IO_VIEW, &io_pdc_cell);
  224. printk(KERN_DEBUG "ranges %ld\n", pa_pdc_cell->mod[1]);
  225. for (i = 0; i < pa_pdc_cell->mod[1]; i++) {
  226. printk(KERN_DEBUG
  227. " PA_VIEW %ld: 0x%016lx 0x%016lx 0x%016lx\n",
  228. i, pa_pdc_cell->mod[2 + i * 3], /* type */
  229. pa_pdc_cell->mod[3 + i * 3], /* start */
  230. pa_pdc_cell->mod[4 + i * 3]); /* finish (ie end) */
  231. printk(KERN_DEBUG
  232. " IO_VIEW %ld: 0x%016lx 0x%016lx 0x%016lx\n",
  233. i, io_pdc_cell.mod[2 + i * 3], /* type */
  234. io_pdc_cell.mod[3 + i * 3], /* start */
  235. io_pdc_cell.mod[4 + i * 3]); /* finish (ie end) */
  236. }
  237. printk(KERN_DEBUG "\n");
  238. break;
  239. }
  240. #endif /* DEBUG_PAT */
  241. kfree(pa_pdc_cell);
  242. return PDC_OK;
  243. }
  244. /* pat pdc can return information about a variety of different
  245. * types of memory (e.g. firmware,i/o, etc) but we only care about
  246. * the usable physical ram right now. Since the firmware specific
  247. * information is allocated on the stack, we'll be generous, in
  248. * case there is a lot of other information we don't care about.
  249. */
  250. #define PAT_MAX_RANGES (4 * MAX_PHYSMEM_RANGES)
  251. static void __init pat_memconfig(void)
  252. {
  253. unsigned long actual_len;
  254. struct pdc_pat_pd_addr_map_entry mem_table[PAT_MAX_RANGES+1];
  255. struct pdc_pat_pd_addr_map_entry *mtbl_ptr;
  256. physmem_range_t *pmem_ptr;
  257. long status;
  258. int entries;
  259. unsigned long length;
  260. int i;
  261. length = (PAT_MAX_RANGES + 1) * sizeof(struct pdc_pat_pd_addr_map_entry);
  262. status = pdc_pat_pd_get_addr_map(&actual_len, mem_table, length, 0L);
  263. if ((status != PDC_OK)
  264. || ((actual_len % sizeof(struct pdc_pat_pd_addr_map_entry)) != 0)) {
  265. /* The above pdc call shouldn't fail, but, just in
  266. * case, just use the PAGE0 info.
  267. */
  268. printk("\n\n\n");
  269. printk(KERN_WARNING "WARNING! Could not get full memory configuration. "
  270. "All memory may not be used!\n\n\n");
  271. pagezero_memconfig();
  272. return;
  273. }
  274. entries = actual_len / sizeof(struct pdc_pat_pd_addr_map_entry);
  275. if (entries > PAT_MAX_RANGES) {
  276. printk(KERN_WARNING "This Machine has more memory ranges than we support!\n");
  277. printk(KERN_WARNING "Some memory may not be used!\n");
  278. }
  279. /* Copy information into the firmware independent pmem_ranges
  280. * array, skipping types we don't care about. Notice we said
  281. * "may" above. We'll use all the entries that were returned.
  282. */
  283. npmem_ranges = 0;
  284. mtbl_ptr = mem_table;
  285. pmem_ptr = pmem_ranges; /* Global firmware independent table */
  286. for (i = 0; i < entries; i++,mtbl_ptr++) {
  287. if ( (mtbl_ptr->entry_type != PAT_MEMORY_DESCRIPTOR)
  288. || (mtbl_ptr->memory_type != PAT_MEMTYPE_MEMORY)
  289. || (mtbl_ptr->pages == 0)
  290. || ( (mtbl_ptr->memory_usage != PAT_MEMUSE_GENERAL)
  291. && (mtbl_ptr->memory_usage != PAT_MEMUSE_GI)
  292. && (mtbl_ptr->memory_usage != PAT_MEMUSE_GNI) ) ) {
  293. continue;
  294. }
  295. if (npmem_ranges == MAX_PHYSMEM_RANGES) {
  296. printk(KERN_WARNING "This Machine has more memory ranges than we support!\n");
  297. printk(KERN_WARNING "Some memory will not be used!\n");
  298. break;
  299. }
  300. set_pmem_entry(pmem_ptr++,mtbl_ptr->paddr,mtbl_ptr->pages);
  301. npmem_ranges++;
  302. }
  303. }
  304. static int __init pat_inventory(void)
  305. {
  306. int status;
  307. ulong mod_index = 0;
  308. struct pdc_pat_cell_num cell_info;
  309. /*
  310. ** Note: Prelude (and it's successors: Lclass, A400/500) only
  311. ** implement PDC_PAT_CELL sub-options 0 and 2.
  312. */
  313. status = pdc_pat_cell_get_number(&cell_info);
  314. if (status != PDC_OK) {
  315. return 0;
  316. }
  317. #ifdef DEBUG_PAT
  318. printk(KERN_DEBUG "CELL_GET_NUMBER: 0x%lx 0x%lx\n", cell_info.cell_num,
  319. cell_info.cell_loc);
  320. #endif
  321. while (PDC_OK == pat_query_module(cell_info.cell_loc, mod_index)) {
  322. mod_index++;
  323. }
  324. return mod_index;
  325. }
  326. /* We only look for extended memory ranges on a 64 bit capable box */
  327. static void __init sprockets_memconfig(void)
  328. {
  329. struct pdc_memory_table_raddr r_addr;
  330. struct pdc_memory_table mem_table[MAX_PHYSMEM_RANGES];
  331. struct pdc_memory_table *mtbl_ptr;
  332. physmem_range_t *pmem_ptr;
  333. long status;
  334. int entries;
  335. int i;
  336. status = pdc_mem_mem_table(&r_addr,mem_table,
  337. (unsigned long)MAX_PHYSMEM_RANGES);
  338. if (status != PDC_OK) {
  339. /* The above pdc call only works on boxes with sprockets
  340. * firmware (newer B,C,J class). Other non PAT PDC machines
  341. * do support more than 3.75 Gb of memory, but we don't
  342. * support them yet.
  343. */
  344. pagezero_memconfig();
  345. return;
  346. }
  347. if (r_addr.entries_total > MAX_PHYSMEM_RANGES) {
  348. printk(KERN_WARNING "This Machine has more memory ranges than we support!\n");
  349. printk(KERN_WARNING "Some memory will not be used!\n");
  350. }
  351. entries = (int)r_addr.entries_returned;
  352. npmem_ranges = 0;
  353. mtbl_ptr = mem_table;
  354. pmem_ptr = pmem_ranges; /* Global firmware independent table */
  355. for (i = 0; i < entries; i++,mtbl_ptr++) {
  356. set_pmem_entry(pmem_ptr++,mtbl_ptr->paddr,mtbl_ptr->pages);
  357. npmem_ranges++;
  358. }
  359. }
  360. #else /* !CONFIG_64BIT */
  361. #define pat_inventory() do { } while (0)
  362. #define pat_memconfig() do { } while (0)
  363. #define sprockets_memconfig() pagezero_memconfig()
  364. #endif /* !CONFIG_64BIT */
  365. #ifndef CONFIG_PA20
  366. /* Code to support Snake machines (7[2350], 7[235]5, 715/Scorpio) */
  367. static struct parisc_device * __init
  368. legacy_create_device(struct pdc_memory_map *r_addr,
  369. struct pdc_module_path *module_path)
  370. {
  371. struct parisc_device *dev;
  372. int status = pdc_mem_map_hpa(r_addr, module_path);
  373. if (status != PDC_OK)
  374. return NULL;
  375. dev = alloc_pa_dev(r_addr->hpa, &module_path->path);
  376. if (dev == NULL)
  377. return NULL;
  378. register_parisc_device(dev);
  379. return dev;
  380. }
  381. /**
  382. * snake_inventory
  383. *
  384. * Before PDC_SYSTEM_MAP was invented, the PDC_MEM_MAP call was used.
  385. * To use it, we initialise the mod_path.bc to 0xff and try all values of
  386. * mod to get the HPA for the top-level devices. Bus adapters may have
  387. * sub-devices which are discovered by setting bc[5] to 0 and bc[4] to the
  388. * module, then trying all possible functions.
  389. */
  390. static void __init snake_inventory(void)
  391. {
  392. int mod;
  393. for (mod = 0; mod < 16; mod++) {
  394. struct parisc_device *dev;
  395. struct pdc_module_path module_path;
  396. struct pdc_memory_map r_addr;
  397. unsigned int func;
  398. memset(module_path.path.bc, 0xff, 6);
  399. module_path.path.mod = mod;
  400. dev = legacy_create_device(&r_addr, &module_path);
  401. if ((!dev) || (dev->id.hw_type != HPHW_BA))
  402. continue;
  403. memset(module_path.path.bc, 0xff, 4);
  404. module_path.path.bc[4] = mod;
  405. for (func = 0; func < 16; func++) {
  406. module_path.path.bc[5] = 0;
  407. module_path.path.mod = func;
  408. legacy_create_device(&r_addr, &module_path);
  409. }
  410. }
  411. }
  412. #else /* CONFIG_PA20 */
  413. #define snake_inventory() do { } while (0)
  414. #endif /* CONFIG_PA20 */
  415. /* Common 32/64 bit based code goes here */
  416. /**
  417. * add_system_map_addresses - Add additional addresses to the parisc device.
  418. * @dev: The parisc device.
  419. * @num_addrs: Then number of addresses to add;
  420. * @module_instance: The system_map module instance.
  421. *
  422. * This function adds any additional addresses reported by the system_map
  423. * firmware to the parisc device.
  424. */
  425. static void __init
  426. add_system_map_addresses(struct parisc_device *dev, int num_addrs,
  427. int module_instance)
  428. {
  429. int i;
  430. long status;
  431. struct pdc_system_map_addr_info addr_result;
  432. dev->addr = kmalloc_array(num_addrs, sizeof(*dev->addr), GFP_KERNEL);
  433. if(!dev->addr) {
  434. printk(KERN_ERR "%s %s(): memory allocation failure\n",
  435. __FILE__, __func__);
  436. return;
  437. }
  438. for(i = 1; i <= num_addrs; ++i) {
  439. status = pdc_system_map_find_addrs(&addr_result,
  440. module_instance, i);
  441. if(PDC_OK == status) {
  442. dev->addr[dev->num_addrs] = (unsigned long)addr_result.mod_addr;
  443. dev->num_addrs++;
  444. } else {
  445. printk(KERN_WARNING
  446. "Bad PDC_FIND_ADDRESS status return (%ld) for index %d\n",
  447. status, i);
  448. }
  449. }
  450. }
  451. /**
  452. * system_map_inventory - Retrieve firmware devices via SYSTEM_MAP.
  453. *
  454. * This function attempts to retrieve and register all the devices firmware
  455. * knows about via the SYSTEM_MAP PDC call.
  456. */
  457. static void __init system_map_inventory(void)
  458. {
  459. int i;
  460. long status = PDC_OK;
  461. for (i = 0; i < 256; i++) {
  462. struct parisc_device *dev;
  463. struct pdc_system_map_mod_info module_result;
  464. struct pdc_module_path module_path;
  465. status = pdc_system_map_find_mods(&module_result,
  466. &module_path, i);
  467. if ((status == PDC_BAD_PROC) || (status == PDC_NE_MOD))
  468. break;
  469. if (status != PDC_OK)
  470. continue;
  471. dev = alloc_pa_dev(module_result.mod_addr, &module_path.path);
  472. if (!dev)
  473. continue;
  474. register_parisc_device(dev);
  475. /* if available, get the additional addresses for a module */
  476. if (!module_result.add_addrs)
  477. continue;
  478. add_system_map_addresses(dev, module_result.add_addrs, i);
  479. }
  480. walk_central_bus();
  481. return;
  482. }
  483. void __init do_memory_inventory(void)
  484. {
  485. switch (pdc_type) {
  486. case PDC_TYPE_PAT:
  487. pat_memconfig();
  488. break;
  489. case PDC_TYPE_SYSTEM_MAP:
  490. sprockets_memconfig();
  491. break;
  492. case PDC_TYPE_SNAKE:
  493. pagezero_memconfig();
  494. return;
  495. default:
  496. panic("Unknown PDC type!\n");
  497. }
  498. if (npmem_ranges == 0 || pmem_ranges[0].start_pfn != 0) {
  499. printk(KERN_WARNING "Bad memory configuration returned!\n");
  500. printk(KERN_WARNING "Some memory may not be used!\n");
  501. pagezero_memconfig();
  502. }
  503. }
  504. void __init do_device_inventory(void)
  505. {
  506. printk(KERN_INFO "Searching for devices...\n");
  507. init_parisc_bus();
  508. switch (pdc_type) {
  509. case PDC_TYPE_PAT:
  510. pat_inventory();
  511. break;
  512. case PDC_TYPE_SYSTEM_MAP:
  513. system_map_inventory();
  514. break;
  515. case PDC_TYPE_SNAKE:
  516. snake_inventory();
  517. break;
  518. default:
  519. panic("Unknown PDC type!\n");
  520. }
  521. printk(KERN_INFO "Found devices:\n");
  522. print_parisc_devices();
  523. #if defined(CONFIG_64BIT) && defined(CONFIG_SMP)
  524. pa_serialize_tlb_flushes = machine_has_merced_bus();
  525. if (pa_serialize_tlb_flushes)
  526. pr_info("Merced bus found: Enable PxTLB serialization.\n");
  527. #endif
  528. #if defined(CONFIG_FW_CFG_SYSFS)
  529. if (running_on_qemu) {
  530. struct resource res[3] = {0,};
  531. unsigned int base;
  532. base = ((unsigned long long) PAGE0->pad0[2] << 32)
  533. | PAGE0->pad0[3]; /* SeaBIOS stored it here */
  534. res[0].name = "fw_cfg";
  535. res[0].start = base;
  536. res[0].end = base + 8 - 1;
  537. res[0].flags = IORESOURCE_MEM;
  538. res[1].name = "ctrl";
  539. res[1].start = 0;
  540. res[1].flags = IORESOURCE_REG;
  541. res[2].name = "data";
  542. res[2].start = 4;
  543. res[2].flags = IORESOURCE_REG;
  544. if (base) {
  545. pr_info("Found qemu fw_cfg interface at %#08x\n", base);
  546. platform_device_register_simple("fw_cfg",
  547. PLATFORM_DEVID_NONE, res, 3);
  548. }
  549. }
  550. #endif
  551. }