machdep.c (49439183ce09e28e9f80dafcc0ff5f2bde79c476) machdep.c (23e42a83c15ff793f09906ddfa40574155fbcc5d)
1/*-
2 * Copyright (c) 2014 Andrew Turner
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 106 unchanged lines hidden (view full) ---

115int64_t dczva_line_size; /* The size of cache line the dc zva zeroes */
116int has_pan;
117
118/*
119 * Physical address of the EFI System Table. Stashed from the metadata hints
120 * passed into the kernel and used by the EFI code to call runtime services.
121 */
122vm_paddr_t efi_systbl_phys;
1/*-
2 * Copyright (c) 2014 Andrew Turner
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 106 unchanged lines hidden (view full) ---

115int64_t dczva_line_size; /* The size of cache line the dc zva zeroes */
116int has_pan;
117
118/*
119 * Physical address of the EFI System Table. Stashed from the metadata hints
120 * passed into the kernel and used by the EFI code to call runtime services.
121 */
122vm_paddr_t efi_systbl_phys;
123static struct efi_map_header *efihdr;
123
124/* pagezero_* implementations are provided in support.S */
125void pagezero_simple(void *);
126void pagezero_cache(void *);
127
128/* pagezero_simple is default pagezero */
129void (*pagezero)(void *p) = pagezero_simple;
130

--- 935 unchanged lines hidden (view full) ---

1066 dczva_line_shift = DCZID_BS_SIZE(dczid_el0);
1067 dczva_line_size = sizeof(int) << dczva_line_shift;
1068
1069 /* Change pagezero function */
1070 pagezero = pagezero_cache;
1071 }
1072}
1073
124
125/* pagezero_* implementations are provided in support.S */
126void pagezero_simple(void *);
127void pagezero_cache(void *);
128
129/* pagezero_simple is default pagezero */
130void (*pagezero)(void *p) = pagezero_simple;
131

--- 935 unchanged lines hidden (view full) ---

1067 dczva_line_shift = DCZID_BS_SIZE(dczid_el0);
1068 dczva_line_size = sizeof(int) << dczva_line_shift;
1069
1070 /* Change pagezero function */
1071 pagezero = pagezero_cache;
1072 }
1073}
1074
1075int
1076memory_mapping_mode(vm_paddr_t pa)
1077{
1078 struct efi_md *map, *p;
1079 size_t efisz;
1080 int ndesc, i;
1081
1082 if (efihdr == NULL)
1083 return (VM_MEMATTR_WRITE_BACK);
1084
1085 /*
1086 * Memory map data provided by UEFI via the GetMemoryMap
1087 * Boot Services API.
1088 */
1089 efisz = (sizeof(struct efi_map_header) + 0xf) & ~0xf;
1090 map = (struct efi_md *)((uint8_t *)efihdr + efisz);
1091
1092 if (efihdr->descriptor_size == 0)
1093 return (VM_MEMATTR_WRITE_BACK);
1094 ndesc = efihdr->memory_size / efihdr->descriptor_size;
1095
1096 for (i = 0, p = map; i < ndesc; i++,
1097 p = efi_next_descriptor(p, efihdr->descriptor_size)) {
1098 if (pa < p->md_phys ||
1099 pa >= p->md_phys + p->md_pages * EFI_PAGE_SIZE)
1100 continue;
1101 if (p->md_type == EFI_MD_TYPE_IOMEM ||
1102 p->md_type == EFI_MD_TYPE_IOPORT)
1103 return (VM_MEMATTR_DEVICE);
1104 else if ((p->md_attr & EFI_MD_ATTR_WB) != 0 ||
1105 p->md_type == EFI_MD_TYPE_RECLAIM)
1106 return (VM_MEMATTR_WRITE_BACK);
1107 else if ((p->md_attr & EFI_MD_ATTR_WT) != 0)
1108 return (VM_MEMATTR_WRITE_THROUGH);
1109 else if ((p->md_attr & EFI_MD_ATTR_WC) != 0)
1110 return (VM_MEMATTR_WRITE_COMBINING);
1111 break;
1112 }
1113
1114 return (VM_MEMATTR_DEVICE);
1115}
1116
1074void
1075initarm(struct arm64_bootparams *abp)
1076{
1077 struct efi_fb *efifb;
1117void
1118initarm(struct arm64_bootparams *abp)
1119{
1120 struct efi_fb *efifb;
1078 struct efi_map_header *efihdr;
1079 struct pcpu *pcpup;
1080 char *env;
1081#ifdef FDT
1082 struct mem_region mem_regions[FDT_MEM_REGIONS];
1083 int mem_regions_sz;
1084#endif
1085 vm_offset_t lastaddr;
1086 caddr_t kmdp;

--- 211 unchanged lines hidden ---
1121 struct pcpu *pcpup;
1122 char *env;
1123#ifdef FDT
1124 struct mem_region mem_regions[FDT_MEM_REGIONS];
1125 int mem_regions_sz;
1126#endif
1127 vm_offset_t lastaddr;
1128 caddr_t kmdp;

--- 211 unchanged lines hidden ---