Changeset 5a6cc679 in mainline for uspace/drv/nic


Ignore:
Timestamp:
2018-01-31T02:21:24Z (8 years ago)
Author:
Jenda <jenda.jzqk73@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a0a9cc2
Parents:
132ab5d1
Message:

Merge commit '50f19b7ee8e94570b5c63896736c4eb49cfa18db' into forwardport

Not all ints are converted to errno_t in xhci tree yet, however it compiles and works :)

Location:
uspace/drv/nic
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/nic/ar9271/ar9271.c

    r132ab5d1 r5a6cc679  
    9999
    100100/* Callback when new device is to be controlled by this driver. */
    101 static int ar9271_add_device(ddf_dev_t *);
     101static errno_t ar9271_add_device(ddf_dev_t *);
    102102
    103103/* 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 *,
     104static errno_t ar9271_ieee80211_start(ieee80211_dev_t *);
     105static errno_t ar9271_ieee80211_tx_handler(ieee80211_dev_t *, void *, size_t);
     106static errno_t ar9271_ieee80211_set_freq(ieee80211_dev_t *, uint16_t);
     107static errno_t ar9271_ieee80211_bssid_change(ieee80211_dev_t *, bool);
     108static errno_t ar9271_ieee80211_key_config(ieee80211_dev_t *, ieee80211_key_config_t *,
    109109    bool);
    110110
     
    128128static ieee80211_iface_t ar9271_ieee80211_iface;
    129129
    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 *,
     130static errno_t ar9271_get_device_info(ddf_fun_t *, nic_device_info_t *);
     131static errno_t ar9271_get_cable_state(ddf_fun_t *, nic_cable_state_t *);
     132static errno_t ar9271_get_operation_mode(ddf_fun_t *, int *, nic_channel_mode_t *,
    133133    nic_role_t *);
    134134
     
    144144 *
    145145 */
    146 static int ar9271_get_device_info(ddf_fun_t *dev, nic_device_info_t *info)
     146static errno_t ar9271_get_device_info(ddf_fun_t *dev, nic_device_info_t *info)
    147147{
    148148        assert(dev);
     
    164164 *
    165165 */
    166 static int ar9271_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state)
     166static errno_t ar9271_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state)
    167167{
    168168        *state = NIC_CS_PLUGGED;
     
    174174 *
    175175 */
    176 static int ar9271_get_operation_mode(ddf_fun_t *fun, int *speed,
     176static errno_t ar9271_get_operation_mode(ddf_fun_t *fun, int *speed,
    177177    nic_channel_mode_t *duplex, nic_role_t *role)
    178178{
     
    187187 *
    188188 */
    189 static int ar9271_on_multicast_mode_change(nic_t *nic,
     189static errno_t ar9271_on_multicast_mode_change(nic_t *nic,
    190190    nic_multicast_mode_t mode, const nic_address_t *addr, size_t addr_cnt)
    191191{
     
    210210 *
    211211 */
    212 static int ar9271_on_unicast_mode_change(nic_t *nic, nic_unicast_mode_t mode,
     212static errno_t ar9271_on_unicast_mode_change(nic_t *nic, nic_unicast_mode_t mode,
    213213    const nic_address_t *addr, size_t addr_cnt)
    214214{
     
    236236 *
    237237 */
    238 static int ar9271_on_broadcast_mode_change(nic_t *nic,
     238static errno_t ar9271_on_broadcast_mode_change(nic_t *nic,
    239239    nic_broadcast_mode_t mode)
    240240{
     
    258258}
    259259
    260 static int ar9271_data_polling(void *arg)
     260static errno_t ar9271_data_polling(void *arg)
    261261{
    262262        assert(arg);
     
    319319 *
    320320 */
    321 static int ar9271_ieee80211_set_freq(ieee80211_dev_t *ieee80211_dev,
     321static errno_t ar9271_ieee80211_set_freq(ieee80211_dev_t *ieee80211_dev,
    322322    uint16_t freq)
    323323{
     
    330330        wmi_send_command(ar9271->htc_device, WMI_STOP_RECV, NULL, 0, NULL);
    331331       
    332         int rc = hw_freq_switch(ar9271, freq);
     332        errno_t rc = hw_freq_switch(ar9271, freq);
    333333        if (rc != EOK) {
    334334                usb_log_error("Failed to HW switch frequency.\n");
     
    352352}
    353353
    354 static int ar9271_ieee80211_bssid_change(ieee80211_dev_t *ieee80211_dev,
     354static errno_t ar9271_ieee80211_bssid_change(ieee80211_dev_t *ieee80211_dev,
    355355    bool connected)
    356356{
     
    401401}
    402402
    403 static int ar9271_ieee80211_key_config(ieee80211_dev_t *ieee80211_dev,
     403static errno_t ar9271_ieee80211_key_config(ieee80211_dev_t *ieee80211_dev,
    404404    ieee80211_key_config_t *key_conf, bool insert)
    405405{
     
    519519}
    520520
    521 static int ar9271_ieee80211_tx_handler(ieee80211_dev_t *ieee80211_dev,
     521static errno_t ar9271_ieee80211_tx_handler(ieee80211_dev_t *ieee80211_dev,
    522522    void *buffer, size_t buffer_size)
    523523{
     
    608608}
    609609
    610 static int ar9271_ieee80211_start(ieee80211_dev_t *ieee80211_dev)
     610static errno_t ar9271_ieee80211_start(ieee80211_dev_t *ieee80211_dev)
    611611{
    612612        assert(ieee80211_dev);
     
    616616        wmi_send_command(ar9271->htc_device, WMI_FLUSH_RECV, NULL, 0, NULL);
    617617       
    618         int rc = hw_reset(ar9271);
     618        errno_t rc = hw_reset(ar9271);
    619619        if (rc != EOK) {
    620620                usb_log_error("Failed to do HW reset.\n");
     
    666666}
    667667
    668 static int ar9271_init(ar9271_t *ar9271, usb_device_t *usb_device, const usb_endpoint_description_t **endpoints)
     668static errno_t ar9271_init(ar9271_t *ar9271, usb_device_t *usb_device, const usb_endpoint_description_t **endpoints)
    669669{
    670670        ar9271->starting_up = true;
     
    680680        }
    681681       
    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);
    683683        if (rc != EOK) {
    684684                free(ar9271->ath_device);
     
    737737 *
    738738 */
    739 static int ar9271_upload_fw(ar9271_t *ar9271)
     739static errno_t ar9271_upload_fw(ar9271_t *ar9271)
    740740{
    741741        usb_device_t *usb_device = ar9271->usb_device;
     
    775775                memcpy(buffer, current_data, chunk_size);
    776776                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,
    778778                    USB_REQUEST_TYPE_VENDOR,
    779779                    USB_REQUEST_RECIPIENT_DEVICE,
     
    803803        */
    804804        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,
    806806            USB_REQUEST_TYPE_VENDOR,
    807807            USB_REQUEST_RECIPIENT_DEVICE,
     
    834834        /* USB framework initialization. */
    835835        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);
    837837        if (rc != EOK) {
    838838                usb_log_error("Failed to create USB device: %s, "
     
    879879 * @return EOK if succeed, error code otherwise
    880880 */
    881 static int ar9271_add_device(ddf_dev_t *dev)
     881static errno_t ar9271_add_device(ddf_dev_t *dev)
    882882{
    883883        assert(dev);
     
    896896       
    897897        /* Initialize AR9271 HTC services. */
    898         int rc = htc_init(ar9271->htc_device);
     898        errno_t rc = htc_init(ar9271->htc_device);
    899899        if (rc != EOK) {
    900900                ar9271_delete_dev_data(ar9271);
  • uspace/drv/nic/ar9271/ath.h

    r132ab5d1 r5a6cc679  
    4040/** Atheros wifi operations. */
    4141typedef 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 *);
    4646} ath_ops_t;
    4747
  • uspace/drv/nic/ar9271/ath_usb.c

    r132ab5d1 r5a6cc679  
    3939#include "ath_usb.h"
    4040
    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 *);
     41static errno_t ath_usb_send_ctrl_message(ath_t *, void *, size_t);
     42static errno_t ath_usb_read_ctrl_message(ath_t *, void *, size_t, size_t *);
     43static errno_t ath_usb_send_data_message(ath_t *, void *, size_t);
     44static errno_t ath_usb_read_data_message(ath_t *, void *, size_t, size_t *);
    4545
    4646static ath_ops_t ath_usb_ops = {
     
    5959 *
    6060 */
    61 int ath_usb_init(ath_t *ath, usb_device_t *usb_device, const usb_endpoint_description_t **endpoints)
     61errno_t ath_usb_init(ath_t *ath, usb_device_t *usb_device, const usb_endpoint_description_t **endpoints)
    6262{
    6363        ath_usb_t *ath_usb = malloc(sizeof(ath_usb_t));
     
    110110 *
    111111 */
    112 static int ath_usb_send_ctrl_message(ath_t *ath, void *buffer,
     112static errno_t ath_usb_send_ctrl_message(ath_t *ath, void *buffer,
    113113    size_t buffer_size)
    114114{
     
    127127 *
    128128 */
    129 static int ath_usb_read_ctrl_message(ath_t *ath, void *buffer,
     129static errno_t ath_usb_read_ctrl_message(ath_t *ath, void *buffer,
    130130    size_t buffer_size, size_t *transferred_size)
    131131{
     
    143143 *
    144144 */
    145 static int ath_usb_send_data_message(ath_t *ath, void *buffer,
     145static errno_t ath_usb_send_data_message(ath_t *ath, void *buffer,
    146146    size_t buffer_size)
    147147{
     
    158158       
    159159        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);
    162162       
    163163        free(complete_buffer);
     
    176176 *
    177177 */
    178 static int ath_usb_read_data_message(ath_t *ath, void *buffer,
     178static errno_t ath_usb_read_data_message(ath_t *ath, void *buffer,
    179179    size_t buffer_size, size_t *transferred_size)
    180180{
  • uspace/drv/nic/ar9271/ath_usb.h

    r132ab5d1 r5a6cc679  
    5959} ath_usb_data_header_t;
    6060
    61 extern int ath_usb_init(ath_t *, usb_device_t *, const usb_endpoint_description_t **endpoints);
     61extern errno_t ath_usb_init(ath_t *, usb_device_t *, const usb_endpoint_description_t **endpoints);
    6262
    6363#endif  /* ATHEROS_ATH_USB_H */
  • uspace/drv/nic/ar9271/htc.c

    r132ab5d1 r5a6cc679  
    6666}
    6767
    68 int htc_init_new_vif(htc_device_t *htc_device)
     68errno_t htc_init_new_vif(htc_device_t *htc_device)
    6969{
    7070        htc_vif_msg_t vif_msg;
     
    153153 *
    154154 */
    155 int htc_send_control_message(htc_device_t *htc_device, void *buffer,
     155errno_t htc_send_control_message(htc_device_t *htc_device, void *buffer,
    156156    size_t buffer_size, uint8_t endpoint_id)
    157157{
     
    176176 *
    177177 */
    178 int htc_send_data_message(htc_device_t *htc_device, void *buffer,
     178errno_t htc_send_data_message(htc_device_t *htc_device, void *buffer,
    179179    size_t buffer_size, uint8_t endpoint_id)
    180180{
     
    199199 *
    200200 */
    201 int htc_read_data_message(htc_device_t *htc_device, void *buffer,
     201errno_t htc_read_data_message(htc_device_t *htc_device, void *buffer,
    202202    size_t buffer_size, size_t *transferred_size)
    203203{
     
    219219 *
    220220 */
    221 int htc_read_control_message(htc_device_t *htc_device, void *buffer,
     221errno_t htc_read_control_message(htc_device_t *htc_device, void *buffer,
    222222    size_t buffer_size, size_t *transferred_size)
    223223{
     
    239239 *
    240240 */
    241 static int htc_connect_service(htc_device_t *htc_device,
     241static errno_t htc_connect_service(htc_device_t *htc_device,
    242242    wmi_services_t service_id, int *response_endpoint_no)
    243243{
     
    261261       
    262262        /* 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,
    264264            htc_device->endpoints.ctrl_endpoint);
    265265        if (rc != EOK) {
     
    312312 *
    313313 */
    314 static int htc_config_credits(htc_device_t *htc_device)
     314static errno_t htc_config_credits(htc_device_t *htc_device)
    315315{
    316316        size_t buffer_size = sizeof(htc_frame_header_t) +
     
    327327       
    328328        /* 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,
    330330            htc_device->endpoints.ctrl_endpoint);
    331331        if (rc != EOK) {
     
    360360 *
    361361 */
    362 static int htc_complete_setup(htc_device_t *htc_device)
     362static errno_t htc_complete_setup(htc_device_t *htc_device)
    363363{
    364364        size_t buffer_size = sizeof(htc_frame_header_t) +
     
    373373       
    374374        /* 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,
    376376            htc_device->endpoints.ctrl_endpoint);
    377377        if (rc != EOK)
     
    394394 *
    395395 */
    396 static int htc_check_ready(htc_device_t *htc_device)
     396static errno_t htc_check_ready(htc_device_t *htc_device)
    397397{
    398398        size_t buffer_size = htc_device->ath_device->ctrl_response_length;
     
    400400       
    401401        /* 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,
    403403            NULL);
    404404        if (rc != EOK) {
     
    430430 *
    431431 */
    432 int htc_device_init(ath_t *ath_device, ieee80211_dev_t *ieee80211_dev,
     432errno_t htc_device_init(ath_t *ath_device, ieee80211_dev_t *ieee80211_dev,
    433433    htc_device_t *htc_device)
    434434{
     
    451451 *
    452452 */
    453 int htc_init(htc_device_t *htc_device)
     453errno_t htc_init(htc_device_t *htc_device)
    454454{
    455455        /* First check ready message in device. */
    456         int rc = htc_check_ready(htc_device);
     456        errno_t rc = htc_check_ready(htc_device);
    457457        if (rc != EOK) {
    458458                usb_log_error("Device is not in ready state after loading "
  • uspace/drv/nic/ar9271/htc.h

    r132ab5d1 r5a6cc679  
    297297} __attribute__((packed)) htc_setup_complete_msg_t;
    298298
    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);
     299extern errno_t htc_device_init(ath_t *, ieee80211_dev_t *, htc_device_t *);
     300extern errno_t htc_init(htc_device_t *);
     301extern errno_t htc_init_new_vif(htc_device_t *);
     302extern errno_t htc_read_control_message(htc_device_t *, void *, size_t, size_t *);
     303extern errno_t htc_read_data_message(htc_device_t *, void *, size_t, size_t *);
     304extern errno_t htc_send_control_message(htc_device_t *, void *, size_t, uint8_t);
     305extern errno_t htc_send_data_message(htc_device_t *, void *, size_t, uint8_t);
    306306
    307307#endif  /* ATHEROS_HTC_H */
  • uspace/drv/nic/ar9271/hw.c

    r132ab5d1 r5a6cc679  
    5252 *
    5353 */
    54 static int hw_read_wait(ar9271_t *ar9271, uint32_t offset, uint32_t mask,
     54static errno_t hw_read_wait(ar9271_t *ar9271, uint32_t offset, uint32_t mask,
    5555    uint32_t value)
    5656{
     
    6767}
    6868
    69 static int hw_reset_power_on(ar9271_t *ar9271)
     69static errno_t hw_reset_power_on(ar9271_t *ar9271)
    7070{
    7171        wmi_reg_t buffer[] = {
     
    9393        wmi_reg_write(ar9271->htc_device, AR9271_RTC_RESET, 1);
    9494       
    95         int rc = hw_read_wait(ar9271,
     95        errno_t rc = hw_read_wait(ar9271,
    9696            AR9271_RTC_STATUS,
    9797            AR9271_RTC_STATUS_MASK,
     
    105105}
    106106
    107 static int hw_set_reset(ar9271_t *ar9271, bool cold)
     107static errno_t hw_set_reset(ar9271_t *ar9271, bool cold)
    108108{
    109109        uint32_t reset_value = AR9271_RTC_RC_MAC_WARM;
     
    135135        wmi_reg_write(ar9271->htc_device, AR9271_RTC_RC, 0);
    136136       
    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);
    138138        if (rc != EOK) {
    139139                usb_log_error("Failed to wait for RTC RC register.\n");
     
    148148}
    149149
    150 static int hw_addr_init(ar9271_t *ar9271)
     150static errno_t hw_addr_init(ar9271_t *ar9271)
    151151{
    152152        uint32_t value;
     
    164164        nic_t *nic = nic_get_from_ddf_dev(ar9271->ddf_dev);
    165165       
    166         int rc = nic_report_address(nic, &ar9271_address);
     166        errno_t rc = nic_report_address(nic, &ar9271_address);
    167167        if (rc != EOK) {
    168168                usb_log_error("Failed to report NIC HW address.\n");
     
    173173}
    174174
    175 static int hw_gpio_set_output(ar9271_t *ar9271, uint32_t gpio, uint32_t type)
     175static errno_t hw_gpio_set_output(ar9271_t *ar9271, uint32_t gpio, uint32_t type)
    176176{
    177177        uint32_t address;
     
    204204}
    205205
    206 static int hw_gpio_set_value(ar9271_t *ar9271, uint32_t gpio, uint32_t value)
     206static errno_t hw_gpio_set_value(ar9271_t *ar9271, uint32_t gpio, uint32_t value)
    207207{
    208208        wmi_reg_set_clear_bit(ar9271->htc_device, AR9271_GPIO_IN_OUT,
     
    218218 *
    219219 */
    220 static int hw_init_proc(ar9271_t *ar9271)
    221 {
    222         int rc = hw_reset_power_on(ar9271);
     220static errno_t hw_init_proc(ar9271_t *ar9271)
     221{
     222        errno_t rc = hw_reset_power_on(ar9271);
    223223        if (rc != EOK) {
    224224                usb_log_error("Failed to HW reset power on.\n");
     
    241241}
    242242
    243 static int hw_init_led(ar9271_t *ar9271)
    244 {
    245         int rc = hw_gpio_set_output(ar9271, AR9271_LED_PIN,
     243static errno_t hw_init_led(ar9271_t *ar9271)
     244{
     245        errno_t rc = hw_gpio_set_output(ar9271, AR9271_LED_PIN,
    246246            AR9271_GPIO_OUT_MUX_AS_OUT);
    247247        if (rc != EOK) {
     
    259259}
    260260
    261 static int hw_activate_phy(ar9271_t *ar9271)
     261static errno_t hw_activate_phy(ar9271_t *ar9271)
    262262{
    263263        wmi_reg_write(ar9271->htc_device, AR9271_PHY_ACTIVE, 1);
     
    267267}
    268268
    269 static int hw_set_operating_mode(ar9271_t *ar9271,
     269static errno_t hw_set_operating_mode(ar9271_t *ar9271,
    270270    ieee80211_operating_mode_t op_mode)
    271271{
     
    295295}
    296296
    297 static int hw_reset_operating_mode(ar9271_t *ar9271)
    298 {
    299         int rc = hw_set_operating_mode(ar9271, IEEE80211_OPMODE_STATION);
     297static errno_t hw_reset_operating_mode(ar9271_t *ar9271)
     298{
     299        errno_t rc = hw_set_operating_mode(ar9271, IEEE80211_OPMODE_STATION);
    300300        if (rc != EOK) {
    301301                usb_log_error("Failed to set opmode to station.\n");
     
    306306}
    307307
    308 static int hw_noise_floor_calibration(ar9271_t *ar9271)
     308static errno_t hw_noise_floor_calibration(ar9271_t *ar9271)
    309309{
    310310        uint32_t value;
     
    325325            AR9271_AGC_CONTROL_NF_CALIB);
    326326       
    327         int rc = hw_read_wait(ar9271, AR9271_AGC_CONTROL,
     327        errno_t rc = hw_read_wait(ar9271, AR9271_AGC_CONTROL,
    328328            AR9271_AGC_CONTROL_NF_CALIB, 0);
    329329        if (rc != EOK) {
     
    344344}
    345345
    346 static int hw_set_freq(ar9271_t *ar9271, uint16_t freq)
     346static errno_t hw_set_freq(ar9271_t *ar9271, uint16_t freq)
    347347{
    348348        /* Not supported channel frequency. */
     
    373373}
    374374
    375 int hw_freq_switch(ar9271_t *ar9271, uint16_t freq)
     375errno_t hw_freq_switch(ar9271_t *ar9271, uint16_t freq)
    376376{
    377377        wmi_reg_write(ar9271->htc_device, AR9271_PHY_RFBUS_KILL, 0x1);
    378378       
    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);
    380380        if (rc != EOK) {
    381381                usb_log_error("Failed to kill RF bus.\n");
     
    407407}
    408408
    409 int hw_set_rx_filter(ar9271_t *ar9271, bool assoc)
     409errno_t hw_set_rx_filter(ar9271_t *ar9271, bool assoc)
    410410{
    411411        uint32_t additional_bits = 0;
     
    425425}
    426426
    427 int hw_set_bssid(ar9271_t *ar9271)
     427errno_t hw_set_bssid(ar9271_t *ar9271)
    428428{
    429429        ieee80211_dev_t *ieee80211_dev = ar9271->ieee80211_dev;
     
    445445}
    446446
    447 int hw_rx_init(ar9271_t *ar9271)
     447errno_t hw_rx_init(ar9271_t *ar9271)
    448448{
    449449        wmi_reg_write(ar9271->htc_device, AR9271_COMMAND,
    450450            AR9271_COMMAND_RX_ENABLE);
    451451       
    452         int rc = hw_set_rx_filter(ar9271, false);
     452        errno_t rc = hw_set_rx_filter(ar9271, false);
    453453        if (rc != EOK) {
    454454                usb_log_error("Failed to set RX filtering.\n");
     
    465465}
    466466
    467 static int hw_init_pll(ar9271_t *ar9271)
     467static errno_t hw_init_pll(ar9271_t *ar9271)
    468468{
    469469        /* Some magic here (set for 2GHz channels). But VERY important :-) */
     
    510510}
    511511
    512 static int hw_calibration(ar9271_t *ar9271)
     512static errno_t hw_calibration(ar9271_t *ar9271)
    513513{
    514514        wmi_reg_set_bit(ar9271->htc_device, AR9271_CARRIER_LEAK_CONTROL,
     
    523523            AR9271_AGC_CONTROL_CALIB);
    524524       
    525         int rc = hw_read_wait(ar9271, AR9271_AGC_CONTROL,
     525        errno_t rc = hw_read_wait(ar9271, AR9271_AGC_CONTROL,
    526526            AR9271_AGC_CONTROL_CALIB, 0);
    527527        if (rc != EOK) {
     
    540540}
    541541
    542 int hw_reset(ar9271_t *ar9271)
     542errno_t hw_reset(ar9271_t *ar9271)
    543543{
    544544        /* Set physical layer as deactivated. */
     
    559559                hw_set_reset(ar9271, true);
    560560       
    561         int rc = hw_init_pll(ar9271);
     561        errno_t rc = hw_init_pll(ar9271);
    562562        if (rc != EOK) {
    563563                usb_log_error("Failed to init PLL.\n");
     
    638638 * @return EOK if succeed, error code otherwise.
    639639 */
    640 int hw_init(ar9271_t *ar9271)
    641 {
    642         int rc = hw_init_proc(ar9271);
     640errno_t hw_init(ar9271_t *ar9271)
     641{
     642        errno_t rc = hw_init_proc(ar9271);
    643643        if (rc != EOK) {
    644644                usb_log_error("Failed to HW reset device.\n");
  • uspace/drv/nic/ar9271/hw.h

    r132ab5d1 r5a6cc679  
    4141#define HW_WAIT_TIME_US  10
    4242
    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);
     43extern errno_t hw_init(ar9271_t *);
     44extern errno_t hw_freq_switch(ar9271_t *, uint16_t);
     45extern errno_t hw_rx_init(ar9271_t *);
     46extern errno_t hw_reset(ar9271_t *);
     47extern errno_t hw_set_bssid(ar9271_t *);
     48extern errno_t hw_set_rx_filter(ar9271_t *, bool);
    4949
    5050#endif  /* ATHEROS_HW_H */
  • uspace/drv/nic/ar9271/wmi.c

    r132ab5d1 r5a6cc679  
    5050 *
    5151 */
    52 int wmi_reg_read(htc_device_t *htc_device, uint32_t reg_offset, uint32_t *res)
     52errno_t wmi_reg_read(htc_device_t *htc_device, uint32_t reg_offset, uint32_t *res)
    5353{
    5454        uint32_t cmd_value = host2uint32_t_be(reg_offset);
     
    5757            malloc(htc_device->ath_device->ctrl_response_length);
    5858       
    59         int rc = wmi_send_command(htc_device, WMI_REG_READ,
     59        errno_t rc = wmi_send_command(htc_device, WMI_REG_READ,
    6060            (uint8_t *) &cmd_value, sizeof(cmd_value), resp_buffer);
    6161       
     
    8282 *
    8383 */
    84 int wmi_reg_write(htc_device_t *htc_device, uint32_t reg_offset, uint32_t val)
     84errno_t wmi_reg_write(htc_device_t *htc_device, uint32_t reg_offset, uint32_t val)
    8585{
    8686        uint32_t cmd_buffer[] = {
     
    9292            malloc(htc_device->ath_device->ctrl_response_length);
    9393       
    94         int rc = wmi_send_command(htc_device, WMI_REG_WRITE,
     94        errno_t rc = wmi_send_command(htc_device, WMI_REG_WRITE,
    9595            (uint8_t *) &cmd_buffer, sizeof(cmd_buffer), resp_buffer);
    9696       
     
    115115 *
    116116 */
    117 int wmi_reg_set_clear_bit(htc_device_t *htc_device, uint32_t reg_offset,
     117errno_t wmi_reg_set_clear_bit(htc_device_t *htc_device, uint32_t reg_offset,
    118118    uint32_t set_bit, uint32_t clear_bit)
    119119{
    120120        uint32_t value;
    121121       
    122         int rc = wmi_reg_read(htc_device, reg_offset, &value);
     122        errno_t rc = wmi_reg_read(htc_device, reg_offset, &value);
    123123        if (rc != EOK) {
    124124                usb_log_error("Failed to read registry value in RMW "
     
    149149 *
    150150 */
    151 int wmi_reg_set_bit(htc_device_t *htc_device, uint32_t reg_offset,
     151errno_t wmi_reg_set_bit(htc_device_t *htc_device, uint32_t reg_offset,
    152152    uint32_t set_bit)
    153153{
     
    164164 *
    165165 */
    166 int wmi_reg_clear_bit(htc_device_t *htc_device, uint32_t reg_offset,
     166errno_t wmi_reg_clear_bit(htc_device_t *htc_device, uint32_t reg_offset,
    167167    uint32_t clear_bit)
    168168{
     
    179179 *
    180180 */
    181 int wmi_reg_buffer_write(htc_device_t *htc_device, wmi_reg_t *reg_buffer,
     181errno_t wmi_reg_buffer_write(htc_device_t *htc_device, wmi_reg_t *reg_buffer,
    182182    size_t elements)
    183183{
     
    198198        }
    199199       
    200         int rc = wmi_send_command(htc_device, WMI_REG_WRITE,
     200        errno_t rc = wmi_send_command(htc_device, WMI_REG_WRITE,
    201201            (uint8_t *) buffer, buffer_size, resp_buffer);
    202202       
     
    223223 *
    224224 */
    225 int wmi_send_command(htc_device_t *htc_device, wmi_command_t command_id,
     225errno_t wmi_send_command(htc_device_t *htc_device, wmi_command_t command_id,
    226226    uint8_t *command_buffer, uint32_t command_length, void *response_buffer)
    227227{
     
    242242       
    243243        /* 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,
    245245            htc_device->endpoints.wmi_endpoint);
    246246        if (rc != EOK) {
  • uspace/drv/nic/ar9271/wmi.h

    r132ab5d1 r5a6cc679  
    117117} wmi_reg_t;
    118118
    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,
     119extern errno_t wmi_reg_read(htc_device_t *, uint32_t, uint32_t *);
     120extern errno_t wmi_reg_write(htc_device_t *, uint32_t, uint32_t);
     121extern errno_t wmi_reg_set_clear_bit(htc_device_t *, uint32_t, uint32_t, uint32_t);
     122extern errno_t wmi_reg_set_bit(htc_device_t *, uint32_t, uint32_t);
     123extern errno_t wmi_reg_clear_bit(htc_device_t *, uint32_t, uint32_t);
     124extern errno_t wmi_reg_buffer_write(htc_device_t *, wmi_reg_t *, size_t);
     125extern errno_t wmi_send_command(htc_device_t *, wmi_command_t, uint8_t *, uint32_t,
    126126    void *);
    127127
  • uspace/drv/nic/e1k/e1k.c

    r132ab5d1 r5a6cc679  
    179179FIBRIL_MUTEX_INITIALIZE(irq_reg_mutex);
    180180
    181 static int e1000_get_address(e1000_t *, nic_address_t *);
     181static errno_t e1000_get_address(e1000_t *, nic_address_t *);
    182182static 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 *,
     183static errno_t e1000_set_addr(ddf_fun_t *, const nic_address_t *);
     184
     185static errno_t e1000_defective_get_mode(ddf_fun_t *, uint32_t *);
     186static errno_t e1000_defective_set_mode(ddf_fun_t *, uint32_t);
     187
     188static errno_t e1000_get_cable_state(ddf_fun_t *, nic_cable_state_t *);
     189static errno_t e1000_get_device_info(ddf_fun_t *, nic_device_info_t *);
     190static errno_t e1000_get_operation_mode(ddf_fun_t *, int *,
    191191    nic_channel_mode_t *, nic_role_t *);
    192 static int e1000_set_operation_mode(ddf_fun_t *, int,
     192static errno_t e1000_set_operation_mode(ddf_fun_t *, int,
    193193    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);
     194static errno_t e1000_autoneg_enable(ddf_fun_t *, uint32_t);
     195static errno_t e1000_autoneg_disable(ddf_fun_t *);
     196static errno_t e1000_autoneg_restart(ddf_fun_t *);
     197
     198static errno_t e1000_vlan_set_tag(ddf_fun_t *, uint16_t, bool, bool);
    199199
    200200/** Network interface options for E1000 card driver */
     
    219219static ddf_dev_ops_t e1000_dev_ops;
    220220
    221 static int e1000_dev_add(ddf_dev_t *);
     221static errno_t e1000_dev_add(ddf_dev_t *);
    222222
    223223/** Basic driver operations for E1000 driver */
     
    233233
    234234/* The default implementation callbacks */
    235 static int e1000_on_activating(nic_t *);
    236 static int e1000_on_stopping(nic_t *);
     235static errno_t e1000_on_activating(nic_t *);
     236static errno_t e1000_on_stopping(nic_t *);
    237237static void e1000_send_frame(nic_t *, void *, size_t);
    238238
     
    288288 *
    289289 */
    290 static int e1000_get_device_info(ddf_fun_t *dev, nic_device_info_t *info)
     290static errno_t e1000_get_device_info(ddf_fun_t *dev, nic_device_info_t *info)
    291291{
    292292        assert(dev);
     
    316316 *
    317317 */
    318 static int e1000_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state)
     318static errno_t e1000_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state)
    319319{
    320320        e1000_t *e1000 = DRIVER_DATA_FUN(fun);
     
    335335 *
    336336 */
    337 static int e1000_get_operation_mode(ddf_fun_t *fun, int *speed,
     337static errno_t e1000_get_operation_mode(ddf_fun_t *fun, int *speed,
    338338    nic_channel_mode_t *duplex, nic_role_t *role)
    339339{
     
    386386 *
    387387 */
    388 static int e1000_set_operation_mode(ddf_fun_t *fun, int speed,
     388static errno_t e1000_set_operation_mode(ddf_fun_t *fun, int speed,
    389389    nic_channel_mode_t duplex, nic_role_t role)
    390390{
     
    434434 *
    435435 */
    436 static int e1000_autoneg_enable(ddf_fun_t *fun, uint32_t advertisement)
     436static errno_t e1000_autoneg_enable(ddf_fun_t *fun, uint32_t advertisement)
    437437{
    438438        e1000_t *e1000 = DRIVER_DATA_FUN(fun);
     
    462462 *
    463463 */
    464 static int e1000_autoneg_disable(ddf_fun_t *fun)
     464static errno_t e1000_autoneg_disable(ddf_fun_t *fun)
    465465{
    466466        e1000_t *e1000 = DRIVER_DATA_FUN(fun);
     
    490490 *
    491491 */
    492 static int e1000_autoneg_restart(ddf_fun_t *dev)
     492static errno_t e1000_autoneg_restart(ddf_fun_t *dev)
    493493{
    494494        return e1000_autoneg_enable(dev, 0);
     
    501501 *
    502502 */
    503 static int e1000_defective_get_mode(ddf_fun_t *fun, uint32_t *mode)
     503static errno_t e1000_defective_get_mode(ddf_fun_t *fun, uint32_t *mode)
    504504{
    505505        e1000_t *e1000 = DRIVER_DATA_FUN(fun);
     
    522522 *
    523523 */
    524 static int e1000_defective_set_mode(ddf_fun_t *fun, uint32_t mode)
     524static errno_t e1000_defective_set_mode(ddf_fun_t *fun, uint32_t mode)
    525525{
    526526        e1000_t *e1000 = DRIVER_DATA_FUN(fun);
    527         int rc = EOK;
     527        errno_t rc = EOK;
    528528       
    529529        fibril_mutex_lock(&e1000->rx_lock);
     
    827827 *
    828828 */
    829 static int e1000_on_multicast_mode_change(nic_t *nic, nic_multicast_mode_t mode,
     829static errno_t e1000_on_multicast_mode_change(nic_t *nic, nic_multicast_mode_t mode,
    830830    const nic_address_t *addr, size_t addr_cnt)
    831831{
    832832        e1000_t *e1000 = DRIVER_DATA_NIC(nic);
    833         int rc = EOK;
     833        errno_t rc = EOK;
    834834       
    835835        fibril_mutex_lock(&e1000->rx_lock);
     
    881881 *
    882882 */
    883 static int e1000_on_unicast_mode_change(nic_t *nic, nic_unicast_mode_t mode,
     883static errno_t e1000_on_unicast_mode_change(nic_t *nic, nic_unicast_mode_t mode,
    884884    const nic_address_t *addr, size_t addr_cnt)
    885885{
    886886        e1000_t *e1000 = DRIVER_DATA_NIC(nic);
    887         int rc = EOK;
     887        errno_t rc = EOK;
    888888       
    889889        fibril_mutex_lock(&e1000->rx_lock);
     
    937937 *
    938938 */
    939 static int e1000_on_broadcast_mode_change(nic_t *nic, nic_broadcast_mode_t mode)
     939static errno_t e1000_on_broadcast_mode_change(nic_t *nic, nic_broadcast_mode_t mode)
    940940{
    941941        e1000_t *e1000 = DRIVER_DATA_NIC(nic);
    942         int rc = EOK;
     942        errno_t rc = EOK;
    943943       
    944944        fibril_mutex_lock(&e1000->rx_lock);
     
    10481048 *
    10491049 */
    1050 static int e1000_vlan_set_tag(ddf_fun_t *fun, uint16_t tag, bool add,
     1050static errno_t e1000_vlan_set_tag(ddf_fun_t *fun, uint16_t tag, bool add,
    10511051    bool strip)
    10521052{
     
    12641264 *
    12651265 */
    1266 inline static int e1000_register_int_handler(nic_t *nic, cap_handle_t *handle)
     1266inline static errno_t e1000_register_int_handler(nic_t *nic, cap_handle_t *handle)
    12671267{
    12681268        e1000_t *e1000 = DRIVER_DATA_NIC(nic);
     
    12751275        e1000_irq_code.cmds[2].addr = e1000->reg_base_phys + E1000_IMC;
    12761276       
    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,
    12781278            e1000_interrupt_handler, &e1000_irq_code, handle);
    12791279       
     
    13191319 *
    13201320 */
    1321 static int e1000_poll_mode_change(nic_t *nic, nic_poll_mode_t mode,
     1321static errno_t e1000_poll_mode_change(nic_t *nic, nic_poll_mode_t mode,
    13221322    const struct timeval *period)
    13231323{
     
    13731373 *
    13741374 */
    1375 static int e1000_initialize_rx_structure(nic_t *nic)
     1375static errno_t e1000_initialize_rx_structure(nic_t *nic)
    13761376{
    13771377        e1000_t *e1000 = DRIVER_DATA_NIC(nic);
     
    13791379       
    13801380        e1000->rx_ring_virt = AS_AREA_ANY;
    1381         int rc = dmamem_map_anonymous(
     1381        errno_t rc = dmamem_map_anonymous(
    13821382            E1000_RX_FRAME_COUNT * sizeof(e1000_rx_descriptor_t),
    13831383            DMAMEM_4GiB, AS_AREA_READ | AS_AREA_WRITE, 0,
     
    15671567 *
    15681568 */
    1569 static int e1000_initialize_tx_structure(e1000_t *e1000)
     1569static errno_t e1000_initialize_tx_structure(e1000_t *e1000)
    15701570{
    15711571        size_t i;
     
    15791579        e1000->tx_frame_virt = NULL;
    15801580       
    1581         int rc = dmamem_map_anonymous(
     1581        errno_t rc = dmamem_map_anonymous(
    15821582            E1000_TX_FRAME_COUNT * sizeof(e1000_tx_descriptor_t),
    15831583            DMAMEM_4GiB, AS_AREA_READ | AS_AREA_WRITE, 0,
     
    17181718 *
    17191719 */
    1720 static int e1000_reset(nic_t *nic)
     1720static errno_t e1000_reset(nic_t *nic)
    17211721{
    17221722        e1000_t *e1000 = DRIVER_DATA_NIC(nic);
     
    17491749 *
    17501750 */
    1751 static int e1000_on_activating(nic_t *nic)
     1751static errno_t e1000_on_activating(nic_t *nic)
    17521752{
    17531753        assert(nic);
     
    17611761        e1000_enable_interrupts(e1000);
    17621762       
    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);
    17641764        if (rc != EOK) {
    17651765                e1000_disable_interrupts(e1000);
     
    17951795 *
    17961796 */
    1797 static int e1000_on_down_unlocked(nic_t *nic)
     1797static errno_t e1000_on_down_unlocked(nic_t *nic)
    17981798{
    17991799        e1000_t *e1000 = DRIVER_DATA_NIC(nic);
     
    18261826 *
    18271827 */
    1828 static int e1000_on_down(nic_t *nic)
     1828static errno_t e1000_on_down(nic_t *nic)
    18291829{
    18301830        e1000_t *e1000 = DRIVER_DATA_NIC(nic);
     
    18341834        fibril_mutex_lock(&e1000->ctrl_lock);
    18351835       
    1836         int rc = e1000_on_down_unlocked(nic);
     1836        errno_t rc = e1000_on_down_unlocked(nic);
    18371837       
    18381838        fibril_mutex_unlock(&e1000->ctrl_lock);
     
    18511851 *
    18521852 */
    1853 static int e1000_on_stopping(nic_t *nic)
     1853static errno_t e1000_on_stopping(nic_t *nic)
    18541854{
    18551855        e1000_t *e1000 = DRIVER_DATA_NIC(nic);
     
    18591859        fibril_mutex_lock(&e1000->ctrl_lock);
    18601860       
    1861         int rc = e1000_on_down_unlocked(nic);
     1861        errno_t rc = e1000_on_down_unlocked(nic);
    18621862        if (rc == EOK)
    18631863                rc = e1000_reset(nic);
     
    19431943 *
    19441944 */
    1945 static int e1000_fill_resource_info(ddf_dev_t *dev,
     1945static errno_t e1000_fill_resource_info(ddf_dev_t *dev,
    19461946    const hw_res_list_parsed_t *hw_resources)
    19471947{
     
    19681968 *
    19691969 */
    1970 static int e1000_get_resource_info(ddf_dev_t *dev)
     1970static errno_t e1000_get_resource_info(ddf_dev_t *dev)
    19711971{
    19721972        assert(dev != NULL);
     
    19771977       
    19781978        /* 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);
    19801980        if (rc != EOK)
    19811981                return rc;
     
    19961996 *
    19971997 */
    1998 static int e1000_device_initialize(ddf_dev_t *dev)
     1998static errno_t e1000_device_initialize(ddf_dev_t *dev)
    19991999{
    20002000        /* Allocate driver data for the device. */
     
    20122012       
    20132013        /* Obtain and fill hardware resources info */
    2014         int rc = e1000_get_resource_info(dev);
     2014        errno_t rc = e1000_get_resource_info(dev);
    20152015        if (rc != EOK) {
    20162016                ddf_msg(LVL_ERROR, "Cannot obtain hardware resources");
     
    21102110 *
    21112111 */
    2112 static int e1000_pio_enable(ddf_dev_t *dev)
     2112static errno_t e1000_pio_enable(ddf_dev_t *dev)
    21132113{
    21142114        e1000_t *e1000 = DRIVER_DATA_DEV(dev);
    21152115       
    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,
    21172117            &e1000->reg_base_virt);
    21182118        if (rc != EOK)
     
    21272127 *
    21282128 */
    2129 int e1000_dev_add(ddf_dev_t *dev)
     2129errno_t e1000_dev_add(ddf_dev_t *dev)
    21302130{
    21312131        ddf_fun_t *fun;
    21322132       
    21332133        /* Initialize device structure for E1000 */
    2134         int rc = e1000_device_initialize(dev);
     2134        errno_t rc = e1000_device_initialize(dev);
    21352135        if (rc != EOK)
    21362136                return rc;
     
    22582258 *
    22592259 */
    2260 static int e1000_get_address(e1000_t *e1000, nic_address_t *address)
     2260static errno_t e1000_get_address(e1000_t *e1000, nic_address_t *address)
    22612261{
    22622262        fibril_mutex_lock(&e1000->rx_lock);
     
    22912291 * @return An error code otherwise
    22922292 */
    2293 static int e1000_set_addr(ddf_fun_t *fun, const nic_address_t *addr)
     2293static errno_t e1000_set_addr(ddf_fun_t *fun, const nic_address_t *addr)
    22942294{
    22952295        nic_t *nic = NIC_DATA_FUN(fun);
     
    22992299        fibril_mutex_lock(&e1000->tx_lock);
    23002300       
    2301         int rc = nic_report_address(nic, addr);
     2301        errno_t rc = nic_report_address(nic, addr);
    23022302        if (rc == EOK)
    23032303                e1000_write_receive_address(e1000, 0, addr, false);
  • uspace/drv/nic/ne2k/dp8390.c

    r132ab5d1 r5a6cc679  
    194194 *
    195195 */
    196 int ne2k_probe(ne2k_t *ne2k)
     196errno_t ne2k_probe(ne2k_t *ne2k)
    197197{
    198198        unsigned int i;
     
    250250 *
    251251 */
    252 int ne2k_up(ne2k_t *ne2k)
     252errno_t ne2k_up(ne2k_t *ne2k)
    253253{
    254254        if (!ne2k->probed)
  • uspace/drv/nic/ne2k/dp8390.h

    r132ab5d1 r5a6cc679  
    265265} ne2k_t;
    266266
    267 extern int ne2k_probe(ne2k_t *);
    268 extern int ne2k_up(ne2k_t *);
     267extern errno_t ne2k_probe(ne2k_t *);
     268extern errno_t ne2k_up(ne2k_t *);
    269269extern void ne2k_down(ne2k_t *);
    270270extern void ne2k_send(nic_t *, void *, size_t);
  • uspace/drv/nic/ne2k/ne2k.c

    r132ab5d1 r5a6cc679  
    124124static void ne2k_interrupt_handler(ipc_call_t *, ddf_dev_t *);
    125125
    126 static int ne2k_register_interrupt(nic_t *nic_data, cap_handle_t *handle)
     126static errno_t ne2k_register_interrupt(nic_t *nic_data, cap_handle_t *handle)
    127127{
    128128        ne2k_t *ne2k = (ne2k_t *) nic_get_specific(nic_data);
     
    178178}
    179179
    180 static int ne2k_dev_init(nic_t *nic_data)
     180static errno_t ne2k_dev_init(nic_t *nic_data)
    181181{
    182182        /* Get HW resources */
     
    184184        hw_res_list_parsed_init(&hw_res_parsed);
    185185       
    186         int rc = nic_get_resources(nic_data, &hw_res_parsed);
     186        errno_t rc = nic_get_resources(nic_data, &hw_res_parsed);
    187187       
    188188        if (rc != EOK)
     
    243243}
    244244
    245 static int ne2k_on_activating(nic_t *nic_data)
     245static errno_t ne2k_on_activating(nic_t *nic_data)
    246246{
    247247        ne2k_t *ne2k = (ne2k_t *) nic_get_specific(nic_data);
    248248
    249249        if (!ne2k->up) {
    250                 int rc = ne2k_up(ne2k);
     250                errno_t rc = ne2k_up(ne2k);
    251251                if (rc != EOK)
    252252                        return rc;
     
    261261}
    262262
    263 static int ne2k_on_stopping(nic_t *nic_data)
     263static errno_t ne2k_on_stopping(nic_t *nic_data)
    264264{
    265265        ne2k_t *ne2k = (ne2k_t *) nic_get_specific(nic_data);
     
    271271}
    272272
    273 static int ne2k_set_address(ddf_fun_t *fun, const nic_address_t *address)
     273static errno_t ne2k_set_address(ddf_fun_t *fun, const nic_address_t *address)
    274274{
    275275        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);
    277277        if (rc != EOK) {
    278278                return EINVAL;
     
    286286}
    287287
    288 static int ne2k_on_unicast_mode_change(nic_t *nic_data,
     288static errno_t ne2k_on_unicast_mode_change(nic_t *nic_data,
    289289        nic_unicast_mode_t new_mode,
    290290        const nic_address_t *address_list, size_t address_count)
     
    313313}
    314314
    315 static int ne2k_on_multicast_mode_change(nic_t *nic_data,
     315static errno_t ne2k_on_multicast_mode_change(nic_t *nic_data,
    316316        nic_multicast_mode_t new_mode,
    317317        const nic_address_t *address_list, size_t address_count)
     
    339339}
    340340
    341 static int ne2k_on_broadcast_mode_change(nic_t *nic_data,
     341static errno_t ne2k_on_broadcast_mode_change(nic_t *nic_data,
    342342        nic_broadcast_mode_t new_mode)
    343343{
     
    355355}
    356356
    357 static int ne2k_dev_add(ddf_dev_t *dev)
     357static errno_t ne2k_dev_add(ddf_dev_t *dev)
    358358{
    359359        ddf_fun_t *fun;
     
    387387        }
    388388       
    389         int rc = ne2k_dev_init(nic_data);
     389        errno_t rc = ne2k_dev_init(nic_data);
    390390        if (rc != EOK) {
    391391                ne2k_dev_cleanup(dev);
  • uspace/drv/nic/rtl8139/driver.c

    r132ab5d1 r5a6cc679  
    280280}
    281281
    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,
     282static errno_t rtl8139_set_addr(ddf_fun_t *fun, const nic_address_t *);
     283static errno_t rtl8139_get_device_info(ddf_fun_t *fun, nic_device_info_t *info);
     284static errno_t rtl8139_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state);
     285static errno_t rtl8139_get_operation_mode(ddf_fun_t *fun, int *speed,
    286286    nic_channel_mode_t *duplex, nic_role_t *role);
    287 static int rtl8139_set_operation_mode(ddf_fun_t *fun, int speed,
     287static errno_t rtl8139_set_operation_mode(ddf_fun_t *fun, int speed,
    288288    nic_channel_mode_t duplex, nic_role_t);
    289289
    290 static int rtl8139_pause_get(ddf_fun_t*, nic_result_t*, nic_result_t*,
     290static errno_t rtl8139_pause_get(ddf_fun_t*, nic_result_t*, nic_result_t*,
    291291    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,
     292static errno_t rtl8139_pause_set(ddf_fun_t*, int, int, uint16_t);
     293
     294static errno_t rtl8139_autoneg_enable(ddf_fun_t *fun, uint32_t advertisement);
     295static errno_t rtl8139_autoneg_disable(ddf_fun_t *fun);
     296static errno_t rtl8139_autoneg_probe(ddf_fun_t *fun, uint32_t *our_advertisement,
    297297    uint32_t *their_advertisement, nic_result_t *result,
    298298    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,
     299static errno_t rtl8139_autoneg_restart(ddf_fun_t *fun);
     300
     301static errno_t rtl8139_defective_get_mode(ddf_fun_t *fun, uint32_t *mode);
     302static errno_t rtl8139_defective_set_mode(ddf_fun_t *fun, uint32_t mode);
     303
     304static errno_t rtl8139_wol_virtue_add(nic_t *nic_data,
    305305        const nic_wol_virtue_t *virtue);
    306306static void rtl8139_wol_virtue_rem(nic_t *nic_data,
    307307        const nic_wol_virtue_t *virtue);
    308308
    309 static int rtl8139_poll_mode_change(nic_t *nic_data, nic_poll_mode_t mode,
     309static errno_t rtl8139_poll_mode_change(nic_t *nic_data, nic_poll_mode_t mode,
    310310    const struct timeval *period);
    311311static void rtl8139_poll(nic_t *nic_data);
     
    334334static ddf_dev_ops_t rtl8139_dev_ops;
    335335
    336 static int rtl8139_dev_add(ddf_dev_t *dev);
     336static errno_t rtl8139_dev_add(ddf_dev_t *dev);
    337337
    338338/** Basic driver operations for RTL8139 driver */
     
    348348
    349349/* The default implementation callbacks */
    350 static int rtl8139_on_activated(nic_t *nic_data);
    351 static int rtl8139_on_stopped(nic_t *nic_data);
     350static errno_t rtl8139_on_activated(nic_t *nic_data);
     351static errno_t rtl8139_on_stopped(nic_t *nic_data);
    352352static void rtl8139_send_frame(nic_t *nic_data, void *data, size_t size);
    353353
     
    846846 *  @return An error code otherwise.
    847847 */
    848 inline static int rtl8139_register_int_handler(nic_t *nic_data, cap_handle_t *handle)
     848inline static errno_t rtl8139_register_int_handler(nic_t *nic_data, cap_handle_t *handle)
    849849{
    850850        rtl8139_t *rtl8139 = nic_get_specific(nic_data);
     
    857857        rtl8139_irq_code.cmds[2].addr = rtl8139->io_addr + ISR;
    858858        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),
    860860            rtl8139->irq, rtl8139_interrupt_handler, &rtl8139_irq_code, handle);
    861861
     
    904904 *  @return EOK if activated successfully, error code otherwise
    905905 */
    906 static int rtl8139_on_activated(nic_t *nic_data)
     906static errno_t rtl8139_on_activated(nic_t *nic_data)
    907907{
    908908        assert(nic_data);
     
    919919        rtl8139_hw_int_set(rtl8139);
    920920
    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);
    922922        if (rc != EOK) {
    923923                rtl8139_on_stopped(nic_data);
     
    935935 *  @return EOK if succeed, error code otherwise
    936936 */
    937 static int rtl8139_on_stopped(nic_t *nic_data)
     937static errno_t rtl8139_on_stopped(nic_t *nic_data)
    938938{
    939939        assert(nic_data);
     
    955955
    956956
    957 static int rtl8139_unicast_set(nic_t *nic_data, nic_unicast_mode_t mode,
     957static errno_t rtl8139_unicast_set(nic_t *nic_data, nic_unicast_mode_t mode,
    958958    const nic_address_t *, size_t);
    959 static int rtl8139_multicast_set(nic_t *nic_data, nic_multicast_mode_t mode,
     959static errno_t rtl8139_multicast_set(nic_t *nic_data, nic_multicast_mode_t mode,
    960960    const nic_address_t *addr, size_t addr_count);
    961 static int rtl8139_broadcast_set(nic_t *nic_data, nic_broadcast_mode_t mode);
     961static errno_t rtl8139_broadcast_set(nic_t *nic_data, nic_broadcast_mode_t mode);
    962962
    963963
     
    10271027 *  @return EOK if succeed, error code otherwise
    10281028 */
    1029 static int rtl8139_fill_resource_info(ddf_dev_t *dev, const hw_res_list_parsed_t
     1029static errno_t rtl8139_fill_resource_info(ddf_dev_t *dev, const hw_res_list_parsed_t
    10301030    *hw_resources)
    10311031{
     
    10671067 *  @return EOK if succeed, error code otherwise
    10681068 */
    1069 static int rtl8139_get_resource_info(ddf_dev_t *dev)
     1069static errno_t rtl8139_get_resource_info(ddf_dev_t *dev)
    10701070{
    10711071        assert(dev);
     
    10781078
    10791079        /* 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);
    10811081        if (rc != EOK)
    10821082                return rc;
    10831083
    10841084        /* 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);
    10861086        hw_res_list_parsed_clean(&hw_res_parsed);
    10871087
     
    10981098 * @return EOK in the case of success, error code otherwise
    10991099 */
    1100 static int rtl8139_buffers_create(rtl8139_t *rtl8139)
     1100static errno_t rtl8139_buffers_create(rtl8139_t *rtl8139)
    11011101{
    11021102        size_t i = 0;
    1103         int rc;
     1103        errno_t rc;
    11041104
    11051105        ddf_msg(LVL_DEBUG, "Creating buffers");
     
    11491149 *  @return EOK if succeed, error code otherwise
    11501150 */
    1151 static int rtl8139_device_initialize(ddf_dev_t *dev)
     1151static errno_t rtl8139_device_initialize(ddf_dev_t *dev)
    11521152{
    11531153        ddf_msg(LVL_DEBUG, "rtl8139_dev_initialize %s", ddf_dev_get_name(dev));
    11541154
    1155         int ret = EOK;
     1155        errno_t ret = EOK;
    11561156
    11571157        ddf_msg(LVL_DEBUG, "rtl8139: creating device data");
     
    12081208 * @return EOK if successed, error code otherwise
    12091209 */
    1210 static int rtl8139_pio_enable(ddf_dev_t *dev)
     1210static errno_t rtl8139_pio_enable(ddf_dev_t *dev)
    12111211{
    12121212        ddf_msg(LVL_DEBUG, NAME ": rtl8139_pio_enable %s", ddf_dev_get_name(dev));
     
    12581258 * @return EOK if added successfully, error code otherwise
    12591259 */
    1260 int rtl8139_dev_add(ddf_dev_t *dev)
     1260errno_t rtl8139_dev_add(ddf_dev_t *dev)
    12611261{
    12621262        ddf_fun_t *fun;
     
    12661266
    12671267        /* Init device structure for rtl8139 */
    1268         int rc = rtl8139_device_initialize(dev);
     1268        errno_t rc = rtl8139_device_initialize(dev);
    12691269        if (rc != EOK)
    12701270                return rc;
     
    13411341 *  @return EOK if succeed, error code otherwise
    13421342 */
    1343 static int rtl8139_set_addr(ddf_fun_t *fun, const nic_address_t *addr)
     1343static errno_t rtl8139_set_addr(ddf_fun_t *fun, const nic_address_t *addr)
    13441344{
    13451345        assert(fun);
     
    13521352        rtl8139_lock_all(rtl8139);
    13531353
    1354         int rc = nic_report_address(nic_data, addr);
     1354        errno_t rc = nic_report_address(nic_data, addr);
    13551355        if ( rc != EOK) {
    13561356                rtl8139_unlock_all(rtl8139);
     
    13711371 *  @return EOK
    13721372 */
    1373 static int rtl8139_get_device_info(ddf_fun_t *fun, nic_device_info_t *info)
     1373static errno_t rtl8139_get_device_info(ddf_fun_t *fun, nic_device_info_t *info)
    13741374{
    13751375        assert(fun);
     
    14061406 *  @return EOK
    14071407 */
    1408 static int rtl8139_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state)
     1408static errno_t rtl8139_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state)
    14091409{
    14101410        assert(fun);
     
    14251425/** Get operation mode of the device
    14261426 */
    1427 static int rtl8139_get_operation_mode(ddf_fun_t *fun, int *speed,
     1427static errno_t rtl8139_get_operation_mode(ddf_fun_t *fun, int *speed,
    14281428    nic_channel_mode_t *duplex, nic_role_t *role)
    14291429{
     
    15021502 *  @return EOK if succeed
    15031503 */
    1504 static int rtl8139_pause_get(ddf_fun_t *fun, nic_result_t *we_send,
     1504static errno_t rtl8139_pause_get(ddf_fun_t *fun, nic_result_t *we_send,
    15051505    nic_result_t *we_receive, uint16_t *time)
    15061506{
     
    15371537 *  @return EOK if succeed, INVAL if the pause frame has no sence
    15381538 */
    1539 static int rtl8139_pause_set(ddf_fun_t *fun, int allow_send, int allow_receive,
     1539static errno_t rtl8139_pause_set(ddf_fun_t *fun, int allow_send, int allow_receive,
    15401540    uint16_t time)
    15411541{
     
    15671567 *
    15681568 */
    1569 static int rtl8139_set_operation_mode(ddf_fun_t *fun, int speed,
     1569static errno_t rtl8139_set_operation_mode(ddf_fun_t *fun, int speed,
    15701570    nic_channel_mode_t duplex, nic_role_t role)
    15711571{
     
    16111611 *  @returns EOK if advertisement mode set successfully
    16121612 */
    1613 static int rtl8139_autoneg_enable(ddf_fun_t *fun, uint32_t advertisement)
     1613static errno_t rtl8139_autoneg_enable(ddf_fun_t *fun, uint32_t advertisement)
    16141614{
    16151615        assert(fun);
     
    16571657 *  @returns EOK
    16581658 */
    1659 static int rtl8139_autoneg_disable(ddf_fun_t *fun)
     1659static errno_t rtl8139_autoneg_disable(ddf_fun_t *fun)
    16601660{
    16611661        assert(fun);
     
    17081708 *  @returns EOK
    17091709 */
    1710 static int rtl8139_autoneg_probe(ddf_fun_t *fun, uint32_t *advertisement,
     1710static errno_t rtl8139_autoneg_probe(ddf_fun_t *fun, uint32_t *advertisement,
    17111711    uint32_t *their_adv, nic_result_t *result, nic_result_t *their_result)
    17121712{
     
    17451745 *  @returns EOK
    17461746 */
    1747 static int rtl8139_autoneg_restart(ddf_fun_t *fun)
     1747static errno_t rtl8139_autoneg_restart(ddf_fun_t *fun)
    17481748{
    17491749        assert(fun);
     
    17931793 *  @returns EOK
    17941794 */
    1795 static int rtl8139_unicast_set(nic_t *nic_data, nic_unicast_mode_t mode,
     1795static errno_t rtl8139_unicast_set(nic_t *nic_data, nic_unicast_mode_t mode,
    17961796    const nic_address_t *addr, size_t addr_cnt)
    17971797{
     
    18511851 *  @returns EOK
    18521852 */
    1853 static int rtl8139_multicast_set(nic_t *nic_data, nic_multicast_mode_t mode,
     1853static errno_t rtl8139_multicast_set(nic_t *nic_data, nic_multicast_mode_t mode,
    18541854    const nic_address_t *addr, size_t addr_count)
    18551855{
     
    18941894 *  @returns EOK
    18951895 */
    1896 static int rtl8139_broadcast_set(nic_t *nic_data, nic_broadcast_mode_t mode)
     1896static errno_t rtl8139_broadcast_set(nic_t *nic_data, nic_broadcast_mode_t mode)
    18971897{
    18981898        assert(nic_data);
     
    19221922 *  @param[out] mode    The current mode
    19231923 */
    1924 static int rtl8139_defective_get_mode(ddf_fun_t *fun, uint32_t *mode)
     1924static errno_t rtl8139_defective_get_mode(ddf_fun_t *fun, uint32_t *mode)
    19251925{
    19261926        assert(fun);
     
    19471947 *  @returns EOK of mode was set
    19481948 */
    1949 static int rtl8139_defective_set_mode(ddf_fun_t *fun, uint32_t mode)
     1949static errno_t rtl8139_defective_set_mode(ddf_fun_t *fun, uint32_t mode)
    19501950{
    19511951        assert(fun);
     
    19791979 *  @returns ELIMIT if no more methods of this kind can be enabled
    19801980 */
    1981 static int rtl8139_wol_virtue_add(nic_t *nic_data,
     1981static errno_t rtl8139_wol_virtue_add(nic_t *nic_data,
    19821982        const nic_wol_virtue_t *virtue)
    19831983{
     
    20582058 *  @returns ENOTSUP if the mode is not supported
    20592059 */
    2060 static int rtl8139_poll_mode_change(nic_t *nic_data, nic_poll_mode_t mode,
     2060static errno_t rtl8139_poll_mode_change(nic_t *nic_data, nic_poll_mode_t mode,
    20612061    const struct timeval *period)
    20622062{
    20632063        assert(nic_data);
    2064         int rc = EOK;
     2064        errno_t rc = EOK;
    20652065
    20662066        rtl8139_t *rtl8139 = nic_get_specific(nic_data);
     
    21432143        printf("%s: HelenOS RTL8139 network adapter driver\n", NAME);
    21442144
    2145         int rc = nic_driver_init(NAME);
     2145        errno_t rc = nic_driver_init(NAME);
    21462146        if (rc != EOK)
    21472147                return rc;
  • uspace/drv/nic/rtl8139/general.c

    r132ab5d1 r5a6cc679  
    8383 *  @return EOK if succeed, error code otherwise
    8484 */
    85 int rtl8139_timer_act_init(rtl8139_timer_act_t * ta, uint32_t timer_freq,
     85errno_t rtl8139_timer_act_init(rtl8139_timer_act_t * ta, uint32_t timer_freq,
    8686    const struct timeval *time)
    8787{
  • uspace/drv/nic/rtl8139/general.h

    r132ab5d1 r5a6cc679  
    6161extern void *rtl8139_memcpy_wrapped(void *, const void *, size_t, size_t,
    6262    size_t);
    63 extern int rtl8139_timer_act_init(rtl8139_timer_act_t *, uint32_t,
     63extern errno_t rtl8139_timer_act_init(rtl8139_timer_act_t *, uint32_t,
    6464    const struct timeval *);
    6565extern int rtl8139_timer_act_step(rtl8139_timer_act_t *, uint32_t *);
  • uspace/drv/nic/rtl8169/driver.c

    r132ab5d1 r5a6cc679  
    5252FIBRIL_MUTEX_INITIALIZE(irq_reg_lock);
    5353
    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,
     54static errno_t rtl8169_set_addr(ddf_fun_t *fun, const nic_address_t *addr);
     55static errno_t rtl8169_get_device_info(ddf_fun_t *fun, nic_device_info_t *info);
     56static errno_t rtl8169_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state);
     57static errno_t rtl8169_get_operation_mode(ddf_fun_t *fun, int *speed,
    5858    nic_channel_mode_t *duplex, nic_role_t *role);
    59 static int rtl8169_set_operation_mode(ddf_fun_t *fun, int speed,
     59static errno_t rtl8169_set_operation_mode(ddf_fun_t *fun, int speed,
    6060    nic_channel_mode_t duplex, nic_role_t role);
    61 static int rtl8169_pause_get(ddf_fun_t *fun, nic_result_t *we_send,
     61static errno_t rtl8169_pause_get(ddf_fun_t *fun, nic_result_t *we_send,
    6262    nic_result_t *we_receive, uint16_t *time);
    63 static int rtl8169_pause_set(ddf_fun_t *fun, int allow_send, int allow_receive,
     63static errno_t rtl8169_pause_set(ddf_fun_t *fun, int allow_send, int allow_receive,
    6464    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,
     65static errno_t rtl8169_autoneg_enable(ddf_fun_t *fun, uint32_t advertisement);
     66static errno_t rtl8169_autoneg_disable(ddf_fun_t *fun);
     67static errno_t rtl8169_autoneg_probe(ddf_fun_t *fun, uint32_t *advertisement,
    6868    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);
     69static errno_t rtl8169_autoneg_restart(ddf_fun_t *fun);
     70static errno_t rtl8169_defective_get_mode(ddf_fun_t *fun, uint32_t *mode);
     71static errno_t rtl8169_defective_set_mode(ddf_fun_t *fun, uint32_t mode);
     72static errno_t rtl8169_on_activated(nic_t *nic_data);
     73static errno_t rtl8169_on_stopped(nic_t *nic_data);
    7474static void rtl8169_send_frame(nic_t *nic_data, void *data, size_t size);
    7575static 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);
     76static inline errno_t rtl8169_register_int_handler(nic_t *nic_data, cap_handle_t *handle);
    7777static inline void rtl8169_get_hwaddr(rtl8169_t *rtl8169, nic_address_t *addr);
    7878static inline void rtl8169_set_hwaddr(rtl8169_t *rtl8169, const nic_address_t *addr);
    7979
    8080static 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);
     81static errno_t rtl8169_get_resource_info(ddf_dev_t *dev);
     82static errno_t rtl8169_fill_resource_info(ddf_dev_t *dev, const hw_res_list_parsed_t *hw_resources);
    8383static rtl8169_t *rtl8169_create_dev_data(ddf_dev_t *dev);
    8484
    85 static int rtl8169_unicast_set(nic_t *nic_data, nic_unicast_mode_t mode,
     85static errno_t rtl8169_unicast_set(nic_t *nic_data, nic_unicast_mode_t mode,
    8686    const nic_address_t *, size_t);
    87 static int rtl8169_multicast_set(nic_t *nic_data, nic_multicast_mode_t mode,
     87static errno_t rtl8169_multicast_set(nic_t *nic_data, nic_multicast_mode_t mode,
    8888    const nic_address_t *addr, size_t addr_count);
    89 static int rtl8169_broadcast_set(nic_t *nic_data, nic_broadcast_mode_t mode);
     89static errno_t rtl8169_broadcast_set(nic_t *nic_data, nic_broadcast_mode_t mode);
    9090
    9191static uint16_t rtl8169_mii_read(rtl8169_t *rtl8169, uint8_t addr);
     
    161161static ddf_dev_ops_t rtl8169_dev_ops;
    162162
    163 static int rtl8169_dev_add(ddf_dev_t *dev);
     163static errno_t rtl8169_dev_add(ddf_dev_t *dev);
    164164
    165165/** Basic driver operations for RTL8169 driver */
     
    174174};
    175175
    176 static int rtl8169_get_resource_info(ddf_dev_t *dev)
     176static errno_t rtl8169_get_resource_info(ddf_dev_t *dev)
    177177{
    178178        assert(dev);
     
    185185
    186186        /* 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);
    188188        if (rc != EOK)
    189189                return rc;
    190190
    191191        /* 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);
    193193        hw_res_list_parsed_clean(&hw_res_parsed);
    194194
     
    196196}
    197197
    198 static int rtl8169_fill_resource_info(ddf_dev_t *dev, const hw_res_list_parsed_t
     198static errno_t rtl8169_fill_resource_info(ddf_dev_t *dev, const hw_res_list_parsed_t
    199199    *hw_resources)
    200200{
     
    229229}
    230230
    231 static int rtl8169_allocate_buffers(rtl8169_t *rtl8169)
    232 {
    233         int rc;
     231static errno_t rtl8169_allocate_buffers(rtl8169_t *rtl8169)
     232{
     233        errno_t rc;
    234234
    235235        ddf_msg(LVL_DEBUG, "Allocating DMA buffer rings");
     
    334334}
    335335
    336 static int rtl8169_dev_initialize(ddf_dev_t *dev)
    337 {
    338         int ret;
     336static errno_t rtl8169_dev_initialize(ddf_dev_t *dev)
     337{
     338        errno_t ret;
    339339
    340340        rtl8169_t *rtl8169 = rtl8169_create_dev_data(dev);
     
    360360}
    361361
    362 inline static int rtl8169_register_int_handler(nic_t *nic_data, cap_handle_t *handle)
     362inline static errno_t rtl8169_register_int_handler(nic_t *nic_data, cap_handle_t *handle)
    363363{
    364364        rtl8169_t *rtl8169 = nic_get_specific(nic_data);
     
    368368        rtl8169_irq_code.cmds[2].addr = rtl8169->regs + ISR;
    369369        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),
    371371            rtl8169->irq, rtl8169_irq_handler, &rtl8169_irq_code, handle);
    372372
     
    374374}
    375375
    376 static int rtl8169_dev_add(ddf_dev_t *dev)
     376static errno_t rtl8169_dev_add(ddf_dev_t *dev)
    377377{
    378378        ddf_fun_t *fun;
    379379        nic_address_t nic_addr;
    380         int rc;
     380        errno_t rc;
    381381
    382382        assert(dev);
     
    481481}
    482482
    483 static int rtl8169_set_addr(ddf_fun_t *fun, const nic_address_t *addr)
     483static errno_t rtl8169_set_addr(ddf_fun_t *fun, const nic_address_t *addr)
    484484{
    485485        nic_t *nic_data = nic_get_from_ddf_fun(fun);
    486486        rtl8169_t *rtl8169 = nic_get_specific(nic_data);
    487         int rc;
     487        errno_t rc;
    488488
    489489        fibril_mutex_lock(&rtl8169->rx_lock);
     
    502502}
    503503
    504 static int rtl8169_get_device_info(ddf_fun_t *fun, nic_device_info_t *info)
     504static errno_t rtl8169_get_device_info(ddf_fun_t *fun, nic_device_info_t *info)
    505505{
    506506        nic_t *nic_data = nic_get_from_ddf_fun(fun);
     
    528528}
    529529
    530 static int rtl8169_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state)
     530static errno_t rtl8169_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state)
    531531{
    532532        rtl8169_t *rtl8169 = nic_get_specific(nic_get_from_ddf_fun(fun));
     
    541541}
    542542
    543 static int rtl8169_get_operation_mode(ddf_fun_t *fun, int *speed,
     543static errno_t rtl8169_get_operation_mode(ddf_fun_t *fun, int *speed,
    544544    nic_channel_mode_t *duplex, nic_role_t *role)
    545545{
     
    563563}
    564564
    565 static int rtl8169_set_operation_mode(ddf_fun_t *fun, int speed,
     565static errno_t rtl8169_set_operation_mode(ddf_fun_t *fun, int speed,
    566566    nic_channel_mode_t duplex, nic_role_t role)
    567567{
     
    594594}
    595595
    596 static int rtl8169_pause_get(ddf_fun_t *fun, nic_result_t *we_send,
     596static errno_t rtl8169_pause_get(ddf_fun_t *fun, nic_result_t *we_send,
    597597    nic_result_t *we_receive, uint16_t *time)
    598598{
     
    600600}
    601601
    602 static int rtl8169_pause_set(ddf_fun_t *fun, int allow_send, int allow_receive,
     602static errno_t rtl8169_pause_set(ddf_fun_t *fun, int allow_send, int allow_receive,
    603603    uint16_t time)
    604604{
     
    606606}
    607607
    608 static int rtl8169_autoneg_enable(ddf_fun_t *fun, uint32_t advertisement)
     608static errno_t rtl8169_autoneg_enable(ddf_fun_t *fun, uint32_t advertisement)
    609609{
    610610        rtl8169_t *rtl8169 = nic_get_specific(nic_get_from_ddf_fun(fun));
     
    630630}
    631631
    632 static int rtl8169_autoneg_disable(ddf_fun_t *fun)
     632static errno_t rtl8169_autoneg_disable(ddf_fun_t *fun)
    633633{
    634634        rtl8169_t *rtl8169 = nic_get_specific(nic_get_from_ddf_fun(fun));
     
    641641}
    642642
    643 static int rtl8169_autoneg_probe(ddf_fun_t *fun, uint32_t *advertisement,
     643static errno_t rtl8169_autoneg_probe(ddf_fun_t *fun, uint32_t *advertisement,
    644644    uint32_t *their_adv, nic_result_t *result, nic_result_t *their_result)
    645645{
     
    647647}
    648648
    649 static int rtl8169_autoneg_restart(ddf_fun_t *fun)
     649static errno_t rtl8169_autoneg_restart(ddf_fun_t *fun)
    650650{
    651651        rtl8169_t *rtl8169 = nic_get_specific(nic_get_from_ddf_fun(fun));
     
    657657}
    658658
    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)
     659static errno_t rtl8169_defective_get_mode(ddf_fun_t *fun, uint32_t *mode)
     660{
     661        return EOK;
     662}
     663
     664static errno_t rtl8169_defective_set_mode(ddf_fun_t *fun, uint32_t mode)
    665665{
    666666        return EOK;
     
    691691}
    692692
    693 static int rtl8169_on_activated(nic_t *nic_data)
    694 {
    695         int rc;
     693static errno_t rtl8169_on_activated(nic_t *nic_data)
     694{
     695        errno_t rc;
    696696        uint64_t tmp;
    697697
     
    753753}
    754754
    755 static int rtl8169_on_stopped(nic_t *nic_data)
     755static errno_t rtl8169_on_stopped(nic_t *nic_data)
    756756{
    757757        ddf_msg(LVL_NOTE, "Stopping device");
     
    819819}
    820820
    821 static int rtl8169_unicast_set(nic_t *nic_data, nic_unicast_mode_t mode,
     821static errno_t rtl8169_unicast_set(nic_t *nic_data, nic_unicast_mode_t mode,
    822822    const nic_address_t *addr, size_t addr_count)
    823823{
     
    871871}
    872872
    873 static int rtl8169_multicast_set(nic_t *nic_data, nic_multicast_mode_t mode,
     873static errno_t rtl8169_multicast_set(nic_t *nic_data, nic_multicast_mode_t mode,
    874874    const nic_address_t *addr, size_t addr_count)
    875875{
     
    915915}
    916916
    917 static int rtl8169_broadcast_set(nic_t *nic_data, nic_broadcast_mode_t mode)
     917static errno_t rtl8169_broadcast_set(nic_t *nic_data, nic_broadcast_mode_t mode)
    918918{
    919919        rtl8169_t *rtl8169 = nic_get_specific(nic_data);
     
    12081208int main(void)
    12091209{
    1210         int rc = nic_driver_init(NAME);
     1210        errno_t rc = nic_driver_init(NAME);
    12111211        if (rc != EOK)
    12121212                return rc;
Note: See TracChangeset for help on using the changeset viewer.