21 #include <linux/types.h>
22 #include <linux/kernel.h>
24 #include <linux/slab.h>
28 #include <asm/mmzone.h>
31 #include <asm/processor.h>
89 bus_id = (model.
hversion >> (4 + 7)) & 0x1f;
106 panic(
"If this is a 64-bit machine, please try a 64-bit kernel.\n");
110 #define PDC_PAGE_ADJ_SHIFT (PAGE_SHIFT - 12)
114 unsigned long pages4k)
126 panic(
"Memory range doesn't align with page size!\n");
133 static void __init pagezero_memconfig(
void)
135 unsigned long npages;
171 pat_query_module(
ulong pcell_loc,
ulong mod_index)
181 panic(
"couldn't allocate memory for PDC_PAT_CELL!");
192 temp = pa_pdc_cell->
cba;
205 dev->pcell_loc = pcell_loc;
206 dev->mod_index = mod_index;
210 dev->mod_info = pa_pdc_cell->
mod_info;
223 pa_pdc_cell->
mod[0]);
228 "PAT_ENTITY_MEM: amount 0x%lx min_gni_base 0x%lx min_gni_len 0x%lx\n",
229 pa_pdc_cell->
mod[0], pa_pdc_cell->
mod[1],
230 pa_pdc_cell->
mod[2]);
251 for (i = 0; i < pa_pdc_cell->
mod[1]; i++) {
253 " PA_VIEW %ld: 0x%016lx 0x%016lx 0x%016lx\n",
254 i, pa_pdc_cell->
mod[2 + i * 3],
255 pa_pdc_cell->
mod[3 + i * 3],
256 pa_pdc_cell->
mod[4 + i * 3]);
258 " IO_VIEW %ld: 0x%016lx 0x%016lx 0x%016lx\n",
259 i, io_pdc_cell->
mod[2 + i * 3],
260 io_pdc_cell->
mod[3 + i * 3],
261 io_pdc_cell->
mod[4 + i * 3]);
281 #define PAT_MAX_RANGES (4 * MAX_PHYSMEM_RANGES)
285 unsigned long actual_len;
307 "All memory may not be used!\n\n\n");
308 pagezero_memconfig();
314 if (entries > PAT_MAX_RANGES) {
325 mtbl_ptr = mem_table;
327 for (i = 0; i <
entries; i++,mtbl_ptr++) {
330 || (mtbl_ptr->
pages == 0)
344 set_pmem_entry(pmem_ptr++,mtbl_ptr->
paddr,mtbl_ptr->
pages);
369 while (
PDC_OK == pat_query_module(cell_info.cell_loc, mod_index)) {
379 struct pdc_memory_table_raddr
r_addr;
381 struct pdc_memory_table *mtbl_ptr;
387 status = pdc_mem_mem_table(&
r_addr,mem_table,
398 pagezero_memconfig();
410 mtbl_ptr = mem_table;
413 set_pmem_entry(pmem_ptr++,mtbl_ptr->paddr,mtbl_ptr->
pages);
420 #define pat_inventory() do { } while (0)
421 #define pat_memconfig() do { } while (0)
422 #define sprockets_memconfig() pagezero_memconfig()
457 static void __init snake_inventory(
void)
460 for (mod = 0; mod < 16; mod++) {
466 memset(module_path.path.bc, 0xff, 6);
467 module_path.path.mod =
mod;
468 dev = legacy_create_device(&
r_addr, &module_path);
469 if ((!dev) || (dev->
id.hw_type !=
HPHW_BA))
472 memset(module_path.path.bc, 0xff, 4);
473 module_path.path.bc[4] =
mod;
475 for (func = 0; func < 16; func++) {
476 module_path.path.bc[5] = 0;
477 module_path.path.mod =
func;
478 legacy_create_device(&
r_addr, &module_path);
484 #define snake_inventory() do { } while (0)
499 add_system_map_addresses(
struct parisc_device *dev,
int num_addrs,
513 for(i = 1; i <= num_addrs; ++
i) {
521 "Bad PDC_FIND_ADDRESS status return (%ld) for index %d\n",
533 static void __init system_map_inventory(
void)
538 for (i = 0; i < 256; i++) {
550 dev =
alloc_pa_dev(module_result.mod_addr, &module_path.path);
557 if (!module_result.add_addrs)
560 add_system_map_addresses(dev, module_result.add_addrs, i);
580 pagezero_memconfig();
584 panic(
"Unknown PDC type!\n");
590 pagezero_memconfig();
607 system_map_inventory();
615 panic(
"Unknown PDC type!\n");