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