Print this page
8634 epoll fails to wake on certain edge-triggered conditions
8635 epoll should not emit POLLNVAL
8636 recursive epoll should emit EPOLLRDNORM
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Toomas Soome <tsoome@me.com>
Reviewed by: Igor Kozhukhov <igor@dilos.org>


   3  *
   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
  20  */
  21 
  22 /*
  23  * Copyright (c) 2013, Joyent, Inc.  All rights reserved.
  24  * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
  25  */
  26 
  27 /*
  28  * The ipmi driver is an openipmi compatible IPMI driver based on the FreeBSD
  29  * driver.
  30  *
  31  * The current implementation has several limitations:
  32  * 1) It only does discovery through the SMBIOS.  The FreeBSD driver has
  33  *    several additional ways to discover the IPMI device (acpi, bus checking,
  34  *    etc.).  This support could be ported if necessary.
  35  * 2) The driver currently only supports the IPMI KCS_MODE mode (reported
  36  *    through the SMBIOS as SMBIOS SMB_IPMI_T_KCS). Support for the other modes
  37  *    (BT_MODE, SMIC_MODE, SSIF_MODE) could be ported if necessary.
  38  * 3) The driver does not currently set up an IPMI watchdog.  This also could
  39  *    be ported if necessary.
  40  */
  41 
  42 #include <sys/devops.h>
  43 #include <sys/conf.h>


 443         return (0);
 444 }
 445 
 446 static int
 447 ipmi_poll(dev_t dv, short events, int anyyet, short *reventsp,
 448     pollhead_t **phpp)
 449 {
 450         struct ipmi_device *dev;
 451         short revent = 0;
 452 
 453         if ((dev = lookup_ipmidev_by_dev(dv)) == NULL)
 454                 return (ENODEV);
 455 
 456         if (events & (POLLIN | POLLRDNORM)) {
 457                 if (!TAILQ_EMPTY(&dev->ipmi_completed_requests))
 458                         revent |= events & (POLLIN | POLLRDNORM);
 459                 if (dev->ipmi_requests == 0)
 460                         revent |= POLLERR;
 461         }
 462 
 463         if (revent == 0) {
 464                 /* nothing has occurred */
 465                 if (!anyyet)
 466                         *phpp = dev->ipmi_pollhead;
 467         }
 468 
 469         *reventsp = revent;
 470         return (0);
 471 }
 472 
 473 /*ARGSUSED*/
 474 static int
 475 ipmi_info(dev_info_t *dip, ddi_info_cmd_t cmd, void *arg, void **resultp)
 476 {
 477         switch (cmd) {
 478         case DDI_INFO_DEVT2DEVINFO:
 479                 *resultp = ipmi_dip;
 480                 return (DDI_SUCCESS);
 481         case DDI_INFO_DEVT2INSTANCE:
 482                 *resultp = NULL;
 483                 return (DDI_SUCCESS);
 484         }
 485         return (DDI_FAILURE);




   3  *
   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
  20  */
  21 
  22 /*
  23  * Copyright 2017 Joyent, Inc.
  24  * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
  25  */
  26 
  27 /*
  28  * The ipmi driver is an openipmi compatible IPMI driver based on the FreeBSD
  29  * driver.
  30  *
  31  * The current implementation has several limitations:
  32  * 1) It only does discovery through the SMBIOS.  The FreeBSD driver has
  33  *    several additional ways to discover the IPMI device (acpi, bus checking,
  34  *    etc.).  This support could be ported if necessary.
  35  * 2) The driver currently only supports the IPMI KCS_MODE mode (reported
  36  *    through the SMBIOS as SMBIOS SMB_IPMI_T_KCS). Support for the other modes
  37  *    (BT_MODE, SMIC_MODE, SSIF_MODE) could be ported if necessary.
  38  * 3) The driver does not currently set up an IPMI watchdog.  This also could
  39  *    be ported if necessary.
  40  */
  41 
  42 #include <sys/devops.h>
  43 #include <sys/conf.h>


 443         return (0);
 444 }
 445 
 446 static int
 447 ipmi_poll(dev_t dv, short events, int anyyet, short *reventsp,
 448     pollhead_t **phpp)
 449 {
 450         struct ipmi_device *dev;
 451         short revent = 0;
 452 
 453         if ((dev = lookup_ipmidev_by_dev(dv)) == NULL)
 454                 return (ENODEV);
 455 
 456         if (events & (POLLIN | POLLRDNORM)) {
 457                 if (!TAILQ_EMPTY(&dev->ipmi_completed_requests))
 458                         revent |= events & (POLLIN | POLLRDNORM);
 459                 if (dev->ipmi_requests == 0)
 460                         revent |= POLLERR;
 461         }
 462 
 463         if ((revent == 0 && !anyyet) || (events & POLLET)) {


 464                 *phpp = dev->ipmi_pollhead;
 465         }
 466 
 467         *reventsp = revent;
 468         return (0);
 469 }
 470 
 471 /*ARGSUSED*/
 472 static int
 473 ipmi_info(dev_info_t *dip, ddi_info_cmd_t cmd, void *arg, void **resultp)
 474 {
 475         switch (cmd) {
 476         case DDI_INFO_DEVT2DEVINFO:
 477                 *resultp = ipmi_dip;
 478                 return (DDI_SUCCESS);
 479         case DDI_INFO_DEVT2INSTANCE:
 480                 *resultp = NULL;
 481                 return (DDI_SUCCESS);
 482         }
 483         return (DDI_FAILURE);