Changeset f4d5f90 in mainline


Ignore:
Timestamp:
2011-12-15T10:36:34Z (12 years ago)
Author:
Frantisek Princ <frantisek.princ@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9fe4db3
Parents:
d9f8dd13 (diff), 9916841 (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 with mainline

Files:
14 added
22 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/ia32/src/boot/vesa_real.inc

    rd9f8dd13 rf4d5f90  
    374374                xor %ebx, %ebx
    375375                xor %edx, %edx
    376                 mov $0xffffffff, %edi
     376                xor %edi, %edi
    377377               
    378378                jz vesa_leave_real  /* force relative jump */
  • kernel/arch/ia64/src/start.S

    rd9f8dd13 rf4d5f90  
    174174        mov ar.bspstore = r8
    175175        loadrs
    176 
     176       
    177177        #
    178178        # Initialize memory stack to some sane value and allocate a scratch area
     
    196196        srlz.i
    197197        srlz.d ;;
    198 
     198       
    199199        br.call.sptk.many b0 = arch_pre_main
    2002000:
  • uspace/Makefile

    rd9f8dd13 rf4d5f90  
    121121        drv/bus/usb/vhc \
    122122        drv/nic/lo \
    123         drv/nic/ne2k
     123        drv/nic/ne2k \
     124        drv/nic/e1k
    124125
    125126ifeq ($(CONFIG_PCC),y)
  • uspace/lib/c/Makefile

    rd9f8dd13 rf4d5f90  
    7070        generic/device/char_dev.c \
    7171        generic/device/nic.c \
     72        generic/device/pci.c \
    7273        generic/elf/elf_load.c \
    7374        generic/event.c \
  • uspace/lib/c/generic/async.c

    rd9f8dd13 rf4d5f90  
    18461846       
    18471847        fibril_mutex_lock(&async_sess_mutex);
    1848 
     1848       
    18491849        int rc = async_hangup_internal(sess->phone);
    18501850       
  • uspace/lib/c/generic/ddi.c

    rd9f8dd13 rf4d5f90  
    7575}
    7676
     77int dmamem_map(dmamem_t *dmamem, size_t pages, unsigned int map_flags,
     78    unsigned int dma_flags)
     79{
     80        // FIXME TODO
     81        return -1;
     82}
     83
     84int dmamem_unmap(dmamem_t *dmamem)
     85{
     86        // FIXME TODO
     87        return -1;
     88}
     89
     90int dmamem_lock(void *virt, void **phys, size_t pages)
     91{
     92        // FIXME TODO
     93        return -1;
     94}
     95
     96int dmamem_unlock(void *virt, size_t pages)
     97{
     98        // FIXME TODO
     99        return -1;
     100}
     101
    77102/** Enable I/O space range to task.
    78103 *
    79104 * Caller of this function must have the IO_MEM_MANAGER capability.
    80105 *
    81  * @param id            Task ID.
    82  * @param ioaddr        Starting address of the I/O range.
    83  * @param size          Size of the range.
     106 * @param id     Task ID.
     107 * @param ioaddr Starting address of the I/O range.
     108 * @param size   Size of the range.
    84109 *
    85  * @return              0 on success, EPERM if the caller lacks the
    86  *                      CAP_IO_MANAGER capability, ENOENT if there is no task
    87  *                      with specified ID and ENOMEM if there was some problem
    88  *                      in allocating memory.
     110 * @return EOK on success
     111 * @return EPERM if the caller lacks the CAP_IO_MANAGER capability
     112 * @return ENOENT if there is no task with specified ID
     113 * @return ENOMEM if there was some problem in allocating memory.
     114 *
    89115 */
    90116int iospace_enable(task_id_t id, void *ioaddr, unsigned long size)
    91117{
    92118        ddi_ioarg_t arg;
    93 
     119       
    94120        arg.task_id = id;
    95121        arg.ioaddr = ioaddr;
    96122        arg.size = size;
    97 
     123       
    98124        return __SYSCALL1(SYS_IOSPACE_ENABLE, (sysarg_t) &arg);
    99125}
     
    101127/** Enable PIO for specified I/O range.
    102128 *
    103  * @param pio_addr      I/O start address.
    104  * @param size          Size of the I/O region.
    105  * @param use_addr      Address where the final address for application's PIO
    106  *                      will be stored.
     129 * @param pio_addr I/O start address.
     130 * @param size     Size of the I/O region.
     131 * @param use_addr Address where the final address for
     132 *                 application's PIO will be stored.
    107133 *
    108  * @return              Zero on success or negative error code.
     134 * @return Zero on success or negative error code.
     135 *
    109136 */
    110137int pio_enable(void *pio_addr, size_t size, void **use_addr)
     
    114141        size_t offset;
    115142        unsigned int pages;
    116 
     143       
    117144#ifdef IO_SPACE_BOUNDARY
    118145        if (pio_addr < IO_SPACE_BOUNDARY) {
     
    121148        }
    122149#endif
    123 
     150       
    124151        phys = (void *) ALIGN_DOWN((uintptr_t) pio_addr, PAGE_SIZE);
    125152        offset = pio_addr - phys;
  • uspace/lib/c/generic/device/nic.c

    rd9f8dd13 rf4d5f90  
    895895 *
    896896 */
    897 int nic_vlan_set_tag(async_sess_t *dev_sess, uint16_t tag, int add, int strip)
     897int nic_vlan_set_tag(async_sess_t *dev_sess, uint16_t tag, bool add, bool strip)
    898898{
    899899        async_exch_t *exch = async_exchange_begin(dev_sess);
  • uspace/lib/c/include/bitops.h

    rd9f8dd13 rf4d5f90  
    4040/** Mask with bit @a n set. */
    4141#define BIT_V(type, n) \
    42     ((type)1 << (n))
     42    ((type) 1 << (n))
    4343
    4444/** Mask with rightmost @a n bits set. */
  • uspace/lib/c/include/ddi.h

    rd9f8dd13 rf4d5f90  
    4040#include <task.h>
    4141
     42typedef struct {
     43        /** Physical memory */
     44        void *phys;
     45       
     46        /** Virtual memory */
     47        void *virt;
     48       
     49        /** Size in pages */
     50        size_t size;
     51       
     52        /** Mapping flags */
     53        unsigned int flags;
     54} dmamem_t;
     55
    4256extern int device_assign_devno(void);
    4357extern int physmem_map(void *, void *, size_t, unsigned int);
     58extern int dmamem_map(dmamem_t *, size_t, unsigned int, unsigned int);
     59extern int dmamem_unmap(dmamem_t *);
     60extern int dmamem_lock(void *, void **, size_t);
     61extern int dmamem_unlock(void *, size_t);
    4462extern int iospace_enable(task_id_t, void *, unsigned long);
    4563extern int pio_enable(void *, size_t, void **);
  • uspace/lib/c/include/device/nic.h

    rd9f8dd13 rf4d5f90  
    127127extern int nic_vlan_get_mask(async_sess_t *, nic_vlan_mask_t *);
    128128extern int nic_vlan_set_mask(async_sess_t *, const nic_vlan_mask_t *);
    129 extern int nic_vlan_set_tag(async_sess_t *, uint16_t, int, int);
     129extern int nic_vlan_set_tag(async_sess_t *, uint16_t, bool, bool);
    130130
    131131extern int nic_wol_virtue_add(async_sess_t *, nic_wv_type_t, const void *,
  • uspace/lib/c/include/ipc/net.h

    rd9f8dd13 rf4d5f90  
    305305 *
    306306 */
    307 #define IPC_GET_DEVICE_HANDLE(call) ((devman_handle_t) IPC_GET_ARG2(call))
     307#define IPC_GET_DEVICE_HANDLE(call)  ((devman_handle_t) IPC_GET_ARG2(call))
    308308
    309309/** Return the device driver service message argument.
  • uspace/lib/c/include/net/device.h

    rd9f8dd13 rf4d5f90  
    7777#define NIC_PART_NUMBER_MAX_LENGTH    64
    7878#define NIC_SERIAL_NUMBER_MAX_LENGTH  64
     79
     80#define NIC_DEFECTIVE_LONG               0x0001
     81#define NIC_DEFECTIVE_SHORT              0x0002
     82#define NIC_DEFECTIVE_BAD_CRC            0x0010
     83#define NIC_DEFECTIVE_BAD_IPV4_CHECKSUM  0x0020
     84#define NIC_DEFECTIVE_BAD_IPV6_CHECKSUM  0x0040
     85#define NIC_DEFECTIVE_BAD_TCP_CHECKSUM   0x0080
     86#define NIC_DEFECTIVE_BAD_UDP_CHECKSUM   0x0100
    7987
    8088/**
  • uspace/lib/drv/generic/remote_nic.c

    rd9f8dd13 rf4d5f90  
    829829       
    830830        uint16_t tag = (uint16_t) IPC_GET_ARG2(*call);
    831         int add = (int) IPC_GET_ARG3(*call);
    832         int strip = (int) IPC_GET_ARG4(*call);
     831        bool add = (int) IPC_GET_ARG3(*call);
     832        bool strip = (int) IPC_GET_ARG4(*call);
    833833       
    834834        int rc = nic_iface->vlan_set_tag(dev, tag, add, strip);
  • uspace/lib/drv/include/ops/nic.h

    rd9f8dd13 rf4d5f90  
    8989        int (*vlan_get_mask)(ddf_fun_t *, nic_vlan_mask_t *);
    9090        int (*vlan_set_mask)(ddf_fun_t *, const nic_vlan_mask_t *);
    91         int (*vlan_set_tag)(ddf_fun_t *, uint16_t, int, int);
     91        int (*vlan_set_tag)(ddf_fun_t *, uint16_t, bool, bool);
    9292       
    9393        int (*wol_virtue_add)(ddf_fun_t *, nic_wv_type_t, const void *,
  • uspace/lib/nic/include/nic.h

    rd9f8dd13 rf4d5f90  
    275275
    276276/* Packet DMA lock */
    277 extern void * nic_dma_lock_packet(packet_t * packet);
    278 extern void nic_dma_unlock_packet(packet_t * packet);
     277extern void *nic_dma_lock_packet(packet_t *);
     278extern int nic_dma_unlock_packet(packet_t *);
    279279
    280280#endif // __NIC_H__
  • uspace/lib/nic/src/nic_driver.c

    rd9f8dd13 rf4d5f90  
    13291329}
    13301330
    1331 // FIXME: Later
    1332 #if 0
    1333 
    13341331/** Lock packet for DMA usage
    13351332 *
     
    13401337{
    13411338        void *phys_addr;
    1342         size_t locked;
    1343         int rc = dma_lock(packet, &phys_addr, 1, &locked);
     1339        int rc = dmamem_lock(packet, &phys_addr, 1);
    13441340        if (rc != EOK)
    13451341                return NULL;
    13461342       
    1347         assert(locked == 1);
    13481343        return phys_addr;
    13491344}
     
    13531348 * @param packet
    13541349 */
    1355 void nic_dma_unlock_packet(packet_t *packet)
    1356 {
    1357         size_t unlocked;
    1358         int rc = dma_unlock(packet, 1, &unlocked);
    1359         if (rc != EOK)
    1360                 return;
    1361        
    1362         assert(unlocked == 1);
    1363 }
    1364 
    1365 #endif
     1350int nic_dma_unlock_packet(packet_t *packet)
     1351{
     1352        return dmamem_unlock(packet, 1);
     1353}
    13661354
    13671355/** @}
  • uspace/lib/usbhost/Makefile

    rd9f8dd13 rf4d5f90  
    3232        -I$(LIBUSB_PREFIX)/include \
    3333        -I$(LIBDRV_PREFIX)/include \
    34         -Iinclude 
     34        -Iinclude
    3535
    3636SOURCES = \
  • uspace/srv/fs/exfat/exfat_bitmap.c

    rd9f8dd13 rf4d5f90  
    4545#include <assert.h>
    4646#include <fibril_synch.h>
    47 #include <malloc.h>
    4847#include <mem.h>
    4948
  • uspace/srv/fs/exfat/exfat_dentry.c

    rd9f8dd13 rf4d5f90  
    101101bool exfat_valid_char(wchar_t ch)
    102102{
    103         /* TODO */
    104         return true;
     103        switch (ch) {
     104        case 0x01 ... 0x1F:
     105        case '/':
     106        case '\\':
     107        case '?':
     108        case '|':
     109        case '>':
     110        case '<':
     111        case '"':
     112        case '*':
     113        case ':':
     114                return false;
     115        default:
     116                return true;
     117        }
    105118}
    106119
    107120bool exfat_valid_name(const char *name)
    108121{
    109         /* TODO */
     122        size_t off = 0;
     123        wchar_t ch;
     124
     125        while ((ch = str_decode(name, &off, STR_NO_LIMIT)) != 0) {
     126                if (!exfat_valid_char(ch))
     127                        return false;
     128        }
    110129        return true;
    111130}
  • uspace/srv/fs/exfat/exfat_directory.c

    rd9f8dd13 rf4d5f90  
    112112                rc = block_put(di->b);
    113113                di->b = NULL;
     114                if (rc != EOK)
     115                        return rc;
    114116        }
    115117        if (!di->b) {
     
    266268                if (idx == 2 || idx == 3)
    267269                        continue;
    268                 checksum = ((checksum << 15) | (checksum >> 1)) + (uint16_t)bytes[idx];
     270                checksum = ((checksum << 15) | (checksum >> 1)) +
     271                    (uint16_t)bytes[idx];
    269272        }
    270273        return checksum;
     
    310313        array[1].stream.valid_data_size = host2uint64_t_le(ds->valid_data_size);
    311314        array[1].stream.data_size = host2uint64_t_le(ds->data_size);
    312         array[0].file.checksum = host2uint16_t_le(exfat_directory_set_checksum((uint8_t *)array,
     315        array[0].file.checksum =
     316            host2uint16_t_le(exfat_directory_set_checksum((uint8_t *)array,
    313317            count * sizeof(exfat_dentry_t)));
    314318
     
    352356        uctablep = EXFAT_NODE(fn);
    353357
    354         uctable_chars = ALIGN_DOWN(uctablep->size, sizeof(uint16_t)) / sizeof(uint16_t);
     358        uctable_chars = ALIGN_DOWN(uctablep->size,
     359            sizeof(uint16_t)) / sizeof(uint16_t);
    355360        uctable = (uint16_t *) malloc(uctable_chars * sizeof(uint16_t));
    356361        rc = exfat_read_uctable(di->bs, uctablep, (uint8_t *)uctable);
     
    417422                        return rc;
    418423
    419                 if (i == df.file.count - 2)
    420                         chars = ds.stream.name_size - EXFAT_NAME_PART_LEN*(df.file.count - 2);
     424                if (i == df.file.count - 2) {
     425                        chars = ds.stream.name_size -
     426                            EXFAT_NAME_PART_LEN*(df.file.count - 2);
     427                }
     428
    421429                rc = exfat_directory_get(di, &de);
    422430                if (rc != EOK)
  • uspace/srv/fs/exfat/exfat_fat.c

    rd9f8dd13 rf4d5f90  
    5050#include <malloc.h>
    5151#include <mem.h>
     52#include <str.h>
    5253
    5354
     
    322323                            (found == 0) ?  EXFAT_CLST_EOF : lifo[found - 1]);
    323324                        if (rc != EOK)
    324                                 break;
     325                                goto exit_error;
    325326                        found++;
    326327                        rc = bitmap_set_cluster(bs, service_id, clst);
    327328                        if (rc != EOK)
    328                                 break;
     329                                goto exit_error;
    329330
    330331                }
     
    339340        }
    340341
     342        rc = ENOSPC;
     343
     344exit_error:
     345
    341346        /* If something wrong - free the clusters */
    342347        while (found--) {
     
    347352        free(lifo);
    348353        fibril_mutex_unlock(&exfat_alloc_lock);
    349         return ENOSPC;
     354        return rc;
    350355}
    351356
     
    537542int exfat_sanity_check(exfat_bs_t *bs, service_id_t service_id)
    538543{
    539         /* TODO */
     544        if (str_cmp((char const *)bs->oem_name, "EXFAT   "))
     545                return ENOTSUP;
     546        else if (uint16_t_le2host(bs->signature) != 0xAA55)
     547                return ENOTSUP;
     548        else if (uint32_t_le2host(bs->fat_sector_count) == 0)
     549                return ENOTSUP;
     550        else if (uint32_t_le2host(bs->data_clusters) == 0)
     551                return ENOTSUP;
     552        else if (bs->fat_count != 1)
     553                return ENOTSUP;
     554        else if ((bs->bytes_per_sector + bs->sec_per_cluster) > 25) {
     555                /* exFAT does not support cluster size > 32 Mb */
     556                return ENOTSUP;
     557        }
    540558        return EOK;
    541559}
  • uspace/srv/fs/exfat/exfat_ops.c

    rd9f8dd13 rf4d5f90  
    657657                        return rc;
    658658                }
     659
     660                rc = exfat_zero_cluster(bs, service_id, nodep->firstc);
     661                if (rc != EOK) {
     662                        (void) exfat_node_put(FS_NODE(nodep));
     663                        return rc;
     664                }
     665
    659666                nodep->size = BPC(bs);
    660667        } else {
     
    739746         */
    740747        rc = exfat_directory_write_file(&di, name);
    741         if (rc != EOK)
    742                 return rc;
     748        if (rc != EOK) {
     749                (void) exfat_directory_close(&di);
     750                fibril_mutex_unlock(&parentp->idx->lock);
     751                return rc;
     752        }
    743753        rc = exfat_directory_close(&di);
    744         if (rc != EOK)
    745                 return rc;
     754        if (rc != EOK) {
     755                fibril_mutex_unlock(&parentp->idx->lock);
     756                return rc;
     757        }
    746758
    747759        fibril_mutex_unlock(&parentp->idx->lock);
     
    12581270                exfat_directory_t di;
    12591271                rc = exfat_directory_open(nodep, &di);
    1260                 if (rc != EOK) goto err;
     1272                if (rc != EOK)
     1273                        goto err;
     1274
    12611275                rc = exfat_directory_seek(&di, pos);
    12621276                if (rc != EOK) {
     
    12681282                    &df, &ds);
    12691283                if (rc == EOK)
    1270                     goto hit;
    1271                 if (rc == ENOENT)
    1272                     goto miss;
     1284                        goto hit;
     1285                else if (rc == ENOENT)
     1286                        goto miss;
     1287
     1288                (void) exfat_directory_close(&di);
    12731289
    12741290err:
     
    12791295miss:
    12801296                rc = exfat_directory_close(&di);
    1281                 if (rc!=EOK)
     1297                if (rc != EOK)
    12821298                        goto err;
    12831299                rc = exfat_node_put(fn);
     
    13971413
    13981414        (void) async_data_write_finalize(callid,
    1399                 b->data + pos % BPS(bs), bytes);
     1415            b->data + pos % BPS(bs), bytes);
    14001416        b->dirty = true;                /* need to sync block */
    14011417        rc = block_put(b);
Note: See TracChangeset for help on using the changeset viewer.