未验证 提交 44384492 编写于 作者: O openeuler-ci-bot 提交者: Gitee

!724 Backport CVEs and bugfixes

Merge Pull Request from: @zhangjialin11 
 
Pull new CVEs:
CVE-2022-4382
CVE-2023-0458
CVE-2023-2269
CVE-2023-2483
CVE-2023-31436
CVE-2023-2194
CVE-2023-2166
CVE-2023-2176
CVE-2023-2007

fs bugfixes from Baokun Li
bpf bugfixes from Liu Jian 
 
Link:https://gitee.com/openeuler/kernel/pulls/724 

Reviewed-by: Zheng Zengkai <zhengzengkai@huawei.com> 
Signed-off-by: Zheng Zengkai <zhengzengkai@huawei.com> 
......@@ -117,7 +117,7 @@ Code Seq# Include File Comments
'C' 01-2F linux/capi.h conflict!
'C' F0-FF drivers/net/wan/cosa.h conflict!
'D' all arch/s390/include/asm/dasd.h
'D' 40-5F drivers/scsi/dpt/dtpi_ioctl.h
'D' 40-5F drivers/scsi/dpt/dtpi_ioctl.h Dead since 2022
'D' 05 drivers/scsi/pmcraid.h
'E' all linux/input.h conflict!
'E' 00-0F xen/evtchn.h conflict!
......
......@@ -5420,14 +5420,6 @@ L: linux-kernel@vger.kernel.org
S: Maintained
F: drivers/staging/fsl-dpaa2/ethsw
DPT_I2O SCSI RAID DRIVER
M: Adaptec OEM Raid Solutions <aacraid@microsemi.com>
L: linux-scsi@vger.kernel.org
S: Maintained
W: http://www.adaptec.com/
F: drivers/scsi/dpt*
F: drivers/scsi/dpt/
DRBD DRIVER
M: Philipp Reisner <philipp.reisner@linbit.com>
M: Lars Ellenberg <lars.ellenberg@linbit.com>
......
......@@ -309,6 +309,9 @@ static int slimpro_i2c_blkwr(struct slimpro_i2c_dev *ctx, u32 chip,
u32 msg[3];
int rc;
if (writelen > I2C_SMBUS_BLOCK_MAX)
return -EINVAL;
memcpy(ctx->dma_buffer, data, writelen);
paddr = dma_map_single(ctx->dev, ctx->dma_buffer, writelen,
DMA_TO_DEVICE);
......
......@@ -1793,6 +1793,14 @@ static void cma_cancel_operation(struct rdma_id_private *id_priv,
{
switch (state) {
case RDMA_CM_ADDR_QUERY:
/*
* We can avoid doing the rdma_addr_cancel() based on state,
* only RDMA_CM_ADDR_QUERY has a work that could still execute.
* Notice that the addr_handler work could still be exiting
* outside this state, however due to the interaction with the
* handler_mutex the work is guaranteed not to touch id_priv
* during exit.
*/
rdma_addr_cancel(&id_priv->id.route.addr.dev_addr);
break;
case RDMA_CM_ROUTE_QUERY:
......@@ -3318,106 +3326,6 @@ static int cma_resolve_ib_addr(struct rdma_id_private *id_priv)
return ret;
}
static int cma_bind_addr(struct rdma_cm_id *id, struct sockaddr *src_addr,
const struct sockaddr *dst_addr)
{
struct sockaddr_storage zero_sock = {};
if (src_addr && src_addr->sa_family)
return rdma_bind_addr(id, src_addr);
/*
* When the src_addr is not specified, automatically supply an any addr
*/
zero_sock.ss_family = dst_addr->sa_family;
if (IS_ENABLED(CONFIG_IPV6) && dst_addr->sa_family == AF_INET6) {
struct sockaddr_in6 *src_addr6 =
(struct sockaddr_in6 *)&zero_sock;
struct sockaddr_in6 *dst_addr6 =
(struct sockaddr_in6 *)dst_addr;
src_addr6->sin6_scope_id = dst_addr6->sin6_scope_id;
if (ipv6_addr_type(&dst_addr6->sin6_addr) & IPV6_ADDR_LINKLOCAL)
id->route.addr.dev_addr.bound_dev_if =
dst_addr6->sin6_scope_id;
} else if (dst_addr->sa_family == AF_IB) {
((struct sockaddr_ib *)&zero_sock)->sib_pkey =
((struct sockaddr_ib *)dst_addr)->sib_pkey;
}
return rdma_bind_addr(id, (struct sockaddr *)&zero_sock);
}
/*
* If required, resolve the source address for bind and leave the id_priv in
* state RDMA_CM_ADDR_BOUND. This oddly uses the state to determine the prior
* calls made by ULP, a previously bound ID will not be re-bound and src_addr is
* ignored.
*/
static int resolve_prepare_src(struct rdma_id_private *id_priv,
struct sockaddr *src_addr,
const struct sockaddr *dst_addr)
{
int ret;
memcpy(cma_dst_addr(id_priv), dst_addr, rdma_addr_size(dst_addr));
if (!cma_comp_exch(id_priv, RDMA_CM_ADDR_BOUND, RDMA_CM_ADDR_QUERY)) {
/* For a well behaved ULP state will be RDMA_CM_IDLE */
ret = cma_bind_addr(&id_priv->id, src_addr, dst_addr);
if (ret)
goto err_dst;
if (WARN_ON(!cma_comp_exch(id_priv, RDMA_CM_ADDR_BOUND,
RDMA_CM_ADDR_QUERY))) {
ret = -EINVAL;
goto err_dst;
}
}
if (cma_family(id_priv) != dst_addr->sa_family) {
ret = -EINVAL;
goto err_state;
}
return 0;
err_state:
cma_comp_exch(id_priv, RDMA_CM_ADDR_QUERY, RDMA_CM_ADDR_BOUND);
err_dst:
memset(cma_dst_addr(id_priv), 0, rdma_addr_size(dst_addr));
return ret;
}
int rdma_resolve_addr(struct rdma_cm_id *id, struct sockaddr *src_addr,
const struct sockaddr *dst_addr, unsigned long timeout_ms)
{
struct rdma_id_private *id_priv =
container_of(id, struct rdma_id_private, id);
int ret;
ret = resolve_prepare_src(id_priv, src_addr, dst_addr);
if (ret)
return ret;
if (cma_any_addr(dst_addr)) {
ret = cma_resolve_loopback(id_priv);
} else {
if (dst_addr->sa_family == AF_IB) {
ret = cma_resolve_ib_addr(id_priv);
} else {
ret = rdma_resolve_ip(cma_src_addr(id_priv), dst_addr,
&id->route.addr.dev_addr,
timeout_ms, addr_handler,
false, id_priv);
}
}
if (ret)
goto err;
return 0;
err:
cma_comp_exch(id_priv, RDMA_CM_ADDR_QUERY, RDMA_CM_ADDR_BOUND);
return ret;
}
EXPORT_SYMBOL(rdma_resolve_addr);
int rdma_set_reuseaddr(struct rdma_cm_id *id, int reuse)
{
struct rdma_id_private *id_priv;
......@@ -3820,27 +3728,26 @@ int rdma_listen(struct rdma_cm_id *id, int backlog)
}
EXPORT_SYMBOL(rdma_listen);
int rdma_bind_addr(struct rdma_cm_id *id, struct sockaddr *addr)
static int rdma_bind_addr_dst(struct rdma_id_private *id_priv,
struct sockaddr *addr, const struct sockaddr *daddr)
{
struct rdma_id_private *id_priv;
struct sockaddr *id_daddr;
int ret;
struct sockaddr *daddr;
if (addr->sa_family != AF_INET && addr->sa_family != AF_INET6 &&
addr->sa_family != AF_IB)
return -EAFNOSUPPORT;
id_priv = container_of(id, struct rdma_id_private, id);
if (!cma_comp_exch(id_priv, RDMA_CM_IDLE, RDMA_CM_ADDR_BOUND))
return -EINVAL;
ret = cma_check_linklocal(&id->route.addr.dev_addr, addr);
ret = cma_check_linklocal(&id_priv->id.route.addr.dev_addr, addr);
if (ret)
goto err1;
memcpy(cma_src_addr(id_priv), addr, rdma_addr_size(addr));
if (!cma_any_addr(addr)) {
ret = cma_translate_addr(addr, &id->route.addr.dev_addr);
ret = cma_translate_addr(addr, &id_priv->id.route.addr.dev_addr);
if (ret)
goto err1;
......@@ -3860,8 +3767,10 @@ int rdma_bind_addr(struct rdma_cm_id *id, struct sockaddr *addr)
}
#endif
}
daddr = cma_dst_addr(id_priv);
daddr->sa_family = addr->sa_family;
id_daddr = cma_dst_addr(id_priv);
if (daddr != id_daddr)
memcpy(id_daddr, daddr, rdma_addr_size(addr));
id_daddr->sa_family = addr->sa_family;
ret = cma_get_port(id_priv);
if (ret)
......@@ -3877,6 +3786,127 @@ int rdma_bind_addr(struct rdma_cm_id *id, struct sockaddr *addr)
cma_comp_exch(id_priv, RDMA_CM_ADDR_BOUND, RDMA_CM_IDLE);
return ret;
}
static int cma_bind_addr(struct rdma_cm_id *id, struct sockaddr *src_addr,
const struct sockaddr *dst_addr)
{
struct rdma_id_private *id_priv =
container_of(id, struct rdma_id_private, id);
struct sockaddr_storage zero_sock = {};
if (src_addr && src_addr->sa_family)
return rdma_bind_addr_dst(id_priv, src_addr, dst_addr);
/*
* When the src_addr is not specified, automatically supply an any addr
*/
zero_sock.ss_family = dst_addr->sa_family;
if (IS_ENABLED(CONFIG_IPV6) && dst_addr->sa_family == AF_INET6) {
struct sockaddr_in6 *src_addr6 =
(struct sockaddr_in6 *)&zero_sock;
struct sockaddr_in6 *dst_addr6 =
(struct sockaddr_in6 *)dst_addr;
src_addr6->sin6_scope_id = dst_addr6->sin6_scope_id;
if (ipv6_addr_type(&dst_addr6->sin6_addr) & IPV6_ADDR_LINKLOCAL)
id->route.addr.dev_addr.bound_dev_if =
dst_addr6->sin6_scope_id;
} else if (dst_addr->sa_family == AF_IB) {
((struct sockaddr_ib *)&zero_sock)->sib_pkey =
((struct sockaddr_ib *)dst_addr)->sib_pkey;
}
return rdma_bind_addr_dst(id_priv, (struct sockaddr *)&zero_sock, dst_addr);
}
/*
* If required, resolve the source address for bind and leave the id_priv in
* state RDMA_CM_ADDR_BOUND. This oddly uses the state to determine the prior
* calls made by ULP, a previously bound ID will not be re-bound and src_addr is
* ignored.
*/
static int resolve_prepare_src(struct rdma_id_private *id_priv,
struct sockaddr *src_addr,
const struct sockaddr *dst_addr)
{
int ret;
if (!cma_comp_exch(id_priv, RDMA_CM_ADDR_BOUND, RDMA_CM_ADDR_QUERY)) {
/* For a well behaved ULP state will be RDMA_CM_IDLE */
ret = cma_bind_addr(&id_priv->id, src_addr, dst_addr);
if (ret)
return ret;
if (WARN_ON(!cma_comp_exch(id_priv, RDMA_CM_ADDR_BOUND,
RDMA_CM_ADDR_QUERY)))
return -EINVAL;
}
if (cma_family(id_priv) != dst_addr->sa_family) {
ret = -EINVAL;
goto err_state;
}
return 0;
err_state:
cma_comp_exch(id_priv, RDMA_CM_ADDR_QUERY, RDMA_CM_ADDR_BOUND);
return ret;
}
int rdma_resolve_addr(struct rdma_cm_id *id, struct sockaddr *src_addr,
const struct sockaddr *dst_addr, unsigned long timeout_ms)
{
struct rdma_id_private *id_priv =
container_of(id, struct rdma_id_private, id);
int ret;
ret = resolve_prepare_src(id_priv, src_addr, dst_addr);
if (ret)
return ret;
if (cma_any_addr(dst_addr)) {
ret = cma_resolve_loopback(id_priv);
} else {
if (dst_addr->sa_family == AF_IB) {
ret = cma_resolve_ib_addr(id_priv);
} else {
/*
* The FSM can return back to RDMA_CM_ADDR_BOUND after
* rdma_resolve_ip() is called, eg through the error
* path in addr_handler(). If this happens the existing
* request must be canceled before issuing a new one.
* Since canceling a request is a bit slow and this
* oddball path is rare, keep track once a request has
* been issued. The track turns out to be a permanent
* state since this is the only cancel as it is
* immediately before rdma_resolve_ip().
*/
if (id_priv->used_resolve_ip)
rdma_addr_cancel(&id->route.addr.dev_addr);
else
id_priv->used_resolve_ip = 1;
ret = rdma_resolve_ip(cma_src_addr(id_priv), dst_addr,
&id->route.addr.dev_addr,
timeout_ms, addr_handler,
false, id_priv);
}
}
if (ret)
goto err;
return 0;
err:
cma_comp_exch(id_priv, RDMA_CM_ADDR_QUERY, RDMA_CM_ADDR_BOUND);
return ret;
}
EXPORT_SYMBOL(rdma_resolve_addr);
int rdma_bind_addr(struct rdma_cm_id *id, struct sockaddr *addr)
{
struct rdma_id_private *id_priv =
container_of(id, struct rdma_id_private, id);
return rdma_bind_addr_dst(id_priv, addr, cma_dst_addr(id_priv));
}
EXPORT_SYMBOL(rdma_bind_addr);
static int cma_format_hdr(void *hdr, struct rdma_id_private *id_priv)
......
......@@ -89,6 +89,7 @@ struct rdma_id_private {
u8 reuseaddr;
u8 afonly;
u8 timeout;
u8 used_resolve_ip;
enum ib_gid_type gid_type;
/*
......
......@@ -1446,11 +1446,12 @@ static int table_clear(struct file *filp, struct dm_ioctl *param, size_t param_s
hc->new_map = NULL;
}
param->flags &= ~DM_INACTIVE_PRESENT_FLAG;
__dev_status(hc->md, param);
md = hc->md;
up_write(&_hash_lock);
param->flags &= ~DM_INACTIVE_PRESENT_FLAG;
__dev_status(md, param);
if (old_map) {
dm_sync_table(md);
dm_table_destroy(old_map);
......
......@@ -728,9 +728,15 @@ static int emac_remove(struct platform_device *pdev)
struct net_device *netdev = dev_get_drvdata(&pdev->dev);
struct emac_adapter *adpt = netdev_priv(netdev);
netif_carrier_off(netdev);
netif_tx_disable(netdev);
unregister_netdev(netdev);
netif_napi_del(&adpt->rx_q.napi);
free_irq(adpt->irq.irq, &adpt->irq);
cancel_work_sync(&adpt->work_thread);
emac_clks_teardown(adpt);
put_device(&adpt->phydev->mdio.dev);
......
......@@ -442,17 +442,6 @@ config SCSI_MVUMI
To compile this driver as a module, choose M here: the
module will be called mvumi.
config SCSI_DPT_I2O
tristate "Adaptec I2O RAID support "
depends on SCSI && PCI && VIRT_TO_BUS
help
This driver supports all of Adaptec's I2O based RAID controllers as
well as the DPT SmartRaid V cards. This is an Adaptec maintained
driver by Deanna Bonds. See <file:Documentation/scsi/dpti.rst>.
To compile this driver as a module, choose M here: the
module will be called dpt_i2o.
config SCSI_ADVANSYS
tristate "AdvanSys SCSI support"
depends on SCSI
......
......@@ -64,7 +64,6 @@ obj-$(CONFIG_BVME6000_SCSI) += 53c700.o bvme6000_scsi.o
obj-$(CONFIG_SCSI_SIM710) += 53c700.o sim710.o
obj-$(CONFIG_SCSI_ADVANSYS) += advansys.o
obj-$(CONFIG_SCSI_BUSLOGIC) += BusLogic.o
obj-$(CONFIG_SCSI_DPT_I2O) += dpt_i2o.o
obj-$(CONFIG_SCSI_ARCMSR) += arcmsr/
obj-$(CONFIG_SCSI_AHA152X) += aha152x.o
obj-$(CONFIG_SCSI_AHA1542) += aha1542.o
......
/* SPDX-License-Identifier: GPL-2.0-or-later */
#ifndef _SCSI_I2O_H
#define _SCSI_I2O_H
/* I2O kernel space accessible structures/APIs
*
* (c) Copyright 1999, 2000 Red Hat Software
*
*************************************************************************
*
* This header file defined the I2O APIs/structures for use by
* the I2O kernel modules.
*/
#ifdef __KERNEL__ /* This file to be included by kernel only */
#include <linux/i2o-dev.h>
#include <linux/notifier.h>
#include <linux/atomic.h>
/*
* Tunable parameters first
*/
/* How many different OSM's are we allowing */
#define MAX_I2O_MODULES 64
#define I2O_EVT_CAPABILITY_OTHER 0x01
#define I2O_EVT_CAPABILITY_CHANGED 0x02
#define I2O_EVT_SENSOR_STATE_CHANGED 0x01
//#ifdef __KERNEL__ /* ioctl stuff only thing exported to users */
#define I2O_MAX_MANAGERS 4
/*
* I2O Interface Objects
*/
#include <linux/wait.h>
typedef wait_queue_head_t adpt_wait_queue_head_t;
#define ADPT_DECLARE_WAIT_QUEUE_HEAD(wait) DECLARE_WAIT_QUEUE_HEAD_ONSTACK(wait)
typedef wait_queue_entry_t adpt_wait_queue_entry_t;
/*
* message structures
*/
struct i2o_message
{
u8 version_offset;
u8 flags;
u16 size;
u32 target_tid:12;
u32 init_tid:12;
u32 function:8;
u32 initiator_context;
/* List follows */
};
struct adpt_device;
struct _adpt_hba;
struct i2o_device
{
struct i2o_device *next; /* Chain */
struct i2o_device *prev;
char dev_name[8]; /* linux /dev name if available */
i2o_lct_entry lct_data;/* Device LCT information */
u32 flags;
struct proc_dir_entry* proc_entry; /* /proc dir */
struct adpt_device *owner;
struct _adpt_hba *controller; /* Controlling IOP */
};
/*
* Each I2O controller has one of these objects
*/
struct i2o_controller
{
char name[16];
int unit;
int type;
int enabled;
struct notifier_block *event_notifer; /* Events */
atomic_t users;
struct i2o_device *devices; /* I2O device chain */
struct i2o_controller *next; /* Controller chain */
};
/*
* I2O System table entry
*/
struct i2o_sys_tbl_entry
{
u16 org_id;
u16 reserved1;
u32 iop_id:12;
u32 reserved2:20;
u16 seg_num:12;
u16 i2o_version:4;
u8 iop_state;
u8 msg_type;
u16 frame_size;
u16 reserved3;
u32 last_changed;
u32 iop_capabilities;
u32 inbound_low;
u32 inbound_high;
};
struct i2o_sys_tbl
{
u8 num_entries;
u8 version;
u16 reserved1;
u32 change_ind;
u32 reserved2;
u32 reserved3;
struct i2o_sys_tbl_entry iops[0];
};
/*
* I2O classes / subclasses
*/
/* Class ID and Code Assignments
* (LCT.ClassID.Version field)
*/
#define I2O_CLASS_VERSION_10 0x00
#define I2O_CLASS_VERSION_11 0x01
/* Class code names
* (from v1.5 Table 6-1 Class Code Assignments.)
*/
#define I2O_CLASS_EXECUTIVE 0x000
#define I2O_CLASS_DDM 0x001
#define I2O_CLASS_RANDOM_BLOCK_STORAGE 0x010
#define I2O_CLASS_SEQUENTIAL_STORAGE 0x011
#define I2O_CLASS_LAN 0x020
#define I2O_CLASS_WAN 0x030
#define I2O_CLASS_FIBRE_CHANNEL_PORT 0x040
#define I2O_CLASS_FIBRE_CHANNEL_PERIPHERAL 0x041
#define I2O_CLASS_SCSI_PERIPHERAL 0x051
#define I2O_CLASS_ATE_PORT 0x060
#define I2O_CLASS_ATE_PERIPHERAL 0x061
#define I2O_CLASS_FLOPPY_CONTROLLER 0x070
#define I2O_CLASS_FLOPPY_DEVICE 0x071
#define I2O_CLASS_BUS_ADAPTER_PORT 0x080
#define I2O_CLASS_PEER_TRANSPORT_AGENT 0x090
#define I2O_CLASS_PEER_TRANSPORT 0x091
/* Rest of 0x092 - 0x09f reserved for peer-to-peer classes
*/
#define I2O_CLASS_MATCH_ANYCLASS 0xffffffff
/* Subclasses
*/
#define I2O_SUBCLASS_i960 0x001
#define I2O_SUBCLASS_HDM 0x020
#define I2O_SUBCLASS_ISM 0x021
/* Operation functions */
#define I2O_PARAMS_FIELD_GET 0x0001
#define I2O_PARAMS_LIST_GET 0x0002
#define I2O_PARAMS_MORE_GET 0x0003
#define I2O_PARAMS_SIZE_GET 0x0004
#define I2O_PARAMS_TABLE_GET 0x0005
#define I2O_PARAMS_FIELD_SET 0x0006
#define I2O_PARAMS_LIST_SET 0x0007
#define I2O_PARAMS_ROW_ADD 0x0008
#define I2O_PARAMS_ROW_DELETE 0x0009
#define I2O_PARAMS_TABLE_CLEAR 0x000A
/*
* I2O serial number conventions / formats
* (circa v1.5)
*/
#define I2O_SNFORMAT_UNKNOWN 0
#define I2O_SNFORMAT_BINARY 1
#define I2O_SNFORMAT_ASCII 2
#define I2O_SNFORMAT_UNICODE 3
#define I2O_SNFORMAT_LAN48_MAC 4
#define I2O_SNFORMAT_WAN 5
/* Plus new in v2.0 (Yellowstone pdf doc)
*/
#define I2O_SNFORMAT_LAN64_MAC 6
#define I2O_SNFORMAT_DDM 7
#define I2O_SNFORMAT_IEEE_REG64 8
#define I2O_SNFORMAT_IEEE_REG128 9
#define I2O_SNFORMAT_UNKNOWN2 0xff
/* Transaction Reply Lists (TRL) Control Word structure */
#define TRL_SINGLE_FIXED_LENGTH 0x00
#define TRL_SINGLE_VARIABLE_LENGTH 0x40
#define TRL_MULTIPLE_FIXED_LENGTH 0x80
/*
* Messaging API values
*/
#define I2O_CMD_ADAPTER_ASSIGN 0xB3
#define I2O_CMD_ADAPTER_READ 0xB2
#define I2O_CMD_ADAPTER_RELEASE 0xB5
#define I2O_CMD_BIOS_INFO_SET 0xA5
#define I2O_CMD_BOOT_DEVICE_SET 0xA7
#define I2O_CMD_CONFIG_VALIDATE 0xBB
#define I2O_CMD_CONN_SETUP 0xCA
#define I2O_CMD_DDM_DESTROY 0xB1
#define I2O_CMD_DDM_ENABLE 0xD5
#define I2O_CMD_DDM_QUIESCE 0xC7
#define I2O_CMD_DDM_RESET 0xD9
#define I2O_CMD_DDM_SUSPEND 0xAF
#define I2O_CMD_DEVICE_ASSIGN 0xB7
#define I2O_CMD_DEVICE_RELEASE 0xB9
#define I2O_CMD_HRT_GET 0xA8
#define I2O_CMD_ADAPTER_CLEAR 0xBE
#define I2O_CMD_ADAPTER_CONNECT 0xC9
#define I2O_CMD_ADAPTER_RESET 0xBD
#define I2O_CMD_LCT_NOTIFY 0xA2
#define I2O_CMD_OUTBOUND_INIT 0xA1
#define I2O_CMD_PATH_ENABLE 0xD3
#define I2O_CMD_PATH_QUIESCE 0xC5
#define I2O_CMD_PATH_RESET 0xD7
#define I2O_CMD_STATIC_MF_CREATE 0xDD
#define I2O_CMD_STATIC_MF_RELEASE 0xDF
#define I2O_CMD_STATUS_GET 0xA0
#define I2O_CMD_SW_DOWNLOAD 0xA9
#define I2O_CMD_SW_UPLOAD 0xAB
#define I2O_CMD_SW_REMOVE 0xAD
#define I2O_CMD_SYS_ENABLE 0xD1
#define I2O_CMD_SYS_MODIFY 0xC1
#define I2O_CMD_SYS_QUIESCE 0xC3
#define I2O_CMD_SYS_TAB_SET 0xA3
#define I2O_CMD_UTIL_NOP 0x00
#define I2O_CMD_UTIL_ABORT 0x01
#define I2O_CMD_UTIL_CLAIM 0x09
#define I2O_CMD_UTIL_RELEASE 0x0B
#define I2O_CMD_UTIL_PARAMS_GET 0x06
#define I2O_CMD_UTIL_PARAMS_SET 0x05
#define I2O_CMD_UTIL_EVT_REGISTER 0x13
#define I2O_CMD_UTIL_EVT_ACK 0x14
#define I2O_CMD_UTIL_CONFIG_DIALOG 0x10
#define I2O_CMD_UTIL_DEVICE_RESERVE 0x0D
#define I2O_CMD_UTIL_DEVICE_RELEASE 0x0F
#define I2O_CMD_UTIL_LOCK 0x17
#define I2O_CMD_UTIL_LOCK_RELEASE 0x19
#define I2O_CMD_UTIL_REPLY_FAULT_NOTIFY 0x15
#define I2O_CMD_SCSI_EXEC 0x81
#define I2O_CMD_SCSI_ABORT 0x83
#define I2O_CMD_SCSI_BUSRESET 0x27
#define I2O_CMD_BLOCK_READ 0x30
#define I2O_CMD_BLOCK_WRITE 0x31
#define I2O_CMD_BLOCK_CFLUSH 0x37
#define I2O_CMD_BLOCK_MLOCK 0x49
#define I2O_CMD_BLOCK_MUNLOCK 0x4B
#define I2O_CMD_BLOCK_MMOUNT 0x41
#define I2O_CMD_BLOCK_MEJECT 0x43
#define I2O_PRIVATE_MSG 0xFF
/*
* Init Outbound Q status
*/
#define I2O_CMD_OUTBOUND_INIT_IN_PROGRESS 0x01
#define I2O_CMD_OUTBOUND_INIT_REJECTED 0x02
#define I2O_CMD_OUTBOUND_INIT_FAILED 0x03
#define I2O_CMD_OUTBOUND_INIT_COMPLETE 0x04
/*
* I2O Get Status State values
*/
#define ADAPTER_STATE_INITIALIZING 0x01
#define ADAPTER_STATE_RESET 0x02
#define ADAPTER_STATE_HOLD 0x04
#define ADAPTER_STATE_READY 0x05
#define ADAPTER_STATE_OPERATIONAL 0x08
#define ADAPTER_STATE_FAILED 0x10
#define ADAPTER_STATE_FAULTED 0x11
/* I2O API function return values */
#define I2O_RTN_NO_ERROR 0
#define I2O_RTN_NOT_INIT 1
#define I2O_RTN_FREE_Q_EMPTY 2
#define I2O_RTN_TCB_ERROR 3
#define I2O_RTN_TRANSACTION_ERROR 4
#define I2O_RTN_ADAPTER_ALREADY_INIT 5
#define I2O_RTN_MALLOC_ERROR 6
#define I2O_RTN_ADPTR_NOT_REGISTERED 7
#define I2O_RTN_MSG_REPLY_TIMEOUT 8
#define I2O_RTN_NO_STATUS 9
#define I2O_RTN_NO_FIRM_VER 10
#define I2O_RTN_NO_LINK_SPEED 11
/* Reply message status defines for all messages */
#define I2O_REPLY_STATUS_SUCCESS 0x00
#define I2O_REPLY_STATUS_ABORT_DIRTY 0x01
#define I2O_REPLY_STATUS_ABORT_NO_DATA_TRANSFER 0x02
#define I2O_REPLY_STATUS_ABORT_PARTIAL_TRANSFER 0x03
#define I2O_REPLY_STATUS_ERROR_DIRTY 0x04
#define I2O_REPLY_STATUS_ERROR_NO_DATA_TRANSFER 0x05
#define I2O_REPLY_STATUS_ERROR_PARTIAL_TRANSFER 0x06
#define I2O_REPLY_STATUS_PROCESS_ABORT_DIRTY 0x08
#define I2O_REPLY_STATUS_PROCESS_ABORT_NO_DATA_TRANSFER 0x09
#define I2O_REPLY_STATUS_PROCESS_ABORT_PARTIAL_TRANSFER 0x0A
#define I2O_REPLY_STATUS_TRANSACTION_ERROR 0x0B
#define I2O_REPLY_STATUS_PROGRESS_REPORT 0x80
/* Status codes and Error Information for Parameter functions */
#define I2O_PARAMS_STATUS_SUCCESS 0x00
#define I2O_PARAMS_STATUS_BAD_KEY_ABORT 0x01
#define I2O_PARAMS_STATUS_BAD_KEY_CONTINUE 0x02
#define I2O_PARAMS_STATUS_BUFFER_FULL 0x03
#define I2O_PARAMS_STATUS_BUFFER_TOO_SMALL 0x04
#define I2O_PARAMS_STATUS_FIELD_UNREADABLE 0x05
#define I2O_PARAMS_STATUS_FIELD_UNWRITEABLE 0x06
#define I2O_PARAMS_STATUS_INSUFFICIENT_FIELDS 0x07
#define I2O_PARAMS_STATUS_INVALID_GROUP_ID 0x08
#define I2O_PARAMS_STATUS_INVALID_OPERATION 0x09
#define I2O_PARAMS_STATUS_NO_KEY_FIELD 0x0A
#define I2O_PARAMS_STATUS_NO_SUCH_FIELD 0x0B
#define I2O_PARAMS_STATUS_NON_DYNAMIC_GROUP 0x0C
#define I2O_PARAMS_STATUS_OPERATION_ERROR 0x0D
#define I2O_PARAMS_STATUS_SCALAR_ERROR 0x0E
#define I2O_PARAMS_STATUS_TABLE_ERROR 0x0F
#define I2O_PARAMS_STATUS_WRONG_GROUP_TYPE 0x10
/* DetailedStatusCode defines for Executive, DDM, Util and Transaction error
* messages: Table 3-2 Detailed Status Codes.*/
#define I2O_DSC_SUCCESS 0x0000
#define I2O_DSC_BAD_KEY 0x0002
#define I2O_DSC_TCL_ERROR 0x0003
#define I2O_DSC_REPLY_BUFFER_FULL 0x0004
#define I2O_DSC_NO_SUCH_PAGE 0x0005
#define I2O_DSC_INSUFFICIENT_RESOURCE_SOFT 0x0006
#define I2O_DSC_INSUFFICIENT_RESOURCE_HARD 0x0007
#define I2O_DSC_CHAIN_BUFFER_TOO_LARGE 0x0009
#define I2O_DSC_UNSUPPORTED_FUNCTION 0x000A
#define I2O_DSC_DEVICE_LOCKED 0x000B
#define I2O_DSC_DEVICE_RESET 0x000C
#define I2O_DSC_INAPPROPRIATE_FUNCTION 0x000D
#define I2O_DSC_INVALID_INITIATOR_ADDRESS 0x000E
#define I2O_DSC_INVALID_MESSAGE_FLAGS 0x000F
#define I2O_DSC_INVALID_OFFSET 0x0010
#define I2O_DSC_INVALID_PARAMETER 0x0011
#define I2O_DSC_INVALID_REQUEST 0x0012
#define I2O_DSC_INVALID_TARGET_ADDRESS 0x0013
#define I2O_DSC_MESSAGE_TOO_LARGE 0x0014
#define I2O_DSC_MESSAGE_TOO_SMALL 0x0015
#define I2O_DSC_MISSING_PARAMETER 0x0016
#define I2O_DSC_TIMEOUT 0x0017
#define I2O_DSC_UNKNOWN_ERROR 0x0018
#define I2O_DSC_UNKNOWN_FUNCTION 0x0019
#define I2O_DSC_UNSUPPORTED_VERSION 0x001A
#define I2O_DSC_DEVICE_BUSY 0x001B
#define I2O_DSC_DEVICE_NOT_AVAILABLE 0x001C
/* Device Claim Types */
#define I2O_CLAIM_PRIMARY 0x01000000
#define I2O_CLAIM_MANAGEMENT 0x02000000
#define I2O_CLAIM_AUTHORIZED 0x03000000
#define I2O_CLAIM_SECONDARY 0x04000000
/* Message header defines for VersionOffset */
#define I2OVER15 0x0001
#define I2OVER20 0x0002
/* Default is 1.5, FIXME: Need support for both 1.5 and 2.0 */
#define I2OVERSION I2OVER15
#define SGL_OFFSET_0 I2OVERSION
#define SGL_OFFSET_4 (0x0040 | I2OVERSION)
#define SGL_OFFSET_5 (0x0050 | I2OVERSION)
#define SGL_OFFSET_6 (0x0060 | I2OVERSION)
#define SGL_OFFSET_7 (0x0070 | I2OVERSION)
#define SGL_OFFSET_8 (0x0080 | I2OVERSION)
#define SGL_OFFSET_9 (0x0090 | I2OVERSION)
#define SGL_OFFSET_10 (0x00A0 | I2OVERSION)
#define SGL_OFFSET_12 (0x00C0 | I2OVERSION)
#define TRL_OFFSET_5 (0x0050 | I2OVERSION)
#define TRL_OFFSET_6 (0x0060 | I2OVERSION)
/* msg header defines for MsgFlags */
#define MSG_STATIC 0x0100
#define MSG_64BIT_CNTXT 0x0200
#define MSG_MULTI_TRANS 0x1000
#define MSG_FAIL 0x2000
#define MSG_LAST 0x4000
#define MSG_REPLY 0x8000
/* minimum size msg */
#define THREE_WORD_MSG_SIZE 0x00030000
#define FOUR_WORD_MSG_SIZE 0x00040000
#define FIVE_WORD_MSG_SIZE 0x00050000
#define SIX_WORD_MSG_SIZE 0x00060000
#define SEVEN_WORD_MSG_SIZE 0x00070000
#define EIGHT_WORD_MSG_SIZE 0x00080000
#define NINE_WORD_MSG_SIZE 0x00090000
#define TEN_WORD_MSG_SIZE 0x000A0000
#define I2O_MESSAGE_SIZE(x) ((x)<<16)
/* Special TID Assignments */
#define ADAPTER_TID 0
#define HOST_TID 1
#define MSG_FRAME_SIZE 128
#define NMBR_MSG_FRAMES 128
#define MSG_POOL_SIZE 16384
#define I2O_POST_WAIT_OK 0
#define I2O_POST_WAIT_TIMEOUT -ETIMEDOUT
#endif /* __KERNEL__ */
#endif /* _SCSI_I2O_H */
/* SPDX-License-Identifier: GPL-2.0-or-later */
/***************************************************************************
dpti_ioctl.h - description
-------------------
begin : Thu Sep 7 2000
copyright : (C) 2001 by Adaptec
See Documentation/scsi/dpti.rst for history, notes, license info
and credits
***************************************************************************/
/***************************************************************************
* *
* *
***************************************************************************/
/***************************************************************************
* This file is generated from osd_unix.h *
* *************************************************************************/
#ifndef _dpti_ioctl_h
#define _dpti_ioctl_h
// IOCTL interface commands
#ifndef _IOWR
# define _IOWR(x,y,z) (((x)<<8)|y)
#endif
#ifndef _IOW
# define _IOW(x,y,z) (((x)<<8)|y)
#endif
#ifndef _IOR
# define _IOR(x,y,z) (((x)<<8)|y)
#endif
#ifndef _IO
# define _IO(x,y) (((x)<<8)|y)
#endif
/* EATA PassThrough Command */
#define EATAUSRCMD _IOWR('D',65,EATA_CP)
/* Set Debug Level If Enabled */
#define DPT_DEBUG _IOW('D',66,int)
/* Get Signature Structure */
#define DPT_SIGNATURE _IOR('D',67,dpt_sig_S)
#if defined __bsdi__
#define DPT_SIGNATURE_PACKED _IOR('D',67,dpt_sig_S_Packed)
#endif
/* Get Number Of DPT Adapters */
#define DPT_NUMCTRLS _IOR('D',68,int)
/* Get Adapter Info Structure */
#define DPT_CTRLINFO _IOR('D',69,CtrlInfo)
/* Get Statistics If Enabled */
#define DPT_STATINFO _IO('D',70)
/* Clear Stats If Enabled */
#define DPT_CLRSTAT _IO('D',71)
/* Get System Info Structure */
#define DPT_SYSINFO _IOR('D',72,sysInfo_S)
/* Set Timeout Value */
#define DPT_TIMEOUT _IO('D',73)
/* Get config Data */
#define DPT_CONFIG _IO('D',74)
/* Get Blink LED Code */
#define DPT_BLINKLED _IOR('D',75,int)
/* Get Statistical information (if available) */
#define DPT_STATS_INFO _IOR('D',80,STATS_DATA)
/* Clear the statistical information */
#define DPT_STATS_CLEAR _IO('D',81)
/* Get Performance metrics */
#define DPT_PERF_INFO _IOR('D',82,dpt_perf_t)
/* Send an I2O command */
#define I2OUSRCMD _IO('D',76)
/* Inform driver to re-acquire LCT information */
#define I2ORESCANCMD _IO('D',77)
/* Inform driver to reset adapter */
#define I2ORESETCMD _IO('D',78)
/* See if the target is mounted */
#define DPT_TARGET_BUSY _IOR('D',79, TARGET_BUSY_T)
/* Structure Returned From Get Controller Info */
typedef struct {
uCHAR state; /* Operational state */
uCHAR id; /* Host adapter SCSI id */
int vect; /* Interrupt vector number */
int base; /* Base I/O address */
int njobs; /* # of jobs sent to HA */
int qdepth; /* Controller queue depth. */
int wakebase; /* mpx wakeup base index. */
uINT SGsize; /* Scatter/Gather list size. */
unsigned heads; /* heads for drives on cntlr. */
unsigned sectors; /* sectors for drives on cntlr. */
uCHAR do_drive32; /* Flag for Above 16 MB Ability */
uCHAR BusQuiet; /* SCSI Bus Quiet Flag */
char idPAL[4]; /* 4 Bytes Of The ID Pal */
uCHAR primary; /* 1 For Primary, 0 For Secondary */
uCHAR eataVersion; /* EATA Version */
uINT cpLength; /* EATA Command Packet Length */
uINT spLength; /* EATA Status Packet Length */
uCHAR drqNum; /* DRQ Index (0,5,6,7) */
uCHAR flag1; /* EATA Flags 1 (Byte 9) */
uCHAR flag2; /* EATA Flags 2 (Byte 30) */
} CtrlInfo;
typedef struct {
uSHORT length; // Remaining length of this
uSHORT drvrHBAnum; // Relative HBA # used by the driver
uINT baseAddr; // Base I/O address
uSHORT blinkState; // Blink LED state (0=Not in blink LED)
uCHAR pciBusNum; // PCI Bus # (Optional)
uCHAR pciDeviceNum; // PCI Device # (Optional)
uSHORT hbaFlags; // Miscellaneous HBA flags
uSHORT Interrupt; // Interrupt set for this device.
# if (defined(_DPT_ARC))
uINT baseLength;
ADAPTER_OBJECT *AdapterObject;
LARGE_INTEGER DmaLogicalAddress;
PVOID DmaVirtualAddress;
LARGE_INTEGER ReplyLogicalAddress;
PVOID ReplyVirtualAddress;
# else
uINT reserved1; // Reserved for future expansion
uINT reserved2; // Reserved for future expansion
uINT reserved3; // Reserved for future expansion
# endif
} drvrHBAinfo_S;
typedef struct TARGET_BUSY
{
uLONG channel;
uLONG id;
uLONG lun;
uLONG isBusy;
} TARGET_BUSY_T;
#endif
/* BSDI dptsig.h,v 1.7 1998/06/03 19:15:00 karels Exp */
/*
* Copyright (c) 1996-1999 Distributed Processing Technology Corporation
* All rights reserved.
*
* Redistribution and use in source form, with or without modification, are
* permitted provided that redistributions of source code must retain the
* above copyright notice, this list of conditions and the following disclaimer.
*
* This software is provided `as is' by Distributed Processing Technology and
* any express or implied warranties, including, but not limited to, the
* implied warranties of merchantability and fitness for a particular purpose,
* are disclaimed. In no event shall Distributed Processing Technology be
* liable for any direct, indirect, incidental, special, exemplary or
* consequential damages (including, but not limited to, procurement of
* substitute goods or services; loss of use, data, or profits; or business
* interruptions) however caused and on any theory of liability, whether in
* contract, strict liability, or tort (including negligence or otherwise)
* arising in any way out of the use of this driver software, even if advised
* of the possibility of such damage.
*
*/
#ifndef __DPTSIG_H_
#define __DPTSIG_H_
#ifdef _SINIX_ADDON
#include "dpt.h"
#endif
/* DPT SIGNATURE SPEC AND HEADER FILE */
/* Signature Version 1 (sorry no 'A') */
/* to make sure we are talking the same size under all OS's */
typedef unsigned char sigBYTE;
typedef unsigned short sigWORD;
typedef unsigned int sigINT;
/*
* use sigWORDLittleEndian for:
* dsCapabilities
* dsDeviceSupp
* dsAdapterSupp
* dsApplication
* use sigLONGLittleEndian for:
* dsOS
* so that the sig can be standardised to Little Endian
*/
#if (defined(_DPT_BIG_ENDIAN))
# define sigWORDLittleEndian(x) ((((x)&0xFF)<<8)|(((x)>>8)&0xFF))
# define sigLONGLittleEndian(x) \
((((x)&0xFF)<<24) | \
(((x)&0xFF00)<<8) | \
(((x)&0xFF0000L)>>8) | \
(((x)&0xFF000000L)>>24))
#else
# define sigWORDLittleEndian(x) (x)
# define sigLONGLittleEndian(x) (x)
#endif
/* must make sure the structure is not word or double-word aligned */
/* --------------------------------------------------------------- */
/* Borland will ignore the following pragma: */
/* Word alignment is OFF by default. If in the, IDE make */
/* sure that Options | Compiler | Code Generation | Word Alignment */
/* is not checked. If using BCC, do not use the -a option. */
#ifndef NO_PACK
#if defined (_DPT_AIX)
#pragma options align=packed
#else
#pragma pack(1)
#endif /* aix */
#endif
/* For the Macintosh */
#ifdef STRUCTALIGNMENTSUPPORTED
#pragma options align=mac68k
#endif
/* Current Signature Version - sigBYTE dsSigVersion; */
/* ------------------------------------------------------------------ */
#define SIG_VERSION 1
/* Processor Family - sigBYTE dsProcessorFamily; DISTINCT VALUES */
/* ------------------------------------------------------------------ */
/* What type of processor the file is meant to run on. */
/* This will let us know whether to read sigWORDs as high/low or low/high. */
#define PROC_INTEL 0x00 /* Intel 80x86/ia64 */
#define PROC_MOTOROLA 0x01 /* Motorola 68K */
#define PROC_MIPS4000 0x02 /* MIPS RISC 4000 */
#define PROC_ALPHA 0x03 /* DEC Alpha */
#define PROC_POWERPC 0x04 /* IBM Power PC */
#define PROC_i960 0x05 /* Intel i960 */
#define PROC_ULTRASPARC 0x06 /* SPARC processor */
/* Specific Minimim Processor - sigBYTE dsProcessor; FLAG BITS */
/* ------------------------------------------------------------------ */
/* Different bit definitions dependent on processor_family */
/* PROC_INTEL: */
#define PROC_8086 0x01 /* Intel 8086 */
#define PROC_286 0x02 /* Intel 80286 */
#define PROC_386 0x04 /* Intel 80386 */
#define PROC_486 0x08 /* Intel 80486 */
#define PROC_PENTIUM 0x10 /* Intel 586 aka P5 aka Pentium */
#define PROC_SEXIUM 0x20 /* Intel 686 aka P6 aka Pentium Pro or MMX */
#define PROC_IA64 0x40 /* Intel IA64 processor */
/* PROC_i960: */
#define PROC_960RX 0x01 /* Intel 80960RC/RD */
#define PROC_960HX 0x02 /* Intel 80960HA/HD/HT */
/* PROC_MOTOROLA: */
#define PROC_68000 0x01 /* Motorola 68000 */
#define PROC_68010 0x02 /* Motorola 68010 */
#define PROC_68020 0x04 /* Motorola 68020 */
#define PROC_68030 0x08 /* Motorola 68030 */
#define PROC_68040 0x10 /* Motorola 68040 */
/* PROC_POWERPC */
#define PROC_PPC601 0x01 /* PowerPC 601 */
#define PROC_PPC603 0x02 /* PowerPC 603 */
#define PROC_PPC604 0x04 /* PowerPC 604 */
/* PROC_MIPS4000: */
#define PROC_R4000 0x01 /* MIPS R4000 */
/* Filetype - sigBYTE dsFiletype; DISTINCT VALUES */
/* ------------------------------------------------------------------ */
#define FT_EXECUTABLE 0 /* Executable Program */
#define FT_SCRIPT 1 /* Script/Batch File??? */
#define FT_HBADRVR 2 /* HBA Driver */
#define FT_OTHERDRVR 3 /* Other Driver */
#define FT_IFS 4 /* Installable Filesystem Driver */
#define FT_ENGINE 5 /* DPT Engine */
#define FT_COMPDRVR 6 /* Compressed Driver Disk */
#define FT_LANGUAGE 7 /* Foreign Language file */
#define FT_FIRMWARE 8 /* Downloadable or actual Firmware */
#define FT_COMMMODL 9 /* Communications Module */
#define FT_INT13 10 /* INT 13 style HBA Driver */
#define FT_HELPFILE 11 /* Help file */
#define FT_LOGGER 12 /* Event Logger */
#define FT_INSTALL 13 /* An Install Program */
#define FT_LIBRARY 14 /* Storage Manager Real-Mode Calls */
#define FT_RESOURCE 15 /* Storage Manager Resource File */
#define FT_MODEM_DB 16 /* Storage Manager Modem Database */
/* Filetype flags - sigBYTE dsFiletypeFlags; FLAG BITS */
/* ------------------------------------------------------------------ */
#define FTF_DLL 0x01 /* Dynamic Link Library */
#define FTF_NLM 0x02 /* Netware Loadable Module */
#define FTF_OVERLAYS 0x04 /* Uses overlays */
#define FTF_DEBUG 0x08 /* Debug version */
#define FTF_TSR 0x10 /* TSR */
#define FTF_SYS 0x20 /* DOS Loadable driver */
#define FTF_PROTECTED 0x40 /* Runs in protected mode */
#define FTF_APP_SPEC 0x80 /* Application Specific */
#define FTF_ROM (FTF_SYS|FTF_TSR) /* Special Case */
/* OEM - sigBYTE dsOEM; DISTINCT VALUES */
/* ------------------------------------------------------------------ */
#define OEM_DPT 0 /* DPT */
#define OEM_ATT 1 /* ATT */
#define OEM_NEC 2 /* NEC */
#define OEM_ALPHA 3 /* Alphatronix */
#define OEM_AST 4 /* AST */
#define OEM_OLIVETTI 5 /* Olivetti */
#define OEM_SNI 6 /* Siemens/Nixdorf */
#define OEM_SUN 7 /* SUN Microsystems */
/* Operating System - sigLONG dsOS; FLAG BITS */
/* ------------------------------------------------------------------ */
#define OS_DOS 0x00000001 /* PC/MS-DOS */
#define OS_WINDOWS 0x00000002 /* Microsoft Windows 3.x */
#define OS_WINDOWS_NT 0x00000004 /* Microsoft Windows NT */
#define OS_OS2M 0x00000008 /* OS/2 1.2.x,MS 1.3.0,IBM 1.3.x - Monolithic */
#define OS_OS2L 0x00000010 /* Microsoft OS/2 1.301 - LADDR */
#define OS_OS22x 0x00000020 /* IBM OS/2 2.x */
#define OS_NW286 0x00000040 /* Novell NetWare 286 */
#define OS_NW386 0x00000080 /* Novell NetWare 386 */
#define OS_GEN_UNIX 0x00000100 /* Generic Unix */
#define OS_SCO_UNIX 0x00000200 /* SCO Unix */
#define OS_ATT_UNIX 0x00000400 /* ATT Unix */
#define OS_UNIXWARE 0x00000800 /* USL Unix */
#define OS_INT_UNIX 0x00001000 /* Interactive Unix */
#define OS_SOLARIS 0x00002000 /* SunSoft Solaris */
#define OS_QNX 0x00004000 /* QNX for Tom Moch */
#define OS_NEXTSTEP 0x00008000 /* NeXTSTEP/OPENSTEP/MACH */
#define OS_BANYAN 0x00010000 /* Banyan Vines */
#define OS_OLIVETTI_UNIX 0x00020000/* Olivetti Unix */
#define OS_MAC_OS 0x00040000 /* Mac OS */
#define OS_WINDOWS_95 0x00080000 /* Microsoft Windows '95 */
#define OS_NW4x 0x00100000 /* Novell Netware 4.x */
#define OS_BSDI_UNIX 0x00200000 /* BSDi Unix BSD/OS 2.0 and up */
#define OS_AIX_UNIX 0x00400000 /* AIX Unix */
#define OS_FREE_BSD 0x00800000 /* FreeBSD Unix */
#define OS_LINUX 0x01000000 /* Linux */
#define OS_DGUX_UNIX 0x02000000 /* Data General Unix */
#define OS_SINIX_N 0x04000000 /* SNI SINIX-N */
#define OS_PLAN9 0x08000000 /* ATT Plan 9 */
#define OS_TSX 0x10000000 /* SNH TSX-32 */
#define OS_OTHER 0x80000000 /* Other */
/* Capabilities - sigWORD dsCapabilities; FLAG BITS */
/* ------------------------------------------------------------------ */
#define CAP_RAID0 0x0001 /* RAID-0 */
#define CAP_RAID1 0x0002 /* RAID-1 */
#define CAP_RAID3 0x0004 /* RAID-3 */
#define CAP_RAID5 0x0008 /* RAID-5 */
#define CAP_SPAN 0x0010 /* Spanning */
#define CAP_PASS 0x0020 /* Provides passthrough */
#define CAP_OVERLAP 0x0040 /* Passthrough supports overlapped commands */
#define CAP_ASPI 0x0080 /* Supports ASPI Command Requests */
#define CAP_ABOVE16MB 0x0100 /* ISA Driver supports greater than 16MB */
#define CAP_EXTEND 0x8000 /* Extended info appears after description */
#ifdef SNI_MIPS
#define CAP_CACHEMODE 0x1000 /* dpt_force_cache is set in driver */
#endif
/* Devices Supported - sigWORD dsDeviceSupp; FLAG BITS */
/* ------------------------------------------------------------------ */
#define DEV_DASD 0x0001 /* DASD (hard drives) */
#define DEV_TAPE 0x0002 /* Tape drives */
#define DEV_PRINTER 0x0004 /* Printers */
#define DEV_PROC 0x0008 /* Processors */
#define DEV_WORM 0x0010 /* WORM drives */
#define DEV_CDROM 0x0020 /* CD-ROM drives */
#define DEV_SCANNER 0x0040 /* Scanners */
#define DEV_OPTICAL 0x0080 /* Optical Drives */
#define DEV_JUKEBOX 0x0100 /* Jukebox */
#define DEV_COMM 0x0200 /* Communications Devices */
#define DEV_OTHER 0x0400 /* Other Devices */
#define DEV_ALL 0xFFFF /* All SCSI Devices */
/* Adapters Families Supported - sigWORD dsAdapterSupp; FLAG BITS */
/* ------------------------------------------------------------------ */
#define ADF_2001 0x0001 /* PM2001 */
#define ADF_2012A 0x0002 /* PM2012A */
#define ADF_PLUS_ISA 0x0004 /* PM2011,PM2021 */
#define ADF_PLUS_EISA 0x0008 /* PM2012B,PM2022 */
#define ADF_SC3_ISA 0x0010 /* PM2021 */
#define ADF_SC3_EISA 0x0020 /* PM2022,PM2122, etc */
#define ADF_SC3_PCI 0x0040 /* SmartCache III PCI */
#define ADF_SC4_ISA 0x0080 /* SmartCache IV ISA */
#define ADF_SC4_EISA 0x0100 /* SmartCache IV EISA */
#define ADF_SC4_PCI 0x0200 /* SmartCache IV PCI */
#define ADF_SC5_PCI 0x0400 /* Fifth Generation I2O products */
/*
* Combinations of products
*/
#define ADF_ALL_2000 (ADF_2001|ADF_2012A)
#define ADF_ALL_PLUS (ADF_PLUS_ISA|ADF_PLUS_EISA)
#define ADF_ALL_SC3 (ADF_SC3_ISA|ADF_SC3_EISA|ADF_SC3_PCI)
#define ADF_ALL_SC4 (ADF_SC4_ISA|ADF_SC4_EISA|ADF_SC4_PCI)
#define ADF_ALL_SC5 (ADF_SC5_PCI)
/* All EATA Cacheing Products */
#define ADF_ALL_CACHE (ADF_ALL_PLUS|ADF_ALL_SC3|ADF_ALL_SC4)
/* All EATA Bus Mastering Products */
#define ADF_ALL_MASTER (ADF_2012A|ADF_ALL_CACHE)
/* All EATA Adapter Products */
#define ADF_ALL_EATA (ADF_2001|ADF_ALL_MASTER)
#define ADF_ALL ADF_ALL_EATA
/* Application - sigWORD dsApplication; FLAG BITS */
/* ------------------------------------------------------------------ */
#define APP_DPTMGR 0x0001 /* DPT Storage Manager */
#define APP_ENGINE 0x0002 /* DPT Engine */
#define APP_SYTOS 0x0004 /* Sytron Sytos Plus */
#define APP_CHEYENNE 0x0008 /* Cheyenne ARCServe + ARCSolo */
#define APP_MSCDEX 0x0010 /* Microsoft CD-ROM extensions */
#define APP_NOVABACK 0x0020 /* NovaStor Novaback */
#define APP_AIM 0x0040 /* Archive Information Manager */
/* Requirements - sigBYTE dsRequirements; FLAG BITS */
/* ------------------------------------------------------------------ */
#define REQ_SMARTROM 0x01 /* Requires SmartROM to be present */
#define REQ_DPTDDL 0x02 /* Requires DPTDDL.SYS to be loaded */
#define REQ_HBA_DRIVER 0x04 /* Requires an HBA driver to be loaded */
#define REQ_ASPI_TRAN 0x08 /* Requires an ASPI Transport Modules */
#define REQ_ENGINE 0x10 /* Requires a DPT Engine to be loaded */
#define REQ_COMM_ENG 0x20 /* Requires a DPT Communications Engine */
/*
* You may adjust dsDescription_size with an override to a value less than
* 50 so that the structure allocates less real space.
*/
#if (!defined(dsDescription_size))
# define dsDescription_size 50
#endif
typedef struct dpt_sig {
char dsSignature[6]; /* ALWAYS "dPtSiG" */
sigBYTE dsSigVersion; /* signature version (currently 1) */
sigBYTE dsProcessorFamily; /* what type of processor */
sigBYTE dsProcessor; /* precise processor */
sigBYTE dsFiletype; /* type of file */
sigBYTE dsFiletypeFlags; /* flags to specify load type, etc. */
sigBYTE dsOEM; /* OEM file was created for */
sigINT dsOS; /* which Operating systems */
sigWORD dsCapabilities; /* RAID levels, etc. */
sigWORD dsDeviceSupp; /* Types of SCSI devices supported */
sigWORD dsAdapterSupp; /* DPT adapter families supported */
sigWORD dsApplication; /* applications file is for */
sigBYTE dsRequirements; /* Other driver dependencies */
sigBYTE dsVersion; /* 1 */
sigBYTE dsRevision; /* 'J' */
sigBYTE dsSubRevision; /* '9' ' ' if N/A */
sigBYTE dsMonth; /* creation month */
sigBYTE dsDay; /* creation day */
sigBYTE dsYear; /* creation year since 1980 (1993=13) */
/* description (NULL terminated) */
char dsDescription[dsDescription_size];
} dpt_sig_S;
/* 32 bytes minimum - with no description. Put NULL at description[0] */
/* 81 bytes maximum - with 49 character description plus NULL. */
/* This line added at Roycroft's request */
/* Microsoft's NT compiler gets confused if you do a pack and don't */
/* restore it. */
#ifndef NO_UNPACK
#if defined (_DPT_AIX)
#pragma options align=reset
#elif defined (UNPACK_FOUR)
#pragma pack(4)
#else
#pragma pack()
#endif /* aix */
#endif
/* For the Macintosh */
#ifdef STRUCTALIGNMENTSUPPORTED
#pragma options align=reset
#endif
#endif
/* BSDI osd_defs.h,v 1.4 1998/06/03 19:14:58 karels Exp */
/*
* Copyright (c) 1996-1999 Distributed Processing Technology Corporation
* All rights reserved.
*
* Redistribution and use in source form, with or without modification, are
* permitted provided that redistributions of source code must retain the
* above copyright notice, this list of conditions and the following disclaimer.
*
* This software is provided `as is' by Distributed Processing Technology and
* any express or implied warranties, including, but not limited to, the
* implied warranties of merchantability and fitness for a particular purpose,
* are disclaimed. In no event shall Distributed Processing Technology be
* liable for any direct, indirect, incidental, special, exemplary or
* consequential damages (including, but not limited to, procurement of
* substitute goods or services; loss of use, data, or profits; or business
* interruptions) however caused and on any theory of liability, whether in
* contract, strict liability, or tort (including negligence or otherwise)
* arising in any way out of the use of this driver software, even if advised
* of the possibility of such damage.
*
*/
#ifndef _OSD_DEFS_H
#define _OSD_DEFS_H
/*File - OSD_DEFS.H
****************************************************************************
*
*Description:
*
* This file contains the OS dependent defines. This file is included
*in osd_util.h and provides the OS specific defines for that file.
*
*Copyright Distributed Processing Technology, Corp.
* 140 Candace Dr.
* Maitland, Fl. 32751 USA
* Phone: (407) 830-5522 Fax: (407) 260-5366
* All Rights Reserved
*
*Author: Doug Anderson
*Date: 1/31/94
*
*Editors:
*
*Remarks:
*
*
*****************************************************************************/
/*Definitions - Defines & Constants ----------------------------------------- */
/* Define the operating system */
#if (defined(__linux__))
# define _DPT_LINUX
#elif (defined(__bsdi__))
# define _DPT_BSDI
#elif (defined(__FreeBSD__))
# define _DPT_FREE_BSD
#else
# define _DPT_SCO
#endif
#if defined (ZIL_CURSES)
#define _DPT_CURSES
#else
#define _DPT_MOTIF
#endif
/* Redefine 'far' to nothing - no far pointer type required in UNIX */
#define far
/* Define the mutually exclusive semaphore type */
#define SEMAPHORE_T unsigned int *
/* Define a handle to a DLL */
#define DLL_HANDLE_T unsigned int *
#endif
/* BSDI osd_util.h,v 1.8 1998/06/03 19:14:58 karels Exp */
/*
* Copyright (c) 1996-1999 Distributed Processing Technology Corporation
* All rights reserved.
*
* Redistribution and use in source form, with or without modification, are
* permitted provided that redistributions of source code must retain the
* above copyright notice, this list of conditions and the following disclaimer.
*
* This software is provided `as is' by Distributed Processing Technology and
* any express or implied warranties, including, but not limited to, the
* implied warranties of merchantability and fitness for a particular purpose,
* are disclaimed. In no event shall Distributed Processing Technology be
* liable for any direct, indirect, incidental, special, exemplary or
* consequential damages (including, but not limited to, procurement of
* substitute goods or services; loss of use, data, or profits; or business
* interruptions) however caused and on any theory of liability, whether in
* contract, strict liability, or tort (including negligence or otherwise)
* arising in any way out of the use of this driver software, even if advised
* of the possibility of such damage.
*
*/
#ifndef __OSD_UTIL_H
#define __OSD_UTIL_H
/*File - OSD_UTIL.H
****************************************************************************
*
*Description:
*
* This file contains defines and function prototypes that are
*operating system dependent. The resources defined in this file
*are not specific to any particular application.
*
*Copyright Distributed Processing Technology, Corp.
* 140 Candace Dr.
* Maitland, Fl. 32751 USA
* Phone: (407) 830-5522 Fax: (407) 260-5366
* All Rights Reserved
*
*Author: Doug Anderson
*Date: 1/7/94
*
*Editors:
*
*Remarks:
*
*
*****************************************************************************/
/*Definitions - Defines & Constants ----------------------------------------- */
/*----------------------------- */
/* Operating system selections: */
/*----------------------------- */
/*#define _DPT_MSDOS */
/*#define _DPT_WIN_3X */
/*#define _DPT_WIN_4X */
/*#define _DPT_WIN_NT */
/*#define _DPT_NETWARE */
/*#define _DPT_OS2 */
/*#define _DPT_SCO */
/*#define _DPT_UNIXWARE */
/*#define _DPT_SOLARIS */
/*#define _DPT_NEXTSTEP */
/*#define _DPT_BANYAN */
/*-------------------------------- */
/* Include the OS specific defines */
/*-------------------------------- */
/*#define OS_SELECTION From Above List */
/*#define SEMAPHORE_T ??? */
/*#define DLL_HANDLE_T ??? */
#if (defined(KERNEL) && (defined(__FreeBSD__) || defined(__bsdi__)))
# include "i386/isa/dpt_osd_defs.h"
#else
# include "osd_defs.h"
#endif
#ifndef DPT_UNALIGNED
#define DPT_UNALIGNED
#endif
#ifndef DPT_EXPORT
#define DPT_EXPORT
#endif
#ifndef DPT_IMPORT
#define DPT_IMPORT
#endif
#ifndef DPT_RUNTIME_IMPORT
#define DPT_RUNTIME_IMPORT DPT_IMPORT
#endif
/*--------------------- */
/* OS dependent defines */
/*--------------------- */
#if defined (_DPT_MSDOS) || defined (_DPT_WIN_3X)
#define _DPT_16_BIT
#else
#define _DPT_32_BIT
#endif
#if defined (_DPT_SCO) || defined (_DPT_UNIXWARE) || defined (_DPT_SOLARIS) || defined (_DPT_AIX) || defined (SNI_MIPS) || defined (_DPT_BSDI) || defined (_DPT_FREE_BSD) || defined(_DPT_LINUX)
#define _DPT_UNIX
#endif
#if defined (_DPT_WIN_3x) || defined (_DPT_WIN_4X) || defined (_DPT_WIN_NT) \
|| defined (_DPT_OS2)
#define _DPT_DLL_SUPPORT
#endif
#if !defined (_DPT_MSDOS) && !defined (_DPT_WIN_3X) && !defined (_DPT_NETWARE)
#define _DPT_PREEMPTIVE
#endif
#if !defined (_DPT_MSDOS) && !defined (_DPT_WIN_3X)
#define _DPT_MULTI_THREADED
#endif
#if !defined (_DPT_MSDOS)
#define _DPT_MULTI_TASKING
#endif
/* These exist for platforms that */
/* chunk when accessing mis-aligned */
/* data */
#if defined (SNI_MIPS) || defined (_DPT_SOLARIS)
#if defined (_DPT_BIG_ENDIAN)
#if !defined (_DPT_STRICT_ALIGN)
#define _DPT_STRICT_ALIGN
#endif
#endif
#endif
/* Determine if in C or C++ mode */
#ifdef __cplusplus
#define _DPT_CPP
#else
#define _DPT_C
#endif
/*-------------------------------------------------------------------*/
/* Under Solaris the compiler refuses to accept code like: */
/* { {"DPT"}, 0, NULL .... }, */
/* and complains about the {"DPT"} part by saying "cannot use { } */
/* to initialize char*". */
/* */
/* By defining these ugly macros we can get around this and also */
/* not have to copy and #ifdef large sections of code. I know that */
/* these macros are *really* ugly, but they should help reduce */
/* maintenance in the long run. */
/* */
/*-------------------------------------------------------------------*/
#if !defined (DPTSQO)
#if defined (_DPT_SOLARIS)
#define DPTSQO
#define DPTSQC
#else
#define DPTSQO {
#define DPTSQC }
#endif /* solaris */
#endif /* DPTSQO */
/*---------------------- */
/* OS dependent typedefs */
/*---------------------- */
#if defined (_DPT_MSDOS) || defined (_DPT_SCO)
#define BYTE unsigned char
#define WORD unsigned short
#endif
#ifndef _DPT_TYPEDEFS
#define _DPT_TYPEDEFS
typedef unsigned char uCHAR;
typedef unsigned short uSHORT;
typedef unsigned int uINT;
typedef unsigned long uLONG;
typedef union {
uCHAR u8[4];
uSHORT u16[2];
uLONG u32;
} access_U;
#endif
#if !defined (NULL)
#define NULL 0
#endif
/*Prototypes - function ----------------------------------------------------- */
#ifdef __cplusplus
extern "C" { /* Declare all these functions as "C" functions */
#endif
/*------------------------ */
/* Byte reversal functions */
/*------------------------ */
/* Reverses the byte ordering of a 2 byte variable */
#if (!defined(osdSwap2))
uSHORT osdSwap2(DPT_UNALIGNED uSHORT *);
#endif // !osdSwap2
/* Reverses the byte ordering of a 4 byte variable and shifts left 8 bits */
#if (!defined(osdSwap3))
uLONG osdSwap3(DPT_UNALIGNED uLONG *);
#endif // !osdSwap3
#ifdef _DPT_NETWARE
#include "novpass.h" /* For DPT_Bswapl() prototype */
/* Inline the byte swap */
#ifdef __cplusplus
inline uLONG osdSwap4(uLONG *inLong) {
return *inLong = DPT_Bswapl(*inLong);
}
#else
#define osdSwap4(inLong) DPT_Bswapl(inLong)
#endif // cplusplus
#else
/* Reverses the byte ordering of a 4 byte variable */
# if (!defined(osdSwap4))
uLONG osdSwap4(DPT_UNALIGNED uLONG *);
# endif // !osdSwap4
/* The following functions ALWAYS swap regardless of the *
* presence of DPT_BIG_ENDIAN */
uSHORT trueSwap2(DPT_UNALIGNED uSHORT *);
uLONG trueSwap4(DPT_UNALIGNED uLONG *);
#endif // netware
/*-------------------------------------*
* Network order swap functions *
* *
* These functions/macros will be used *
* by the structure insert()/extract() *
* functions. *
*
* We will enclose all structure *
* portability modifications inside *
* #ifdefs. When we are ready, we *
* will #define DPT_PORTABLE to begin *
* using the modifications. *
*-------------------------------------*/
uLONG netSwap4(uLONG val);
#if defined (_DPT_BIG_ENDIAN)
// for big-endian we need to swap
#ifndef NET_SWAP_2
#define NET_SWAP_2(x) (((x) >> 8) | ((x) << 8))
#endif // NET_SWAP_2
#ifndef NET_SWAP_4
#define NET_SWAP_4(x) netSwap4((x))
#endif // NET_SWAP_4
#else
// for little-endian we don't need to do anything
#ifndef NET_SWAP_2
#define NET_SWAP_2(x) (x)
#endif // NET_SWAP_2
#ifndef NET_SWAP_4
#define NET_SWAP_4(x) (x)
#endif // NET_SWAP_4
#endif // big endian
/*----------------------------------- */
/* Run-time loadable module functions */
/*----------------------------------- */
/* Loads the specified run-time loadable DLL */
DLL_HANDLE_T osdLoadModule(uCHAR *);
/* Unloads the specified run-time loadable DLL */
uSHORT osdUnloadModule(DLL_HANDLE_T);
/* Returns a pointer to a function inside a run-time loadable DLL */
void * osdGetFnAddr(DLL_HANDLE_T,uCHAR *);
/*--------------------------------------- */
/* Mutually exclusive semaphore functions */
/*--------------------------------------- */
/* Create a named semaphore */
SEMAPHORE_T osdCreateNamedSemaphore(char *);
/* Create a mutually exlusive semaphore */
SEMAPHORE_T osdCreateSemaphore(void);
/* create an event semaphore */
SEMAPHORE_T osdCreateEventSemaphore(void);
/* create a named event semaphore */
SEMAPHORE_T osdCreateNamedEventSemaphore(char *);
/* Destroy the specified mutually exclusive semaphore object */
uSHORT osdDestroySemaphore(SEMAPHORE_T);
/* Request access to the specified mutually exclusive semaphore */
uLONG osdRequestSemaphore(SEMAPHORE_T,uLONG);
/* Release access to the specified mutually exclusive semaphore */
uSHORT osdReleaseSemaphore(SEMAPHORE_T);
/* wait for a event to happen */
uLONG osdWaitForEventSemaphore(SEMAPHORE_T, uLONG);
/* signal an event */
uLONG osdSignalEventSemaphore(SEMAPHORE_T);
/* reset the event */
uLONG osdResetEventSemaphore(SEMAPHORE_T);
/*----------------- */
/* Thread functions */
/*----------------- */
/* Releases control to the task switcher in non-preemptive */
/* multitasking operating systems. */
void osdSwitchThreads(void);
/* Starts a thread function */
uLONG osdStartThread(void *,void *);
/* what is my thread id */
uLONG osdGetThreadID(void);
/* wakes up the specifed thread */
void osdWakeThread(uLONG);
/* osd sleep for x milliseconds */
void osdSleep(uLONG);
#define DPT_THREAD_PRIORITY_LOWEST 0x00
#define DPT_THREAD_PRIORITY_NORMAL 0x01
#define DPT_THREAD_PRIORITY_HIGHEST 0x02
uCHAR osdSetThreadPriority(uLONG tid, uCHAR priority);
#ifdef __cplusplus
} /* end the xtern "C" declaration */
#endif
#endif /* osd_util_h */
/* BSDI sys_info.h,v 1.6 1998/06/03 19:14:59 karels Exp */
/*
* Copyright (c) 1996-1999 Distributed Processing Technology Corporation
* All rights reserved.
*
* Redistribution and use in source form, with or without modification, are
* permitted provided that redistributions of source code must retain the
* above copyright notice, this list of conditions and the following disclaimer.
*
* This software is provided `as is' by Distributed Processing Technology and
* any express or implied warranties, including, but not limited to, the
* implied warranties of merchantability and fitness for a particular purpose,
* are disclaimed. In no event shall Distributed Processing Technology be
* liable for any direct, indirect, incidental, special, exemplary or
* consequential damages (including, but not limited to, procurement of
* substitute goods or services; loss of use, data, or profits; or business
* interruptions) however caused and on any theory of liability, whether in
* contract, strict liability, or tort (including negligence or otherwise)
* arising in any way out of the use of this driver software, even if advised
* of the possibility of such damage.
*
*/
#ifndef __SYS_INFO_H
#define __SYS_INFO_H
/*File - SYS_INFO.H
****************************************************************************
*
*Description:
*
* This file contains structure definitions for the OS dependent
*layer system information buffers.
*
*Copyright Distributed Processing Technology, Corp.
* 140 Candace Dr.
* Maitland, Fl. 32751 USA
* Phone: (407) 830-5522 Fax: (407) 260-5366
* All Rights Reserved
*
*Author: Don Kemper
*Date: 5/10/94
*
*Editors:
*
*Remarks:
*
*
*****************************************************************************/
/*Include Files ------------------------------------------------------------- */
#include "osd_util.h"
#ifndef NO_PACK
#if defined (_DPT_AIX)
#pragma options align=packed
#else
#pragma pack(1)
#endif /* aix */
#endif // no unpack
/*struct - driveParam_S - start
*===========================================================================
*
*Description:
*
* This structure defines the drive parameters seen during
*booting.
*
*---------------------------------------------------------------------------*/
#ifdef __cplusplus
struct driveParam_S {
#else
typedef struct {
#endif
uSHORT cylinders; /* Up to 1024 */
uCHAR heads; /* Up to 255 */
uCHAR sectors; /* Up to 63 */
#ifdef __cplusplus
//---------- Portability Additions ----------- in sp_sinfo.cpp
#ifdef DPT_PORTABLE
uSHORT netInsert(dptBuffer_S *buffer);
uSHORT netExtract(dptBuffer_S *buffer);
#endif // DPT PORTABLE
//--------------------------------------------
};
#else
} driveParam_S;
#endif
/*driveParam_S - end */
/*struct - sysInfo_S - start
*===========================================================================
*
*Description:
*
* This structure defines the command system information that
*should be returned by every OS dependent layer.
*
*---------------------------------------------------------------------------*/
/*flags - bit definitions */
#define SI_CMOS_Valid 0x0001
#define SI_NumDrivesValid 0x0002
#define SI_ProcessorValid 0x0004
#define SI_MemorySizeValid 0x0008
#define SI_DriveParamsValid 0x0010
#define SI_SmartROMverValid 0x0020
#define SI_OSversionValid 0x0040
#define SI_OSspecificValid 0x0080 /* 1 if OS structure returned */
#define SI_BusTypeValid 0x0100
#define SI_ALL_VALID 0x0FFF /* All Std SysInfo is valid */
#define SI_NO_SmartROM 0x8000
/*busType - definitions */
#define SI_ISA_BUS 0x00
#define SI_MCA_BUS 0x01
#define SI_EISA_BUS 0x02
#define SI_PCI_BUS 0x04
#ifdef __cplusplus
struct sysInfo_S {
#else
typedef struct {
#endif
uCHAR drive0CMOS; /* CMOS Drive 0 Type */
uCHAR drive1CMOS; /* CMOS Drive 1 Type */
uCHAR numDrives; /* 0040:0075 contents */
uCHAR processorFamily; /* Same as DPTSIG's definition */
uCHAR processorType; /* Same as DPTSIG's definition */
uCHAR smartROMMajorVersion;
uCHAR smartROMMinorVersion; /* SmartROM version */
uCHAR smartROMRevision;
uSHORT flags; /* See bit definitions above */
uSHORT conventionalMemSize; /* in KB */
uINT extendedMemSize; /* in KB */
uINT osType; /* Same as DPTSIG's definition */
uCHAR osMajorVersion;
uCHAR osMinorVersion; /* The OS version */
uCHAR osRevision;
#ifdef _SINIX_ADDON
uCHAR busType; /* See defininitions above */
uSHORT osSubRevision;
uCHAR pad[2]; /* For alignment */
#else
uCHAR osSubRevision;
uCHAR busType; /* See defininitions above */
uCHAR pad[3]; /* For alignment */
#endif
driveParam_S drives[16]; /* SmartROM Logical Drives */
#ifdef __cplusplus
//---------- Portability Additions ----------- in sp_sinfo.cpp
#ifdef DPT_PORTABLE
uSHORT netInsert(dptBuffer_S *buffer);
uSHORT netExtract(dptBuffer_S *buffer);
#endif // DPT PORTABLE
//--------------------------------------------
};
#else
} sysInfo_S;
#endif
/*sysInfo_S - end */
/*struct - DOS_Info_S - start
*===========================================================================
*
*Description:
*
* This structure defines the system information specific to a
*DOS workstation.
*
*---------------------------------------------------------------------------*/
/*flags - bit definitions */
#define DI_DOS_HIGH 0x01 /* DOS is loaded high */
#define DI_DPMI_VALID 0x02 /* DPMI version is valid */
#ifdef __cplusplus
struct DOS_Info_S {
#else
typedef struct {
#endif
uCHAR flags; /* See bit definitions above */
uSHORT driverLocation; /* SmartROM BIOS address */
uSHORT DOS_version;
uSHORT DPMI_version;
#ifdef __cplusplus
//---------- Portability Additions ----------- in sp_sinfo.cpp
#ifdef DPT_PORTABLE
uSHORT netInsert(dptBuffer_S *buffer);
uSHORT netExtract(dptBuffer_S *buffer);
#endif // DPT PORTABLE
//--------------------------------------------
};
#else
} DOS_Info_S;
#endif
/*DOS_Info_S - end */
/*struct - Netware_Info_S - start
*===========================================================================
*
*Description:
*
* This structure defines the system information specific to a
*Netware machine.
*
*---------------------------------------------------------------------------*/
#ifdef __cplusplus
struct Netware_Info_S {
#else
typedef struct {
#endif
uCHAR driverName[13]; /* ie PM12NW31.DSK */
uCHAR serverName[48];
uCHAR netwareVersion; /* The Netware OS version */
uCHAR netwareSubVersion;
uCHAR netwareRevision;
uSHORT maxConnections; /* Probably 250 or 1000 */
uSHORT connectionsInUse;
uSHORT maxVolumes;
uCHAR unused;
uCHAR SFTlevel;
uCHAR TTSlevel;
uCHAR clibMajorVersion; /* The CLIB.NLM version */
uCHAR clibMinorVersion;
uCHAR clibRevision;
#ifdef __cplusplus
//---------- Portability Additions ----------- in sp_sinfo.cpp
#ifdef DPT_PORTABLE
uSHORT netInsert(dptBuffer_S *buffer);
uSHORT netExtract(dptBuffer_S *buffer);
#endif // DPT PORTABLE
//--------------------------------------------
};
#else
} Netware_Info_S;
#endif
/*Netware_Info_S - end */
/*struct - OS2_Info_S - start
*===========================================================================
*
*Description:
*
* This structure defines the system information specific to an
*OS/2 machine.
*
*---------------------------------------------------------------------------*/
#ifdef __cplusplus
struct OS2_Info_S {
#else
typedef struct {
#endif
uCHAR something;
#ifdef __cplusplus
//---------- Portability Additions ----------- in sp_sinfo.cpp
#ifdef DPT_PORTABLE
uSHORT netInsert(dptBuffer_S *buffer);
uSHORT netExtract(dptBuffer_S *buffer);
#endif // DPT PORTABLE
//--------------------------------------------
};
#else
} OS2_Info_S;
#endif
/*OS2_Info_S - end */
/*struct - WinNT_Info_S - start
*===========================================================================
*
*Description:
*
* This structure defines the system information specific to a
*Windows NT machine.
*
*---------------------------------------------------------------------------*/
#ifdef __cplusplus
struct WinNT_Info_S {
#else
typedef struct {
#endif
uCHAR something;
#ifdef __cplusplus
//---------- Portability Additions ----------- in sp_sinfo.cpp
#ifdef DPT_PORTABLE
uSHORT netInsert(dptBuffer_S *buffer);
uSHORT netExtract(dptBuffer_S *buffer);
#endif // DPT PORTABLE
//--------------------------------------------
};
#else
} WinNT_Info_S;
#endif
/*WinNT_Info_S - end */
/*struct - SCO_Info_S - start
*===========================================================================
*
*Description:
*
* This structure defines the system information specific to an
*SCO UNIX machine.
*
*---------------------------------------------------------------------------*/
#ifdef __cplusplus
struct SCO_Info_S {
#else
typedef struct {
#endif
uCHAR something;
#ifdef __cplusplus
//---------- Portability Additions ----------- in sp_sinfo.cpp
#ifdef DPT_PORTABLE
uSHORT netInsert(dptBuffer_S *buffer);
uSHORT netExtract(dptBuffer_S *buffer);
#endif // DPT PORTABLE
//--------------------------------------------
};
#else
} SCO_Info_S;
#endif
/*SCO_Info_S - end */
/*struct - USL_Info_S - start
*===========================================================================
*
*Description:
*
* This structure defines the system information specific to a
*USL UNIX machine.
*
*---------------------------------------------------------------------------*/
#ifdef __cplusplus
struct USL_Info_S {
#else
typedef struct {
#endif
uCHAR something;
#ifdef __cplusplus
//---------- Portability Additions ----------- in sp_sinfo.cpp
#ifdef DPT_PORTABLE
uSHORT netInsert(dptBuffer_S *buffer);
uSHORT netExtract(dptBuffer_S *buffer);
#endif // DPT PORTABLE
//--------------------------------------------
};
#else
} USL_Info_S;
#endif
/*USL_Info_S - end */
/* Restore default structure packing */
#ifndef NO_UNPACK
#if defined (_DPT_AIX)
#pragma options align=reset
#elif defined (UNPACK_FOUR)
#pragma pack(4)
#else
#pragma pack()
#endif /* aix */
#endif // no unpack
#endif // __SYS_INFO_H
此差异已折叠。
/* SPDX-License-Identifier: GPL-2.0-or-later */
/***************************************************************************
dpti.h - description
-------------------
begin : Thu Sep 7 2000
copyright : (C) 2001 by Adaptec
See Documentation/scsi/dpti.rst for history, notes, license info
and credits
***************************************************************************/
/***************************************************************************
* *
* *
***************************************************************************/
#ifndef _DPT_H
#define _DPT_H
#define MAX_TO_IOP_MESSAGES (255)
#define MAX_FROM_IOP_MESSAGES (255)
/*
* SCSI interface function Prototypes
*/
static int adpt_detect(struct scsi_host_template * sht);
static int adpt_queue(struct Scsi_Host *h, struct scsi_cmnd * cmd);
static int adpt_abort(struct scsi_cmnd * cmd);
static int adpt_reset(struct scsi_cmnd* cmd);
static int adpt_slave_configure(struct scsi_device *);
static const char *adpt_info(struct Scsi_Host *pSHost);
static int adpt_bios_param(struct scsi_device * sdev, struct block_device *dev,
sector_t, int geom[]);
static int adpt_bus_reset(struct scsi_cmnd* cmd);
static int adpt_device_reset(struct scsi_cmnd* cmd);
/*
* struct scsi_host_template (see scsi/scsi_host.h)
*/
#define DPT_DRIVER_NAME "Adaptec I2O RAID"
#ifndef HOSTS_C
#include "dpt/sys_info.h"
#include <linux/wait.h>
#include "dpt/dpti_i2o.h"
#include "dpt/dpti_ioctl.h"
#define DPT_I2O_VERSION "2.4 Build 5go"
#define DPT_VERSION 2
#define DPT_REVISION '4'
#define DPT_SUBREVISION '5'
#define DPT_BETA ""
#define DPT_MONTH 8
#define DPT_DAY 7
#define DPT_YEAR (2001-1980)
#define DPT_DRIVER "dpt_i2o"
#define DPTI_I2O_MAJOR (151)
#define DPT_ORGANIZATION_ID (0x1B) /* For Private Messages */
#define DPTI_MAX_HBA (16)
#define MAX_CHANNEL (5) // Maximum Channel # Supported
#define MAX_ID (128) // Maximum Target ID Supported
/* Sizes in 4 byte words */
#define REPLY_FRAME_SIZE (17)
#define MAX_MESSAGE_SIZE (128)
#define SG_LIST_ELEMENTS (56)
#define EMPTY_QUEUE 0xffffffff
#define I2O_INTERRUPT_PENDING_B (0x08)
#define PCI_DPT_VENDOR_ID (0x1044) // DPT PCI Vendor ID
#define PCI_DPT_DEVICE_ID (0xA501) // DPT PCI I2O Device ID
#define PCI_DPT_RAPTOR_DEVICE_ID (0xA511)
/* Debugging macro from Linux Device Drivers - Rubini */
#undef PDEBUG
#ifdef DEBUG
//TODO add debug level switch
# define PDEBUG(fmt, args...) printk(KERN_DEBUG "dpti: " fmt, ##args)
# define PDEBUGV(fmt, args...) printk(KERN_DEBUG "dpti: " fmt, ##args)
#else
# define PDEBUG(fmt, args...) /* not debugging: nothing */
# define PDEBUGV(fmt, args...) /* not debugging: nothing */
#endif
#define PERROR(fmt, args...) printk(KERN_ERR fmt, ##args)
#define PWARN(fmt, args...) printk(KERN_WARNING fmt, ##args)
#define PINFO(fmt, args...) printk(KERN_INFO fmt, ##args)
#define PCRIT(fmt, args...) printk(KERN_CRIT fmt, ##args)
#define SHUTDOWN_SIGS (sigmask(SIGKILL)|sigmask(SIGINT)|sigmask(SIGTERM))
// Command timeouts
#define FOREVER (0)
#define TMOUT_INQUIRY (20)
#define TMOUT_FLUSH (360/45)
#define TMOUT_ABORT (30)
#define TMOUT_SCSI (300)
#define TMOUT_IOPRESET (360)
#define TMOUT_GETSTATUS (15)
#define TMOUT_INITOUTBOUND (15)
#define TMOUT_LCT (360)
#define I2O_SCSI_DEVICE_DSC_MASK 0x00FF
#define I2O_DETAIL_STATUS_UNSUPPORTED_FUNCTION 0x000A
#define I2O_SCSI_DSC_MASK 0xFF00
#define I2O_SCSI_DSC_SUCCESS 0x0000
#define I2O_SCSI_DSC_REQUEST_ABORTED 0x0200
#define I2O_SCSI_DSC_UNABLE_TO_ABORT 0x0300
#define I2O_SCSI_DSC_COMPLETE_WITH_ERROR 0x0400
#define I2O_SCSI_DSC_ADAPTER_BUSY 0x0500
#define I2O_SCSI_DSC_REQUEST_INVALID 0x0600
#define I2O_SCSI_DSC_PATH_INVALID 0x0700
#define I2O_SCSI_DSC_DEVICE_NOT_PRESENT 0x0800
#define I2O_SCSI_DSC_UNABLE_TO_TERMINATE 0x0900
#define I2O_SCSI_DSC_SELECTION_TIMEOUT 0x0A00
#define I2O_SCSI_DSC_COMMAND_TIMEOUT 0x0B00
#define I2O_SCSI_DSC_MR_MESSAGE_RECEIVED 0x0D00
#define I2O_SCSI_DSC_SCSI_BUS_RESET 0x0E00
#define I2O_SCSI_DSC_PARITY_ERROR_FAILURE 0x0F00
#define I2O_SCSI_DSC_AUTOSENSE_FAILED 0x1000
#define I2O_SCSI_DSC_NO_ADAPTER 0x1100
#define I2O_SCSI_DSC_DATA_OVERRUN 0x1200
#define I2O_SCSI_DSC_UNEXPECTED_BUS_FREE 0x1300
#define I2O_SCSI_DSC_SEQUENCE_FAILURE 0x1400
#define I2O_SCSI_DSC_REQUEST_LENGTH_ERROR 0x1500
#define I2O_SCSI_DSC_PROVIDE_FAILURE 0x1600
#define I2O_SCSI_DSC_BDR_MESSAGE_SENT 0x1700
#define I2O_SCSI_DSC_REQUEST_TERMINATED 0x1800
#define I2O_SCSI_DSC_IDE_MESSAGE_SENT 0x3300
#define I2O_SCSI_DSC_RESOURCE_UNAVAILABLE 0x3400
#define I2O_SCSI_DSC_UNACKNOWLEDGED_EVENT 0x3500
#define I2O_SCSI_DSC_MESSAGE_RECEIVED 0x3600
#define I2O_SCSI_DSC_INVALID_CDB 0x3700
#define I2O_SCSI_DSC_LUN_INVALID 0x3800
#define I2O_SCSI_DSC_SCSI_TID_INVALID 0x3900
#define I2O_SCSI_DSC_FUNCTION_UNAVAILABLE 0x3A00
#define I2O_SCSI_DSC_NO_NEXUS 0x3B00
#define I2O_SCSI_DSC_SCSI_IID_INVALID 0x3C00
#define I2O_SCSI_DSC_CDB_RECEIVED 0x3D00
#define I2O_SCSI_DSC_LUN_ALREADY_ENABLED 0x3E00
#define I2O_SCSI_DSC_BUS_BUSY 0x3F00
#define I2O_SCSI_DSC_QUEUE_FROZEN 0x4000
#ifndef TRUE
#define TRUE 1
#define FALSE 0
#endif
#define HBA_FLAGS_INSTALLED_B 0x00000001 // Adapter Was Installed
#define HBA_FLAGS_BLINKLED_B 0x00000002 // Adapter In Blink LED State
#define HBA_FLAGS_IN_RESET 0x00000040 /* in reset */
#define HBA_HOSTRESET_FAILED 0x00000080 /* adpt_resethost failed */
// Device state flags
#define DPTI_DEV_ONLINE 0x00
#define DPTI_DEV_UNSCANNED 0x01
#define DPTI_DEV_RESET 0x02
#define DPTI_DEV_OFFLINE 0x04
struct adpt_device {
struct adpt_device* next_lun;
u32 flags;
u32 type;
u32 capacity;
u32 block_size;
u8 scsi_channel;
u8 scsi_id;
u64 scsi_lun;
u8 state;
u16 tid;
struct i2o_device* pI2o_dev;
struct scsi_device *pScsi_dev;
};
struct adpt_channel {
struct adpt_device* device[MAX_ID]; /* used as an array of 128 scsi ids */
u8 scsi_id;
u8 type;
u16 tid;
u32 state;
struct i2o_device* pI2o_dev;
};
// HBA state flags
#define DPTI_STATE_RESET (0x01)
typedef struct _adpt_hba {
struct _adpt_hba *next;
struct pci_dev *pDev;
struct Scsi_Host *host;
u32 state;
spinlock_t state_lock;
int unit;
int host_no; /* SCSI host number */
u8 initialized;
u8 in_use; /* is the management node open*/
char name[32];
char detail[55];
void __iomem *base_addr_virt;
void __iomem *msg_addr_virt;
ulong base_addr_phys;
void __iomem *post_port;
void __iomem *reply_port;
void __iomem *irq_mask;
u16 post_count;
u32 post_fifo_size;
u32 reply_fifo_size;
u32* reply_pool;
dma_addr_t reply_pool_pa;
u32 sg_tablesize; // Scatter/Gather List Size.
u8 top_scsi_channel;
u8 top_scsi_id;
u64 top_scsi_lun;
u8 dma64;
i2o_status_block* status_block;
dma_addr_t status_block_pa;
i2o_hrt* hrt;
dma_addr_t hrt_pa;
i2o_lct* lct;
dma_addr_t lct_pa;
uint lct_size;
struct i2o_device* devices;
struct adpt_channel channel[MAX_CHANNEL];
struct proc_dir_entry* proc_entry; /* /proc dir */
void __iomem *FwDebugBuffer_P; // Virtual Address Of FW Debug Buffer
u32 FwDebugBufferSize; // FW Debug Buffer Size In Bytes
void __iomem *FwDebugStrLength_P;// Virtual Addr Of FW Debug String Len
void __iomem *FwDebugFlags_P; // Virtual Address Of FW Debug Flags
void __iomem *FwDebugBLEDflag_P;// Virtual Addr Of FW Debug BLED
void __iomem *FwDebugBLEDvalue_P;// Virtual Addr Of FW Debug BLED
u32 FwDebugFlags;
u32 *ioctl_reply_context[4];
} adpt_hba;
struct sg_simple_element {
u32 flag_count;
u32 addr_bus;
};
/*
* Function Prototypes
*/
static void adpt_i2o_sys_shutdown(void);
static int adpt_init(void);
static int adpt_i2o_build_sys_table(void);
static irqreturn_t adpt_isr(int irq, void *dev_id);
static void adpt_i2o_report_hba_unit(adpt_hba* pHba, struct i2o_device *d);
static int adpt_i2o_query_scalar(adpt_hba* pHba, int tid,
int group, int field, void *buf, int buflen);
#ifdef DEBUG
static const char *adpt_i2o_get_class_name(int class);
#endif
static int adpt_i2o_issue_params(int cmd, adpt_hba* pHba, int tid,
void *opblk, dma_addr_t opblk_pa, int oplen,
void *resblk, dma_addr_t resblk_pa, int reslen);
static int adpt_i2o_post_wait(adpt_hba* pHba, u32* msg, int len, int timeout);
static int adpt_i2o_lct_get(adpt_hba* pHba);
static int adpt_i2o_parse_lct(adpt_hba* pHba);
static int adpt_i2o_activate_hba(adpt_hba* pHba);
static int adpt_i2o_enable_hba(adpt_hba* pHba);
static int adpt_i2o_install_device(adpt_hba* pHba, struct i2o_device *d);
static s32 adpt_i2o_post_this(adpt_hba* pHba, u32* data, int len);
static s32 adpt_i2o_quiesce_hba(adpt_hba* pHba);
static s32 adpt_i2o_status_get(adpt_hba* pHba);
static s32 adpt_i2o_init_outbound_q(adpt_hba* pHba);
static s32 adpt_i2o_hrt_get(adpt_hba* pHba);
static s32 adpt_scsi_to_i2o(adpt_hba* pHba, struct scsi_cmnd* cmd, struct adpt_device* dptdevice);
static void adpt_i2o_scsi_complete(void __iomem *reply, struct scsi_cmnd *cmd);
static s32 adpt_scsi_host_alloc(adpt_hba* pHba,struct scsi_host_template * sht);
static s32 adpt_hba_reset(adpt_hba* pHba);
static s32 adpt_i2o_reset_hba(adpt_hba* pHba);
static s32 adpt_rescan(adpt_hba* pHba);
static s32 adpt_i2o_reparse_lct(adpt_hba* pHba);
static s32 adpt_send_nop(adpt_hba*pHba,u32 m);
static void adpt_i2o_delete_hba(adpt_hba* pHba);
static void adpt_inquiry(adpt_hba* pHba);
static struct adpt_device* adpt_find_device(adpt_hba* pHba, u32 chan, u32 id, u64 lun);
static int adpt_install_hba(struct scsi_host_template* sht, struct pci_dev* pDev) ;
static int adpt_i2o_online_hba(adpt_hba* pHba);
static void adpt_i2o_post_wait_complete(u32, int);
static int adpt_i2o_systab_send(adpt_hba* pHba);
static int adpt_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg);
static int adpt_open(struct inode *inode, struct file *file);
static int adpt_close(struct inode *inode, struct file *file);
#ifdef UARTDELAY
static void adpt_delay(int millisec);
#endif
#define PRINT_BUFFER_SIZE 512
#define HBA_FLAGS_DBG_FLAGS_MASK 0xffff0000 // Mask for debug flags
#define HBA_FLAGS_DBG_KERNEL_PRINT_B 0x00010000 // Kernel Debugger Print
#define HBA_FLAGS_DBG_FW_PRINT_B 0x00020000 // Firmware Debugger Print
#define HBA_FLAGS_DBG_FUNCTION_ENTRY_B 0x00040000 // Function Entry Point
#define HBA_FLAGS_DBG_FUNCTION_EXIT_B 0x00080000 // Function Exit
#define HBA_FLAGS_DBG_ERROR_B 0x00100000 // Error Conditions
#define HBA_FLAGS_DBG_INIT_B 0x00200000 // Init Prints
#define HBA_FLAGS_DBG_OS_COMMANDS_B 0x00400000 // OS Command Info
#define HBA_FLAGS_DBG_SCAN_B 0x00800000 // Device Scan
#define FW_DEBUG_STR_LENGTH_OFFSET 0
#define FW_DEBUG_FLAGS_OFFSET 4
#define FW_DEBUG_BLED_OFFSET 8
#define FW_DEBUG_FLAGS_NO_HEADERS_B 0x01
#endif /* !HOSTS_C */
#endif /* _DPT_H */
......@@ -229,6 +229,7 @@ static void put_ep (struct ep_data *data)
*/
static const char *CHIP;
static DEFINE_MUTEX(sb_mutex); /* Serialize superblock operations */
/*----------------------------------------------------------------------*/
......@@ -2012,13 +2013,20 @@ gadgetfs_fill_super (struct super_block *sb, struct fs_context *fc)
{
struct inode *inode;
struct dev_data *dev;
int rc;
if (the_device)
return -ESRCH;
mutex_lock(&sb_mutex);
if (the_device) {
rc = -ESRCH;
goto Done;
}
CHIP = usb_get_gadget_udc_name();
if (!CHIP)
return -ENODEV;
if (!CHIP) {
rc = -ENODEV;
goto Done;
}
/* superblock */
sb->s_blocksize = PAGE_SIZE;
......@@ -2055,13 +2063,17 @@ gadgetfs_fill_super (struct super_block *sb, struct fs_context *fc)
* from binding to a controller.
*/
the_device = dev;
return 0;
rc = 0;
goto Done;
Enomem:
Enomem:
kfree(CHIP);
CHIP = NULL;
rc = -ENOMEM;
return -ENOMEM;
Done:
mutex_unlock(&sb_mutex);
return rc;
}
/* "mount -t gadgetfs path /dev/gadget" ends up here */
......@@ -2083,6 +2095,7 @@ static int gadgetfs_init_fs_context(struct fs_context *fc)
static void
gadgetfs_kill_sb (struct super_block *sb)
{
mutex_lock(&sb_mutex);
kill_litter_super (sb);
if (the_device) {
put_dev (the_device);
......@@ -2090,6 +2103,7 @@ gadgetfs_kill_sb (struct super_block *sb)
}
kfree(CHIP);
CHIP = NULL;
mutex_unlock(&sb_mutex);
}
/*----------------------------------------------------------------------*/
......
......@@ -642,6 +642,14 @@ int ext4_ind_map_blocks(handle_t *handle, struct inode *inode,
ext4_update_inode_fsync_trans(handle, inode, 1);
count = ar.len;
/*
* Update reserved blocks/metadata blocks after successful block
* allocation which had been deferred till now.
*/
if (flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE)
ext4_da_update_reserve_space(inode, count, 1);
got_it:
map->m_flags |= EXT4_MAP_MAPPED;
map->m_pblk = le32_to_cpu(chain[depth-1].key);
......
......@@ -651,16 +651,6 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode,
*/
ext4_clear_inode_state(inode, EXT4_STATE_EXT_MIGRATE);
}
/*
* Update reserved blocks/metadata blocks after successful
* block allocation which had been deferred till now. We don't
* support fallocate for non extent files. So we can update
* reserve space here.
*/
if ((retval > 0) &&
(flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE))
ext4_da_update_reserve_space(inode, retval, 1);
}
if (retval > 0) {
......@@ -3504,7 +3494,7 @@ static int ext4_iomap_overwrite_begin(struct inode *inode, loff_t offset,
*/
flags &= ~IOMAP_WRITE;
ret = ext4_iomap_begin(inode, offset, length, flags, iomap, srcmap);
WARN_ON_ONCE(iomap->type != IOMAP_MAPPED);
WARN_ON_ONCE(!ret && iomap->type != IOMAP_MAPPED);
return ret;
}
......
......@@ -884,6 +884,16 @@ static void bdi_split_work_to_wbs(struct backing_dev_info *bdi,
continue;
}
/*
* If wb_tryget fails, the wb has been shutdown, skip it.
*
* Pin @wb so that it stays on @bdi->wb_list. This allows
* continuing iteration from @wb after dropping and
* regrabbing rcu read lock.
*/
if (!wb_tryget(wb))
continue;
/* alloc failed, execute synchronously using on-stack fallback */
work = &fallback_work;
*work = *base_work;
......@@ -892,13 +902,6 @@ static void bdi_split_work_to_wbs(struct backing_dev_info *bdi,
work->done = &fallback_work_done;
wb_queue_work(wb, work);
/*
* Pin @wb so that it stays on @bdi->wb_list. This allows
* continuing iteration from @wb after dropping and
* regrabbing rcu read lock.
*/
wb_get(wb);
last_wb = wb;
rcu_read_unlock();
......
......@@ -1548,6 +1548,8 @@ int do_prlimit(struct task_struct *tsk, unsigned int resource,
if (resource >= RLIM_NLIMITS)
return -EINVAL;
resource = array_index_nospec(resource, RLIM_NLIMITS);
if (new_rlim) {
if (new_rlim->rlim_cur > new_rlim->rlim_max)
return -EINVAL;
......
......@@ -378,6 +378,15 @@ static void wb_exit(struct bdi_writeback *wb)
static DEFINE_SPINLOCK(cgwb_lock);
static struct workqueue_struct *cgwb_release_wq;
static void cgwb_free_rcu(struct rcu_head *rcu_head)
{
struct bdi_writeback *wb = container_of(rcu_head,
struct bdi_writeback, rcu);
percpu_ref_exit(&wb->refcnt);
kfree(wb);
}
static void cgwb_release_workfn(struct work_struct *work)
{
struct bdi_writeback *wb = container_of(work, struct bdi_writeback,
......@@ -395,9 +404,8 @@ static void cgwb_release_workfn(struct work_struct *work)
blkcg_unpin_online(blkcg);
fprop_local_destroy_percpu(&wb->memcg_completions);
percpu_ref_exit(&wb->refcnt);
wb_exit(wb);
kfree_rcu(wb, rcu);
call_rcu(&wb->rcu, cgwb_free_rcu);
}
static void cgwb_release(struct percpu_ref *refcnt)
......
......@@ -680,7 +680,7 @@ static int can_rcv(struct sk_buff *skb, struct net_device *dev,
{
struct canfd_frame *cfd = (struct canfd_frame *)skb->data;
if (unlikely(dev->type != ARPHRD_CAN || skb->len != CAN_MTU)) {
if (unlikely(dev->type != ARPHRD_CAN || !can_get_ml_priv(dev) || skb->len != CAN_MTU)) {
pr_warn_once("PF_CAN: dropped non conform CAN skbuff: dev type %d, len %d\n",
dev->type, skb->len);
goto free_skb;
......@@ -706,7 +706,7 @@ static int canfd_rcv(struct sk_buff *skb, struct net_device *dev,
{
struct canfd_frame *cfd = (struct canfd_frame *)skb->data;
if (unlikely(dev->type != ARPHRD_CAN || skb->len != CANFD_MTU)) {
if (unlikely(dev->type != ARPHRD_CAN || !can_get_ml_priv(dev) || skb->len != CANFD_MTU)) {
pr_warn_once("PF_CAN: dropped non conform CAN FD skbuff: dev type %d, len %d\n",
dev->type, skb->len);
goto free_skb;
......
......@@ -1119,6 +1119,8 @@ void sk_psock_stop_strp(struct sock *sk, struct sk_psock *psock)
{
struct sk_psock_parser *parser = &psock->parser;
psock_set_prog(&psock->progs.skb_parser, NULL);
if (!parser->enabled)
return;
......@@ -1132,6 +1134,8 @@ void sk_psock_stop_verdict(struct sock *sk, struct sk_psock *psock)
{
struct sk_psock_parser *parser = &psock->parser;
psock_set_prog(&psock->progs.skb_verdict, NULL);
if (!parser->enabled)
return;
......
......@@ -145,6 +145,8 @@ static void sock_map_add_link(struct sk_psock *psock,
spin_unlock_bh(&psock->link_lock);
}
static int sock_map_init_proto(struct sock *sk, struct sk_psock *psock);
static void sock_map_del_link(struct sock *sk,
struct sk_psock *psock, void *link_raw)
{
......@@ -170,8 +172,10 @@ static void sock_map_del_link(struct sock *sk,
write_lock_bh(&sk->sk_callback_lock);
if (strp_stop)
sk_psock_stop_strp(sk, psock);
else
if (verdict_stop)
sk_psock_stop_verdict(sk, psock);
sock_map_init_proto(sk, psock);
write_unlock_bh(&sk->sk_callback_lock);
}
}
......@@ -286,29 +290,34 @@ static int sock_map_link(struct bpf_map *map, struct sk_psock_progs *progs,
if (msg_parser)
psock_set_prog(&psock->progs.msg_parser, msg_parser);
if (skb_parser)
psock_set_prog(&psock->progs.skb_parser, skb_parser);
if (skb_verdict)
psock_set_prog(&psock->progs.skb_verdict, skb_verdict);
/* msg_* and stream_* programs references tracked in psock after this
* point. Reference dec and cleanup will occur through psock destructor
*/
ret = sock_map_init_proto(sk, psock);
if (ret < 0)
goto out_drop;
if (ret < 0) {
sk_psock_put(sk, psock);
goto out;
}
write_lock_bh(&sk->sk_callback_lock);
if (skb_parser && skb_verdict && !psock->parser.enabled) {
ret = sk_psock_init_strp(sk, psock);
if (ret)
goto out_unlock_drop;
psock_set_prog(&psock->progs.skb_verdict, skb_verdict);
psock_set_prog(&psock->progs.skb_parser, skb_parser);
if (ret) {
write_unlock_bh(&sk->sk_callback_lock);
sk_psock_put(sk, psock);
goto out;
}
sk_psock_start_strp(sk, psock);
} else if (!skb_parser && skb_verdict && !psock->parser.enabled) {
psock_set_prog(&psock->progs.skb_verdict, skb_verdict);
sk_psock_start_verdict(sk,psock);
}
write_unlock_bh(&sk->sk_callback_lock);
return 0;
out_unlock_drop:
write_unlock_bh(&sk->sk_callback_lock);
out_drop:
sk_psock_put(sk, psock);
out_progs:
if (msg_parser)
bpf_prog_put(msg_parser);
......@@ -318,6 +327,7 @@ static int sock_map_link(struct bpf_map *map, struct sk_psock_progs *progs,
out_put_skb_verdict:
if (skb_verdict)
bpf_prog_put(skb_verdict);
out:
return ret;
}
......
......@@ -266,6 +266,71 @@ static int tcp_bpf_wait_data(struct sock *sk, struct sk_psock *psock,
return ret;
}
static int tcp_bpf_recvmsg_parser(struct sock *sk,
struct msghdr *msg,
size_t len,
int nonblock,
int flags,
int *addr_len)
{
struct sk_psock *psock;
int copied;
if (unlikely(flags & MSG_ERRQUEUE))
return inet_recv_error(sk, msg, len, addr_len);
if (!len)
return 0;
psock = sk_psock_get(sk);
if (unlikely(!psock))
return tcp_recvmsg(sk, msg, len, nonblock, flags, addr_len);
lock_sock(sk);
msg_bytes_ready:
copied = __tcp_bpf_recvmsg(sk, psock, msg, len, flags);
if (!copied) {
long timeo;
int data;
if (sock_flag(sk, SOCK_DONE))
goto out;
if (sk->sk_err) {
copied = sock_error(sk);
goto out;
}
if (sk->sk_shutdown & RCV_SHUTDOWN)
goto out;
if (sk->sk_state == TCP_CLOSE) {
copied = -ENOTCONN;
goto out;
}
timeo = sock_rcvtimeo(sk, nonblock);
if (!timeo) {
copied = -EAGAIN;
goto out;
}
if (signal_pending(current)) {
copied = sock_intr_errno(timeo);
goto out;
}
data = tcp_bpf_wait_data(sk, psock, flags, timeo, NULL);
if (data && !sk_psock_queue_empty(psock))
goto msg_bytes_ready;
copied = -EAGAIN;
}
out:
release_sock(sk);
sk_psock_put(sk, psock);
return copied;
}
static int tcp_bpf_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
int nonblock, int flags, int *addr_len)
{
......@@ -569,6 +634,8 @@ enum {
enum {
TCP_BPF_BASE,
TCP_BPF_TX,
TCP_BPF_RX,
TCP_BPF_TXRX,
TCP_BPF_NUM_CFGS,
};
......@@ -588,6 +655,12 @@ static void tcp_bpf_rebuild_protos(struct proto prot[TCP_BPF_NUM_CFGS],
prot[TCP_BPF_TX] = prot[TCP_BPF_BASE];
prot[TCP_BPF_TX].sendmsg = tcp_bpf_sendmsg;
prot[TCP_BPF_TX].sendpage = tcp_bpf_sendpage;
prot[TCP_BPF_RX] = prot[TCP_BPF_BASE];
prot[TCP_BPF_RX].recvmsg = tcp_bpf_recvmsg_parser;
prot[TCP_BPF_TXRX] = prot[TCP_BPF_TX];
prot[TCP_BPF_TXRX].recvmsg = tcp_bpf_recvmsg_parser;
}
static void tcp_bpf_check_v6_needs_rebuild(struct proto *ops)
......@@ -625,6 +698,10 @@ struct proto *tcp_bpf_get_proto(struct sock *sk, struct sk_psock *psock)
int family = sk->sk_family == AF_INET6 ? TCP_BPF_IPV6 : TCP_BPF_IPV4;
int config = psock->progs.msg_parser ? TCP_BPF_TX : TCP_BPF_BASE;
if (psock->progs.skb_verdict) {
config = (config == TCP_BPF_TX) ? TCP_BPF_TXRX : TCP_BPF_RX;
}
if (sk->sk_family == AF_INET6) {
if (tcp_bpf_assert_proto_ops(psock->sk_proto))
return ERR_PTR(-EINVAL);
......
......@@ -421,15 +421,16 @@ static int qfq_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
} else
weight = 1;
if (tb[TCA_QFQ_LMAX]) {
if (tb[TCA_QFQ_LMAX])
lmax = nla_get_u32(tb[TCA_QFQ_LMAX]);
if (lmax < QFQ_MIN_LMAX || lmax > (1UL << QFQ_MTU_SHIFT)) {
pr_notice("qfq: invalid max length %u\n", lmax);
return -EINVAL;
}
} else
else
lmax = psched_mtu(qdisc_dev(sch));
if (lmax < QFQ_MIN_LMAX || lmax > (1UL << QFQ_MTU_SHIFT)) {
pr_notice("qfq: invalid max length %u\n", lmax);
return -EINVAL;
}
inv_w = ONE_FP / weight;
weight = ONE_FP / inv_w;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册