Changeset e27e36e in mainline for uspace/drv/platform/mac/mac.c


Ignore:
Timestamp:
2017-10-04T17:39:48Z (7 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c188c62
Parents:
7e55bed7
Message:

Convert CUDA driver to DDF.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/platform/mac/mac.c

    r7e55bed7 re27e36e  
    4141#include <ops/hw_res.h>
    4242#include <stdio.h>
     43#include <sysinfo.h>
    4344
    4445#define NAME  "mac"
     
    4748        hw_resource_list_t hw_resources;
    4849} mac_fun_t;
     50
     51static hw_resource_t adb_regs[] = {
     52        {
     53                .type = IO_RANGE,
     54                .res.io_range = {
     55                        .address = 0,
     56                        .size = 0x2000,
     57                        .relative = false,
     58                        .endianness = BIG_ENDIAN
     59                }
     60        },
     61};
     62
     63static mac_fun_t adb_data = {
     64        .hw_resources = {
     65                1,
     66                adb_regs
     67        }
     68};
    4969
    5070static hw_resource_t pci_conf_regs[] = {
     
    88108{
    89109        ddf_msg(LVL_DEBUG, "Adding new function '%s'.", name);
     110        printf("mac: Adding new function '%s'.\n", name);
    90111       
    91112        ddf_fun_t *fnode = NULL;
     
    114135        }
    115136       
     137        printf("mac: Added new function '%s' (str=%s).\n", name, str_match_id);
    116138        return true;
    117139       
     
    135157static int mac_dev_add(ddf_dev_t *dev)
    136158{
     159        int rc;
     160        uintptr_t cuda_physical;
    137161#if 0
    138162        /* Register functions */
    139         if (!mac_add_fun(dev, "pci0", "intel_pci", &pci_data))
    140                 ddf_msg(LVL_ERROR, "Failed to add functions for Mac platform.");
     163        if (!mac_add_fun(dev, "pci0", "intel_pci", &pci_data)) {
     164                ddf_msg(LVL_ERROR, "Failed to add PCI function for Mac platform.");
     165                return EIO;
     166        }
    141167#else
    142168        (void)pci_data;
    143         (void)mac_add_fun;
    144169#endif
    145        
     170        rc = sysinfo_get_value("cuda.address.physical", &cuda_physical);
     171        if (rc != EOK)
     172                return EIO;
     173
     174        adb_regs[0].res.io_range.address = cuda_physical;
     175
     176        if (!mac_add_fun(dev, "adb", "cuda_adb", &adb_data)) {
     177                ddf_msg(LVL_ERROR, "Failed to add ADB function for Mac platform.");
     178                return EIO;
     179        }
     180
    146181        return EOK;
    147182}
Note: See TracChangeset for help on using the changeset viewer.