Changeset View
Changeset View
Standalone View
Standalone View
head/sys/arm64/arm64/machdep.c
Show First 20 Lines • Show All 114 Lines • ▼ Show 20 Lines | |||||
int64_t dczva_line_size; /* The size of cache line the dc zva zeroes */ | int64_t dczva_line_size; /* The size of cache line the dc zva zeroes */ | ||||
int has_pan; | int has_pan; | ||||
/* | /* | ||||
* Physical address of the EFI System Table. Stashed from the metadata hints | * Physical address of the EFI System Table. Stashed from the metadata hints | ||||
* passed into the kernel and used by the EFI code to call runtime services. | * passed into the kernel and used by the EFI code to call runtime services. | ||||
*/ | */ | ||||
vm_paddr_t efi_systbl_phys; | vm_paddr_t efi_systbl_phys; | ||||
static struct efi_map_header *efihdr; | |||||
/* pagezero_* implementations are provided in support.S */ | /* pagezero_* implementations are provided in support.S */ | ||||
void pagezero_simple(void *); | void pagezero_simple(void *); | ||||
void pagezero_cache(void *); | void pagezero_cache(void *); | ||||
/* pagezero_simple is default pagezero */ | /* pagezero_simple is default pagezero */ | ||||
void (*pagezero)(void *p) = pagezero_simple; | void (*pagezero)(void *p) = pagezero_simple; | ||||
▲ Show 20 Lines • Show All 935 Lines • ▼ Show 20 Lines | else { | ||||
dczva_line_shift = DCZID_BS_SIZE(dczid_el0); | dczva_line_shift = DCZID_BS_SIZE(dczid_el0); | ||||
dczva_line_size = sizeof(int) << dczva_line_shift; | dczva_line_size = sizeof(int) << dczva_line_shift; | ||||
/* Change pagezero function */ | /* Change pagezero function */ | ||||
pagezero = pagezero_cache; | pagezero = pagezero_cache; | ||||
} | } | ||||
} | } | ||||
int | |||||
memory_mapping_mode(vm_paddr_t pa) | |||||
{ | |||||
struct efi_md *map, *p; | |||||
size_t efisz; | |||||
int ndesc, i; | |||||
if (efihdr == NULL) | |||||
return (VM_MEMATTR_WRITE_BACK); | |||||
/* | |||||
* Memory map data provided by UEFI via the GetMemoryMap | |||||
* Boot Services API. | |||||
*/ | |||||
efisz = (sizeof(struct efi_map_header) + 0xf) & ~0xf; | |||||
map = (struct efi_md *)((uint8_t *)efihdr + efisz); | |||||
if (efihdr->descriptor_size == 0) | |||||
return (VM_MEMATTR_WRITE_BACK); | |||||
ndesc = efihdr->memory_size / efihdr->descriptor_size; | |||||
for (i = 0, p = map; i < ndesc; i++, | |||||
p = efi_next_descriptor(p, efihdr->descriptor_size)) { | |||||
if (pa < p->md_phys || | |||||
pa >= p->md_phys + p->md_pages * EFI_PAGE_SIZE) | |||||
continue; | |||||
if (p->md_type == EFI_MD_TYPE_IOMEM || | |||||
p->md_type == EFI_MD_TYPE_IOPORT) | |||||
return (VM_MEMATTR_DEVICE); | |||||
else if ((p->md_attr & EFI_MD_ATTR_WB) != 0 || | |||||
p->md_type == EFI_MD_TYPE_RECLAIM) | |||||
return (VM_MEMATTR_WRITE_BACK); | |||||
else if ((p->md_attr & EFI_MD_ATTR_WT) != 0) | |||||
return (VM_MEMATTR_WRITE_THROUGH); | |||||
else if ((p->md_attr & EFI_MD_ATTR_WC) != 0) | |||||
return (VM_MEMATTR_WRITE_COMBINING); | |||||
break; | |||||
} | |||||
return (VM_MEMATTR_DEVICE); | |||||
} | |||||
void | void | ||||
initarm(struct arm64_bootparams *abp) | initarm(struct arm64_bootparams *abp) | ||||
{ | { | ||||
struct efi_fb *efifb; | struct efi_fb *efifb; | ||||
struct efi_map_header *efihdr; | |||||
struct pcpu *pcpup; | struct pcpu *pcpup; | ||||
char *env; | char *env; | ||||
#ifdef FDT | #ifdef FDT | ||||
struct mem_region mem_regions[FDT_MEM_REGIONS]; | struct mem_region mem_regions[FDT_MEM_REGIONS]; | ||||
int mem_regions_sz; | int mem_regions_sz; | ||||
#endif | #endif | ||||
vm_offset_t lastaddr; | vm_offset_t lastaddr; | ||||
caddr_t kmdp; | caddr_t kmdp; | ||||
▲ Show 20 Lines • Show All 211 Lines • Show Last 20 Lines |