Changeset a1b9f63 in mainline
- Timestamp:
- 2018-08-31T10:32:40Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 6bf5b8c
- Parents:
- b1834a01
- git-author:
- Jakub Jermar <jakub@…> (2018-08-31 09:54:11)
- git-committer:
- Jakub Jermar <jakub@…> (2018-08-31 10:32:40)
- Location:
- kernel
- Files:
-
- 29 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/amd64/src/vreg.c
rb1834a01 ra1b9f63 66 66 panic("Cannot allocate VREG frame."); 67 67 68 page = (uint64_t *) km_map(frame, PAGE_SIZE, 68 page = (uint64_t *) km_map(frame, PAGE_SIZE, PAGE_SIZE, 69 69 PAGE_READ | PAGE_WRITE | PAGE_USER | PAGE_CACHEABLE); 70 70 -
kernel/arch/arm32/src/mach/beagleboardxm/beagleboardxm.c
rb1834a01 ra1b9f63 102 102 beagleboard.irc_addr = 103 103 (void *) km_map(AMDM37x_IRC_BASE_ADDRESS, AMDM37x_IRC_SIZE, 104 PAGE_NOT_CACHEABLE);104 KM_NATURAL_ALIGNMENT, PAGE_NOT_CACHEABLE); 105 105 assert(beagleboard.irc_addr); 106 106 omap_irc_init(beagleboard.irc_addr); -
kernel/arch/arm32/src/mach/beaglebone/beaglebone.c
rb1834a01 ra1b9f63 88 88 { 89 89 bbone.irc_addr = (void *) km_map(AM335x_IRC_BASE_ADDRESS, 90 AM335x_IRC_SIZE, PAGE_NOT_CACHEABLE);90 AM335x_IRC_SIZE, KM_NATURAL_ALIGNMENT, PAGE_NOT_CACHEABLE); 91 91 92 92 bbone.cm_per_addr = (void *) km_map(AM335x_CM_PER_BASE_ADDRESS, 93 AM335x_CM_PER_SIZE, PAGE_NOT_CACHEABLE);93 AM335x_CM_PER_SIZE, KM_NATURAL_ALIGNMENT, PAGE_NOT_CACHEABLE); 94 94 95 95 bbone.cm_dpll_addr = (void *) km_map(AM335x_CM_DPLL_BASE_ADDRESS, 96 AM335x_CM_DPLL_SIZE, PAGE_NOT_CACHEABLE);96 AM335x_CM_DPLL_SIZE, KM_NATURAL_ALIGNMENT, PAGE_NOT_CACHEABLE); 97 97 98 98 bbone.ctrl_module = (void *) km_map(AM335x_CTRL_MODULE_BASE_ADDRESS, 99 AM335x_CTRL_MODULE_SIZE, PAGE_NOT_CACHEABLE); 99 AM335x_CTRL_MODULE_SIZE, KM_NATURAL_ALIGNMENT, 100 PAGE_NOT_CACHEABLE); 100 101 101 102 assert(bbone.irc_addr != NULL); -
kernel/arch/arm32/src/mach/gta02/gta02.c
rb1834a01 ra1b9f63 103 103 104 104 gta02_timer = (void *) km_map(S3C24XX_TIMER_ADDRESS, PAGE_SIZE, 105 PAGE_ NOT_CACHEABLE);106 irqc_regs = (void *) km_map(S3C24XX_IRQC_ADDRESS, PAGE_SIZE, 105 PAGE_SIZE, PAGE_NOT_CACHEABLE); 106 irqc_regs = (void *) km_map(S3C24XX_IRQC_ADDRESS, PAGE_SIZE, PAGE_SIZE, 107 107 PAGE_NOT_CACHEABLE); 108 108 -
kernel/arch/arm32/src/mach/integratorcp/integratorcp.c
rb1834a01 ra1b9f63 135 135 void icp_init(void) 136 136 { 137 icp.hw_map.uart = km_map(ICP_UART, PAGE_SIZE, 138 PAGE_WRITE | PAGE_NOT_CACHEABLE); 139 icp.hw_map.kbd_ctrl = km_map(ICP_KBD, PAGE_SIZE, PAGE_NOT_CACHEABLE); 137 icp.hw_map.uart = km_map(ICP_UART, PAGE_SIZE, PAGE_SIZE, 138 PAGE_WRITE | PAGE_NOT_CACHEABLE); 139 icp.hw_map.kbd_ctrl = km_map(ICP_KBD, PAGE_SIZE, PAGE_SIZE, 140 PAGE_NOT_CACHEABLE); 140 141 icp.hw_map.kbd_stat = icp.hw_map.kbd_ctrl + ICP_KBD_STAT; 141 142 icp.hw_map.kbd_data = icp.hw_map.kbd_ctrl + ICP_KBD_DATA; 142 143 icp.hw_map.kbd_intstat = icp.hw_map.kbd_ctrl + ICP_KBD_INTR_STAT; 143 icp.hw_map.rtc = km_map(ICP_RTC, PAGE_SIZE, 144 icp.hw_map.rtc = km_map(ICP_RTC, PAGE_SIZE, PAGE_SIZE, 144 145 PAGE_WRITE | PAGE_NOT_CACHEABLE); 145 146 icp.hw_map.rtc1_load = icp.hw_map.rtc + ICP_RTC1_LOAD_OFFSET; … … 150 151 icp.hw_map.rtc1_intrstat = icp.hw_map.rtc + ICP_RTC1_INTRSTAT_OFFSET; 151 152 152 icp.hw_map.irqc = km_map(ICP_IRQC, PAGE_SIZE, 153 icp.hw_map.irqc = km_map(ICP_IRQC, PAGE_SIZE, PAGE_SIZE, 153 154 PAGE_WRITE | PAGE_NOT_CACHEABLE); 154 155 icp.hw_map.irqc_mask = icp.hw_map.irqc + ICP_IRQC_MASK_OFFSET; 155 156 icp.hw_map.irqc_unmask = icp.hw_map.irqc + ICP_IRQC_UNMASK_OFFSET; 156 icp.hw_map.cmcr = km_map(ICP_CMCR, PAGE_SIZE, 157 icp.hw_map.cmcr = km_map(ICP_CMCR, PAGE_SIZE, PAGE_SIZE, 157 158 PAGE_WRITE | PAGE_NOT_CACHEABLE); 158 159 icp.hw_map.sdramcr = icp.hw_map.cmcr + ICP_SDRAMCR_OFFSET; 159 icp.hw_map.vga = km_map(ICP_VGA, PAGE_SIZE, 160 icp.hw_map.vga = km_map(ICP_VGA, PAGE_SIZE, PAGE_SIZE, 160 161 PAGE_WRITE | PAGE_NOT_CACHEABLE); 161 162 -
kernel/arch/arm32/src/mach/raspberrypi/raspberrypi.c
rb1834a01 ra1b9f63 103 103 /* Initialize interrupt controller */ 104 104 raspi.irc = (void *) km_map(BCM2835_IRC_ADDR, sizeof(bcm2835_irc_t), 105 PAGE_NOT_CACHEABLE);105 KM_NATURAL_ALIGNMENT, PAGE_NOT_CACHEABLE); 106 106 assert(raspi.irc); 107 107 bcm2835_irc_init(raspi.irc); … … 109 109 /* Initialize system timer */ 110 110 raspi.timer = (void *) km_map(BCM2835_TIMER_ADDR, 111 sizeof(bcm2835_timer_t), 112 PAGE_NOT_CACHEABLE); 111 sizeof(bcm2835_timer_t), KM_NATURAL_ALIGNMENT, PAGE_NOT_CACHEABLE); 113 112 } 114 113 -
kernel/arch/arm32/src/ras.c
rb1834a01 ra1b9f63 56 56 frame = frame_alloc(1, FRAME_LOWMEM, 0); 57 57 58 ras_page = (uintptr_t *) km_map(frame, 59 PAGE_ SIZE, PAGE_READ | PAGE_WRITE | PAGE_USER | PAGE_CACHEABLE);58 ras_page = (uintptr_t *) km_map(frame, PAGE_SIZE, PAGE_SIZE, 59 PAGE_READ | PAGE_WRITE | PAGE_USER | PAGE_CACHEABLE); 60 60 61 61 memsetb(ras_page, PAGE_SIZE, 0); -
kernel/arch/ia32/src/smp/smp.c
rb1834a01 ra1b9f63 76 76 if (config.cpu_count > 1) { 77 77 l_apic = (uint32_t *) km_map((uintptr_t) l_apic, PAGE_SIZE, 78 PAGE_ WRITE | PAGE_NOT_CACHEABLE);78 PAGE_SIZE, PAGE_WRITE | PAGE_NOT_CACHEABLE); 79 79 io_apic = (uint32_t *) km_map((uintptr_t) io_apic, PAGE_SIZE, 80 PAGE_ WRITE | PAGE_NOT_CACHEABLE);80 PAGE_SIZE, PAGE_WRITE | PAGE_NOT_CACHEABLE); 81 81 } 82 82 } -
kernel/arch/ia32/src/vreg.c
rb1834a01 ra1b9f63 67 67 panic("Cannot allocate VREG frame."); 68 68 69 page = (uint32_t *) km_map(frame, PAGE_SIZE, 69 page = (uint32_t *) km_map(frame, PAGE_SIZE, PAGE_SIZE, 70 70 PAGE_READ | PAGE_WRITE | PAGE_USER | PAGE_CACHEABLE); 71 71 -
kernel/arch/ia64/src/ia64.c
rb1834a01 ra1b9f63 106 106 static void iosapic_init(void) 107 107 { 108 uintptr_t IOSAPIC = km_map(iosapic_base, PAGE_SIZE, 108 uintptr_t IOSAPIC = km_map(iosapic_base, PAGE_SIZE, PAGE_SIZE, 109 109 PAGE_WRITE | PAGE_NOT_CACHEABLE); 110 110 int i; … … 136 136 /* Map the page with legacy I/O. */ 137 137 legacyio_virt_base = km_map(LEGACYIO_PHYS_BASE, LEGACYIO_SIZE, 138 PAGE_WRITE | PAGE_NOT_CACHEABLE);138 KM_NATURAL_ALIGNMENT, PAGE_WRITE | PAGE_NOT_CACHEABLE); 139 139 140 140 iosapic_init(); -
kernel/arch/ppc32/src/drivers/pic.c
rb1834a01 ra1b9f63 42 42 void pic_init(uintptr_t base, size_t size, cir_t *cir, void **cir_arg) 43 43 { 44 pic = (uint32_t *) km_map(base, size, PAGE_WRITE | PAGE_NOT_CACHEABLE); 44 pic = (uint32_t *) km_map(base, size, KM_NATURAL_ALIGNMENT, 45 PAGE_WRITE | PAGE_NOT_CACHEABLE); 45 46 *cir = pic_ack_interrupt; 46 47 *cir_arg = NULL; -
kernel/arch/ppc32/src/ppc32.c
rb1834a01 ra1b9f63 242 242 243 243 cuda_t *cuda = (cuda_t *) (km_map(aligned_addr, offset + size, 244 KM_NATURAL_ALIGNMENT, 244 245 PAGE_WRITE | PAGE_NOT_CACHEABLE) + offset); 245 246 -
kernel/arch/sparc64/src/drivers/kbd.c
rb1834a01 ra1b9f63 119 119 120 120 ioport8_t *ns16550 = (ioport8_t *) (km_map(aligned_addr, offset + size, 121 PAGE_WRITE | PAGE_NOT_CACHEABLE) + offset);121 KM_NATURAL_ALIGNMENT, PAGE_WRITE | PAGE_NOT_CACHEABLE) + offset); 122 122 123 123 ns16550_instance_t *ns16550_instance = ns16550_init(ns16550, 0, inr, cir, -
kernel/arch/sparc64/src/drivers/pci.c
rb1834a01 ra1b9f63 110 110 pci->op = &pci_sabre_ops; 111 111 pci->reg = (uint64_t *) km_map(paddr, reg[SABRE_INTERNAL_REG].size, 112 PAGE_WRITE | PAGE_NOT_CACHEABLE);112 KM_NATURAL_ALIGNMENT, PAGE_WRITE | PAGE_NOT_CACHEABLE); 113 113 114 114 return pci; … … 152 152 pci->op = &pci_psycho_ops; 153 153 pci->reg = (uint64_t *) km_map(paddr, reg[PSYCHO_INTERNAL_REG].size, 154 PAGE_WRITE | PAGE_NOT_CACHEABLE);154 KM_NATURAL_ALIGNMENT, PAGE_WRITE | PAGE_NOT_CACHEABLE); 155 155 156 156 return pci; -
kernel/genarch/include/genarch/drivers/amdm37x/gpt.h
rb1834a01 ra1b9f63 208 208 // TODO find a nicer way to setup 32kHz clock source for timer1 209 209 // reg 0x48004C40 is CM_CLKSEL_WKUP see page 485 of the manual 210 ioport32_t *clksel = (void *) km_map(0x48004C40, 4, PAGE_NOT_CACHEABLE); 210 ioport32_t *clksel = (void *) km_map(0x48004C40, 4, PAGE_SIZE, 211 PAGE_NOT_CACHEABLE); 211 212 *clksel &= ~1; 212 213 km_unmap((uintptr_t)clksel, 4); … … 214 215 assert(timer); 215 216 /* Map control register */ 216 timer->regs = (void *) km_map(ioregs, iosize, PAGE_NOT_CACHEABLE); 217 timer->regs = (void *) km_map(ioregs, iosize, KM_NATURAL_ALIGNMENT, 218 PAGE_NOT_CACHEABLE); 217 219 218 220 /* Reset the timer */ -
kernel/genarch/src/acpi/acpi.c
rb1834a01 ra1b9f63 105 105 /* Start with mapping the header only. */ 106 106 vhdr = (struct acpi_sdt_header *) km_map((uintptr_t) psdt, 107 sizeof(struct acpi_sdt_header), PAGE_READ | PAGE_NOT_CACHEABLE); 107 sizeof(struct acpi_sdt_header), KM_NATURAL_ALIGNMENT, 108 PAGE_READ | PAGE_NOT_CACHEABLE); 108 109 109 110 /* Now we can map the entire structure. */ 110 111 vsdt = (struct acpi_sdt_header *) km_map((uintptr_t) psdt, 111 vhdr->length, PAGE_WRITE | PAGE_NOT_CACHEABLE); 112 vhdr->length, KM_NATURAL_ALIGNMENT, 113 PAGE_WRITE | PAGE_NOT_CACHEABLE); 112 114 113 115 // TODO: do not leak vtmp -
kernel/genarch/src/drivers/am335x/timer.c
rb1834a01 ra1b9f63 101 101 size = regs_map[id].size; 102 102 103 timer->regs = (void *) km_map(base_addr, size, PAGE_NOT_CACHEABLE); 103 timer->regs = (void *) km_map(base_addr, size, KM_NATURAL_ALIGNMENT, 104 PAGE_NOT_CACHEABLE); 104 105 assert(timer->regs != NULL); 105 106 -
kernel/genarch/src/drivers/bcm2835/mbox.c
rb1834a01 ra1b9f63 93 93 94 94 fb_mbox = (void *) km_map(BCM2835_MBOX0_ADDR, sizeof(bcm2835_mbox_t), 95 PAGE_NOT_CACHEABLE);95 KM_NATURAL_ALIGNMENT, PAGE_NOT_CACHEABLE); 96 96 97 97 fb_desc->width = 640; -
kernel/genarch/src/drivers/ega/ega.c
rb1834a01 ra1b9f63 601 601 instance->base = base; 602 602 instance->addr = (uint8_t *) km_map(addr, EGA_VRAM_SIZE, 603 PAGE_WRITE | PAGE_NOT_CACHEABLE);603 KM_NATURAL_ALIGNMENT, PAGE_WRITE | PAGE_NOT_CACHEABLE); 604 604 if (!instance->addr) { 605 605 LOG("Unable to EGA video memory."); -
kernel/genarch/src/drivers/omap/uart.c
rb1834a01 ra1b9f63 88 88 { 89 89 assert(uart); 90 uart->regs = (void *)km_map(addr, size, PAGE_NOT_CACHEABLE); 90 uart->regs = (void *)km_map(addr, size, KM_NATURAL_ALIGNMENT, 91 PAGE_NOT_CACHEABLE); 91 92 92 93 assert(uart->regs); -
kernel/genarch/src/drivers/pl011/pl011.c
rb1834a01 ra1b9f63 100 100 assert(uart); 101 101 uart->regs = (void *)km_map(addr, sizeof(pl011_uart_regs_t), 102 PAGE_NOT_CACHEABLE);102 KM_NATURAL_ALIGNMENT, PAGE_NOT_CACHEABLE); 103 103 assert(uart->regs); 104 104 -
kernel/genarch/src/drivers/s3c24xx/uart.c
rb1834a01 ra1b9f63 116 116 uart_dev->data = uart; 117 117 118 uart->io = (s3c24xx_uart_io_t *) km_map(paddr, PAGE_SIZE, 118 uart->io = (s3c24xx_uart_io_t *) km_map(paddr, PAGE_SIZE, PAGE_SIZE, 119 119 PAGE_WRITE | PAGE_NOT_CACHEABLE); 120 120 uart->indev = NULL; -
kernel/genarch/src/fb/fb.c
rb1834a01 ra1b9f63 610 610 611 611 instance->addr = (uint8_t *) km_map((uintptr_t) props->addr, fbsize, 612 PAGE_WRITE | PAGE_NOT_CACHEABLE);612 KM_NATURAL_ALIGNMENT, PAGE_WRITE | PAGE_NOT_CACHEABLE); 613 613 if (!instance->addr) { 614 614 LOG("Unable to map framebuffer."); -
kernel/generic/include/mm/km.h
rb1834a01 ra1b9f63 39 39 #include <mm/frame.h> 40 40 41 #define KM_NATURAL_ALIGNMENT -1U 42 41 43 extern void km_identity_init(void); 42 44 extern void km_non_identity_init(void); … … 49 51 extern bool km_is_non_identity(uintptr_t); 50 52 51 extern uintptr_t km_map(uintptr_t, size_t, unsigned int);53 extern uintptr_t km_map(uintptr_t, size_t, size_t, unsigned int); 52 54 extern void km_unmap(uintptr_t, size_t); 53 55 -
kernel/generic/src/console/cmd.c
rb1834a01 ra1b9f63 728 728 #endif 729 729 ptr = (uint8_t *) km_map(argv[0].intval, sizeof(uint8_t), 730 PAGE_ NOT_CACHEABLE);730 PAGE_SIZE, PAGE_NOT_CACHEABLE); 731 731 732 732 const uint8_t val = pio_read_8(ptr); … … 758 758 #endif 759 759 ptr = (uint16_t *) km_map(argv[0].intval, sizeof(uint16_t), 760 PAGE_ NOT_CACHEABLE);760 PAGE_SIZE, PAGE_NOT_CACHEABLE); 761 761 762 762 const uint16_t val = pio_read_16(ptr); … … 788 788 #endif 789 789 ptr = (uint32_t *) km_map(argv[0].intval, sizeof(uint32_t), 790 PAGE_ NOT_CACHEABLE);790 PAGE_SIZE, PAGE_NOT_CACHEABLE); 791 791 792 792 const uint32_t val = pio_read_32(ptr); … … 818 818 #endif 819 819 ptr = (uint8_t *) km_map(argv[0].intval, sizeof(uint8_t), 820 PAGE_ NOT_CACHEABLE);820 PAGE_SIZE, PAGE_NOT_CACHEABLE); 821 821 822 822 printf("write %" PRIxn ": %" PRIx8 "\n", argv[0].intval, … … 849 849 #endif 850 850 ptr = (uint16_t *) km_map(argv[0].intval, sizeof(uint16_t), 851 PAGE_ NOT_CACHEABLE);851 PAGE_SIZE, PAGE_NOT_CACHEABLE); 852 852 853 853 printf("write %" PRIxn ": %" PRIx16 "\n", argv[0].intval, … … 880 880 #endif 881 881 ptr = (uint32_t *) km_map(argv[0].intval, sizeof(uint32_t), 882 PAGE_ NOT_CACHEABLE);882 PAGE_SIZE, PAGE_NOT_CACHEABLE); 883 883 884 884 printf("write %" PRIxn ": %" PRIx32 "\n", argv[0].intval, -
kernel/generic/src/ipc/irq.c
rb1834a01 ra1b9f63 95 95 #endif 96 96 ranges[i].base = km_map(pbase[i], ranges[i].size, 97 KM_NATURAL_ALIGNMENT, 97 98 PAGE_READ | PAGE_WRITE | PAGE_KERNEL | PAGE_NOT_CACHEABLE); 98 99 if (!ranges[i].base) { -
kernel/generic/src/main/kinit.c
rb1834a01 ra1b9f63 249 249 */ 250 250 uintptr_t page = km_map(init.tasks[i].paddr, 251 init.tasks[i].size, 251 init.tasks[i].size, KM_NATURAL_ALIGNMENT, 252 252 PAGE_READ | PAGE_WRITE | PAGE_CACHEABLE); 253 253 assert(page); -
kernel/generic/src/mm/km.c
rb1834a01 ra1b9f63 130 130 131 131 static uintptr_t 132 km_map_aligned(uintptr_t paddr, size_t size, unsigned int flags)132 km_map_aligned(uintptr_t paddr, size_t size, size_t align, unsigned int flags) 133 133 { 134 134 uintptr_t vaddr; 135 size_t align;136 135 uintptr_t offs; 136 137 if (align == KM_NATURAL_ALIGNMENT) 138 align = ispwr2(size) ? size : (1U << (fnzb(size) + 1)); 137 139 138 140 assert(ALIGN_DOWN(paddr, FRAME_SIZE) == paddr); 139 141 assert(ALIGN_UP(size, FRAME_SIZE) == size); 140 141 /* Enforce natural or at least PAGE_SIZE alignment. */ 142 align = ispwr2(size) ? size : (1U << (fnzb(size) + 1));142 assert(ispwr2(align)); 143 144 /* Enforce at least PAGE_SIZE alignment. */ 143 145 vaddr = km_page_alloc(size, max(PAGE_SIZE, align)); 144 146 … … 185 187 * @return New virtual address mapped to paddr. 186 188 */ 187 uintptr_t km_map(uintptr_t paddr, size_t size, unsigned int flags)189 uintptr_t km_map(uintptr_t paddr, size_t size, size_t align, unsigned int flags) 188 190 { 189 191 uintptr_t page; … … 192 194 offs = paddr - ALIGN_DOWN(paddr, FRAME_SIZE); 193 195 page = km_map_aligned(ALIGN_DOWN(paddr, FRAME_SIZE), 194 ALIGN_UP(size + offs, FRAME_SIZE), flags);196 ALIGN_UP(size + offs, FRAME_SIZE), align, flags); 195 197 196 198 return page + offs; … … 256 258 frame = frame_alloc(1, FRAME_HIGHMEM | FRAME_ATOMIC | flags, 0); 257 259 if (frame) { 258 page = km_map(frame, PAGE_SIZE, 260 page = km_map(frame, PAGE_SIZE, PAGE_SIZE, 259 261 PAGE_READ | PAGE_WRITE | PAGE_CACHEABLE); 260 262 if (!page) { -
kernel/test/mm/mapping1.c
rb1834a01 ra1b9f63 43 43 uintptr_t frame = frame_alloc(1, FRAME_NONE, 0); 44 44 45 uintptr_t page0 = km_map(frame, FRAME_SIZE, 45 uintptr_t page0 = km_map(frame, FRAME_SIZE, FRAME_SIZE, 46 46 PAGE_READ | PAGE_WRITE | PAGE_CACHEABLE); 47 47 TPRINTF("Virtual address %p mapped to physical address %p.\n", 48 48 (void *) page0, (void *) frame); 49 49 50 uintptr_t page1 = km_map(frame, FRAME_SIZE, 50 uintptr_t page1 = km_map(frame, FRAME_SIZE, FRAME_SIZE, 51 51 PAGE_READ | PAGE_WRITE | PAGE_CACHEABLE); 52 52 TPRINTF("Virtual address %p mapped to physical address %p.\n",
Note:
See TracChangeset
for help on using the changeset viewer.