Page MenuHomeFreeBSD

D7605.1777082937.diff
No OneTemporary

Size
2 KB
Referenced Files
None
Subscribers
None

D7605.1777082937.diff

Index: head/sys/powerpc/booke/booke_machdep.c
===================================================================
--- head/sys/powerpc/booke/booke_machdep.c
+++ head/sys/powerpc/booke/booke_machdep.c
@@ -249,6 +249,7 @@
booke_check_for_fdt(uint32_t arg1, vm_offset_t *dtbp)
{
void *ptr;
+ int fdt_size;
if (arg1 % 8 != 0)
return (-1);
@@ -257,6 +258,19 @@
if (fdt_check_header(ptr) != 0)
return (-1);
+ /*
+ * Read FDT total size from the header of FDT.
+ * This for sure hits within first page which is
+ * already mapped.
+ */
+ fdt_size = fdt_totalsize((void *)ptr);
+
+ /*
+ * Ok, arg1 points to FDT, so we need to map it in.
+ * First, unmap this page and then map FDT again with full size
+ */
+ pmap_early_io_unmap((vm_offset_t)ptr, PAGE_SIZE);
+ ptr = (void *)pmap_early_io_map(arg1, fdt_size);
*dtbp = (vm_offset_t)ptr;
return (0);
Index: head/sys/powerpc/booke/pmap.c
===================================================================
--- head/sys/powerpc/booke/pmap.c
+++ head/sys/powerpc/booke/pmap.c
@@ -3419,6 +3419,29 @@
set_mas4_defaults();
}
+void
+pmap_early_io_unmap(vm_offset_t va, vm_size_t size)
+{
+ int i;
+ tlb_entry_t e;
+
+ for (i = 0; i < TLB1_ENTRIES && size > 0; i ++) {
+ tlb1_read_entry(&e, i);
+ if (!(e.mas1 & MAS1_VALID))
+ continue;
+ /*
+ * FIXME: this code does not work if VA region
+ * spans multiple TLB entries. This does not cause
+ * problems right now but shall be fixed in the future
+ */
+ if (va >= e.virt && (va + size) <= (e.virt + e.size)) {
+ size -= e.size;
+ e.mas1 &= ~MAS1_VALID;
+ tlb1_write_entry(&e, i);
+ }
+ }
+}
+
vm_offset_t
pmap_early_io_map(vm_paddr_t pa, vm_size_t size)
{
Index: head/sys/powerpc/include/pmap.h
===================================================================
--- head/sys/powerpc/include/pmap.h
+++ head/sys/powerpc/include/pmap.h
@@ -260,6 +260,7 @@
extern int pmap_bootstrapped;
vm_offset_t pmap_early_io_map(vm_paddr_t pa, vm_size_t size);
+void pmap_early_io_unmap(vm_offset_t va, vm_size_t size);
#endif

File Metadata

Mime Type
text/plain
Expires
Sat, Apr 25, 2:08 AM (19 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28425502
Default Alt Text
D7605.1777082937.diff (2 KB)

Event Timeline