Ignore:
File:
1 edited

Legend:

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

    rc188c62 r0f2a9be  
    11/*
    22 * Copyright (c) 2011 Martin Decky
    3  * Copyright (c) 2017 Jiri Svoboda
    43 * All rights reserved.
    54 *
     
    4140#include <errno.h>
    4241#include <ops/hw_res.h>
    43 #include <ops/pio_window.h>
    4442#include <stdio.h>
    45 #include <sysinfo.h>
    4643
    4744#define NAME  "mac"
     
    4946typedef struct {
    5047        hw_resource_list_t hw_resources;
    51         pio_window_t pio_window;
    5248} mac_fun_t;
    53 
    54 static hw_resource_t adb_res[] = {
    55         {
    56                 .type = IO_RANGE,
    57                 .res.io_range = {
    58                         .address = 0,
    59                         .size = 0x2000,
    60                         .relative = true,
    61                         .endianness = BIG_ENDIAN
    62                 }
    63         },
    64         {
    65                 .type = INTERRUPT,
    66                 .res.interrupt = {
    67                         .irq = 0 /* patched at run time */
    68                 }
    69         },
    70 };
    71 
    72 static mac_fun_t adb_data = {
    73         .hw_resources = {
    74                 sizeof(adb_res) / sizeof(adb_res[0]),
    75                 adb_res
    76         },
    77         .pio_window = {
    78                 .io = {
    79                         .base = 0, /* patched at run time */
    80                         .size = 0x2000
    81                 }
    82         }
    83 };
    8449
    8550static hw_resource_t pci_conf_regs[] = {
     
    11479
    11580/** Obtain function soft-state from DDF function node */
    116 static mac_fun_t *mac_fun(ddf_fun_t *ddf_fun)
     81static mac_fun_t *mac_fun(ddf_fun_t *fnode)
    11782{
    118         return ddf_fun_data_get(ddf_fun);
    119 }
    120 
    121 static pio_window_t *mac_get_pio_window(ddf_fun_t *ddf_fun)
    122 {
    123         mac_fun_t *fun = mac_fun(ddf_fun);
    124         return &fun->pio_window;
     83        return ddf_fun_data_get(fnode);
    12584}
    12685
     
    12988{
    13089        ddf_msg(LVL_DEBUG, "Adding new function '%s'.", name);
    131         printf("mac: Adding new function '%s'.\n", name);
    13290       
    13391        ddf_fun_t *fnode = NULL;
     
    156114        }
    157115       
    158         printf("mac: Added new function '%s' (str=%s).\n", name, str_match_id);
    159116        return true;
    160117       
     
    178135static int mac_dev_add(ddf_dev_t *dev)
    179136{
    180         int rc;
    181         uintptr_t cuda_physical;
    182         sysarg_t cuda_inr;
    183137#if 0
    184138        /* Register functions */
    185         if (!mac_add_fun(dev, "pci0", "intel_pci", &pci_data)) {
    186                 ddf_msg(LVL_ERROR, "Failed to add PCI function for Mac platform.");
    187                 return EIO;
    188         }
     139        if (!mac_add_fun(dev, "pci0", "intel_pci", &pci_data))
     140                ddf_msg(LVL_ERROR, "Failed to add functions for Mac platform.");
    189141#else
    190142        (void)pci_data;
     143        (void)mac_add_fun;
    191144#endif
    192         rc = sysinfo_get_value("cuda.address.physical", &cuda_physical);
    193         if (rc != EOK)
    194                 return EIO;
    195         rc = sysinfo_get_value("cuda.inr", &cuda_inr);
    196         if (rc != EOK)
    197                 return EIO;
    198 
    199         adb_data.pio_window.io.base = cuda_physical;
    200         adb_res[1].res.interrupt.irq = cuda_inr;
    201 
    202         if (!mac_add_fun(dev, "adb", "cuda_adb", &adb_data)) {
    203                 ddf_msg(LVL_ERROR, "Failed to add ADB function for Mac platform.");
    204                 return EIO;
    205         }
    206 
     145       
    207146        return EOK;
    208147}
     
    234173}
    235174
    236 static pio_window_ops_t fun_pio_window_ops = {
    237         .get_pio_window = &mac_get_pio_window
    238 };
    239 
    240175static hw_res_ops_t fun_hw_res_ops = {
    241176        .get_resource_list = &mac_get_resources,
     
    248183        ddf_log_init(NAME);
    249184        mac_fun_ops.interfaces[HW_RES_DEV_IFACE] = &fun_hw_res_ops;
    250         mac_fun_ops.interfaces[PIO_WINDOW_DEV_IFACE] = &fun_pio_window_ops;
    251185        return ddf_driver_main(&mac_driver);
    252186}
Note: See TracChangeset for help on using the changeset viewer.