Changeset 5a6cc679 in mainline for uspace/drv/nic
- Timestamp:
- 2018-01-31T02:21:24Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a0a9cc2
- Parents:
- 132ab5d1
- Location:
- uspace/drv/nic
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/nic/ar9271/ar9271.c
r132ab5d1 r5a6cc679 99 99 100 100 /* Callback when new device is to be controlled by this driver. */ 101 static int ar9271_add_device(ddf_dev_t *);101 static errno_t ar9271_add_device(ddf_dev_t *); 102 102 103 103 /* IEEE 802.11 callbacks */ 104 static int ar9271_ieee80211_start(ieee80211_dev_t *);105 static int ar9271_ieee80211_tx_handler(ieee80211_dev_t *, void *, size_t);106 static int ar9271_ieee80211_set_freq(ieee80211_dev_t *, uint16_t);107 static int ar9271_ieee80211_bssid_change(ieee80211_dev_t *, bool);108 static int ar9271_ieee80211_key_config(ieee80211_dev_t *, ieee80211_key_config_t *,104 static errno_t ar9271_ieee80211_start(ieee80211_dev_t *); 105 static errno_t ar9271_ieee80211_tx_handler(ieee80211_dev_t *, void *, size_t); 106 static errno_t ar9271_ieee80211_set_freq(ieee80211_dev_t *, uint16_t); 107 static errno_t ar9271_ieee80211_bssid_change(ieee80211_dev_t *, bool); 108 static errno_t ar9271_ieee80211_key_config(ieee80211_dev_t *, ieee80211_key_config_t *, 109 109 bool); 110 110 … … 128 128 static ieee80211_iface_t ar9271_ieee80211_iface; 129 129 130 static int ar9271_get_device_info(ddf_fun_t *, nic_device_info_t *);131 static int ar9271_get_cable_state(ddf_fun_t *, nic_cable_state_t *);132 static int ar9271_get_operation_mode(ddf_fun_t *, int *, nic_channel_mode_t *,130 static errno_t ar9271_get_device_info(ddf_fun_t *, nic_device_info_t *); 131 static errno_t ar9271_get_cable_state(ddf_fun_t *, nic_cable_state_t *); 132 static errno_t ar9271_get_operation_mode(ddf_fun_t *, int *, nic_channel_mode_t *, 133 133 nic_role_t *); 134 134 … … 144 144 * 145 145 */ 146 static int ar9271_get_device_info(ddf_fun_t *dev, nic_device_info_t *info)146 static errno_t ar9271_get_device_info(ddf_fun_t *dev, nic_device_info_t *info) 147 147 { 148 148 assert(dev); … … 164 164 * 165 165 */ 166 static int ar9271_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state)166 static errno_t ar9271_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state) 167 167 { 168 168 *state = NIC_CS_PLUGGED; … … 174 174 * 175 175 */ 176 static int ar9271_get_operation_mode(ddf_fun_t *fun, int *speed,176 static errno_t ar9271_get_operation_mode(ddf_fun_t *fun, int *speed, 177 177 nic_channel_mode_t *duplex, nic_role_t *role) 178 178 { … … 187 187 * 188 188 */ 189 static int ar9271_on_multicast_mode_change(nic_t *nic,189 static errno_t ar9271_on_multicast_mode_change(nic_t *nic, 190 190 nic_multicast_mode_t mode, const nic_address_t *addr, size_t addr_cnt) 191 191 { … … 210 210 * 211 211 */ 212 static int ar9271_on_unicast_mode_change(nic_t *nic, nic_unicast_mode_t mode,212 static errno_t ar9271_on_unicast_mode_change(nic_t *nic, nic_unicast_mode_t mode, 213 213 const nic_address_t *addr, size_t addr_cnt) 214 214 { … … 236 236 * 237 237 */ 238 static int ar9271_on_broadcast_mode_change(nic_t *nic,238 static errno_t ar9271_on_broadcast_mode_change(nic_t *nic, 239 239 nic_broadcast_mode_t mode) 240 240 { … … 258 258 } 259 259 260 static int ar9271_data_polling(void *arg)260 static errno_t ar9271_data_polling(void *arg) 261 261 { 262 262 assert(arg); … … 319 319 * 320 320 */ 321 static int ar9271_ieee80211_set_freq(ieee80211_dev_t *ieee80211_dev,321 static errno_t ar9271_ieee80211_set_freq(ieee80211_dev_t *ieee80211_dev, 322 322 uint16_t freq) 323 323 { … … 330 330 wmi_send_command(ar9271->htc_device, WMI_STOP_RECV, NULL, 0, NULL); 331 331 332 int rc = hw_freq_switch(ar9271, freq);332 errno_t rc = hw_freq_switch(ar9271, freq); 333 333 if (rc != EOK) { 334 334 usb_log_error("Failed to HW switch frequency.\n"); … … 352 352 } 353 353 354 static int ar9271_ieee80211_bssid_change(ieee80211_dev_t *ieee80211_dev,354 static errno_t ar9271_ieee80211_bssid_change(ieee80211_dev_t *ieee80211_dev, 355 355 bool connected) 356 356 { … … 401 401 } 402 402 403 static int ar9271_ieee80211_key_config(ieee80211_dev_t *ieee80211_dev,403 static errno_t ar9271_ieee80211_key_config(ieee80211_dev_t *ieee80211_dev, 404 404 ieee80211_key_config_t *key_conf, bool insert) 405 405 { … … 519 519 } 520 520 521 static int ar9271_ieee80211_tx_handler(ieee80211_dev_t *ieee80211_dev,521 static errno_t ar9271_ieee80211_tx_handler(ieee80211_dev_t *ieee80211_dev, 522 522 void *buffer, size_t buffer_size) 523 523 { … … 608 608 } 609 609 610 static int ar9271_ieee80211_start(ieee80211_dev_t *ieee80211_dev)610 static errno_t ar9271_ieee80211_start(ieee80211_dev_t *ieee80211_dev) 611 611 { 612 612 assert(ieee80211_dev); … … 616 616 wmi_send_command(ar9271->htc_device, WMI_FLUSH_RECV, NULL, 0, NULL); 617 617 618 int rc = hw_reset(ar9271);618 errno_t rc = hw_reset(ar9271); 619 619 if (rc != EOK) { 620 620 usb_log_error("Failed to do HW reset.\n"); … … 666 666 } 667 667 668 static int ar9271_init(ar9271_t *ar9271, usb_device_t *usb_device, const usb_endpoint_description_t **endpoints)668 static errno_t ar9271_init(ar9271_t *ar9271, usb_device_t *usb_device, const usb_endpoint_description_t **endpoints) 669 669 { 670 670 ar9271->starting_up = true; … … 680 680 } 681 681 682 int rc = ath_usb_init(ar9271->ath_device, usb_device, endpoints);682 errno_t rc = ath_usb_init(ar9271->ath_device, usb_device, endpoints); 683 683 if (rc != EOK) { 684 684 free(ar9271->ath_device); … … 737 737 * 738 738 */ 739 static int ar9271_upload_fw(ar9271_t *ar9271)739 static errno_t ar9271_upload_fw(ar9271_t *ar9271) 740 740 { 741 741 usb_device_t *usb_device = ar9271->usb_device; … … 775 775 memcpy(buffer, current_data, chunk_size); 776 776 usb_pipe_t *ctrl_pipe = usb_device_get_default_pipe(usb_device); 777 int rc = usb_control_request_set(ctrl_pipe,777 errno_t rc = usb_control_request_set(ctrl_pipe, 778 778 USB_REQUEST_TYPE_VENDOR, 779 779 USB_REQUEST_RECIPIENT_DEVICE, … … 803 803 */ 804 804 usb_pipe_t *ctrl_pipe = usb_device_get_default_pipe(usb_device); 805 int rc = usb_control_request_set(ctrl_pipe,805 errno_t rc = usb_control_request_set(ctrl_pipe, 806 806 USB_REQUEST_TYPE_VENDOR, 807 807 USB_REQUEST_RECIPIENT_DEVICE, … … 834 834 /* USB framework initialization. */ 835 835 const char *err_msg = NULL; 836 int rc = usb_device_create_ddf(dev, endpoints, &err_msg);836 errno_t rc = usb_device_create_ddf(dev, endpoints, &err_msg); 837 837 if (rc != EOK) { 838 838 usb_log_error("Failed to create USB device: %s, " … … 879 879 * @return EOK if succeed, error code otherwise 880 880 */ 881 static int ar9271_add_device(ddf_dev_t *dev)881 static errno_t ar9271_add_device(ddf_dev_t *dev) 882 882 { 883 883 assert(dev); … … 896 896 897 897 /* Initialize AR9271 HTC services. */ 898 int rc = htc_init(ar9271->htc_device);898 errno_t rc = htc_init(ar9271->htc_device); 899 899 if (rc != EOK) { 900 900 ar9271_delete_dev_data(ar9271); -
uspace/drv/nic/ar9271/ath.h
r132ab5d1 r5a6cc679 40 40 /** Atheros wifi operations. */ 41 41 typedef struct { 42 int (*send_ctrl_message)(struct ath *, void *, size_t);43 int (*read_ctrl_message)(struct ath *, void *, size_t, size_t *);44 int (*send_data_message)(struct ath *, void *, size_t);45 int (*read_data_message)(struct ath *, void *, size_t, size_t *);42 errno_t (*send_ctrl_message)(struct ath *, void *, size_t); 43 errno_t (*read_ctrl_message)(struct ath *, void *, size_t, size_t *); 44 errno_t (*send_data_message)(struct ath *, void *, size_t); 45 errno_t (*read_data_message)(struct ath *, void *, size_t, size_t *); 46 46 } ath_ops_t; 47 47 -
uspace/drv/nic/ar9271/ath_usb.c
r132ab5d1 r5a6cc679 39 39 #include "ath_usb.h" 40 40 41 static int ath_usb_send_ctrl_message(ath_t *, void *, size_t);42 static int ath_usb_read_ctrl_message(ath_t *, void *, size_t, size_t *);43 static int ath_usb_send_data_message(ath_t *, void *, size_t);44 static int ath_usb_read_data_message(ath_t *, void *, size_t, size_t *);41 static errno_t ath_usb_send_ctrl_message(ath_t *, void *, size_t); 42 static errno_t ath_usb_read_ctrl_message(ath_t *, void *, size_t, size_t *); 43 static errno_t ath_usb_send_data_message(ath_t *, void *, size_t); 44 static errno_t ath_usb_read_data_message(ath_t *, void *, size_t, size_t *); 45 45 46 46 static ath_ops_t ath_usb_ops = { … … 59 59 * 60 60 */ 61 int ath_usb_init(ath_t *ath, usb_device_t *usb_device, const usb_endpoint_description_t **endpoints)61 errno_t ath_usb_init(ath_t *ath, usb_device_t *usb_device, const usb_endpoint_description_t **endpoints) 62 62 { 63 63 ath_usb_t *ath_usb = malloc(sizeof(ath_usb_t)); … … 110 110 * 111 111 */ 112 static int ath_usb_send_ctrl_message(ath_t *ath, void *buffer,112 static errno_t ath_usb_send_ctrl_message(ath_t *ath, void *buffer, 113 113 size_t buffer_size) 114 114 { … … 127 127 * 128 128 */ 129 static int ath_usb_read_ctrl_message(ath_t *ath, void *buffer,129 static errno_t ath_usb_read_ctrl_message(ath_t *ath, void *buffer, 130 130 size_t buffer_size, size_t *transferred_size) 131 131 { … … 143 143 * 144 144 */ 145 static int ath_usb_send_data_message(ath_t *ath, void *buffer,145 static errno_t ath_usb_send_data_message(ath_t *ath, void *buffer, 146 146 size_t buffer_size) 147 147 { … … 158 158 159 159 ath_usb_t *ath_usb = (ath_usb_t *) ath->specific_data; 160 int ret_val = usb_pipe_write(ath_usb->output_data_pipe, complete_buffer,161 complete_buffer _size);160 const errno_t ret_val = usb_pipe_write(ath_usb->output_data_pipe, 161 complete_buffer, complete_buffer_size); 162 162 163 163 free(complete_buffer); … … 176 176 * 177 177 */ 178 static int ath_usb_read_data_message(ath_t *ath, void *buffer,178 static errno_t ath_usb_read_data_message(ath_t *ath, void *buffer, 179 179 size_t buffer_size, size_t *transferred_size) 180 180 { -
uspace/drv/nic/ar9271/ath_usb.h
r132ab5d1 r5a6cc679 59 59 } ath_usb_data_header_t; 60 60 61 extern int ath_usb_init(ath_t *, usb_device_t *, const usb_endpoint_description_t **endpoints);61 extern errno_t ath_usb_init(ath_t *, usb_device_t *, const usb_endpoint_description_t **endpoints); 62 62 63 63 #endif /* ATHEROS_ATH_USB_H */ -
uspace/drv/nic/ar9271/htc.c
r132ab5d1 r5a6cc679 66 66 } 67 67 68 int htc_init_new_vif(htc_device_t *htc_device)68 errno_t htc_init_new_vif(htc_device_t *htc_device) 69 69 { 70 70 htc_vif_msg_t vif_msg; … … 153 153 * 154 154 */ 155 int htc_send_control_message(htc_device_t *htc_device, void *buffer,155 errno_t htc_send_control_message(htc_device_t *htc_device, void *buffer, 156 156 size_t buffer_size, uint8_t endpoint_id) 157 157 { … … 176 176 * 177 177 */ 178 int htc_send_data_message(htc_device_t *htc_device, void *buffer,178 errno_t htc_send_data_message(htc_device_t *htc_device, void *buffer, 179 179 size_t buffer_size, uint8_t endpoint_id) 180 180 { … … 199 199 * 200 200 */ 201 int htc_read_data_message(htc_device_t *htc_device, void *buffer,201 errno_t htc_read_data_message(htc_device_t *htc_device, void *buffer, 202 202 size_t buffer_size, size_t *transferred_size) 203 203 { … … 219 219 * 220 220 */ 221 int htc_read_control_message(htc_device_t *htc_device, void *buffer,221 errno_t htc_read_control_message(htc_device_t *htc_device, void *buffer, 222 222 size_t buffer_size, size_t *transferred_size) 223 223 { … … 239 239 * 240 240 */ 241 static int htc_connect_service(htc_device_t *htc_device,241 static errno_t htc_connect_service(htc_device_t *htc_device, 242 242 wmi_services_t service_id, int *response_endpoint_no) 243 243 { … … 261 261 262 262 /* Send HTC message. */ 263 int rc = htc_send_control_message(htc_device, buffer, buffer_size,263 errno_t rc = htc_send_control_message(htc_device, buffer, buffer_size, 264 264 htc_device->endpoints.ctrl_endpoint); 265 265 if (rc != EOK) { … … 312 312 * 313 313 */ 314 static int htc_config_credits(htc_device_t *htc_device)314 static errno_t htc_config_credits(htc_device_t *htc_device) 315 315 { 316 316 size_t buffer_size = sizeof(htc_frame_header_t) + … … 327 327 328 328 /* Send HTC message. */ 329 int rc = htc_send_control_message(htc_device, buffer, buffer_size,329 errno_t rc = htc_send_control_message(htc_device, buffer, buffer_size, 330 330 htc_device->endpoints.ctrl_endpoint); 331 331 if (rc != EOK) { … … 360 360 * 361 361 */ 362 static int htc_complete_setup(htc_device_t *htc_device)362 static errno_t htc_complete_setup(htc_device_t *htc_device) 363 363 { 364 364 size_t buffer_size = sizeof(htc_frame_header_t) + … … 373 373 374 374 /* Send HTC message. */ 375 int rc = htc_send_control_message(htc_device, buffer, buffer_size,375 errno_t rc = htc_send_control_message(htc_device, buffer, buffer_size, 376 376 htc_device->endpoints.ctrl_endpoint); 377 377 if (rc != EOK) … … 394 394 * 395 395 */ 396 static int htc_check_ready(htc_device_t *htc_device)396 static errno_t htc_check_ready(htc_device_t *htc_device) 397 397 { 398 398 size_t buffer_size = htc_device->ath_device->ctrl_response_length; … … 400 400 401 401 /* Read response from device. */ 402 int rc = htc_read_control_message(htc_device, buffer, buffer_size,402 errno_t rc = htc_read_control_message(htc_device, buffer, buffer_size, 403 403 NULL); 404 404 if (rc != EOK) { … … 430 430 * 431 431 */ 432 int htc_device_init(ath_t *ath_device, ieee80211_dev_t *ieee80211_dev,432 errno_t htc_device_init(ath_t *ath_device, ieee80211_dev_t *ieee80211_dev, 433 433 htc_device_t *htc_device) 434 434 { … … 451 451 * 452 452 */ 453 int htc_init(htc_device_t *htc_device)453 errno_t htc_init(htc_device_t *htc_device) 454 454 { 455 455 /* First check ready message in device. */ 456 int rc = htc_check_ready(htc_device);456 errno_t rc = htc_check_ready(htc_device); 457 457 if (rc != EOK) { 458 458 usb_log_error("Device is not in ready state after loading " -
uspace/drv/nic/ar9271/htc.h
r132ab5d1 r5a6cc679 297 297 } __attribute__((packed)) htc_setup_complete_msg_t; 298 298 299 extern int htc_device_init(ath_t *, ieee80211_dev_t *, htc_device_t *);300 extern int htc_init(htc_device_t *);301 extern int htc_init_new_vif(htc_device_t *);302 extern int htc_read_control_message(htc_device_t *, void *, size_t, size_t *);303 extern int htc_read_data_message(htc_device_t *, void *, size_t, size_t *);304 extern int htc_send_control_message(htc_device_t *, void *, size_t, uint8_t);305 extern int htc_send_data_message(htc_device_t *, void *, size_t, uint8_t);299 extern errno_t htc_device_init(ath_t *, ieee80211_dev_t *, htc_device_t *); 300 extern errno_t htc_init(htc_device_t *); 301 extern errno_t htc_init_new_vif(htc_device_t *); 302 extern errno_t htc_read_control_message(htc_device_t *, void *, size_t, size_t *); 303 extern errno_t htc_read_data_message(htc_device_t *, void *, size_t, size_t *); 304 extern errno_t htc_send_control_message(htc_device_t *, void *, size_t, uint8_t); 305 extern errno_t htc_send_data_message(htc_device_t *, void *, size_t, uint8_t); 306 306 307 307 #endif /* ATHEROS_HTC_H */ -
uspace/drv/nic/ar9271/hw.c
r132ab5d1 r5a6cc679 52 52 * 53 53 */ 54 static int hw_read_wait(ar9271_t *ar9271, uint32_t offset, uint32_t mask,54 static errno_t hw_read_wait(ar9271_t *ar9271, uint32_t offset, uint32_t mask, 55 55 uint32_t value) 56 56 { … … 67 67 } 68 68 69 static int hw_reset_power_on(ar9271_t *ar9271)69 static errno_t hw_reset_power_on(ar9271_t *ar9271) 70 70 { 71 71 wmi_reg_t buffer[] = { … … 93 93 wmi_reg_write(ar9271->htc_device, AR9271_RTC_RESET, 1); 94 94 95 int rc = hw_read_wait(ar9271,95 errno_t rc = hw_read_wait(ar9271, 96 96 AR9271_RTC_STATUS, 97 97 AR9271_RTC_STATUS_MASK, … … 105 105 } 106 106 107 static int hw_set_reset(ar9271_t *ar9271, bool cold)107 static errno_t hw_set_reset(ar9271_t *ar9271, bool cold) 108 108 { 109 109 uint32_t reset_value = AR9271_RTC_RC_MAC_WARM; … … 135 135 wmi_reg_write(ar9271->htc_device, AR9271_RTC_RC, 0); 136 136 137 int rc = hw_read_wait(ar9271, AR9271_RTC_RC, AR9271_RTC_RC_MASK, 0);137 errno_t rc = hw_read_wait(ar9271, AR9271_RTC_RC, AR9271_RTC_RC_MASK, 0); 138 138 if (rc != EOK) { 139 139 usb_log_error("Failed to wait for RTC RC register.\n"); … … 148 148 } 149 149 150 static int hw_addr_init(ar9271_t *ar9271)150 static errno_t hw_addr_init(ar9271_t *ar9271) 151 151 { 152 152 uint32_t value; … … 164 164 nic_t *nic = nic_get_from_ddf_dev(ar9271->ddf_dev); 165 165 166 int rc = nic_report_address(nic, &ar9271_address);166 errno_t rc = nic_report_address(nic, &ar9271_address); 167 167 if (rc != EOK) { 168 168 usb_log_error("Failed to report NIC HW address.\n"); … … 173 173 } 174 174 175 static int hw_gpio_set_output(ar9271_t *ar9271, uint32_t gpio, uint32_t type)175 static errno_t hw_gpio_set_output(ar9271_t *ar9271, uint32_t gpio, uint32_t type) 176 176 { 177 177 uint32_t address; … … 204 204 } 205 205 206 static int hw_gpio_set_value(ar9271_t *ar9271, uint32_t gpio, uint32_t value)206 static errno_t hw_gpio_set_value(ar9271_t *ar9271, uint32_t gpio, uint32_t value) 207 207 { 208 208 wmi_reg_set_clear_bit(ar9271->htc_device, AR9271_GPIO_IN_OUT, … … 218 218 * 219 219 */ 220 static int hw_init_proc(ar9271_t *ar9271)221 { 222 int rc = hw_reset_power_on(ar9271);220 static errno_t hw_init_proc(ar9271_t *ar9271) 221 { 222 errno_t rc = hw_reset_power_on(ar9271); 223 223 if (rc != EOK) { 224 224 usb_log_error("Failed to HW reset power on.\n"); … … 241 241 } 242 242 243 static int hw_init_led(ar9271_t *ar9271)244 { 245 int rc = hw_gpio_set_output(ar9271, AR9271_LED_PIN,243 static errno_t hw_init_led(ar9271_t *ar9271) 244 { 245 errno_t rc = hw_gpio_set_output(ar9271, AR9271_LED_PIN, 246 246 AR9271_GPIO_OUT_MUX_AS_OUT); 247 247 if (rc != EOK) { … … 259 259 } 260 260 261 static int hw_activate_phy(ar9271_t *ar9271)261 static errno_t hw_activate_phy(ar9271_t *ar9271) 262 262 { 263 263 wmi_reg_write(ar9271->htc_device, AR9271_PHY_ACTIVE, 1); … … 267 267 } 268 268 269 static int hw_set_operating_mode(ar9271_t *ar9271,269 static errno_t hw_set_operating_mode(ar9271_t *ar9271, 270 270 ieee80211_operating_mode_t op_mode) 271 271 { … … 295 295 } 296 296 297 static int hw_reset_operating_mode(ar9271_t *ar9271)298 { 299 int rc = hw_set_operating_mode(ar9271, IEEE80211_OPMODE_STATION);297 static errno_t hw_reset_operating_mode(ar9271_t *ar9271) 298 { 299 errno_t rc = hw_set_operating_mode(ar9271, IEEE80211_OPMODE_STATION); 300 300 if (rc != EOK) { 301 301 usb_log_error("Failed to set opmode to station.\n"); … … 306 306 } 307 307 308 static int hw_noise_floor_calibration(ar9271_t *ar9271)308 static errno_t hw_noise_floor_calibration(ar9271_t *ar9271) 309 309 { 310 310 uint32_t value; … … 325 325 AR9271_AGC_CONTROL_NF_CALIB); 326 326 327 int rc = hw_read_wait(ar9271, AR9271_AGC_CONTROL,327 errno_t rc = hw_read_wait(ar9271, AR9271_AGC_CONTROL, 328 328 AR9271_AGC_CONTROL_NF_CALIB, 0); 329 329 if (rc != EOK) { … … 344 344 } 345 345 346 static int hw_set_freq(ar9271_t *ar9271, uint16_t freq)346 static errno_t hw_set_freq(ar9271_t *ar9271, uint16_t freq) 347 347 { 348 348 /* Not supported channel frequency. */ … … 373 373 } 374 374 375 int hw_freq_switch(ar9271_t *ar9271, uint16_t freq)375 errno_t hw_freq_switch(ar9271_t *ar9271, uint16_t freq) 376 376 { 377 377 wmi_reg_write(ar9271->htc_device, AR9271_PHY_RFBUS_KILL, 0x1); 378 378 379 int rc = hw_read_wait(ar9271, AR9271_PHY_RFBUS_GRANT, 0x1, 0x1);379 errno_t rc = hw_read_wait(ar9271, AR9271_PHY_RFBUS_GRANT, 0x1, 0x1); 380 380 if (rc != EOK) { 381 381 usb_log_error("Failed to kill RF bus.\n"); … … 407 407 } 408 408 409 int hw_set_rx_filter(ar9271_t *ar9271, bool assoc)409 errno_t hw_set_rx_filter(ar9271_t *ar9271, bool assoc) 410 410 { 411 411 uint32_t additional_bits = 0; … … 425 425 } 426 426 427 int hw_set_bssid(ar9271_t *ar9271)427 errno_t hw_set_bssid(ar9271_t *ar9271) 428 428 { 429 429 ieee80211_dev_t *ieee80211_dev = ar9271->ieee80211_dev; … … 445 445 } 446 446 447 int hw_rx_init(ar9271_t *ar9271)447 errno_t hw_rx_init(ar9271_t *ar9271) 448 448 { 449 449 wmi_reg_write(ar9271->htc_device, AR9271_COMMAND, 450 450 AR9271_COMMAND_RX_ENABLE); 451 451 452 int rc = hw_set_rx_filter(ar9271, false);452 errno_t rc = hw_set_rx_filter(ar9271, false); 453 453 if (rc != EOK) { 454 454 usb_log_error("Failed to set RX filtering.\n"); … … 465 465 } 466 466 467 static int hw_init_pll(ar9271_t *ar9271)467 static errno_t hw_init_pll(ar9271_t *ar9271) 468 468 { 469 469 /* Some magic here (set for 2GHz channels). But VERY important :-) */ … … 510 510 } 511 511 512 static int hw_calibration(ar9271_t *ar9271)512 static errno_t hw_calibration(ar9271_t *ar9271) 513 513 { 514 514 wmi_reg_set_bit(ar9271->htc_device, AR9271_CARRIER_LEAK_CONTROL, … … 523 523 AR9271_AGC_CONTROL_CALIB); 524 524 525 int rc = hw_read_wait(ar9271, AR9271_AGC_CONTROL,525 errno_t rc = hw_read_wait(ar9271, AR9271_AGC_CONTROL, 526 526 AR9271_AGC_CONTROL_CALIB, 0); 527 527 if (rc != EOK) { … … 540 540 } 541 541 542 int hw_reset(ar9271_t *ar9271)542 errno_t hw_reset(ar9271_t *ar9271) 543 543 { 544 544 /* Set physical layer as deactivated. */ … … 559 559 hw_set_reset(ar9271, true); 560 560 561 int rc = hw_init_pll(ar9271);561 errno_t rc = hw_init_pll(ar9271); 562 562 if (rc != EOK) { 563 563 usb_log_error("Failed to init PLL.\n"); … … 638 638 * @return EOK if succeed, error code otherwise. 639 639 */ 640 int hw_init(ar9271_t *ar9271)641 { 642 int rc = hw_init_proc(ar9271);640 errno_t hw_init(ar9271_t *ar9271) 641 { 642 errno_t rc = hw_init_proc(ar9271); 643 643 if (rc != EOK) { 644 644 usb_log_error("Failed to HW reset device.\n"); -
uspace/drv/nic/ar9271/hw.h
r132ab5d1 r5a6cc679 41 41 #define HW_WAIT_TIME_US 10 42 42 43 extern int hw_init(ar9271_t *);44 extern int hw_freq_switch(ar9271_t *, uint16_t);45 extern int hw_rx_init(ar9271_t *);46 extern int hw_reset(ar9271_t *);47 extern int hw_set_bssid(ar9271_t *);48 extern int hw_set_rx_filter(ar9271_t *, bool);43 extern errno_t hw_init(ar9271_t *); 44 extern errno_t hw_freq_switch(ar9271_t *, uint16_t); 45 extern errno_t hw_rx_init(ar9271_t *); 46 extern errno_t hw_reset(ar9271_t *); 47 extern errno_t hw_set_bssid(ar9271_t *); 48 extern errno_t hw_set_rx_filter(ar9271_t *, bool); 49 49 50 50 #endif /* ATHEROS_HW_H */ -
uspace/drv/nic/ar9271/wmi.c
r132ab5d1 r5a6cc679 50 50 * 51 51 */ 52 int wmi_reg_read(htc_device_t *htc_device, uint32_t reg_offset, uint32_t *res)52 errno_t wmi_reg_read(htc_device_t *htc_device, uint32_t reg_offset, uint32_t *res) 53 53 { 54 54 uint32_t cmd_value = host2uint32_t_be(reg_offset); … … 57 57 malloc(htc_device->ath_device->ctrl_response_length); 58 58 59 int rc = wmi_send_command(htc_device, WMI_REG_READ,59 errno_t rc = wmi_send_command(htc_device, WMI_REG_READ, 60 60 (uint8_t *) &cmd_value, sizeof(cmd_value), resp_buffer); 61 61 … … 82 82 * 83 83 */ 84 int wmi_reg_write(htc_device_t *htc_device, uint32_t reg_offset, uint32_t val)84 errno_t wmi_reg_write(htc_device_t *htc_device, uint32_t reg_offset, uint32_t val) 85 85 { 86 86 uint32_t cmd_buffer[] = { … … 92 92 malloc(htc_device->ath_device->ctrl_response_length); 93 93 94 int rc = wmi_send_command(htc_device, WMI_REG_WRITE,94 errno_t rc = wmi_send_command(htc_device, WMI_REG_WRITE, 95 95 (uint8_t *) &cmd_buffer, sizeof(cmd_buffer), resp_buffer); 96 96 … … 115 115 * 116 116 */ 117 int wmi_reg_set_clear_bit(htc_device_t *htc_device, uint32_t reg_offset,117 errno_t wmi_reg_set_clear_bit(htc_device_t *htc_device, uint32_t reg_offset, 118 118 uint32_t set_bit, uint32_t clear_bit) 119 119 { 120 120 uint32_t value; 121 121 122 int rc = wmi_reg_read(htc_device, reg_offset, &value);122 errno_t rc = wmi_reg_read(htc_device, reg_offset, &value); 123 123 if (rc != EOK) { 124 124 usb_log_error("Failed to read registry value in RMW " … … 149 149 * 150 150 */ 151 int wmi_reg_set_bit(htc_device_t *htc_device, uint32_t reg_offset,151 errno_t wmi_reg_set_bit(htc_device_t *htc_device, uint32_t reg_offset, 152 152 uint32_t set_bit) 153 153 { … … 164 164 * 165 165 */ 166 int wmi_reg_clear_bit(htc_device_t *htc_device, uint32_t reg_offset,166 errno_t wmi_reg_clear_bit(htc_device_t *htc_device, uint32_t reg_offset, 167 167 uint32_t clear_bit) 168 168 { … … 179 179 * 180 180 */ 181 int wmi_reg_buffer_write(htc_device_t *htc_device, wmi_reg_t *reg_buffer,181 errno_t wmi_reg_buffer_write(htc_device_t *htc_device, wmi_reg_t *reg_buffer, 182 182 size_t elements) 183 183 { … … 198 198 } 199 199 200 int rc = wmi_send_command(htc_device, WMI_REG_WRITE,200 errno_t rc = wmi_send_command(htc_device, WMI_REG_WRITE, 201 201 (uint8_t *) buffer, buffer_size, resp_buffer); 202 202 … … 223 223 * 224 224 */ 225 int wmi_send_command(htc_device_t *htc_device, wmi_command_t command_id,225 errno_t wmi_send_command(htc_device_t *htc_device, wmi_command_t command_id, 226 226 uint8_t *command_buffer, uint32_t command_length, void *response_buffer) 227 227 { … … 242 242 243 243 /* Send message. */ 244 int rc = htc_send_control_message(htc_device, buffer, buffer_size,244 errno_t rc = htc_send_control_message(htc_device, buffer, buffer_size, 245 245 htc_device->endpoints.wmi_endpoint); 246 246 if (rc != EOK) { -
uspace/drv/nic/ar9271/wmi.h
r132ab5d1 r5a6cc679 117 117 } wmi_reg_t; 118 118 119 extern int wmi_reg_read(htc_device_t *, uint32_t, uint32_t *);120 extern int wmi_reg_write(htc_device_t *, uint32_t, uint32_t);121 extern int wmi_reg_set_clear_bit(htc_device_t *, uint32_t, uint32_t, uint32_t);122 extern int wmi_reg_set_bit(htc_device_t *, uint32_t, uint32_t);123 extern int wmi_reg_clear_bit(htc_device_t *, uint32_t, uint32_t);124 extern int wmi_reg_buffer_write(htc_device_t *, wmi_reg_t *, size_t);125 extern int wmi_send_command(htc_device_t *, wmi_command_t, uint8_t *, uint32_t,119 extern errno_t wmi_reg_read(htc_device_t *, uint32_t, uint32_t *); 120 extern errno_t wmi_reg_write(htc_device_t *, uint32_t, uint32_t); 121 extern errno_t wmi_reg_set_clear_bit(htc_device_t *, uint32_t, uint32_t, uint32_t); 122 extern errno_t wmi_reg_set_bit(htc_device_t *, uint32_t, uint32_t); 123 extern errno_t wmi_reg_clear_bit(htc_device_t *, uint32_t, uint32_t); 124 extern errno_t wmi_reg_buffer_write(htc_device_t *, wmi_reg_t *, size_t); 125 extern errno_t wmi_send_command(htc_device_t *, wmi_command_t, uint8_t *, uint32_t, 126 126 void *); 127 127 -
uspace/drv/nic/e1k/e1k.c
r132ab5d1 r5a6cc679 179 179 FIBRIL_MUTEX_INITIALIZE(irq_reg_mutex); 180 180 181 static int e1000_get_address(e1000_t *, nic_address_t *);181 static errno_t e1000_get_address(e1000_t *, nic_address_t *); 182 182 static void e1000_eeprom_get_address(e1000_t *, nic_address_t *); 183 static int e1000_set_addr(ddf_fun_t *, const nic_address_t *);184 185 static int e1000_defective_get_mode(ddf_fun_t *, uint32_t *);186 static int e1000_defective_set_mode(ddf_fun_t *, uint32_t);187 188 static int e1000_get_cable_state(ddf_fun_t *, nic_cable_state_t *);189 static int e1000_get_device_info(ddf_fun_t *, nic_device_info_t *);190 static int e1000_get_operation_mode(ddf_fun_t *, int *,183 static errno_t e1000_set_addr(ddf_fun_t *, const nic_address_t *); 184 185 static errno_t e1000_defective_get_mode(ddf_fun_t *, uint32_t *); 186 static errno_t e1000_defective_set_mode(ddf_fun_t *, uint32_t); 187 188 static errno_t e1000_get_cable_state(ddf_fun_t *, nic_cable_state_t *); 189 static errno_t e1000_get_device_info(ddf_fun_t *, nic_device_info_t *); 190 static errno_t e1000_get_operation_mode(ddf_fun_t *, int *, 191 191 nic_channel_mode_t *, nic_role_t *); 192 static int e1000_set_operation_mode(ddf_fun_t *, int,192 static errno_t e1000_set_operation_mode(ddf_fun_t *, int, 193 193 nic_channel_mode_t, nic_role_t); 194 static int e1000_autoneg_enable(ddf_fun_t *, uint32_t);195 static int e1000_autoneg_disable(ddf_fun_t *);196 static int e1000_autoneg_restart(ddf_fun_t *);197 198 static int e1000_vlan_set_tag(ddf_fun_t *, uint16_t, bool, bool);194 static errno_t e1000_autoneg_enable(ddf_fun_t *, uint32_t); 195 static errno_t e1000_autoneg_disable(ddf_fun_t *); 196 static errno_t e1000_autoneg_restart(ddf_fun_t *); 197 198 static errno_t e1000_vlan_set_tag(ddf_fun_t *, uint16_t, bool, bool); 199 199 200 200 /** Network interface options for E1000 card driver */ … … 219 219 static ddf_dev_ops_t e1000_dev_ops; 220 220 221 static int e1000_dev_add(ddf_dev_t *);221 static errno_t e1000_dev_add(ddf_dev_t *); 222 222 223 223 /** Basic driver operations for E1000 driver */ … … 233 233 234 234 /* The default implementation callbacks */ 235 static int e1000_on_activating(nic_t *);236 static int e1000_on_stopping(nic_t *);235 static errno_t e1000_on_activating(nic_t *); 236 static errno_t e1000_on_stopping(nic_t *); 237 237 static void e1000_send_frame(nic_t *, void *, size_t); 238 238 … … 288 288 * 289 289 */ 290 static int e1000_get_device_info(ddf_fun_t *dev, nic_device_info_t *info)290 static errno_t e1000_get_device_info(ddf_fun_t *dev, nic_device_info_t *info) 291 291 { 292 292 assert(dev); … … 316 316 * 317 317 */ 318 static int e1000_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state)318 static errno_t e1000_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state) 319 319 { 320 320 e1000_t *e1000 = DRIVER_DATA_FUN(fun); … … 335 335 * 336 336 */ 337 static int e1000_get_operation_mode(ddf_fun_t *fun, int *speed,337 static errno_t e1000_get_operation_mode(ddf_fun_t *fun, int *speed, 338 338 nic_channel_mode_t *duplex, nic_role_t *role) 339 339 { … … 386 386 * 387 387 */ 388 static int e1000_set_operation_mode(ddf_fun_t *fun, int speed,388 static errno_t e1000_set_operation_mode(ddf_fun_t *fun, int speed, 389 389 nic_channel_mode_t duplex, nic_role_t role) 390 390 { … … 434 434 * 435 435 */ 436 static int e1000_autoneg_enable(ddf_fun_t *fun, uint32_t advertisement)436 static errno_t e1000_autoneg_enable(ddf_fun_t *fun, uint32_t advertisement) 437 437 { 438 438 e1000_t *e1000 = DRIVER_DATA_FUN(fun); … … 462 462 * 463 463 */ 464 static int e1000_autoneg_disable(ddf_fun_t *fun)464 static errno_t e1000_autoneg_disable(ddf_fun_t *fun) 465 465 { 466 466 e1000_t *e1000 = DRIVER_DATA_FUN(fun); … … 490 490 * 491 491 */ 492 static int e1000_autoneg_restart(ddf_fun_t *dev)492 static errno_t e1000_autoneg_restart(ddf_fun_t *dev) 493 493 { 494 494 return e1000_autoneg_enable(dev, 0); … … 501 501 * 502 502 */ 503 static int e1000_defective_get_mode(ddf_fun_t *fun, uint32_t *mode)503 static errno_t e1000_defective_get_mode(ddf_fun_t *fun, uint32_t *mode) 504 504 { 505 505 e1000_t *e1000 = DRIVER_DATA_FUN(fun); … … 522 522 * 523 523 */ 524 static int e1000_defective_set_mode(ddf_fun_t *fun, uint32_t mode)524 static errno_t e1000_defective_set_mode(ddf_fun_t *fun, uint32_t mode) 525 525 { 526 526 e1000_t *e1000 = DRIVER_DATA_FUN(fun); 527 int rc = EOK;527 errno_t rc = EOK; 528 528 529 529 fibril_mutex_lock(&e1000->rx_lock); … … 827 827 * 828 828 */ 829 static int e1000_on_multicast_mode_change(nic_t *nic, nic_multicast_mode_t mode,829 static errno_t e1000_on_multicast_mode_change(nic_t *nic, nic_multicast_mode_t mode, 830 830 const nic_address_t *addr, size_t addr_cnt) 831 831 { 832 832 e1000_t *e1000 = DRIVER_DATA_NIC(nic); 833 int rc = EOK;833 errno_t rc = EOK; 834 834 835 835 fibril_mutex_lock(&e1000->rx_lock); … … 881 881 * 882 882 */ 883 static int e1000_on_unicast_mode_change(nic_t *nic, nic_unicast_mode_t mode,883 static errno_t e1000_on_unicast_mode_change(nic_t *nic, nic_unicast_mode_t mode, 884 884 const nic_address_t *addr, size_t addr_cnt) 885 885 { 886 886 e1000_t *e1000 = DRIVER_DATA_NIC(nic); 887 int rc = EOK;887 errno_t rc = EOK; 888 888 889 889 fibril_mutex_lock(&e1000->rx_lock); … … 937 937 * 938 938 */ 939 static int e1000_on_broadcast_mode_change(nic_t *nic, nic_broadcast_mode_t mode)939 static errno_t e1000_on_broadcast_mode_change(nic_t *nic, nic_broadcast_mode_t mode) 940 940 { 941 941 e1000_t *e1000 = DRIVER_DATA_NIC(nic); 942 int rc = EOK;942 errno_t rc = EOK; 943 943 944 944 fibril_mutex_lock(&e1000->rx_lock); … … 1048 1048 * 1049 1049 */ 1050 static int e1000_vlan_set_tag(ddf_fun_t *fun, uint16_t tag, bool add,1050 static errno_t e1000_vlan_set_tag(ddf_fun_t *fun, uint16_t tag, bool add, 1051 1051 bool strip) 1052 1052 { … … 1264 1264 * 1265 1265 */ 1266 inline static int e1000_register_int_handler(nic_t *nic, cap_handle_t *handle)1266 inline static errno_t e1000_register_int_handler(nic_t *nic, cap_handle_t *handle) 1267 1267 { 1268 1268 e1000_t *e1000 = DRIVER_DATA_NIC(nic); … … 1275 1275 e1000_irq_code.cmds[2].addr = e1000->reg_base_phys + E1000_IMC; 1276 1276 1277 int rc = register_interrupt_handler(nic_get_ddf_dev(nic), e1000->irq,1277 errno_t rc = register_interrupt_handler(nic_get_ddf_dev(nic), e1000->irq, 1278 1278 e1000_interrupt_handler, &e1000_irq_code, handle); 1279 1279 … … 1319 1319 * 1320 1320 */ 1321 static int e1000_poll_mode_change(nic_t *nic, nic_poll_mode_t mode,1321 static errno_t e1000_poll_mode_change(nic_t *nic, nic_poll_mode_t mode, 1322 1322 const struct timeval *period) 1323 1323 { … … 1373 1373 * 1374 1374 */ 1375 static int e1000_initialize_rx_structure(nic_t *nic)1375 static errno_t e1000_initialize_rx_structure(nic_t *nic) 1376 1376 { 1377 1377 e1000_t *e1000 = DRIVER_DATA_NIC(nic); … … 1379 1379 1380 1380 e1000->rx_ring_virt = AS_AREA_ANY; 1381 int rc = dmamem_map_anonymous(1381 errno_t rc = dmamem_map_anonymous( 1382 1382 E1000_RX_FRAME_COUNT * sizeof(e1000_rx_descriptor_t), 1383 1383 DMAMEM_4GiB, AS_AREA_READ | AS_AREA_WRITE, 0, … … 1567 1567 * 1568 1568 */ 1569 static int e1000_initialize_tx_structure(e1000_t *e1000)1569 static errno_t e1000_initialize_tx_structure(e1000_t *e1000) 1570 1570 { 1571 1571 size_t i; … … 1579 1579 e1000->tx_frame_virt = NULL; 1580 1580 1581 int rc = dmamem_map_anonymous(1581 errno_t rc = dmamem_map_anonymous( 1582 1582 E1000_TX_FRAME_COUNT * sizeof(e1000_tx_descriptor_t), 1583 1583 DMAMEM_4GiB, AS_AREA_READ | AS_AREA_WRITE, 0, … … 1718 1718 * 1719 1719 */ 1720 static int e1000_reset(nic_t *nic)1720 static errno_t e1000_reset(nic_t *nic) 1721 1721 { 1722 1722 e1000_t *e1000 = DRIVER_DATA_NIC(nic); … … 1749 1749 * 1750 1750 */ 1751 static int e1000_on_activating(nic_t *nic)1751 static errno_t e1000_on_activating(nic_t *nic) 1752 1752 { 1753 1753 assert(nic); … … 1761 1761 e1000_enable_interrupts(e1000); 1762 1762 1763 int rc = hw_res_enable_interrupt(e1000->parent_sess, e1000->irq);1763 errno_t rc = hw_res_enable_interrupt(e1000->parent_sess, e1000->irq); 1764 1764 if (rc != EOK) { 1765 1765 e1000_disable_interrupts(e1000); … … 1795 1795 * 1796 1796 */ 1797 static int e1000_on_down_unlocked(nic_t *nic)1797 static errno_t e1000_on_down_unlocked(nic_t *nic) 1798 1798 { 1799 1799 e1000_t *e1000 = DRIVER_DATA_NIC(nic); … … 1826 1826 * 1827 1827 */ 1828 static int e1000_on_down(nic_t *nic)1828 static errno_t e1000_on_down(nic_t *nic) 1829 1829 { 1830 1830 e1000_t *e1000 = DRIVER_DATA_NIC(nic); … … 1834 1834 fibril_mutex_lock(&e1000->ctrl_lock); 1835 1835 1836 int rc = e1000_on_down_unlocked(nic);1836 errno_t rc = e1000_on_down_unlocked(nic); 1837 1837 1838 1838 fibril_mutex_unlock(&e1000->ctrl_lock); … … 1851 1851 * 1852 1852 */ 1853 static int e1000_on_stopping(nic_t *nic)1853 static errno_t e1000_on_stopping(nic_t *nic) 1854 1854 { 1855 1855 e1000_t *e1000 = DRIVER_DATA_NIC(nic); … … 1859 1859 fibril_mutex_lock(&e1000->ctrl_lock); 1860 1860 1861 int rc = e1000_on_down_unlocked(nic);1861 errno_t rc = e1000_on_down_unlocked(nic); 1862 1862 if (rc == EOK) 1863 1863 rc = e1000_reset(nic); … … 1943 1943 * 1944 1944 */ 1945 static int e1000_fill_resource_info(ddf_dev_t *dev,1945 static errno_t e1000_fill_resource_info(ddf_dev_t *dev, 1946 1946 const hw_res_list_parsed_t *hw_resources) 1947 1947 { … … 1968 1968 * 1969 1969 */ 1970 static int e1000_get_resource_info(ddf_dev_t *dev)1970 static errno_t e1000_get_resource_info(ddf_dev_t *dev) 1971 1971 { 1972 1972 assert(dev != NULL); … … 1977 1977 1978 1978 /* Get hw resources form parent driver */ 1979 int rc = nic_get_resources(NIC_DATA_DEV(dev), &hw_res_parsed);1979 errno_t rc = nic_get_resources(NIC_DATA_DEV(dev), &hw_res_parsed); 1980 1980 if (rc != EOK) 1981 1981 return rc; … … 1996 1996 * 1997 1997 */ 1998 static int e1000_device_initialize(ddf_dev_t *dev)1998 static errno_t e1000_device_initialize(ddf_dev_t *dev) 1999 1999 { 2000 2000 /* Allocate driver data for the device. */ … … 2012 2012 2013 2013 /* Obtain and fill hardware resources info */ 2014 int rc = e1000_get_resource_info(dev);2014 errno_t rc = e1000_get_resource_info(dev); 2015 2015 if (rc != EOK) { 2016 2016 ddf_msg(LVL_ERROR, "Cannot obtain hardware resources"); … … 2110 2110 * 2111 2111 */ 2112 static int e1000_pio_enable(ddf_dev_t *dev)2112 static errno_t e1000_pio_enable(ddf_dev_t *dev) 2113 2113 { 2114 2114 e1000_t *e1000 = DRIVER_DATA_DEV(dev); 2115 2115 2116 int rc = pio_enable(e1000->reg_base_phys, 8 * PAGE_SIZE,2116 errno_t rc = pio_enable(e1000->reg_base_phys, 8 * PAGE_SIZE, 2117 2117 &e1000->reg_base_virt); 2118 2118 if (rc != EOK) … … 2127 2127 * 2128 2128 */ 2129 int e1000_dev_add(ddf_dev_t *dev)2129 errno_t e1000_dev_add(ddf_dev_t *dev) 2130 2130 { 2131 2131 ddf_fun_t *fun; 2132 2132 2133 2133 /* Initialize device structure for E1000 */ 2134 int rc = e1000_device_initialize(dev);2134 errno_t rc = e1000_device_initialize(dev); 2135 2135 if (rc != EOK) 2136 2136 return rc; … … 2258 2258 * 2259 2259 */ 2260 static int e1000_get_address(e1000_t *e1000, nic_address_t *address)2260 static errno_t e1000_get_address(e1000_t *e1000, nic_address_t *address) 2261 2261 { 2262 2262 fibril_mutex_lock(&e1000->rx_lock); … … 2291 2291 * @return An error code otherwise 2292 2292 */ 2293 static int e1000_set_addr(ddf_fun_t *fun, const nic_address_t *addr)2293 static errno_t e1000_set_addr(ddf_fun_t *fun, const nic_address_t *addr) 2294 2294 { 2295 2295 nic_t *nic = NIC_DATA_FUN(fun); … … 2299 2299 fibril_mutex_lock(&e1000->tx_lock); 2300 2300 2301 int rc = nic_report_address(nic, addr);2301 errno_t rc = nic_report_address(nic, addr); 2302 2302 if (rc == EOK) 2303 2303 e1000_write_receive_address(e1000, 0, addr, false); -
uspace/drv/nic/ne2k/dp8390.c
r132ab5d1 r5a6cc679 194 194 * 195 195 */ 196 int ne2k_probe(ne2k_t *ne2k)196 errno_t ne2k_probe(ne2k_t *ne2k) 197 197 { 198 198 unsigned int i; … … 250 250 * 251 251 */ 252 int ne2k_up(ne2k_t *ne2k)252 errno_t ne2k_up(ne2k_t *ne2k) 253 253 { 254 254 if (!ne2k->probed) -
uspace/drv/nic/ne2k/dp8390.h
r132ab5d1 r5a6cc679 265 265 } ne2k_t; 266 266 267 extern int ne2k_probe(ne2k_t *);268 extern int ne2k_up(ne2k_t *);267 extern errno_t ne2k_probe(ne2k_t *); 268 extern errno_t ne2k_up(ne2k_t *); 269 269 extern void ne2k_down(ne2k_t *); 270 270 extern void ne2k_send(nic_t *, void *, size_t); -
uspace/drv/nic/ne2k/ne2k.c
r132ab5d1 r5a6cc679 124 124 static void ne2k_interrupt_handler(ipc_call_t *, ddf_dev_t *); 125 125 126 static int ne2k_register_interrupt(nic_t *nic_data, cap_handle_t *handle)126 static errno_t ne2k_register_interrupt(nic_t *nic_data, cap_handle_t *handle) 127 127 { 128 128 ne2k_t *ne2k = (ne2k_t *) nic_get_specific(nic_data); … … 178 178 } 179 179 180 static int ne2k_dev_init(nic_t *nic_data)180 static errno_t ne2k_dev_init(nic_t *nic_data) 181 181 { 182 182 /* Get HW resources */ … … 184 184 hw_res_list_parsed_init(&hw_res_parsed); 185 185 186 int rc = nic_get_resources(nic_data, &hw_res_parsed);186 errno_t rc = nic_get_resources(nic_data, &hw_res_parsed); 187 187 188 188 if (rc != EOK) … … 243 243 } 244 244 245 static int ne2k_on_activating(nic_t *nic_data)245 static errno_t ne2k_on_activating(nic_t *nic_data) 246 246 { 247 247 ne2k_t *ne2k = (ne2k_t *) nic_get_specific(nic_data); 248 248 249 249 if (!ne2k->up) { 250 int rc = ne2k_up(ne2k);250 errno_t rc = ne2k_up(ne2k); 251 251 if (rc != EOK) 252 252 return rc; … … 261 261 } 262 262 263 static int ne2k_on_stopping(nic_t *nic_data)263 static errno_t ne2k_on_stopping(nic_t *nic_data) 264 264 { 265 265 ne2k_t *ne2k = (ne2k_t *) nic_get_specific(nic_data); … … 271 271 } 272 272 273 static int ne2k_set_address(ddf_fun_t *fun, const nic_address_t *address)273 static errno_t ne2k_set_address(ddf_fun_t *fun, const nic_address_t *address) 274 274 { 275 275 nic_t *nic_data = DRIVER_DATA(ddf_fun_get_dev(fun)); 276 int rc = nic_report_address(nic_data, address);276 errno_t rc = nic_report_address(nic_data, address); 277 277 if (rc != EOK) { 278 278 return EINVAL; … … 286 286 } 287 287 288 static int ne2k_on_unicast_mode_change(nic_t *nic_data,288 static errno_t ne2k_on_unicast_mode_change(nic_t *nic_data, 289 289 nic_unicast_mode_t new_mode, 290 290 const nic_address_t *address_list, size_t address_count) … … 313 313 } 314 314 315 static int ne2k_on_multicast_mode_change(nic_t *nic_data,315 static errno_t ne2k_on_multicast_mode_change(nic_t *nic_data, 316 316 nic_multicast_mode_t new_mode, 317 317 const nic_address_t *address_list, size_t address_count) … … 339 339 } 340 340 341 static int ne2k_on_broadcast_mode_change(nic_t *nic_data,341 static errno_t ne2k_on_broadcast_mode_change(nic_t *nic_data, 342 342 nic_broadcast_mode_t new_mode) 343 343 { … … 355 355 } 356 356 357 static int ne2k_dev_add(ddf_dev_t *dev)357 static errno_t ne2k_dev_add(ddf_dev_t *dev) 358 358 { 359 359 ddf_fun_t *fun; … … 387 387 } 388 388 389 int rc = ne2k_dev_init(nic_data);389 errno_t rc = ne2k_dev_init(nic_data); 390 390 if (rc != EOK) { 391 391 ne2k_dev_cleanup(dev); -
uspace/drv/nic/rtl8139/driver.c
r132ab5d1 r5a6cc679 280 280 } 281 281 282 static int rtl8139_set_addr(ddf_fun_t *fun, const nic_address_t *);283 static int rtl8139_get_device_info(ddf_fun_t *fun, nic_device_info_t *info);284 static int rtl8139_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state);285 static int rtl8139_get_operation_mode(ddf_fun_t *fun, int *speed,282 static errno_t rtl8139_set_addr(ddf_fun_t *fun, const nic_address_t *); 283 static errno_t rtl8139_get_device_info(ddf_fun_t *fun, nic_device_info_t *info); 284 static errno_t rtl8139_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state); 285 static errno_t rtl8139_get_operation_mode(ddf_fun_t *fun, int *speed, 286 286 nic_channel_mode_t *duplex, nic_role_t *role); 287 static int rtl8139_set_operation_mode(ddf_fun_t *fun, int speed,287 static errno_t rtl8139_set_operation_mode(ddf_fun_t *fun, int speed, 288 288 nic_channel_mode_t duplex, nic_role_t); 289 289 290 static int rtl8139_pause_get(ddf_fun_t*, nic_result_t*, nic_result_t*,290 static errno_t rtl8139_pause_get(ddf_fun_t*, nic_result_t*, nic_result_t*, 291 291 uint16_t *); 292 static int rtl8139_pause_set(ddf_fun_t*, int, int, uint16_t);293 294 static int rtl8139_autoneg_enable(ddf_fun_t *fun, uint32_t advertisement);295 static int rtl8139_autoneg_disable(ddf_fun_t *fun);296 static int rtl8139_autoneg_probe(ddf_fun_t *fun, uint32_t *our_advertisement,292 static errno_t rtl8139_pause_set(ddf_fun_t*, int, int, uint16_t); 293 294 static errno_t rtl8139_autoneg_enable(ddf_fun_t *fun, uint32_t advertisement); 295 static errno_t rtl8139_autoneg_disable(ddf_fun_t *fun); 296 static errno_t rtl8139_autoneg_probe(ddf_fun_t *fun, uint32_t *our_advertisement, 297 297 uint32_t *their_advertisement, nic_result_t *result, 298 298 nic_result_t *their_result); 299 static int rtl8139_autoneg_restart(ddf_fun_t *fun);300 301 static int rtl8139_defective_get_mode(ddf_fun_t *fun, uint32_t *mode);302 static int rtl8139_defective_set_mode(ddf_fun_t *fun, uint32_t mode);303 304 static int rtl8139_wol_virtue_add(nic_t *nic_data,299 static errno_t rtl8139_autoneg_restart(ddf_fun_t *fun); 300 301 static errno_t rtl8139_defective_get_mode(ddf_fun_t *fun, uint32_t *mode); 302 static errno_t rtl8139_defective_set_mode(ddf_fun_t *fun, uint32_t mode); 303 304 static errno_t rtl8139_wol_virtue_add(nic_t *nic_data, 305 305 const nic_wol_virtue_t *virtue); 306 306 static void rtl8139_wol_virtue_rem(nic_t *nic_data, 307 307 const nic_wol_virtue_t *virtue); 308 308 309 static int rtl8139_poll_mode_change(nic_t *nic_data, nic_poll_mode_t mode,309 static errno_t rtl8139_poll_mode_change(nic_t *nic_data, nic_poll_mode_t mode, 310 310 const struct timeval *period); 311 311 static void rtl8139_poll(nic_t *nic_data); … … 334 334 static ddf_dev_ops_t rtl8139_dev_ops; 335 335 336 static int rtl8139_dev_add(ddf_dev_t *dev);336 static errno_t rtl8139_dev_add(ddf_dev_t *dev); 337 337 338 338 /** Basic driver operations for RTL8139 driver */ … … 348 348 349 349 /* The default implementation callbacks */ 350 static int rtl8139_on_activated(nic_t *nic_data);351 static int rtl8139_on_stopped(nic_t *nic_data);350 static errno_t rtl8139_on_activated(nic_t *nic_data); 351 static errno_t rtl8139_on_stopped(nic_t *nic_data); 352 352 static void rtl8139_send_frame(nic_t *nic_data, void *data, size_t size); 353 353 … … 846 846 * @return An error code otherwise. 847 847 */ 848 inline static int rtl8139_register_int_handler(nic_t *nic_data, cap_handle_t *handle)848 inline static errno_t rtl8139_register_int_handler(nic_t *nic_data, cap_handle_t *handle) 849 849 { 850 850 rtl8139_t *rtl8139 = nic_get_specific(nic_data); … … 857 857 rtl8139_irq_code.cmds[2].addr = rtl8139->io_addr + ISR; 858 858 rtl8139_irq_code.cmds[3].addr = rtl8139->io_addr + IMR; 859 int rc = register_interrupt_handler(nic_get_ddf_dev(nic_data),859 errno_t rc = register_interrupt_handler(nic_get_ddf_dev(nic_data), 860 860 rtl8139->irq, rtl8139_interrupt_handler, &rtl8139_irq_code, handle); 861 861 … … 904 904 * @return EOK if activated successfully, error code otherwise 905 905 */ 906 static int rtl8139_on_activated(nic_t *nic_data)906 static errno_t rtl8139_on_activated(nic_t *nic_data) 907 907 { 908 908 assert(nic_data); … … 919 919 rtl8139_hw_int_set(rtl8139); 920 920 921 int rc = hw_res_enable_interrupt(rtl8139->parent_sess, rtl8139->irq);921 errno_t rc = hw_res_enable_interrupt(rtl8139->parent_sess, rtl8139->irq); 922 922 if (rc != EOK) { 923 923 rtl8139_on_stopped(nic_data); … … 935 935 * @return EOK if succeed, error code otherwise 936 936 */ 937 static int rtl8139_on_stopped(nic_t *nic_data)937 static errno_t rtl8139_on_stopped(nic_t *nic_data) 938 938 { 939 939 assert(nic_data); … … 955 955 956 956 957 static int rtl8139_unicast_set(nic_t *nic_data, nic_unicast_mode_t mode,957 static errno_t rtl8139_unicast_set(nic_t *nic_data, nic_unicast_mode_t mode, 958 958 const nic_address_t *, size_t); 959 static int rtl8139_multicast_set(nic_t *nic_data, nic_multicast_mode_t mode,959 static errno_t rtl8139_multicast_set(nic_t *nic_data, nic_multicast_mode_t mode, 960 960 const nic_address_t *addr, size_t addr_count); 961 static int rtl8139_broadcast_set(nic_t *nic_data, nic_broadcast_mode_t mode);961 static errno_t rtl8139_broadcast_set(nic_t *nic_data, nic_broadcast_mode_t mode); 962 962 963 963 … … 1027 1027 * @return EOK if succeed, error code otherwise 1028 1028 */ 1029 static int rtl8139_fill_resource_info(ddf_dev_t *dev, const hw_res_list_parsed_t1029 static errno_t rtl8139_fill_resource_info(ddf_dev_t *dev, const hw_res_list_parsed_t 1030 1030 *hw_resources) 1031 1031 { … … 1067 1067 * @return EOK if succeed, error code otherwise 1068 1068 */ 1069 static int rtl8139_get_resource_info(ddf_dev_t *dev)1069 static errno_t rtl8139_get_resource_info(ddf_dev_t *dev) 1070 1070 { 1071 1071 assert(dev); … … 1078 1078 1079 1079 /* Get hw resources form parent driver */ 1080 int rc = nic_get_resources(nic_data, &hw_res_parsed);1080 errno_t rc = nic_get_resources(nic_data, &hw_res_parsed); 1081 1081 if (rc != EOK) 1082 1082 return rc; 1083 1083 1084 1084 /* Fill resources information to the device */ 1085 int ret = rtl8139_fill_resource_info(dev, &hw_res_parsed);1085 errno_t ret = rtl8139_fill_resource_info(dev, &hw_res_parsed); 1086 1086 hw_res_list_parsed_clean(&hw_res_parsed); 1087 1087 … … 1098 1098 * @return EOK in the case of success, error code otherwise 1099 1099 */ 1100 static int rtl8139_buffers_create(rtl8139_t *rtl8139)1100 static errno_t rtl8139_buffers_create(rtl8139_t *rtl8139) 1101 1101 { 1102 1102 size_t i = 0; 1103 int rc;1103 errno_t rc; 1104 1104 1105 1105 ddf_msg(LVL_DEBUG, "Creating buffers"); … … 1149 1149 * @return EOK if succeed, error code otherwise 1150 1150 */ 1151 static int rtl8139_device_initialize(ddf_dev_t *dev)1151 static errno_t rtl8139_device_initialize(ddf_dev_t *dev) 1152 1152 { 1153 1153 ddf_msg(LVL_DEBUG, "rtl8139_dev_initialize %s", ddf_dev_get_name(dev)); 1154 1154 1155 int ret = EOK;1155 errno_t ret = EOK; 1156 1156 1157 1157 ddf_msg(LVL_DEBUG, "rtl8139: creating device data"); … … 1208 1208 * @return EOK if successed, error code otherwise 1209 1209 */ 1210 static int rtl8139_pio_enable(ddf_dev_t *dev)1210 static errno_t rtl8139_pio_enable(ddf_dev_t *dev) 1211 1211 { 1212 1212 ddf_msg(LVL_DEBUG, NAME ": rtl8139_pio_enable %s", ddf_dev_get_name(dev)); … … 1258 1258 * @return EOK if added successfully, error code otherwise 1259 1259 */ 1260 int rtl8139_dev_add(ddf_dev_t *dev)1260 errno_t rtl8139_dev_add(ddf_dev_t *dev) 1261 1261 { 1262 1262 ddf_fun_t *fun; … … 1266 1266 1267 1267 /* Init device structure for rtl8139 */ 1268 int rc = rtl8139_device_initialize(dev);1268 errno_t rc = rtl8139_device_initialize(dev); 1269 1269 if (rc != EOK) 1270 1270 return rc; … … 1341 1341 * @return EOK if succeed, error code otherwise 1342 1342 */ 1343 static int rtl8139_set_addr(ddf_fun_t *fun, const nic_address_t *addr)1343 static errno_t rtl8139_set_addr(ddf_fun_t *fun, const nic_address_t *addr) 1344 1344 { 1345 1345 assert(fun); … … 1352 1352 rtl8139_lock_all(rtl8139); 1353 1353 1354 int rc = nic_report_address(nic_data, addr);1354 errno_t rc = nic_report_address(nic_data, addr); 1355 1355 if ( rc != EOK) { 1356 1356 rtl8139_unlock_all(rtl8139); … … 1371 1371 * @return EOK 1372 1372 */ 1373 static int rtl8139_get_device_info(ddf_fun_t *fun, nic_device_info_t *info)1373 static errno_t rtl8139_get_device_info(ddf_fun_t *fun, nic_device_info_t *info) 1374 1374 { 1375 1375 assert(fun); … … 1406 1406 * @return EOK 1407 1407 */ 1408 static int rtl8139_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state)1408 static errno_t rtl8139_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state) 1409 1409 { 1410 1410 assert(fun); … … 1425 1425 /** Get operation mode of the device 1426 1426 */ 1427 static int rtl8139_get_operation_mode(ddf_fun_t *fun, int *speed,1427 static errno_t rtl8139_get_operation_mode(ddf_fun_t *fun, int *speed, 1428 1428 nic_channel_mode_t *duplex, nic_role_t *role) 1429 1429 { … … 1502 1502 * @return EOK if succeed 1503 1503 */ 1504 static int rtl8139_pause_get(ddf_fun_t *fun, nic_result_t *we_send,1504 static errno_t rtl8139_pause_get(ddf_fun_t *fun, nic_result_t *we_send, 1505 1505 nic_result_t *we_receive, uint16_t *time) 1506 1506 { … … 1537 1537 * @return EOK if succeed, INVAL if the pause frame has no sence 1538 1538 */ 1539 static int rtl8139_pause_set(ddf_fun_t *fun, int allow_send, int allow_receive,1539 static errno_t rtl8139_pause_set(ddf_fun_t *fun, int allow_send, int allow_receive, 1540 1540 uint16_t time) 1541 1541 { … … 1567 1567 * 1568 1568 */ 1569 static int rtl8139_set_operation_mode(ddf_fun_t *fun, int speed,1569 static errno_t rtl8139_set_operation_mode(ddf_fun_t *fun, int speed, 1570 1570 nic_channel_mode_t duplex, nic_role_t role) 1571 1571 { … … 1611 1611 * @returns EOK if advertisement mode set successfully 1612 1612 */ 1613 static int rtl8139_autoneg_enable(ddf_fun_t *fun, uint32_t advertisement)1613 static errno_t rtl8139_autoneg_enable(ddf_fun_t *fun, uint32_t advertisement) 1614 1614 { 1615 1615 assert(fun); … … 1657 1657 * @returns EOK 1658 1658 */ 1659 static int rtl8139_autoneg_disable(ddf_fun_t *fun)1659 static errno_t rtl8139_autoneg_disable(ddf_fun_t *fun) 1660 1660 { 1661 1661 assert(fun); … … 1708 1708 * @returns EOK 1709 1709 */ 1710 static int rtl8139_autoneg_probe(ddf_fun_t *fun, uint32_t *advertisement,1710 static errno_t rtl8139_autoneg_probe(ddf_fun_t *fun, uint32_t *advertisement, 1711 1711 uint32_t *their_adv, nic_result_t *result, nic_result_t *their_result) 1712 1712 { … … 1745 1745 * @returns EOK 1746 1746 */ 1747 static int rtl8139_autoneg_restart(ddf_fun_t *fun)1747 static errno_t rtl8139_autoneg_restart(ddf_fun_t *fun) 1748 1748 { 1749 1749 assert(fun); … … 1793 1793 * @returns EOK 1794 1794 */ 1795 static int rtl8139_unicast_set(nic_t *nic_data, nic_unicast_mode_t mode,1795 static errno_t rtl8139_unicast_set(nic_t *nic_data, nic_unicast_mode_t mode, 1796 1796 const nic_address_t *addr, size_t addr_cnt) 1797 1797 { … … 1851 1851 * @returns EOK 1852 1852 */ 1853 static int rtl8139_multicast_set(nic_t *nic_data, nic_multicast_mode_t mode,1853 static errno_t rtl8139_multicast_set(nic_t *nic_data, nic_multicast_mode_t mode, 1854 1854 const nic_address_t *addr, size_t addr_count) 1855 1855 { … … 1894 1894 * @returns EOK 1895 1895 */ 1896 static int rtl8139_broadcast_set(nic_t *nic_data, nic_broadcast_mode_t mode)1896 static errno_t rtl8139_broadcast_set(nic_t *nic_data, nic_broadcast_mode_t mode) 1897 1897 { 1898 1898 assert(nic_data); … … 1922 1922 * @param[out] mode The current mode 1923 1923 */ 1924 static int rtl8139_defective_get_mode(ddf_fun_t *fun, uint32_t *mode)1924 static errno_t rtl8139_defective_get_mode(ddf_fun_t *fun, uint32_t *mode) 1925 1925 { 1926 1926 assert(fun); … … 1947 1947 * @returns EOK of mode was set 1948 1948 */ 1949 static int rtl8139_defective_set_mode(ddf_fun_t *fun, uint32_t mode)1949 static errno_t rtl8139_defective_set_mode(ddf_fun_t *fun, uint32_t mode) 1950 1950 { 1951 1951 assert(fun); … … 1979 1979 * @returns ELIMIT if no more methods of this kind can be enabled 1980 1980 */ 1981 static int rtl8139_wol_virtue_add(nic_t *nic_data,1981 static errno_t rtl8139_wol_virtue_add(nic_t *nic_data, 1982 1982 const nic_wol_virtue_t *virtue) 1983 1983 { … … 2058 2058 * @returns ENOTSUP if the mode is not supported 2059 2059 */ 2060 static int rtl8139_poll_mode_change(nic_t *nic_data, nic_poll_mode_t mode,2060 static errno_t rtl8139_poll_mode_change(nic_t *nic_data, nic_poll_mode_t mode, 2061 2061 const struct timeval *period) 2062 2062 { 2063 2063 assert(nic_data); 2064 int rc = EOK;2064 errno_t rc = EOK; 2065 2065 2066 2066 rtl8139_t *rtl8139 = nic_get_specific(nic_data); … … 2143 2143 printf("%s: HelenOS RTL8139 network adapter driver\n", NAME); 2144 2144 2145 int rc = nic_driver_init(NAME);2145 errno_t rc = nic_driver_init(NAME); 2146 2146 if (rc != EOK) 2147 2147 return rc; -
uspace/drv/nic/rtl8139/general.c
r132ab5d1 r5a6cc679 83 83 * @return EOK if succeed, error code otherwise 84 84 */ 85 int rtl8139_timer_act_init(rtl8139_timer_act_t * ta, uint32_t timer_freq,85 errno_t rtl8139_timer_act_init(rtl8139_timer_act_t * ta, uint32_t timer_freq, 86 86 const struct timeval *time) 87 87 { -
uspace/drv/nic/rtl8139/general.h
r132ab5d1 r5a6cc679 61 61 extern void *rtl8139_memcpy_wrapped(void *, const void *, size_t, size_t, 62 62 size_t); 63 extern int rtl8139_timer_act_init(rtl8139_timer_act_t *, uint32_t,63 extern errno_t rtl8139_timer_act_init(rtl8139_timer_act_t *, uint32_t, 64 64 const struct timeval *); 65 65 extern int rtl8139_timer_act_step(rtl8139_timer_act_t *, uint32_t *); -
uspace/drv/nic/rtl8169/driver.c
r132ab5d1 r5a6cc679 52 52 FIBRIL_MUTEX_INITIALIZE(irq_reg_lock); 53 53 54 static int rtl8169_set_addr(ddf_fun_t *fun, const nic_address_t *addr);55 static int rtl8169_get_device_info(ddf_fun_t *fun, nic_device_info_t *info);56 static int rtl8169_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state);57 static int rtl8169_get_operation_mode(ddf_fun_t *fun, int *speed,54 static errno_t rtl8169_set_addr(ddf_fun_t *fun, const nic_address_t *addr); 55 static errno_t rtl8169_get_device_info(ddf_fun_t *fun, nic_device_info_t *info); 56 static errno_t rtl8169_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state); 57 static errno_t rtl8169_get_operation_mode(ddf_fun_t *fun, int *speed, 58 58 nic_channel_mode_t *duplex, nic_role_t *role); 59 static int rtl8169_set_operation_mode(ddf_fun_t *fun, int speed,59 static errno_t rtl8169_set_operation_mode(ddf_fun_t *fun, int speed, 60 60 nic_channel_mode_t duplex, nic_role_t role); 61 static int rtl8169_pause_get(ddf_fun_t *fun, nic_result_t *we_send,61 static errno_t rtl8169_pause_get(ddf_fun_t *fun, nic_result_t *we_send, 62 62 nic_result_t *we_receive, uint16_t *time); 63 static int rtl8169_pause_set(ddf_fun_t *fun, int allow_send, int allow_receive,63 static errno_t rtl8169_pause_set(ddf_fun_t *fun, int allow_send, int allow_receive, 64 64 uint16_t time); 65 static int rtl8169_autoneg_enable(ddf_fun_t *fun, uint32_t advertisement);66 static int rtl8169_autoneg_disable(ddf_fun_t *fun);67 static int rtl8169_autoneg_probe(ddf_fun_t *fun, uint32_t *advertisement,65 static errno_t rtl8169_autoneg_enable(ddf_fun_t *fun, uint32_t advertisement); 66 static errno_t rtl8169_autoneg_disable(ddf_fun_t *fun); 67 static errno_t rtl8169_autoneg_probe(ddf_fun_t *fun, uint32_t *advertisement, 68 68 uint32_t *their_adv, nic_result_t *result, nic_result_t *their_result); 69 static int rtl8169_autoneg_restart(ddf_fun_t *fun);70 static int rtl8169_defective_get_mode(ddf_fun_t *fun, uint32_t *mode);71 static int rtl8169_defective_set_mode(ddf_fun_t *fun, uint32_t mode);72 static int rtl8169_on_activated(nic_t *nic_data);73 static int rtl8169_on_stopped(nic_t *nic_data);69 static errno_t rtl8169_autoneg_restart(ddf_fun_t *fun); 70 static errno_t rtl8169_defective_get_mode(ddf_fun_t *fun, uint32_t *mode); 71 static errno_t rtl8169_defective_set_mode(ddf_fun_t *fun, uint32_t mode); 72 static errno_t rtl8169_on_activated(nic_t *nic_data); 73 static errno_t rtl8169_on_stopped(nic_t *nic_data); 74 74 static void rtl8169_send_frame(nic_t *nic_data, void *data, size_t size); 75 75 static void rtl8169_irq_handler(ipc_call_t *icall, ddf_dev_t *dev); 76 static inline int rtl8169_register_int_handler(nic_t *nic_data, cap_handle_t *handle);76 static inline errno_t rtl8169_register_int_handler(nic_t *nic_data, cap_handle_t *handle); 77 77 static inline void rtl8169_get_hwaddr(rtl8169_t *rtl8169, nic_address_t *addr); 78 78 static inline void rtl8169_set_hwaddr(rtl8169_t *rtl8169, const nic_address_t *addr); 79 79 80 80 static void rtl8169_reset(rtl8169_t *rtl8169); 81 static int rtl8169_get_resource_info(ddf_dev_t *dev);82 static int rtl8169_fill_resource_info(ddf_dev_t *dev, const hw_res_list_parsed_t *hw_resources);81 static errno_t rtl8169_get_resource_info(ddf_dev_t *dev); 82 static errno_t rtl8169_fill_resource_info(ddf_dev_t *dev, const hw_res_list_parsed_t *hw_resources); 83 83 static rtl8169_t *rtl8169_create_dev_data(ddf_dev_t *dev); 84 84 85 static int rtl8169_unicast_set(nic_t *nic_data, nic_unicast_mode_t mode,85 static errno_t rtl8169_unicast_set(nic_t *nic_data, nic_unicast_mode_t mode, 86 86 const nic_address_t *, size_t); 87 static int rtl8169_multicast_set(nic_t *nic_data, nic_multicast_mode_t mode,87 static errno_t rtl8169_multicast_set(nic_t *nic_data, nic_multicast_mode_t mode, 88 88 const nic_address_t *addr, size_t addr_count); 89 static int rtl8169_broadcast_set(nic_t *nic_data, nic_broadcast_mode_t mode);89 static errno_t rtl8169_broadcast_set(nic_t *nic_data, nic_broadcast_mode_t mode); 90 90 91 91 static uint16_t rtl8169_mii_read(rtl8169_t *rtl8169, uint8_t addr); … … 161 161 static ddf_dev_ops_t rtl8169_dev_ops; 162 162 163 static int rtl8169_dev_add(ddf_dev_t *dev);163 static errno_t rtl8169_dev_add(ddf_dev_t *dev); 164 164 165 165 /** Basic driver operations for RTL8169 driver */ … … 174 174 }; 175 175 176 static int rtl8169_get_resource_info(ddf_dev_t *dev)176 static errno_t rtl8169_get_resource_info(ddf_dev_t *dev) 177 177 { 178 178 assert(dev); … … 185 185 186 186 /* Get hw resources form parent driver */ 187 int rc = nic_get_resources(nic_data, &hw_res_parsed);187 errno_t rc = nic_get_resources(nic_data, &hw_res_parsed); 188 188 if (rc != EOK) 189 189 return rc; 190 190 191 191 /* Fill resources information to the device */ 192 int ret = rtl8169_fill_resource_info(dev, &hw_res_parsed);192 errno_t ret = rtl8169_fill_resource_info(dev, &hw_res_parsed); 193 193 hw_res_list_parsed_clean(&hw_res_parsed); 194 194 … … 196 196 } 197 197 198 static int rtl8169_fill_resource_info(ddf_dev_t *dev, const hw_res_list_parsed_t198 static errno_t rtl8169_fill_resource_info(ddf_dev_t *dev, const hw_res_list_parsed_t 199 199 *hw_resources) 200 200 { … … 229 229 } 230 230 231 static int rtl8169_allocate_buffers(rtl8169_t *rtl8169)232 { 233 int rc;231 static errno_t rtl8169_allocate_buffers(rtl8169_t *rtl8169) 232 { 233 errno_t rc; 234 234 235 235 ddf_msg(LVL_DEBUG, "Allocating DMA buffer rings"); … … 334 334 } 335 335 336 static int rtl8169_dev_initialize(ddf_dev_t *dev)337 { 338 int ret;336 static errno_t rtl8169_dev_initialize(ddf_dev_t *dev) 337 { 338 errno_t ret; 339 339 340 340 rtl8169_t *rtl8169 = rtl8169_create_dev_data(dev); … … 360 360 } 361 361 362 inline static int rtl8169_register_int_handler(nic_t *nic_data, cap_handle_t *handle)362 inline static errno_t rtl8169_register_int_handler(nic_t *nic_data, cap_handle_t *handle) 363 363 { 364 364 rtl8169_t *rtl8169 = nic_get_specific(nic_data); … … 368 368 rtl8169_irq_code.cmds[2].addr = rtl8169->regs + ISR; 369 369 rtl8169_irq_code.cmds[3].addr = rtl8169->regs + IMR; 370 int rc = register_interrupt_handler(nic_get_ddf_dev(nic_data),370 errno_t rc = register_interrupt_handler(nic_get_ddf_dev(nic_data), 371 371 rtl8169->irq, rtl8169_irq_handler, &rtl8169_irq_code, handle); 372 372 … … 374 374 } 375 375 376 static int rtl8169_dev_add(ddf_dev_t *dev)376 static errno_t rtl8169_dev_add(ddf_dev_t *dev) 377 377 { 378 378 ddf_fun_t *fun; 379 379 nic_address_t nic_addr; 380 int rc;380 errno_t rc; 381 381 382 382 assert(dev); … … 481 481 } 482 482 483 static int rtl8169_set_addr(ddf_fun_t *fun, const nic_address_t *addr)483 static errno_t rtl8169_set_addr(ddf_fun_t *fun, const nic_address_t *addr) 484 484 { 485 485 nic_t *nic_data = nic_get_from_ddf_fun(fun); 486 486 rtl8169_t *rtl8169 = nic_get_specific(nic_data); 487 int rc;487 errno_t rc; 488 488 489 489 fibril_mutex_lock(&rtl8169->rx_lock); … … 502 502 } 503 503 504 static int rtl8169_get_device_info(ddf_fun_t *fun, nic_device_info_t *info)504 static errno_t rtl8169_get_device_info(ddf_fun_t *fun, nic_device_info_t *info) 505 505 { 506 506 nic_t *nic_data = nic_get_from_ddf_fun(fun); … … 528 528 } 529 529 530 static int rtl8169_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state)530 static errno_t rtl8169_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state) 531 531 { 532 532 rtl8169_t *rtl8169 = nic_get_specific(nic_get_from_ddf_fun(fun)); … … 541 541 } 542 542 543 static int rtl8169_get_operation_mode(ddf_fun_t *fun, int *speed,543 static errno_t rtl8169_get_operation_mode(ddf_fun_t *fun, int *speed, 544 544 nic_channel_mode_t *duplex, nic_role_t *role) 545 545 { … … 563 563 } 564 564 565 static int rtl8169_set_operation_mode(ddf_fun_t *fun, int speed,565 static errno_t rtl8169_set_operation_mode(ddf_fun_t *fun, int speed, 566 566 nic_channel_mode_t duplex, nic_role_t role) 567 567 { … … 594 594 } 595 595 596 static int rtl8169_pause_get(ddf_fun_t *fun, nic_result_t *we_send,596 static errno_t rtl8169_pause_get(ddf_fun_t *fun, nic_result_t *we_send, 597 597 nic_result_t *we_receive, uint16_t *time) 598 598 { … … 600 600 } 601 601 602 static int rtl8169_pause_set(ddf_fun_t *fun, int allow_send, int allow_receive,602 static errno_t rtl8169_pause_set(ddf_fun_t *fun, int allow_send, int allow_receive, 603 603 uint16_t time) 604 604 { … … 606 606 } 607 607 608 static int rtl8169_autoneg_enable(ddf_fun_t *fun, uint32_t advertisement)608 static errno_t rtl8169_autoneg_enable(ddf_fun_t *fun, uint32_t advertisement) 609 609 { 610 610 rtl8169_t *rtl8169 = nic_get_specific(nic_get_from_ddf_fun(fun)); … … 630 630 } 631 631 632 static int rtl8169_autoneg_disable(ddf_fun_t *fun)632 static errno_t rtl8169_autoneg_disable(ddf_fun_t *fun) 633 633 { 634 634 rtl8169_t *rtl8169 = nic_get_specific(nic_get_from_ddf_fun(fun)); … … 641 641 } 642 642 643 static int rtl8169_autoneg_probe(ddf_fun_t *fun, uint32_t *advertisement,643 static errno_t rtl8169_autoneg_probe(ddf_fun_t *fun, uint32_t *advertisement, 644 644 uint32_t *their_adv, nic_result_t *result, nic_result_t *their_result) 645 645 { … … 647 647 } 648 648 649 static int rtl8169_autoneg_restart(ddf_fun_t *fun)649 static errno_t rtl8169_autoneg_restart(ddf_fun_t *fun) 650 650 { 651 651 rtl8169_t *rtl8169 = nic_get_specific(nic_get_from_ddf_fun(fun)); … … 657 657 } 658 658 659 static int rtl8169_defective_get_mode(ddf_fun_t *fun, uint32_t *mode)660 { 661 return EOK; 662 } 663 664 static int rtl8169_defective_set_mode(ddf_fun_t *fun, uint32_t mode)659 static errno_t rtl8169_defective_get_mode(ddf_fun_t *fun, uint32_t *mode) 660 { 661 return EOK; 662 } 663 664 static errno_t rtl8169_defective_set_mode(ddf_fun_t *fun, uint32_t mode) 665 665 { 666 666 return EOK; … … 691 691 } 692 692 693 static int rtl8169_on_activated(nic_t *nic_data)694 { 695 int rc;693 static errno_t rtl8169_on_activated(nic_t *nic_data) 694 { 695 errno_t rc; 696 696 uint64_t tmp; 697 697 … … 753 753 } 754 754 755 static int rtl8169_on_stopped(nic_t *nic_data)755 static errno_t rtl8169_on_stopped(nic_t *nic_data) 756 756 { 757 757 ddf_msg(LVL_NOTE, "Stopping device"); … … 819 819 } 820 820 821 static int rtl8169_unicast_set(nic_t *nic_data, nic_unicast_mode_t mode,821 static errno_t rtl8169_unicast_set(nic_t *nic_data, nic_unicast_mode_t mode, 822 822 const nic_address_t *addr, size_t addr_count) 823 823 { … … 871 871 } 872 872 873 static int rtl8169_multicast_set(nic_t *nic_data, nic_multicast_mode_t mode,873 static errno_t rtl8169_multicast_set(nic_t *nic_data, nic_multicast_mode_t mode, 874 874 const nic_address_t *addr, size_t addr_count) 875 875 { … … 915 915 } 916 916 917 static int rtl8169_broadcast_set(nic_t *nic_data, nic_broadcast_mode_t mode)917 static errno_t rtl8169_broadcast_set(nic_t *nic_data, nic_broadcast_mode_t mode) 918 918 { 919 919 rtl8169_t *rtl8169 = nic_get_specific(nic_data); … … 1208 1208 int main(void) 1209 1209 { 1210 int rc = nic_driver_init(NAME);1210 errno_t rc = nic_driver_init(NAME); 1211 1211 if (rc != EOK) 1212 1212 return rc;
Note:
See TracChangeset
for help on using the changeset viewer.