@@ -64,6 +64,44 @@ struct BostonState {
64
64
hwaddr fdt_base ;
65
65
};
66
66
67
+ enum {
68
+ BOSTON_LOWDDR ,
69
+ BOSTON_PCIE0 ,
70
+ BOSTON_PCIE1 ,
71
+ BOSTON_PCIE2 ,
72
+ BOSTON_PCIE2_MMIO ,
73
+ BOSTON_CM ,
74
+ BOSTON_GIC ,
75
+ BOSTON_CDMM ,
76
+ BOSTON_CPC ,
77
+ BOSTON_PLATREG ,
78
+ BOSTON_UART ,
79
+ BOSTON_LCD ,
80
+ BOSTON_FLASH ,
81
+ BOSTON_PCIE1_MMIO ,
82
+ BOSTON_PCIE0_MMIO ,
83
+ BOSTON_HIGHDDR ,
84
+ };
85
+
86
+ static const MemMapEntry boston_memmap [] = {
87
+ [BOSTON_LOWDDR ] = { 0x0 , 0x10000000 },
88
+ [BOSTON_PCIE0 ] = { 0x10000000 , 0x2000000 },
89
+ [BOSTON_PCIE1 ] = { 0x12000000 , 0x2000000 },
90
+ [BOSTON_PCIE2 ] = { 0x14000000 , 0x2000000 },
91
+ [BOSTON_PCIE2_MMIO ] = { 0x16000000 , 0x100000 },
92
+ [BOSTON_CM ] = { 0x16100000 , 0x20000 },
93
+ [BOSTON_GIC ] = { 0x16120000 , 0x20000 },
94
+ [BOSTON_CDMM ] = { 0x16140000 , 0x8000 },
95
+ [BOSTON_CPC ] = { 0x16200000 , 0x8000 },
96
+ [BOSTON_PLATREG ] = { 0x17ffd000 , 0x1000 },
97
+ [BOSTON_UART ] = { 0x17ffe000 , 0x20 },
98
+ [BOSTON_LCD ] = { 0x17fff000 , 0x8 },
99
+ [BOSTON_FLASH ] = { 0x18000000 , 0x8000000 },
100
+ [BOSTON_PCIE1_MMIO ] = { 0x20000000 , 0x20000000 },
101
+ [BOSTON_PCIE0_MMIO ] = { 0x40000000 , 0x40000000 },
102
+ [BOSTON_HIGHDDR ] = { 0x80000000 , 0x0 },
103
+ };
104
+
67
105
enum boston_plat_reg {
68
106
PLAT_FPGA_BUILD = 0x00 ,
69
107
PLAT_CORE_CL = 0x04 ,
@@ -275,24 +313,24 @@ type_init(boston_register_types)
275
313
276
314
static void gen_firmware (uint32_t * p , hwaddr kernel_entry , hwaddr fdt_addr )
277
315
{
278
- const uint32_t cm_base = 0x16100000 ;
279
- const uint32_t gic_base = 0x16120000 ;
280
- const uint32_t cpc_base = 0x16200000 ;
316
+ uint64_t regaddr ;
281
317
282
318
/* Move CM GCRs */
283
- bl_gen_write_ulong ( & p ,
284
- cpu_mips_phys_to_kseg1 ( NULL , GCR_BASE_ADDR + GCR_BASE_OFS ) ,
285
- cm_base );
319
+ regaddr = cpu_mips_phys_to_kseg1 ( NULL , GCR_BASE_ADDR + GCR_BASE_OFS ) ,
320
+ bl_gen_write_ulong ( & p , regaddr ,
321
+ boston_memmap [ BOSTON_CM ]. base );
286
322
287
323
/* Move & enable GIC GCRs */
288
- bl_gen_write_ulong (& p ,
289
- cpu_mips_phys_to_kseg1 (NULL , cm_base + GCR_GIC_BASE_OFS ),
290
- gic_base | GCR_GIC_BASE_GICEN_MSK );
324
+ regaddr = cpu_mips_phys_to_kseg1 (NULL , boston_memmap [BOSTON_CM ].base
325
+ + GCR_GIC_BASE_OFS ),
326
+ bl_gen_write_ulong (& p , regaddr ,
327
+ boston_memmap [BOSTON_GIC ].base | GCR_GIC_BASE_GICEN_MSK );
291
328
292
329
/* Move & enable CPC GCRs */
293
- bl_gen_write_ulong (& p ,
294
- cpu_mips_phys_to_kseg1 (NULL , cm_base + GCR_CPC_BASE_OFS ),
295
- cpc_base | GCR_CPC_BASE_CPCEN_MSK );
330
+ regaddr = cpu_mips_phys_to_kseg1 (NULL , boston_memmap [BOSTON_CM ].base
331
+ + GCR_CPC_BASE_OFS ),
332
+ bl_gen_write_ulong (& p , regaddr ,
333
+ boston_memmap [BOSTON_CPC ].base | GCR_CPC_BASE_CPCEN_MSK );
296
334
297
335
/*
298
336
* Setup argument registers to follow the UHI boot protocol:
@@ -333,8 +371,9 @@ static const void *boston_fdt_filter(void *opaque, const void *fdt_orig,
333
371
ram_low_sz = MIN (256 * MiB , machine -> ram_size );
334
372
ram_high_sz = machine -> ram_size - ram_low_sz ;
335
373
qemu_fdt_setprop_sized_cells (fdt , "/memory@0" , "reg" ,
336
- 1 , 0x00000000 , 1 , ram_low_sz ,
337
- 1 , 0x90000000 , 1 , ram_high_sz );
374
+ 1 , boston_memmap [BOSTON_LOWDDR ].base , 1 , ram_low_sz ,
375
+ 1 , boston_memmap [BOSTON_HIGHDDR ].base + ram_low_sz ,
376
+ 1 , ram_high_sz );
338
377
339
378
fdt = g_realloc (fdt , fdt_totalsize (fdt ));
340
379
qemu_fdt_dumpdtb (fdt , fdt_sz );
@@ -438,11 +477,15 @@ static void boston_mach_init(MachineState *machine)
438
477
sysbus_mmio_map_overlap (SYS_BUS_DEVICE (& s -> cps ), 0 , 0 , 1 );
439
478
440
479
flash = g_new (MemoryRegion , 1 );
441
- memory_region_init_rom (flash , NULL , "boston.flash" , 128 * MiB ,
442
- & error_fatal );
443
- memory_region_add_subregion_overlap (sys_mem , 0x18000000 , flash , 0 );
480
+ memory_region_init_rom (flash , NULL , "boston.flash" ,
481
+ boston_memmap [BOSTON_FLASH ].size , & error_fatal );
482
+ memory_region_add_subregion_overlap (sys_mem ,
483
+ boston_memmap [BOSTON_FLASH ].base ,
484
+ flash , 0 );
444
485
445
- memory_region_add_subregion_overlap (sys_mem , 0x80000000 , machine -> ram , 0 );
486
+ memory_region_add_subregion_overlap (sys_mem ,
487
+ boston_memmap [BOSTON_HIGHDDR ].base ,
488
+ machine -> ram , 0 );
446
489
447
490
ddr_low_alias = g_new (MemoryRegion , 1 );
448
491
memory_region_init_alias (ddr_low_alias , NULL , "boston_low.ddr" ,
@@ -451,32 +494,41 @@ static void boston_mach_init(MachineState *machine)
451
494
memory_region_add_subregion_overlap (sys_mem , 0 , ddr_low_alias , 0 );
452
495
453
496
xilinx_pcie_init (sys_mem , 0 ,
454
- 0x10000000 , 32 * MiB ,
455
- 0x40000000 , 1 * GiB ,
497
+ boston_memmap [BOSTON_PCIE0 ].base ,
498
+ boston_memmap [BOSTON_PCIE0 ].size ,
499
+ boston_memmap [BOSTON_PCIE0_MMIO ].base ,
500
+ boston_memmap [BOSTON_PCIE0_MMIO ].size ,
456
501
get_cps_irq (& s -> cps , 2 ), false);
457
502
458
503
xilinx_pcie_init (sys_mem , 1 ,
459
- 0x12000000 , 32 * MiB ,
460
- 0x20000000 , 512 * MiB ,
504
+ boston_memmap [BOSTON_PCIE1 ].base ,
505
+ boston_memmap [BOSTON_PCIE1 ].size ,
506
+ boston_memmap [BOSTON_PCIE1_MMIO ].base ,
507
+ boston_memmap [BOSTON_PCIE1_MMIO ].size ,
461
508
get_cps_irq (& s -> cps , 1 ), false);
462
509
463
510
pcie2 = xilinx_pcie_init (sys_mem , 2 ,
464
- 0x14000000 , 32 * MiB ,
465
- 0x16000000 , 1 * MiB ,
511
+ boston_memmap [BOSTON_PCIE2 ].base ,
512
+ boston_memmap [BOSTON_PCIE2 ].size ,
513
+ boston_memmap [BOSTON_PCIE2_MMIO ].base ,
514
+ boston_memmap [BOSTON_PCIE2_MMIO ].size ,
466
515
get_cps_irq (& s -> cps , 0 ), true);
467
516
468
517
platreg = g_new (MemoryRegion , 1 );
469
518
memory_region_init_io (platreg , NULL , & boston_platreg_ops , s ,
470
- "boston-platregs" , 0x1000 );
471
- memory_region_add_subregion_overlap (sys_mem , 0x17ffd000 , platreg , 0 );
519
+ "boston-platregs" ,
520
+ boston_memmap [BOSTON_PLATREG ].size );
521
+ memory_region_add_subregion_overlap (sys_mem ,
522
+ boston_memmap [BOSTON_PLATREG ].base , platreg , 0 );
472
523
473
- s -> uart = serial_mm_init (sys_mem , 0x17ffe000 , 2 ,
524
+ s -> uart = serial_mm_init (sys_mem , boston_memmap [ BOSTON_UART ]. base , 2 ,
474
525
get_cps_irq (& s -> cps , 3 ), 10000000 ,
475
526
serial_hd (0 ), DEVICE_NATIVE_ENDIAN );
476
527
477
528
lcd = g_new (MemoryRegion , 1 );
478
529
memory_region_init_io (lcd , NULL , & boston_lcd_ops , s , "boston-lcd" , 0x8 );
479
- memory_region_add_subregion_overlap (sys_mem , 0x17fff000 , lcd , 0 );
530
+ memory_region_add_subregion_overlap (sys_mem ,
531
+ boston_memmap [BOSTON_LCD ].base , lcd , 0 );
480
532
481
533
chr = qemu_chr_new ("lcd" , "vc:320x240" , NULL );
482
534
qemu_chr_fe_init (& s -> lcd_display , chr , NULL );
0 commit comments