Print this page
MFV: illumos-gate@d48defc5a82c2bc955d3c8c9a5a3c7ccea87d5d4
9793 vioblk attach doesn't always fail when it should
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>
Reviewed by: Toomas Soome <tsoome@me.com>
Reviewed by: Andy Fiddaman <omnios@citrus-it.net>
Approved by: Garrett D'Amore <garrett@damore.org>
Author: Hans Rosenfeld <hans.rosenfeld@joyent.com>
NEX-4424 kstat module needs cleanup
Reviewed by: Richard Elling <Richard.Elling@RichardElling.com>
Reviewed by: Garrett D'Amore <garrett@damore.org>
NEX-4420 format(1M) should be able to use device inquiry properties
Reviewed by: Dan McDonald <danmcd@omniti.com>
NEX-4419 blkdev and blkdev drivers should provide inquiry properties
Reviewed by: Garrett D'Amore <garrett@damore.org>
Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
re #13879 make libsqlite a real shared lib (tweaks)
  Fix rebuild after pull (remove files left in the way)
  Make sqlite.h SQLITE_VERSION more predictable.
OS-5 Integrate virtio drivers
    integration cleanup (copyrights, cddl 1.0)
port of illumos-1147
    1147 integrate the virtio-block driver
    Reviewed by: Dmitry Yusupov <Dmitry.Yusupov@nexenta.com>
    Reviewed by: Gordon Ross <gordon.w.ross@gmail.com>
    Approved by: Garrett D'Amore <garrett@damore.org>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/vioblk/vioblk.c
          +++ new/usr/src/uts/common/io/vioblk/vioblk.c
   1    1  /*
   2      - * CDDL HEADER START
        2 + * This file and its contents are supplied under the terms of the
        3 + * Common Development and Distribution License ("CDDL"), version 1.0.
        4 + * You may only use this file in accordance with the terms of version
        5 + * 1.0 of the CDDL.
   3    6   *
   4      - * The contents of this file are subject to the terms of the
   5      - * Common Development and Distribution License (the "License").
   6      - * You may not use this file except in compliance with the License.
   7      - *
   8      - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9      - * or http://www.opensolaris.org/os/licensing.
  10      - * See the License for the specific language governing permissions
  11      - * and limitations under the License.
  12      - *
  13      - * When distributing Covered Code, include this CDDL HEADER in each
  14      - * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15      - * If applicable, add the following below this CDDL HEADER, with the
  16      - * fields enclosed by brackets "[]" replaced with your own identifying
  17      - * information: Portions Copyright [yyyy] [name of copyright owner]
  18      - *
  19      - * CDDL HEADER END
        7 + * A full copy of the text of the CDDL should have accompanied this
        8 + * source.  A copy of the CDDL is also available via the Internet at
        9 + * http://www.illumos.org/license/CDDL.
  20   10   */
  21   11  
  22   12  /*
  23   13   * Copyright (c) 2015, Nexenta Systems, Inc. All rights reserved.
  24   14   * Copyright (c) 2012, Alexey Zaytsev <alexey.zaytsev@gmail.com>
       15 + * Copyright 2017, Joyent Inc.
  25   16   */
  26   17  
       18 +/*
       19 + * VirtIO block device driver
       20 + */
  27   21  
  28   22  #include <sys/modctl.h>
  29   23  #include <sys/blkdev.h>
  30   24  #include <sys/types.h>
  31   25  #include <sys/errno.h>
  32   26  #include <sys/param.h>
  33   27  #include <sys/stropts.h>
  34   28  #include <sys/stream.h>
  35   29  #include <sys/strsubr.h>
  36   30  #include <sys/kmem.h>
↓ open down ↓ 785 lines elided ↑ open up ↑
 822  816  
 823  817          instance = ddi_get_instance(devinfo);
 824  818  
 825  819          switch (cmd) {
 826  820          case DDI_ATTACH:
 827  821                  break;
 828  822  
 829  823          case DDI_RESUME:
 830  824          case DDI_PM_RESUME:
 831  825                  dev_err(devinfo, CE_WARN, "resume not supported yet");
 832      -                ret = DDI_FAILURE;
 833      -                goto exit;
      826 +                return (DDI_FAILURE);
 834  827  
 835  828          default:
 836  829                  dev_err(devinfo, CE_WARN, "cmd 0x%x not recognized", cmd);
 837      -                ret = DDI_FAILURE;
 838      -                goto exit;
      830 +                return (DDI_FAILURE);
 839  831          }
 840  832  
 841  833          sc = kmem_zalloc(sizeof (struct vioblk_softc), KM_SLEEP);
 842  834          ddi_set_driver_private(devinfo, sc);
 843  835  
 844  836          vsc = &sc->sc_virtio;
 845  837  
 846  838          /* Duplicate for faster access / less typing */
 847  839          sc->sc_dev = devinfo;
 848  840          vsc->sc_dev = devinfo;
↓ open down ↓ 173 lines elided ↑ open up ↑
1022 1014          virtio_release_ints(&sc->sc_virtio);
1023 1015  exit_int:
1024 1016          virtio_set_status(&sc->sc_virtio, VIRTIO_CONFIG_DEVICE_STATUS_FAILED);
1025 1017          ddi_regs_map_free(&sc->sc_virtio.sc_ioh);
1026 1018  exit_map:
1027 1019          kstat_delete(sc->sc_intrstat);
1028 1020  exit_intrstat:
1029 1021          mutex_destroy(&sc->lock_devid);
1030 1022          cv_destroy(&sc->cv_devid);
1031 1023          kmem_free(sc, sizeof (struct vioblk_softc));
1032      -exit:
1033      -        return (ret);
     1024 +        return (DDI_FAILURE);
1034 1025  }
1035 1026  
1036 1027  static int
1037 1028  vioblk_detach(dev_info_t *devinfo, ddi_detach_cmd_t cmd)
1038 1029  {
1039 1030          struct vioblk_softc *sc = ddi_get_driver_private(devinfo);
1040 1031  
1041 1032          switch (cmd) {
1042 1033          case DDI_DETACH:
1043 1034                  break;
↓ open down ↓ 65 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX