Changes in uspace/drv/char/sun4v-con/main.c [7aa94304:f4cfd271] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/char/sun4v-con/main.c
r7aa94304 rf4cfd271 32 32 #include <ddf/driver.h> 33 33 #include <ddf/log.h> 34 #include <device/hw_res_parsed.h> 34 35 #include <errno.h> 35 36 #include <stdio.h> … … 58 59 }; 59 60 61 static int sun4v_con_get_res(ddf_dev_t *dev, sun4v_con_res_t *res) 62 { 63 async_sess_t *parent_sess; 64 hw_res_list_parsed_t hw_res; 65 int rc; 66 67 parent_sess = ddf_dev_parent_sess_get(dev); 68 if (parent_sess == NULL) 69 return ENOMEM; 70 71 hw_res_list_parsed_init(&hw_res); 72 rc = hw_res_get_list_parsed(parent_sess, &hw_res, 0); 73 if (rc != EOK) 74 return rc; 75 76 if (hw_res.mem_ranges.count != 2) { 77 rc = EINVAL; 78 goto error; 79 } 80 81 res->in_base = RNGABS(hw_res.mem_ranges.ranges[0]); 82 res->out_base = RNGABS(hw_res.mem_ranges.ranges[1]); 83 return EOK; 84 error: 85 hw_res_list_parsed_clean(&hw_res); 86 return rc; 87 } 88 89 60 90 static int sun4v_con_dev_add(ddf_dev_t *dev) 61 91 { 62 92 sun4v_con_t *sun4v_con; 93 sun4v_con_res_t res; 94 int rc; 63 95 64 96 ddf_msg(LVL_DEBUG, "sun4v_con_dev_add(%p)", dev); … … 71 103 sun4v_con->dev = dev; 72 104 73 return sun4v_con_add(sun4v_con); 105 rc = sun4v_con_get_res(dev, &res); 106 if (rc != EOK) { 107 ddf_msg(LVL_ERROR, "Failed getting hardware resource list.\n"); 108 return EIO; 109 } 110 111 return sun4v_con_add(sun4v_con, &res); 74 112 } 75 113
Note:
See TracChangeset
for help on using the changeset viewer.