Changes in uspace/drv/platform/mac/mac.c [cccd60c3:0f2a9be] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/platform/mac/mac.c
rcccd60c3 r0f2a9be 1 1 /* 2 2 * Copyright (c) 2011 Martin Decky 3 * Copyright (c) 2017 Jiri Svoboda4 3 * All rights reserved. 5 4 * … … 41 40 #include <errno.h> 42 41 #include <ops/hw_res.h> 43 #include <ops/pio_window.h>44 42 #include <stdio.h> 45 #include <sysinfo.h>46 43 47 44 #define NAME "mac" … … 49 46 typedef struct { 50 47 hw_resource_list_t hw_resources; 51 pio_window_t pio_window;52 48 } 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_ENDIAN62 }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_res76 },77 .pio_window = {78 .io = {79 .base = 0, /* patched at run time */80 .size = 0x200081 }82 }83 };84 49 85 50 static hw_resource_t pci_conf_regs[] = { … … 114 79 115 80 /** Obtain function soft-state from DDF function node */ 116 static mac_fun_t *mac_fun(ddf_fun_t * ddf_fun)81 static mac_fun_t *mac_fun(ddf_fun_t *fnode) 117 82 { 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); 125 84 } 126 85 … … 129 88 { 130 89 ddf_msg(LVL_DEBUG, "Adding new function '%s'.", name); 131 printf("mac: Adding new function '%s'.\n", name);132 90 133 91 ddf_fun_t *fnode = NULL; … … 156 114 } 157 115 158 printf("mac: Added new function '%s' (str=%s).\n", name, str_match_id);159 116 return true; 160 117 … … 178 135 static int mac_dev_add(ddf_dev_t *dev) 179 136 { 180 int rc;181 uintptr_t cuda_physical;182 sysarg_t cuda_inr;183 137 #if 0 184 138 /* 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."); 189 141 #else 190 142 (void)pci_data; 143 (void)mac_add_fun; 191 144 #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 207 146 return EOK; 208 147 } … … 227 166 } 228 167 229 static int mac_enable_interrupt(ddf_fun_t *fun, int irq)168 static bool mac_enable_interrupt(ddf_fun_t *fun) 230 169 { 231 170 /* TODO */ … … 233 172 return false; 234 173 } 235 236 static pio_window_ops_t fun_pio_window_ops = {237 .get_pio_window = &mac_get_pio_window238 };239 174 240 175 static hw_res_ops_t fun_hw_res_ops = { … … 248 183 ddf_log_init(NAME); 249 184 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;251 185 return ddf_driver_main(&mac_driver); 252 186 }
Note:
See TracChangeset
for help on using the changeset viewer.