Changes in / [a4f8c3f:850f24d1] in mainline


Ignore:
Location:
uspace
Files:
6 deleted
9 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/sysinst/sysinst.c

    ra4f8c3f r850f24d1  
    158158static void sysinst_futil_create_dir(void *, const char *);
    159159static errno_t sysinst_eject_dev(sysinst_t *, service_id_t);
     160static errno_t sysinst_eject_phys_by_mp(sysinst_t *, const char *);
    160161
    161162static futil_cb_t sysinst_futil_cb = {
     
    272273        case 0:
    273274                /* OK */
     275                sysinst_action(sysinst, "Ejecting installation media.");
     276                (void)sysinst_eject_phys_by_mp(sysinst, CD_MOUNT_POINT);
    274277                (void)sysinst_restart(sysinst);
    275278                break;
     
    592595        rc = futil_rcopy_contents(sysinst->futil, CFG_FILES_SRC,
    593596            CFG_FILES_DEST);
    594         if (rc != EOK)
    595                 return rc;
     597        if (rc != EOK) {
     598                sysinst_error(sysinst, "Error copying initial configuration "
     599                    "files.");
     600                return rc;
     601        }
    596602
    597603        return EOK;
     
    613619            "sysinst_copy_boot_files(): copy bootloader files");
    614620        rc = futil_rcopy_contents(sysinst->futil, BOOT_FILES_SRC, MOUNT_POINT);
    615         if (rc != EOK)
    616                 return rc;
     621        if (rc != EOK) {
     622                sysinst_error(sysinst, "Error copying bootloader "
     623                    "files.");
     624                return rc;
     625        }
    617626
    618627        sysinst_debug(sysinst, "sysinst_copy_boot_files(): OK");
     
    891900        errno_t rc;
    892901
     902        log_msg(LOG_DEFAULT, LVL_NOTE,
     903            "sysinst_eject_phys_by_mp(%s)", path);
     904
    893905        rc = vol_create(&vol);
    894906        if (rc != EOK) {
     
    934946        shutdown_failed = false;
    935947
     948        sysinst_action(sysinst, "Restarting the system.");
     949
    936950        rc = system_open(SYSTEM_DEFAULT, &sysinst_system_cb, NULL, &system);
    937951        if (rc != EOK) {
     
    983997{
    984998        errno_t rc;
     999        bool clean_dev = false;
    9851000
    9861001        sysinst_action(sysinst, "Creating device label and file system.");
     
    9881003        rc = sysinst_label_dev(sysinst, dev);
    9891004        if (rc != EOK)
    990                 return rc;
     1005                goto error;
     1006
     1007        clean_dev = true;
    9911008
    9921009        sysinst_action(sysinst, "Creating system directory structure.");
    9931010        rc = sysinst_setup_sysvol(sysinst);
    9941011        if (rc != EOK)
    995                 return rc;
     1012                goto error;
    9961013
    9971014        sysinst_action(sysinst, "Copying boot files.");
    9981015        rc = sysinst_copy_boot_files(sysinst);
    9991016        if (rc != EOK)
    1000                 return rc;
     1017                goto error;
    10011018
    10021019        sysinst_action(sysinst, "Configuring the system.");
    10031020        rc = sysinst_customize_initrd(sysinst);
    10041021        if (rc != EOK)
    1005                 return rc;
     1022                goto error;
    10061023
    10071024        sysinst_action(sysinst, "Finishing system volume.");
    10081025        rc = sysinst_finish_dev(sysinst);
    10091026        if (rc != EOK)
    1010                 return rc;
     1027                goto error;
     1028
     1029        clean_dev = false;
    10111030
    10121031        sysinst_action(sysinst, "Installing boot blocks.");
     
    10151034                return rc;
    10161035
    1017         sysinst_action(sysinst, "Ejecting installation media.");
    1018         rc = sysinst_eject_phys_by_mp(sysinst, CD_MOUNT_POINT);
    1019         if (rc != EOK)
    1020                 return rc;
    1021 
    1022         return EOK;
     1036        return EOK;
     1037error:
     1038        if (clean_dev)
     1039                (void)sysinst_finish_dev(sysinst);
     1040        return rc;
    10231041}
    10241042
     
    10551073
    10561074        sysinst_progress_destroy(sysinst->progress);
     1075        sysinst->progress = NULL;
     1076
    10571077        rc = sysinst_restart_dlg_create(sysinst);
    10581078        if (rc != EOK)
     
    12331253static void sysinst_action(sysinst_t *sysinst, const char *action)
    12341254{
     1255        log_msg(LOG_DEFAULT, LVL_NOTE, "%s", action);
     1256
    12351257        if (sysinst->progress == NULL)
    12361258                return;
     
    12381260        ui_label_set_text(sysinst->progress->action, action);
    12391261        ui_label_paint(sysinst->progress->action);
    1240         log_msg(LOG_DEFAULT, LVL_NOTE, "%s", action);
    12411262}
    12421263
  • uspace/drv/block/ahci/ahci.c

    ra4f8c3f r850f24d1  
    11/*
     2 * Copyright (c) 2025 Jiri Svoboda
    23 * Copyright (c) 2012 Petr Jerman
    34 * All rights reserved.
     
    3233
    3334#include <as.h>
     35#include <bd_srv.h>
    3436#include <errno.h>
    3537#include <stdio.h>
     
    3941#include <device/hw_res_parsed.h>
    4042#include <pci_dev_iface.h>
    41 #include <ahci_iface.h>
    4243#include "ahci.h"
    4344#include "ahci_hw.h"
     
    109110        }
    110111
    111 static errno_t get_sata_device_name(ddf_fun_t *, size_t, char *);
    112 static errno_t get_num_blocks(ddf_fun_t *, uint64_t *);
    113 static errno_t get_block_size(ddf_fun_t *, size_t *);
    114 static errno_t read_blocks(ddf_fun_t *, uint64_t, size_t, void *);
    115 static errno_t write_blocks(ddf_fun_t *, uint64_t, size_t, void *);
     112static errno_t ahci_read_blocks(sata_dev_t *, uint64_t, size_t, void *);
     113static errno_t ahci_write_blocks(sata_dev_t *, uint64_t, size_t, void *);
    116114
    117115static errno_t ahci_identify_device(sata_dev_t *);
     
    131129static int sata_devices_count = 0;
    132130
    133 /*
    134  * AHCI Interface
    135  */
    136 
    137 static ahci_iface_t ahci_interface = {
    138         .get_sata_device_name = &get_sata_device_name,
    139         .get_num_blocks = &get_num_blocks,
    140         .get_block_size = &get_block_size,
    141         .read_blocks = &read_blocks,
    142         .write_blocks = &write_blocks
    143 };
    144 
    145 static ddf_dev_ops_t ahci_ops = {
    146         .interfaces[AHCI_DEV_IFACE] = &ahci_interface
     131static errno_t ahci_bd_open(bd_srvs_t *, bd_srv_t *);
     132static errno_t ahci_bd_close(bd_srv_t *);
     133static errno_t ahci_bd_read_blocks(bd_srv_t *, aoff64_t, size_t, void *, size_t);
     134static errno_t ahci_bd_write_blocks(bd_srv_t *, aoff64_t, size_t, const void *, size_t);
     135static errno_t ahci_bd_get_block_size(bd_srv_t *, size_t *);
     136static errno_t ahci_bd_get_num_blocks(bd_srv_t *, aoff64_t *);
     137
     138static void ahci_bd_connection(ipc_call_t *, void *);
     139
     140static bd_ops_t ahci_bd_ops = {
     141        .open = ahci_bd_open,
     142        .close = ahci_bd_close,
     143        .read_blocks = ahci_bd_read_blocks,
     144        .write_blocks = ahci_bd_write_blocks,
     145        .get_block_size = ahci_bd_get_block_size,
     146        .get_num_blocks = ahci_bd_get_num_blocks
    147147};
    148148
     
    156156};
    157157
    158 /** Get SATA structure from DDF function. */
    159 static sata_dev_t *fun_sata_dev(ddf_fun_t *fun)
    160 {
    161         return ddf_fun_data_get(fun);
    162 }
    163 
    164 /** Get SATA device name.
    165  *
    166  * @param fun                  Device function handling the call.
    167  * @param sata_dev_name_length Length of the sata_dev_name buffer.
    168  * @param sata_dev_name        Buffer for SATA device name.
    169  *
    170  * @return EOK.
    171  *
    172  */
    173 static errno_t get_sata_device_name(ddf_fun_t *fun,
    174     size_t sata_dev_name_length, char *sata_dev_name)
    175 {
    176         sata_dev_t *sata = fun_sata_dev(fun);
    177         str_cpy(sata_dev_name, sata_dev_name_length, sata->model);
    178         return EOK;
    179 }
    180 
    181 /** Get Number of blocks in SATA device.
    182  *
    183  * @param fun    Device function handling the call.
    184  * @param blocks Return number of blocks in SATA device.
    185  *
    186  * @return EOK.
    187  *
    188  */
    189 static errno_t get_num_blocks(ddf_fun_t *fun, uint64_t *num_blocks)
    190 {
    191         sata_dev_t *sata = fun_sata_dev(fun);
    192         *num_blocks = sata->blocks;
    193         return EOK;
    194 }
    195 
    196 /** Get SATA device block size.
    197  *
    198  * @param fun        Device function handling the call.
    199  * @param block_size Return block size.
    200  *
    201  * @return EOK.
    202  *
    203  */
    204 static errno_t get_block_size(ddf_fun_t *fun, size_t *block_size)
    205 {
    206         sata_dev_t *sata = fun_sata_dev(fun);
    207         *block_size = sata->block_size;
    208         return EOK;
    209 }
    210 
    211 /** Read data blocks into SATA device.
    212  *
    213  * @param fun      Device function handling the call.
     158/** Get SATA structure from block device service structure. */
     159static sata_dev_t *bd_srv_sata(bd_srv_t *bd)
     160{
     161        return (sata_dev_t *) bd->srvs->sarg;
     162}
     163
     164/** Read data blocks from SATA device.
     165 *
     166 * @param sata     SATA device
    214167 * @param blocknum Number of first block.
    215168 * @param count    Number of blocks to read.
    216169 * @param buf      Buffer for data.
    217170 *
    218  * @return EOK if succeed, error code otherwise
    219  *
    220  */
    221 static errno_t read_blocks(ddf_fun_t *fun, uint64_t blocknum,
     171 * @return EOK on success, error code otherwise
     172 *
     173 */
     174static errno_t ahci_read_blocks(sata_dev_t *sata, uint64_t blocknum,
    222175    size_t count, void *buf)
    223176{
    224         sata_dev_t *sata = fun_sata_dev(fun);
    225 
    226177        uintptr_t phys;
    227178        void *ibuf = AS_AREA_ANY;
     
    252203}
    253204
    254 /** Write data blocks into SATA device.
    255  *
    256  * @param fun      Device function handling the call.
     205/** Write data blocks to SATA device.
     206 *
     207 * @param sata     SATA device
    257208 * @param blocknum Number of first block.
    258209 * @param count    Number of blocks to write.
    259210 * @param buf      Buffer with data.
    260211 *
    261  * @return EOK if succeed, error code otherwise
    262  *
    263  */
    264 static errno_t write_blocks(ddf_fun_t *fun, uint64_t blocknum,
     212 * @return EOK on success, error code otherwise
     213 */
     214static errno_t ahci_write_blocks(sata_dev_t *sata, uint64_t blocknum,
    265215    size_t count, void *buf)
    266216{
    267         sata_dev_t *sata = fun_sata_dev(fun);
    268 
    269217        uintptr_t phys;
    270218        void *ibuf = AS_AREA_ANY;
     
    290238
    291239        return rc;
     240}
     241
     242/** Open device. */
     243static errno_t ahci_bd_open(bd_srvs_t *bds, bd_srv_t *bd)
     244{
     245        return EOK;
     246}
     247
     248/** Close device. */
     249static errno_t ahci_bd_close(bd_srv_t *bd)
     250{
     251        return EOK;
     252}
     253
     254/** Read blocks from partition. */
     255static errno_t ahci_bd_read_blocks(bd_srv_t *bd, aoff64_t ba, size_t cnt,
     256    void *buf, size_t size)
     257{
     258        sata_dev_t *sata = bd_srv_sata(bd);
     259
     260        if (size < cnt * sata->block_size)
     261                return EINVAL;
     262
     263        return ahci_read_blocks(sata, ba, cnt, buf);
     264}
     265
     266/** Write blocks to partition. */
     267static errno_t ahci_bd_write_blocks(bd_srv_t *bd, aoff64_t ba, size_t cnt,
     268    const void *buf, size_t size)
     269{
     270        sata_dev_t *sata = bd_srv_sata(bd);
     271
     272        if (size < cnt * sata->block_size)
     273                return EINVAL;
     274
     275        return ahci_write_blocks(sata, ba, cnt, (void *)buf);
     276}
     277
     278/** Get device block size. */
     279static errno_t ahci_bd_get_block_size(bd_srv_t *bd, size_t *rsize)
     280{
     281        sata_dev_t *sata = bd_srv_sata(bd);
     282
     283        *rsize = sata->block_size;
     284        return EOK;
     285}
     286
     287/** Get number of blocks on device. */
     288static errno_t ahci_bd_get_num_blocks(bd_srv_t *bd, aoff64_t *rnb)
     289{
     290        sata_dev_t *sata = bd_srv_sata(bd);
     291
     292        *rnb = sata->blocks;
     293        return EOK;
     294}
     295
     296static void ahci_bd_connection(ipc_call_t *icall, void *arg)
     297{
     298        sata_dev_t *sata;
     299
     300        sata = (sata_dev_t *) ddf_fun_data_get((ddf_fun_t *)arg);
     301        bd_conn(icall, &sata->bds);
    292302}
    293303
     
    415425 * @param sata SATA device structure.
    416426 *
    417  * @return EOK if succeed, error code otherwise.
     427 * @return EOK on success, error code otherwise.
    418428 *
    419429 */
     
    596606 * @param sata SATA device structure.
    597607 *
    598  * @return EOK if succeed, error code otherwise
     608 * @return EOK on success, error code otherwise
    599609 *
    600610 */
     
    725735 * @param blocknum Block number to read.
    726736 *
    727  * @return EOK if succeed, error code otherwise
     737 * @return EOK on success, error code otherwise
    728738 *
    729739 */
     
    754764 * @param blocknum Block number to write.
    755765 *
    756  * @return EOK if succeed, error code otherwise
     766 * @return EOK on success, error code otherwise
    757767 *
    758768 */
     
    813823 * @param blocknum Block number to write.
    814824 *
    815  * @return EOK if succeed, error code otherwise
     825 * @return EOK on success, error code otherwise
    816826 *
    817827 */
     
    920930 * @param port AHCI port structure
    921931 *
    922  * @return SATA device structure if succeed, NULL otherwise.
     932 * @return SATA device structure on success, NULL otherwise.
    923933 *
    924934 */
     
    10281038 * @param port_num Number of AHCI port with existing SATA device.
    10291039 *
    1030  * @return EOK if succeed, error code otherwise.
     1040 * @return EOK on success, error code otherwise.
    10311041 *
    10321042 */
     
    10351045{
    10361046        ddf_fun_t *fun = NULL;
     1047        bool bound = false;
    10371048        errno_t rc;
    10381049
     
    10751086        }
    10761087
    1077         ddf_fun_set_ops(fun, &ahci_ops);
     1088        fun = sata->fun;
     1089
     1090        bd_srvs_init(&sata->bds);
     1091        sata->bds.ops = &ahci_bd_ops;
     1092        sata->bds.sarg = (void *)sata;
     1093
     1094        /* Set up a connection handler. */
     1095        ddf_fun_set_conn_handler(fun, ahci_bd_connection);
     1096
     1097        ddf_msg(LVL_NOTE, "Device %s - %s, blocks: %" PRIu64
     1098            " block_size: %zu\n", sata_dev_name, sata->model, sata->blocks,
     1099            sata->block_size);
    10781100
    10791101        rc = ddf_fun_bind(fun);
     
    10831105        }
    10841106
     1107        bound = true;
     1108
     1109        rc = ddf_fun_add_to_category(fun, "disk");
     1110        if (rc != EOK) {
     1111                ddf_msg(LVL_ERROR, "Failed adding function %s to category "
     1112                    "'disk'.", sata_dev_name);
     1113                goto error;
     1114        }
     1115
    10851116        return EOK;
    10861117
    10871118error:
     1119        if (bound)
     1120                ddf_fun_unbind(fun);
    10881121        sata->is_invalid_device = true;
    10891122        if (fun != NULL)
     
    11221155 * @param dev DDF device structure.
    11231156 *
    1124  * @return AHCI device structure if succeed, NULL otherwise.
     1157 * @return AHCI device structure on success, NULL otherwise.
    11251158 *
    11261159 */
     
    12461279 * @param dev DDF device structure.
    12471280 *
    1248  * @return EOK if succeed, error code otherwise.
     1281 * @return EOK on success, error code otherwise.
    12491282 *
    12501283 */
  • uspace/drv/block/ahci/ahci.h

    ra4f8c3f r850f24d1  
    11/*
     2 * Copyright (c) 2025 Jiri Svoboda
    23 * Copyright (c) 2012 Petr Jerman
    34 * All rights reserved.
     
    3132 */
    3233
    33 #ifndef __AHCI_H__
    34 #define __AHCI_H__
     34#ifndef AHCI_H
     35#define AHCI_H
    3536
    3637#include <async.h>
     38#include <bd_srv.h>
    3739#include <ddf/interrupt.h>
    3840#include <stdio.h>
     
    105107        /** Highest UDMA mode supported. */
    106108        uint8_t highest_udma_mode;
     109
     110        /** Block device service structure */
     111        bd_srvs_t bds;
    107112} sata_dev_t;
    108113
  • uspace/drv/block/ahci/ahci_hw.h

    ra4f8c3f r850f24d1  
    11/*
     2 * Copyright (c) 2025 Jiri Svoboda
    23 * Copyright (c) 2012 Petr Jerman
    34 * All rights reserved.
     
    3132 */
    3233
    33 #ifndef __AHCI_HW_H__
    34 #define __AHCI_HW_H__
     34#ifndef AHCI_HW_H
     35#define AHCI_HW_H
    3536
    3637#include <stdint.h>
  • uspace/drv/block/ahci/ahci_sata.h

    ra4f8c3f r850f24d1  
    11/*
     2 * Copyright (c) 2025 Jiri Svoboda
    23 * Copyright (c) 2012 Petr Jerman
    34 * All rights reserved.
     
    3132 */
    3233
    33 #ifndef __AHCI_SATA_H__
    34 #define __AHCI_SATA_H__
     34#ifndef AHCI_SATA_H
     35#define AHCI_SATA_H
    3536
    3637#include <stdint.h>
  • uspace/drv/hid/usbhid/mouse/mousedev.c

    ra4f8c3f r850f24d1  
    11/*
     2 * Copyright (c) 2025 Jiri Svoboda
    23 * Copyright (c) 2011 Lubos Slovak, Vojtech Horky
    34 * Copyright (c) 2018 Ondrej Hlavaty
     
    166167        assert(mouse_dev != NULL);
    167168
    168         if (mouse_dev->mouse_sess == NULL) {
    169                 usb_log_warning(NAME " No console session.");
    170                 return;
    171         }
     169        if (mouse_dev->mouse_sess == NULL)
     170                return;
    172171
    173172        const usb_hid_report_field_t *move_x = get_mouse_axis_move_field(
  • uspace/lib/drv/generic/dev_iface.c

    ra4f8c3f r850f24d1  
    11/*
     2 * Copyright (c) 2025 Jiri Svoboda
    23 * Copyright (c) 2010 Lenka Trochtova
    34 * All rights reserved.
     
    5354#include "remote_audio_mixer.h"
    5455#include "remote_audio_pcm.h"
    55 #include "remote_ahci.h"
    5656
    5757static const iface_dipatch_table_t remote_ifaces = {
     
    7171                [LED_DEV_IFACE] = &remote_led_dev_iface,
    7272                [BATTERY_DEV_IFACE] = &remote_battery_dev_iface,
    73                 [AHCI_DEV_IFACE] = &remote_ahci_iface,
    7473        }
    7574};
  • uspace/lib/drv/meson.build

    ra4f8c3f r850f24d1  
    11#
     2# Copyright (c) 2025 Jiri Svoboda
    23# Copyright (c) 2005 Martin Decky
    34# Copyright (c) 2007 Jakub Jermar
     
    5051        'generic/remote_led_dev.c',
    5152        'generic/remote_battery_dev.c',
    52         'generic/remote_ahci.c',
    5353)
  • uspace/srv/meson.build

    ra4f8c3f r850f24d1  
    11#
    2 # Copyright (c) 2024 Jiri Svoboda
     2# Copyright (c) 2025 Jiri Svoboda
    33# Copyright (c) 2019 Jiří Zárevúcky
    44# All rights reserved.
     
    3232        'bd/file_bd',
    3333        'bd/rd',
    34         'bd/sata_bd',
    3534        'bd/vbd',
    3635        'clipboard',
Note: See TracChangeset for help on using the changeset viewer.