Changeset c188c62 in mainline for uspace/drv/platform/mac/mac.c
- Timestamp:
- 2017-10-05T18:00:52Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 81b9d3e
- Parents:
- e27e36e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/platform/mac/mac.c
re27e36e rc188c62 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> 43 45 #include <sysinfo.h> … … 47 49 typedef struct { 48 50 hw_resource_list_t hw_resources; 51 pio_window_t pio_window; 49 52 } mac_fun_t; 50 53 51 static hw_resource_t adb_re gs[] = {54 static hw_resource_t adb_res[] = { 52 55 { 53 56 .type = IO_RANGE, … … 55 58 .address = 0, 56 59 .size = 0x2000, 57 .relative = false,60 .relative = true, 58 61 .endianness = BIG_ENDIAN 62 } 63 }, 64 { 65 .type = INTERRUPT, 66 .res.interrupt = { 67 .irq = 0 /* patched at run time */ 59 68 } 60 69 }, … … 63 72 static mac_fun_t adb_data = { 64 73 .hw_resources = { 65 1, 66 adb_regs 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 } 67 82 } 68 83 }; … … 99 114 100 115 /** Obtain function soft-state from DDF function node */ 101 static mac_fun_t *mac_fun(ddf_fun_t *fnode) 102 { 103 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; 104 125 } 105 126 … … 159 180 int rc; 160 181 uintptr_t cuda_physical; 182 sysarg_t cuda_inr; 161 183 #if 0 162 184 /* Register functions */ … … 171 193 if (rc != EOK) 172 194 return EIO; 173 174 adb_regs[0].res.io_range.address = cuda_physical; 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; 175 201 176 202 if (!mac_add_fun(dev, "adb", "cuda_adb", &adb_data)) { … … 208 234 } 209 235 236 static pio_window_ops_t fun_pio_window_ops = { 237 .get_pio_window = &mac_get_pio_window 238 }; 239 210 240 static hw_res_ops_t fun_hw_res_ops = { 211 241 .get_resource_list = &mac_get_resources, … … 218 248 ddf_log_init(NAME); 219 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; 220 251 return ddf_driver_main(&mac_driver); 221 252 }
Note:
See TracChangeset
for help on using the changeset viewer.