Changeset bf9cb2f in mainline
- Timestamp:
- 2014-05-19T01:01:27Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 10ef47ba
- Parents:
- 527f1ca
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/ddi/ddi.c
r527f1ca rbf9cb2f 229 229 void *virt_ptr, uintptr_t bound) 230 230 { 231 uintptr_t virt = (uintptr_t) -1; 232 int rc = physmem_map(ALIGN_DOWN(phys, FRAME_SIZE), pages, flags, 233 &virt, bound); 231 uintptr_t virt; 232 int rc = copy_from_uspace(&virt, virt_ptr, sizeof(virt)); 233 if (rc != EOK) 234 return rc; 235 236 rc = physmem_map(ALIGN_DOWN(phys, FRAME_SIZE), pages, flags, &virt, 237 bound); 234 238 if (rc != EOK) 235 239 return rc; … … 390 394 return rc; 391 395 396 uintptr_t virt; 397 rc = copy_from_uspace(&virt, virt_ptr, sizeof(virt)); 398 if (rc != EOK) 399 return rc; 400 392 401 uintptr_t phys; 393 uintptr_t virt = (uintptr_t) -1;394 402 rc = dmamem_map_anonymous(size, constraint, map_flags, flags, 395 403 &phys, &virt, bound); -
uspace/app/kio/kio.c
r527f1ca rbf9cb2f 63 63 64 64 /* Pointer to kio area */ 65 static wchar_t *kio ;65 static wchar_t *kio = (wchar_t *) AS_AREA_ANY; 66 66 static size_t kio_length; 67 67 -
uspace/drv/audio/sb16/dsp.c
r527f1ca rbf9cb2f 178 178 179 179 uintptr_t pa = 0; 180 void *buffer = NULL;180 void *buffer = AS_AREA_ANY; 181 181 182 182 int ret = dmamem_map_anonymous(size, DMAMEM_16MiB | 0x0000ffff, -
uspace/drv/block/ahci/ahci.c
r527f1ca rbf9cb2f 234 234 235 235 uintptr_t phys; 236 void *ibuf ;236 void *ibuf = AS_AREA_ANY; 237 237 int rc = dmamem_map_anonymous(sata->block_size, DMAMEM_4GiB, 238 238 AS_AREA_READ | AS_AREA_WRITE, 0, &phys, &ibuf); … … 277 277 278 278 uintptr_t phys; 279 void *ibuf ;279 void *ibuf = AS_AREA_ANY; 280 280 int rc = dmamem_map_anonymous(sata->block_size, DMAMEM_4GiB, 281 281 AS_AREA_READ | AS_AREA_WRITE, 0, &phys, &ibuf); … … 436 436 437 437 uintptr_t phys; 438 sata_identify_data_t *idata ;438 sata_identify_data_t *idata = AS_AREA_ANY; 439 439 int rc = dmamem_map_anonymous(SATA_IDENTIFY_DEVICE_BUFFER_LENGTH, 440 440 DMAMEM_4GiB, AS_AREA_READ | AS_AREA_WRITE, 0, &phys, 441 (void * *) &idata);441 (void *) &idata); 442 442 if (rc != EOK) { 443 443 ddf_msg(LVL_ERROR, "Cannot allocate buffer to identify device."); … … 630 630 631 631 uintptr_t phys; 632 sata_identify_data_t *idata ;632 sata_identify_data_t *idata = AS_AREA_ANY; 633 633 int rc = dmamem_map_anonymous(SATA_SET_FEATURE_BUFFER_LENGTH, 634 634 DMAMEM_4GiB, AS_AREA_READ | AS_AREA_WRITE, 0, &phys, 635 (void * *) &idata);635 (void *) &idata); 636 636 if (rc != EOK) { 637 637 ddf_msg(LVL_ERROR, "Cannot allocate buffer for device set mode."); … … 938 938 size_t size = 4096; 939 939 uintptr_t phys = 0; 940 void *virt_fb = NULL;941 void *virt_cmd = NULL;942 void *virt_table = NULL;940 void *virt_fb = AS_AREA_ANY; 941 void *virt_cmd = AS_AREA_ANY; 942 void *virt_table = AS_AREA_ANY; 943 943 ddf_fun_t *fun; 944 944 … … 1155 1155 1156 1156 /* Map AHCI registers. */ 1157 ahci->memregs = NULL;1157 ahci->memregs = AS_AREA_ANY; 1158 1158 1159 1159 physmem_map(RNGABS(hw_res_parsed.mem_ranges.ranges[0]), 1160 1160 AHCI_MEMREGS_PAGES_COUNT, AS_AREA_READ | AS_AREA_WRITE, 1161 (void * *) &ahci->memregs);1161 (void *) &ahci->memregs); 1162 1162 if (ahci->memregs == NULL) 1163 1163 goto error_map_registers; -
uspace/drv/bus/usb/uhci/utils/malloc32.h
r527f1ca rbf9cb2f 103 103 { 104 104 uintptr_t phys; 105 void *address ;105 void *address = AS_AREA_ANY; 106 106 107 107 const int ret = dmamem_map_anonymous(UHCI_REQUIRED_PAGE_SIZE, -
uspace/drv/fb/amdm37x_dispc/amdm37x_dispc.c
r527f1ca rbf9cb2f 38 38 #include <ddf/log.h> 39 39 #include <ddi.h> 40 #include <a bi/mm/as.h>40 #include <as.h> 41 41 42 42 #include "amdm37x_dispc.h" … … 274 274 const size_t size = ALIGN_UP(x * y * bpp, PAGE_SIZE); 275 275 uintptr_t pa; 276 void *buffer ;276 void *buffer = AS_AREA_ANY; 277 277 int ret = dmamem_map_anonymous(size, DMAMEM_4GiB, 278 278 AS_AREA_READ | AS_AREA_WRITE, 0, &pa, &buffer); -
uspace/drv/fb/kfb/port.c
r527f1ca rbf9cb2f 333 333 334 334 kfb.size = scanline * height; 335 kfb.addr = AS_AREA_ANY; 336 335 337 rc = physmem_map(paddr + offset, 336 338 ALIGN_UP(kfb.size, PAGE_SIZE) >> PAGE_WIDTH, -
uspace/drv/nic/e1k/e1k.c
r527f1ca rbf9cb2f 1375 1375 fibril_mutex_lock(&e1000->rx_lock); 1376 1376 1377 e1000->rx_ring_virt = AS_AREA_ANY; 1377 1378 int rc = dmamem_map_anonymous( 1378 1379 E1000_RX_FRAME_COUNT * sizeof(e1000_rx_descriptor_t), … … 1396 1397 } 1397 1398 1398 size_t i; 1399 uintptr_t frame_phys; 1400 void *frame_virt; 1401 1402 for (i = 0; i < E1000_RX_FRAME_COUNT; i++) { 1399 for (size_t i = 0; i < E1000_RX_FRAME_COUNT; i++) { 1400 uintptr_t frame_phys; 1401 void *frame_virt = AS_AREA_ANY; 1402 1403 1403 rc = dmamem_map_anonymous(E1000_MAX_SEND_FRAME_SIZE, 1404 1404 DMAMEM_4GiB, AS_AREA_READ | AS_AREA_WRITE, 0, … … 1412 1412 1413 1413 /* Write descriptor */ 1414 for ( i = 0; i < E1000_RX_FRAME_COUNT; i++)1414 for (size_t i = 0; i < E1000_RX_FRAME_COUNT; i++) 1415 1415 e1000_fill_new_rx_descriptor(nic, i); 1416 1416 … … 1421 1421 1422 1422 error: 1423 for ( i = 0; i < E1000_RX_FRAME_COUNT; i++) {1423 for (size_t i = 0; i < E1000_RX_FRAME_COUNT; i++) { 1424 1424 if (e1000->rx_frame_virt[i] != NULL) { 1425 1425 dmamem_unmap_anonymous(e1000->rx_frame_virt[i]); … … 1571 1571 1572 1572 e1000->tx_ring_phys = 0; 1573 e1000->tx_ring_virt = NULL;1573 e1000->tx_ring_virt = AS_AREA_ANY; 1574 1574 1575 1575 e1000->tx_frame_phys = NULL; … … 1597 1597 1598 1598 for (i = 0; i < E1000_TX_FRAME_COUNT; i++) { 1599 e1000->tx_frame_virt[i] = AS_AREA_ANY; 1599 1600 rc = dmamem_map_anonymous(E1000_MAX_SEND_FRAME_SIZE, 1600 1601 DMAMEM_4GiB, AS_AREA_READ | AS_AREA_WRITE, -
uspace/drv/nic/rtl8139/driver.c
r527f1ca rbf9cb2f 1141 1141 1142 1142 ddf_msg(LVL_DEBUG, "Creating buffers"); 1143 1143 1144 rtl8139->tx_buff_virt = AS_AREA_ANY; 1144 1145 rc = dmamem_map_anonymous(TX_PAGES * PAGE_SIZE, DMAMEM_4GiB, 1145 1146 AS_AREA_WRITE, 0, &rtl8139->tx_buff_phys, &rtl8139->tx_buff_virt); … … 1161 1162 ddf_msg(LVL_DEBUG, "Allocating receiver buffer of the size %d bytes", 1162 1163 RxBUF_TOT_LENGTH); 1163 1164 1165 rtl8139->rx_buff_virt = AS_AREA_ANY; 1164 1166 rc = dmamem_map_anonymous(RxBUF_TOT_LENGTH, DMAMEM_4GiB, 1165 1167 AS_AREA_READ, 0, &rtl8139->rx_buff_phys, &rtl8139->rx_buff_virt); -
uspace/lib/c/generic/ddi.c
r527f1ca rbf9cb2f 71 71 * @param flags Flags for the new address space area. 72 72 * @param virt Virtual address of the starting page. 73 * 74 * @return EOK on success 75 * @return EPERM if the caller lacks the CAP_MEM_MANAGER capability 76 * @return ENOENT if there is no task with specified ID 73 * If set to AS_AREA_ANY ((void *) -1), a suitable value 74 * is found by the kernel, otherwise the kernel tries to 75 * obey the desired value. 76 * 77 * @return EOK on success. 78 * @return EPERM if the caller lacks the CAP_MEM_MANAGER capability. 77 79 * @return ENOMEM if there was some problem in creating 78 80 * the address space area. … … 85 87 } 86 88 89 /** Lock a piece physical memory for DMA transfers. 90 * 91 * The mapping of the specified virtual memory address 92 * to physical memory address is locked in order to 93 * make it safe for DMA transferts. 94 * 95 * Caller of this function must have the CAP_MEM_MANAGER capability. 96 * 97 * @param virt Virtual address of the memory to be locked. 98 * @param size Number of bytes to lock. 99 * @param map_flags Desired virtual memory area flags. 100 * @param flags Flags for the physical memory address. 101 * @param phys Locked physical memory address. 102 * 103 * @return EOK on success. 104 * @return EPERM if the caller lacks the CAP_MEM_MANAGER capability. 105 * @return ENOMEM if there was some problem in creating 106 * the address space area. 107 * 108 */ 87 109 int dmamem_map(void *virt, size_t size, unsigned int map_flags, 88 110 unsigned int flags, uintptr_t *phys) … … 93 115 } 94 116 117 /** Map a piece of physical memory suitable for DMA transfers. 118 * 119 * Caller of this function must have the CAP_MEM_MANAGER capability. 120 * 121 * @param size Number of bytes to map. 122 * @param constraint Bit mask defining the contraint on the physical 123 * address to be mapped. 124 * @param map_flags Desired virtual memory area flags. 125 * @param flags Flags for the physical memory address. 126 * @param virt Virtual address of the starting page. 127 * If set to AS_AREA_ANY ((void *) -1), a suitable value 128 * is found by the kernel, otherwise the kernel tries to 129 * obey the desired value. 130 * 131 * @return EOK on success. 132 * @return EPERM if the caller lacks the CAP_MEM_MANAGER capability. 133 * @return ENOMEM if there was some problem in creating 134 * the address space area. 135 * 136 */ 95 137 int dmamem_map_anonymous(size_t size, uintptr_t constraint, 96 138 unsigned int map_flags, unsigned int flags, uintptr_t *phys, void **virt) … … 221 263 size_t pages = SIZE2PAGES(offset + size); 222 264 223 void *virt_page ;265 void *virt_page = AS_AREA_ANY; 224 266 int rc = physmem_map(phys_frame, pages, 225 267 AS_AREA_READ | AS_AREA_WRITE, &virt_page); -
uspace/lib/c/generic/time.c
r527f1ca rbf9cb2f 555 555 } 556 556 557 void *addr ;557 void *addr = AS_AREA_ANY; 558 558 rc = physmem_map(faddr, 1, AS_AREA_READ | AS_AREA_CACHEABLE, 559 559 &addr); -
uspace/srv/bd/rd/rd.c
r527f1ca rbf9cb2f 60 60 61 61 /** Pointer to the ramdisk's image */ 62 static void *rd_addr ;62 static void *rd_addr = AS_AREA_ANY; 63 63 64 64 /** Size of the ramdisk */ -
uspace/srv/hid/input/port/niagara.c
r527f1ca rbf9cb2f 74 74 uint64_t read_ptr; 75 75 char data[INPUT_BUFFER_SIZE]; 76 } 77 __attribute__ ((packed)) 78 __attribute__ ((aligned(PAGE_SIZE))) 79 *input_buffer_t; 76 } __attribute__((packed)) __attribute__((aligned(PAGE_SIZE))) *input_buffer_t; 80 77 81 78 /* virtual address of the shared buffer */ 82 static input_buffer_t input_buffer ;79 static input_buffer_t input_buffer = (input_buffer_t) AS_AREA_ANY; 83 80 84 81 static volatile bool polling_disabled = false; … … 87 84 /** 88 85 * Initializes the Niagara driver. 89 * Maps the shared buffer and creates the polling thread. 86 * Maps the shared buffer and creates the polling thread. 90 87 */ 91 88 static int niagara_port_init(kbd_dev_t *kdev) -
uspace/srv/hid/output/port/ega.c
r527f1ca rbf9cb2f 215 215 216 216 ega.size = (ega.cols * ega.rows) << 1; 217 ega.addr = AS_AREA_ANY; 217 218 218 219 rc = physmem_map(paddr, -
uspace/srv/hid/output/port/kchar.c
r527f1ca rbf9cb2f 84 84 return rc; 85 85 86 kchar.addr = AS_AREA_ANY; 87 86 88 rc = physmem_map(paddr, 87 89 ALIGN_UP(1, PAGE_SIZE) >> PAGE_WIDTH, -
uspace/srv/hid/output/port/niagara.c
r527f1ca rbf9cb2f 104 104 return rc; 105 105 106 niagara.fifo = (output_fifo_t *) AS_AREA_ANY; 107 106 108 rc = physmem_map(paddr, 1, AS_AREA_READ | AS_AREA_WRITE, 107 109 (void *) &niagara.fifo); -
uspace/srv/hw/irc/obio/obio.c
r527f1ca rbf9cb2f 70 70 71 71 static uintptr_t base_phys; 72 static volatile uint64_t *base_virt ;72 static volatile uint64_t *base_virt = (volatile uint64_t *) AS_AREA_ANY; 73 73 74 74 /** Handle one connection to obio.
Note:
See TracChangeset
for help on using the changeset viewer.