Changeset 8d6c1f1 in mainline for kernel/generic


Ignore:
Timestamp:
2011-06-07T21:31:35Z (14 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
75608143
Parents:
ff4f073 (diff), eb522e8 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge USB support.

Changes from bzr://helenos-usb.bzr.sourceforge.net/bzrroot/helenos-usb/mainline:

  • replaced '-' with '_' in new driver names
  • USB libs are built for each architecture
  • devman starts early
  • sys_thread_udelay() uses generic delay()
  • sys_as_create_area() now creates cacheable areas by default
Location:
kernel/generic
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/ddi/irq.h

    rff4f073 r8d6c1f1  
    7777         */
    7878        CMD_PIO_WRITE_A_32,
    79        
     79
     80        /** Read 1 byte from the memory space. */
     81        CMD_MEM_READ_8,
     82        /** Read 2 bytes from the memory space. */
     83        CMD_MEM_READ_16,
     84        /** Read 4 bytes from the memory space. */
     85        CMD_MEM_READ_32,
     86
     87        /** Write 1 byte to the memory space. */
     88        CMD_MEM_WRITE_8,
     89        /** Write 2 bytes to the memory space. */
     90        CMD_MEM_WRITE_16,
     91        /** Write 4 bytes to the memory space. */
     92        CMD_MEM_WRITE_32,
     93
     94        /** Write 1 byte from the source argument to the memory space. */
     95        CMD_MEM_WRITE_A_8,
     96        /** Write 2 bytes from the source argument to the memory space. */
     97        CMD_MEM_WRITE_A_16,
     98        /** Write 4 bytes from the source argument to the memory space. */
     99        CMD_MEM_WRITE_A_32,
     100
    80101        /**
    81102         * Perform a bit masking on the source argument
     
    203224        /** Notification configuration structure. */
    204225        ipc_notif_cfg_t notif_cfg;
     226
     227        as_t *driver_as;
    205228} irq_t;
    206229
  • kernel/generic/include/mm/page.h

    rff4f073 r8d6c1f1  
    3737
    3838#include <typedefs.h>
     39#include <proc/task.h>
    3940#include <mm/as.h>
    4041#include <arch/mm/page.h>
     
    6566extern uintptr_t hw_map(uintptr_t, size_t);
    6667
     68extern sysarg_t sys_page_find_mapping(uintptr_t, uintptr_t *);
     69
    6770#endif
    6871
  • kernel/generic/include/proc/thread.h

    rff4f073 r8d6c1f1  
    258258extern sysarg_t sys_thread_get_id(thread_id_t *);
    259259extern sysarg_t sys_thread_usleep(uint32_t);
     260extern sysarg_t sys_thread_udelay(uint32_t);
    260261
    261262#endif
  • kernel/generic/include/syscall/syscall.h

    rff4f073 r8d6c1f1  
    4444        SYS_THREAD_GET_ID,
    4545        SYS_THREAD_USLEEP,
     46        SYS_THREAD_UDELAY,
    4647       
    4748        SYS_TASK_GET_ID,
     
    6061        SYS_AS_AREA_DESTROY,
    6162        SYS_AS_GET_UNMAPPED_AREA,
     63       
     64        SYS_PAGE_FIND_MAPPING,
    6265       
    6366        SYS_IPC_CALL_SYNC_FAST,
  • kernel/generic/src/ipc/irq.c

    rff4f073 r8d6c1f1  
    174174        irq->notif_cfg.code = code;
    175175        irq->notif_cfg.counter = 0;
     176        irq->driver_as = AS;
    176177       
    177178        /*
     
    364365                return IRQ_DECLINE;
    365366       
     367#define CMD_MEM_READ(target) \
     368do { \
     369        void *va = code->cmds[i].addr; \
     370        if (AS != irq->driver_as) \
     371                as_switch(AS, irq->driver_as); \
     372        memcpy_from_uspace(&target, va, (sizeof(target))); \
     373        if (dstarg) \
     374                scratch[dstarg] = target; \
     375} while(0)
     376
     377#define CMD_MEM_WRITE(val) \
     378do { \
     379        void *va = code->cmds[i].addr; \
     380        if (AS != irq->driver_as) \
     381                as_switch(AS, irq->driver_as); \
     382        memcpy_to_uspace(va, &val, sizeof(val)); \
     383} while (0)
     384
     385        as_t *current_as = AS;
    366386        size_t i;
    367387        for (i = 0; i < code->cmdcount; i++) {
     
    422442                        }
    423443                        break;
     444                case CMD_MEM_READ_8: {
     445                        uint8_t val;
     446                        CMD_MEM_READ(val);
     447                        break;
     448                        }
     449                case CMD_MEM_READ_16: {
     450                        uint16_t val;
     451                        CMD_MEM_READ(val);
     452                        break;
     453                        }
     454                case CMD_MEM_READ_32: {
     455                        uint32_t val;
     456                        CMD_MEM_READ(val);
     457                        break;
     458                        }
     459                case CMD_MEM_WRITE_8: {
     460                        uint8_t val = code->cmds[i].value;
     461                        CMD_MEM_WRITE(val);
     462                        break;
     463                        }
     464                case CMD_MEM_WRITE_16: {
     465                        uint16_t val = code->cmds[i].value;
     466                        CMD_MEM_WRITE(val);
     467                        break;
     468                        }
     469                case CMD_MEM_WRITE_32: {
     470                        uint32_t val = code->cmds[i].value;
     471                        CMD_MEM_WRITE(val);
     472                        break;
     473                        }
     474                case CMD_MEM_WRITE_A_8:
     475                        if (srcarg) {
     476                                uint8_t val = scratch[srcarg];
     477                                CMD_MEM_WRITE(val);
     478                        }
     479                        break;
     480                case CMD_MEM_WRITE_A_16:
     481                        if (srcarg) {
     482                                uint16_t val = scratch[srcarg];
     483                                CMD_MEM_WRITE(val);
     484                        }
     485                        break;
     486                case CMD_MEM_WRITE_A_32:
     487                        if (srcarg) {
     488                                uint32_t val = scratch[srcarg];
     489                                CMD_MEM_WRITE(val);
     490                        }
     491                        break;
    424492                case CMD_BTEST:
    425493                        if ((srcarg) && (dstarg)) {
     
    435503                        break;
    436504                case CMD_ACCEPT:
     505                        if (AS != current_as)
     506                                as_switch(AS, current_as);
    437507                        return IRQ_ACCEPT;
    438508                case CMD_DECLINE:
    439509                default:
     510                        if (AS != current_as)
     511                                as_switch(AS, current_as);
    440512                        return IRQ_DECLINE;
    441513                }
    442514        }
     515        if (AS != current_as)
     516                as_switch(AS, current_as);
    443517       
    444518        return IRQ_DECLINE;
  • kernel/generic/src/mm/page.c

    rff4f073 r8d6c1f1  
    6060
    6161#include <mm/page.h>
     62#include <genarch/mm/page_ht.h>
     63#include <genarch/mm/page_pt.h>
    6264#include <arch/mm/page.h>
    6365#include <arch/mm/asid.h>
     
    7072#include <debug.h>
    7173#include <arch.h>
     74#include <syscall/copy.h>
     75#include <errno.h>
    7276
    7377/** Virtual operations for page subsystem. */
     
    172176}
    173177
     178/** Syscall wrapper for getting mapping of a virtual page.
     179 *
     180 * @retval EOK Everything went find, @p uspace_frame and @p uspace_node
     181 *             contains correct values.
     182 * @retval ENOENT Virtual address has no mapping.
     183 */
     184sysarg_t sys_page_find_mapping(uintptr_t virt_address,
     185    uintptr_t *uspace_frame)
     186{
     187        mutex_lock(&AS->lock);
     188       
     189        pte_t *pte = page_mapping_find(AS, virt_address, false);
     190        if (!PTE_VALID(pte) || !PTE_PRESENT(pte)) {
     191                mutex_unlock(&AS->lock);
     192               
     193                return (sysarg_t) ENOENT;
     194        }
     195       
     196        uintptr_t phys_address = PTE_GET_FRAME(pte);
     197       
     198        mutex_unlock(&AS->lock);
     199       
     200        int rc = copy_to_uspace(uspace_frame,
     201            &phys_address, sizeof(phys_address));
     202        if (rc != EOK) {
     203                return (sysarg_t) rc;
     204        }
     205       
     206        return EOK;
     207}
     208
    174209/** @}
    175210 */
  • kernel/generic/src/proc/thread.c

    rff4f073 r8d6c1f1  
    5555#include <time/clock.h>
    5656#include <time/timeout.h>
     57#include <time/delay.h>
    5758#include <config.h>
    5859#include <arch/interrupt.h>
     
    912913}
    913914
     915sysarg_t sys_thread_udelay(uint32_t usec)
     916{
     917        delay(usec);
     918        return 0;
     919}
     920
    914921/** @}
    915922 */
  • kernel/generic/src/syscall/syscall.c

    rff4f073 r8d6c1f1  
    4141#include <proc/program.h>
    4242#include <mm/as.h>
     43#include <mm/page.h>
    4344#include <print.h>
    4445#include <arch.h>
     
    126127        (syshandler_t) sys_thread_get_id,
    127128        (syshandler_t) sys_thread_usleep,
     129        (syshandler_t) sys_thread_udelay,
    128130       
    129131        (syshandler_t) sys_task_get_id,
     
    144146        (syshandler_t) sys_as_area_destroy,
    145147        (syshandler_t) sys_as_get_unmapped_area,
     148       
     149        /* Page mapping related syscalls. */
     150        (syshandler_t) sys_page_find_mapping,
    146151       
    147152        /* IPC related syscalls. */
Note: See TracChangeset for help on using the changeset viewer.