Changeset 46321fb in mainline for kernel/arch/ia64/src
- Timestamp:
- 2008-11-25T20:22:04Z (17 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 83d9712
- Parents:
- 14c331a
- Location:
- kernel/arch/ia64/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/ia64/src/ddi/ddi.c
r14c331a r46321fb 1 1 /* 2 * Copyright (c) 2006 Jakub Jermar 2 * Copyright (c) 2006 Jakub Jermar, Jakub vana 3 3 * All rights reserved. 4 4 * … … 36 36 #include <proc/task.h> 37 37 #include <arch/types.h> 38 #include <mm/slab.h> 39 #include <errno.h> 40 41 #define IO_MEMMAP_PAGES 16384 42 #define PORTS_PER_PAGE 4 38 43 39 44 /** Enable I/O space range for task. … … 49 54 int ddi_iospace_enable_arch(task_t *task, uintptr_t ioaddr, size_t size) 50 55 { 56 57 if(!task->arch.iomap) 58 { 59 uint8_t *map; 60 task->arch.iomap=malloc(sizeof(bitmap_t),0); 61 map=malloc(BITS2BYTES(IO_MEMMAP_PAGES),0); 62 if(!map) 63 return ENOMEM; 64 bitmap_initialize(task->arch.iomap,map,IO_MEMMAP_PAGES); 65 bitmap_clear_range(task->arch.iomap,0,IO_MEMMAP_PAGES); 66 } 67 68 uintptr_t iopage = ioaddr / PORTS_PER_PAGE; 69 size = ALIGN_UP (size+ioaddr-4*iopage,PORTS_PER_PAGE); 70 bitmap_set_range(task->arch.iomap,iopage,size/4); 71 72 51 73 return 0; 52 74 } -
kernel/arch/ia64/src/drivers/ega.c
r14c331a r46321fb 47 47 #include <sysinfo/sysinfo.h> 48 48 #include <arch/drivers/ega.h> 49 #include <ddi/ddi.h> 50 49 51 50 52 /* … … 52 54 * Simple and short. Function for displaying characters and "scrolling". 53 55 */ 56 57 58 static parea_t ega_parea; /**< Physical memory area for EGA video RAM. */ 59 54 60 55 61 SPINLOCK_INITIALIZE(egalock); … … 76 82 chardev_initialize("ega_out", &ega_console, &ega_ops); 77 83 stdout = &ega_console; 84 85 86 ega_parea.pbase = VIDEORAM & 0xffffffff; 87 ega_parea.vbase = (uintptr_t) videoram; 88 ega_parea.frames = 1; 89 ega_parea.cacheable = false; 90 ddi_parea_register(&ega_parea); 91 78 92 79 93 sysinfo_set_item_val("fb", NULL, true); … … 81 95 sysinfo_set_item_val("fb.width", NULL, ROW); 82 96 sysinfo_set_item_val("fb.height", NULL, ROWS); 83 sysinfo_set_item_val("fb.address.physical", NULL, VIDEORAM );97 sysinfo_set_item_val("fb.address.physical", NULL, VIDEORAM & 0xffffffff); 84 98 85 99 #ifndef CONFIG_FB -
kernel/arch/ia64/src/ia64.c
r14c331a r46321fb 61 61 #include <panic.h> 62 62 #include <print.h> 63 #include <sysinfo/sysinfo.h> 63 64 64 65 /*NS16550 as a COM 1*/ … … 183 184 184 185 } 186 187 sysinfo_set_item_val("ia64_iospace", NULL, true); 188 sysinfo_set_item_val("ia64_iospace.address", NULL, true); 189 sysinfo_set_item_val("ia64_iospace.address.virtual", NULL, IO_OFFSET); 190 185 191 } 186 192 -
kernel/arch/ia64/src/mm/tlb.c
r14c331a r46321fb 476 476 } 477 477 478 479 480 static int is_io_page_accessible(int page) 481 { 482 if(TASK->arch.iomap) return bitmap_get(TASK->arch.iomap,page); 483 else return 0; 484 } 485 486 #define IO_FRAME_BASE 0xFFFFC000000 487 488 /** There is special handling of memmaped lagacy io, because 489 * of 4KB sized access 490 * only for userspace 491 * 492 * @param va virtual address of page fault 493 * @param istate Structure with saved interruption state. 494 * 495 * 496 * @return 1 on success, 0 on fail 497 */ 498 static int try_memmap_io_insertion(uintptr_t va, istate_t *istate) 499 { 500 if((va >= IO_OFFSET ) && (va < IO_OFFSET + (1<<IO_PAGE_WIDTH))) 501 if(TASK){ 502 503 uint64_t io_page=(va & ((1<<IO_PAGE_WIDTH)-1)) >> (USPACE_IO_PAGE_WIDTH); 504 if(is_io_page_accessible(io_page)){ 505 //printf("Insert %llX\n",va); 506 507 uint64_t page,frame; 508 509 page = IO_OFFSET + (1 << USPACE_IO_PAGE_WIDTH) * io_page; 510 frame = IO_FRAME_BASE + (1 << USPACE_IO_PAGE_WIDTH) * io_page; 511 512 513 tlb_entry_t entry; 514 515 entry.word[0] = 0; 516 entry.word[1] = 0; 517 518 entry.p = true; /* present */ 519 entry.ma = MA_UNCACHEABLE; 520 entry.a = true; /* already accessed */ 521 entry.d = true; /* already dirty */ 522 entry.pl = PL_USER; 523 entry.ar = AR_READ | AR_WRITE; 524 entry.ppn = frame >> PPN_SHIFT; //MUSIM spocitat frame 525 entry.ps = USPACE_IO_PAGE_WIDTH; 526 527 dtc_mapping_insert(page, TASK->as->asid, entry); //Musim zjistit ASID 528 return 1; 529 }else { 530 fault_if_from_uspace(istate,"IO access fault at %p",va); 531 return 0; 532 } 533 } else 534 return 0; 535 else 536 return 0; 537 538 return 0; 539 540 } 541 542 543 544 478 545 /** Data TLB fault handler for faults with VHPT turned off. 479 546 * … … 512 579 page_table_unlock(AS, true); 513 580 } else { 581 page_table_unlock(AS, true); 582 if (try_memmap_io_insertion(va,istate)) return; 514 583 /* 515 584 * Forward the page fault to the address space page fault handler. 516 585 */ 517 page_table_unlock(AS, true);518 586 if (as_page_fault(va, PF_ACCESS_READ, istate) == AS_PF_FAULT) { 519 587 fault_if_from_uspace(istate,"Page fault at %p",va);
Note:
See TracChangeset
for help on using the changeset viewer.