亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? ultrastor.c

?? LINUX1.0源代碼,代碼條理清晰
?? C
?? 第 1 頁 / 共 3 頁
字號:
/*
 *	ultrastor.c	Copyright (C) 1992 David B. Gentzel
 *	Low-level SCSI driver for UltraStor 14F, 24F, and 34F
 *	by David B. Gentzel, Whitfield Software Services, Carnegie, PA
 *	    (gentzel@nova.enet.dec.com)
 *  scatter/gather added by Scott Taylor (n217cg@tamuts.tamu.edu)
 *  24F and multiple command support by John F. Carr (jfc@athena.mit.edu)
 *    John's work modified by Caleb Epstein (cae@jpmorgan.com) and 
 *    Eric Youngdale (eric@tantalus.nrl.navy.mil).
 *	Thanks to UltraStor for providing the necessary documentation
 */

/*
 * TODO:
 *	1. Find out why scatter/gather is limited to 16 requests per command.
 *	2. Look at command linking (mscp.command_link and
 *	   mscp.command_link_id).  (Does not work with many disks, 
 *				and no performance increase.  ERY).
 *	3. Allow multiple adapters.
 */

/*
 * NOTES:
 *    The UltraStor 14F, 24F, and 34F are a family of intelligent, high
 *    performance SCSI-2 host adapters.  They all support command queueing
 *    and scatter/gather I/O.  Some of them can also emulate the standard
 *    WD1003 interface for use with OS's which don't support SCSI.  Here
 *    is the scoop on the various models:
 *	14F - ISA first-party DMA HA with floppy support and WD1003 emulation.
 *	14N - ISA HA with floppy support.  I think that this is a non-DMA
 *	      HA.  Nothing further known.
 *	24F - EISA Bus Master HA with floppy support and WD1003 emulation.
 *	34F - VL-Bus Bus Master HA with floppy support (no WD1003 emulation).
 *
 *    The 14F, 24F, and 34F are supported by this driver.
 *
 *    Places flagged with a triple question-mark are things which are either
 *    unfinished, questionable, or wrong.
 */

/* Changes from version 1.9 to 1.11
 *
 * Patches to bring this driver up to speed with the default kernel
 * driver which supports only the 14F and 34F adapters.  This version
 * should compile cleanly into 0.99.13, 0.99.12 and probably 0.99.11.
 *
 * Fixes from Eric Youngdale to fix a few possible race conditions and
 * several problems with bit testing operations (insufficient
 * parentheses).
 *
 * Removed the ultrastor_abort() and ultrastor_reset() functions
 * (enclosed them in #if 0 / #endif).  These functions, at least on
 * the 24F, cause the SCSI bus to do odd things and generally lead to
 * kernel panics and machine hangs.  This is like the Adaptec code.
 *
 * Use check/snarf_region for 14f, 34f to avoid I/O space address conflicts.
 */

/* Changes from version 1.8 to version 1.9
 *
 *  0.99.11 patches (cae@jpmorgan.com) */

/* Changes from version 1.7 to version 1.8
 *
 * Better error reporting.
 */

/* Changes from version 1.6 to version 1.7
 *
 * Removed CSIR command code.
 *
 * Better race condition avoidance (xchgb function added).
 *
 * Set ICM and OGM status to zero at probe (24F)
 *
 * reset sends soft reset to UltraStor adapter
 *
 * reset adapter if adapter interrupts with an invalid MSCP address
 *
 * handle aborted command interrupt (24F)
 *
 */

/* Changes from version 1.5 to version 1.6:
 *
 * Read MSCP address from ICM _before_ clearing the interrupt flag.
 * This fixes a race condition.
 */

/* Changes from version 1.4 to version 1.5:
 *
 * Abort now calls done when multiple commands are enabled.
 *
 * Clear busy when aborted command finishes, not when abort is called.
 *
 * More debugging messages for aborts.
 */

/* Changes from version 1.3 to version 1.4:
 *
 * Enable automatic request of sense data on error (requires newer version
 * of scsi.c to be useful).
 *
 * Fix PORT_OVERRIDE for 14F.
 *
 * Fix abort and reset to work properly (config.aborted wasn't cleared
 * after it was tested, so after a command abort no further commands would
 * work).
 *
 * Boot time test to enable SCSI bus reset (defaults to not allowing reset).
 *
 * Fix test for OGM busy -- the busy bit is in different places on the 24F.
 *
 * Release ICM slot by clearing first byte on 24F.
 */

#include <linux/stddef.h>
#include <linux/string.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/ioport.h>

#include <asm/io.h>
#include <asm/bitops.h>
#include <asm/system.h>
#include <asm/dma.h>

#define ULTRASTOR_PRIVATE	/* Get the private stuff from ultrastor.h */
#include "../block/blk.h"
#include "scsi.h"
#include "hosts.h"
#include "ultrastor.h"

#define FALSE 0
#define TRUE 1

#ifndef ULTRASTOR_DEBUG
#define ULTRASTOR_DEBUG (UD_ABORT|UD_CSIR|UD_RESET)
#endif

#define VERSION "1.11 alpha"

#define ARRAY_SIZE(arr) (sizeof (arr) / sizeof (arr)[0])

#define PACKED		__attribute__((packed))
#define ALIGNED(x)	__attribute__((aligned(x)))


/* The 14F uses an array of 4-byte ints for its scatter/gather list.
   The data can be unaligned, but need not be.  It's easier to give
   the list normal alignment since it doesn't need to fit into a
   packed structure.  */

typedef struct {
  unsigned int address;
  unsigned int num_bytes;
} ultrastor_sg_list;


/* MailBox SCSI Command Packet.  Basic command structure for communicating
   with controller. */
struct mscp {
  unsigned char opcode: 3;		/* type of command */
  unsigned char xdir: 2;		/* data transfer direction */
  unsigned char dcn: 1;		/* disable disconnect */
  unsigned char ca: 1;		/* use cache (if available) */
  unsigned char sg: 1;		/* scatter/gather operation */
  unsigned char target_id: 3;		/* target SCSI id */
  unsigned char ch_no: 2;		/* SCSI channel (always 0 for 14f) */
  unsigned char lun: 3;		/* logical unit number */
  unsigned int transfer_data PACKED;	/* transfer data pointer */
  unsigned int transfer_data_length PACKED;	/* length in bytes */
  unsigned int command_link PACKED;	/* for linking command chains */
  unsigned char scsi_command_link_id;	/* identifies command in chain */
  unsigned char number_of_sg_list;	/* (if sg is set) 8 bytes per list */
  unsigned char length_of_sense_byte;
  unsigned char length_of_scsi_cdbs;	/* 6, 10, or 12 */
  unsigned char scsi_cdbs[12];	/* SCSI commands */
  unsigned char adapter_status;	/* non-zero indicates HA error */
  unsigned char target_status;	/* non-zero indicates target error */
  unsigned int sense_data PACKED;
  /* The following fields are for software only.  They are included in
     the MSCP structure because they are associated with SCSI requests.  */
  void (*done)(Scsi_Cmnd *);
  Scsi_Cmnd *SCint;
  ultrastor_sg_list sglist[ULTRASTOR_14F_MAX_SG];
};


/* Port addresses (relative to the base address) */
#define U14F_PRODUCT_ID(port) ((port) + 0x4)
#define CONFIG(port) ((port) + 0x6)

/* Port addresses relative to the doorbell base address.  */
#define LCL_DOORBELL_MASK(port) ((port) + 0x0)
#define LCL_DOORBELL_INTR(port) ((port) + 0x1)
#define SYS_DOORBELL_MASK(port) ((port) + 0x2)
#define SYS_DOORBELL_INTR(port) ((port) + 0x3)


/* Used to store configuration info read from config i/o registers.  Most of
   this is not used yet, but might as well save it.
   
   This structure also holds port addresses that are not at the same offset
   on the 14F and 24F.
   
   This structure holds all data that must be duplicated to support multiple
   adapters.  */

static struct ultrastor_config
{
  unsigned short port_address;		/* base address of card */
  unsigned short doorbell_address;	/* base address of doorbell CSRs */
  unsigned short ogm_address;		/* base address of OGM */
  unsigned short icm_address;		/* base address of ICM */
  const void *bios_segment;
  unsigned char interrupt: 4;
  unsigned char dma_channel: 3;
  unsigned char bios_drive_number: 1;
  unsigned char heads;
  unsigned char sectors;
  unsigned char ha_scsi_id: 3;
  unsigned char subversion: 4;
  unsigned char revision;
  /* The slot number is used to distinguish the 24F (slot != 0) from
     the 14F and 34F (slot == 0). */
  unsigned char slot;

#ifdef PRINT_U24F_VERSION
  volatile int csir_done;
#endif

  /* Our index in the host adapter array maintained by higher-level driver */
  int host_number;

  /* A pool of MSCP structures for this adapter, and a bitmask of
     busy structures.  (If ULTRASTOR_14F_MAX_CMDS == 1, a 1 byte
     busy flag is used instead.)  */

#if ULTRASTOR_MAX_CMDS == 1
  unsigned char mscp_busy;
#else
  unsigned short mscp_free;
#endif
  volatile unsigned char aborted[ULTRASTOR_MAX_CMDS];
  struct mscp mscp[ULTRASTOR_MAX_CMDS];
} config = {0};

/* Set this to 1 to reset the SCSI bus on error.  */
int ultrastor_bus_reset = 0;


/* Allowed BIOS base addresses (NULL indicates reserved) */
static const void *const bios_segment_table[8] = {
  NULL,	     (void *)0xC4000, (void *)0xC8000, (void *)0xCC000,
  (void *)0xD0000, (void *)0xD4000, (void *)0xD8000, (void *)0xDC000,
};

/* Allowed IRQs for 14f */
static const unsigned char interrupt_table_14f[4] = { 15, 14, 11, 10 };

/* Allowed DMA channels for 14f (0 indicates reserved) */
static const unsigned char dma_channel_table_14f[4] = { 5, 6, 7, 0 };

/* Head/sector mappings allowed by 14f */
static const struct {
  unsigned char heads;
  unsigned char sectors;
} mapping_table[4] = { { 16, 63 }, { 64, 32 }, { 64, 63 }, { 64, 32 } };

#ifndef PORT_OVERRIDE
/* ??? A probe of address 0x310 screws up NE2000 cards */
static const unsigned short ultrastor_ports_14f[] = {
  0x330, 0x340, /*0x310,*/ 0x230, 0x240, 0x210, 0x130, 0x140,
};
#endif

static void ultrastor_interrupt(int cpl);
static inline void build_sg_list(struct mscp *, Scsi_Cmnd *SCpnt);


static inline int find_and_clear_bit_16(unsigned short *field)
{
  int rv;
  cli();
  if (*field == 0) panic("No free mscp");
  asm("xorl %0,%0\n0:\tbsfw %1,%w0\n\tbtr %0,%1\n\tjnc 0b"
      : "=&r" (rv), "=m" (*field) : "1" (*field));
  sti();
  return rv;
}

/* This asm is fragile: it doesn't work without the casts and it may
   not work without optimization.  Maybe I should add a swap builtin
   to gcc.  --jfc  */
static inline unsigned char xchgb(unsigned char reg,
				  volatile unsigned char *mem)
{
  asm("xchgb %0,%1" :
      "=r" (reg), "=m" (*(unsigned char *)mem) :
      "0" (reg), "1" (*(unsigned char *)mem));
  return reg;
}

#if ULTRASTOR_DEBUG & (UD_COMMAND | UD_ABORT)

static void log_ultrastor_abort(register struct ultrastor_config *config,
				int command)
{
  static char fmt[80] = "abort %d (%x); MSCP free pool: %x;";
  register int i;
  int flags;
  save_flags(flags);
  cli();

  for (i = 0; i < ULTRASTOR_MAX_CMDS; i++)
    {
      fmt[20 + i*2] = ' ';
      if (! (config->mscp_free & (1 << i)))
	fmt[21 + i*2] = '0' + config->mscp[i].target_id;
      else
	fmt[21 + i*2] = '-';
    }
  fmt[20 + ULTRASTOR_MAX_CMDS * 2] = '\n';
  fmt[21 + ULTRASTOR_MAX_CMDS * 2] = 0;
  printk(fmt, command, &config->mscp[command], config->mscp_free);
  restore_flags(flags);
}
#endif

static int ultrastor_14f_detect(int hostnum)
{
    size_t i;
    unsigned char in_byte, version_byte = 0;
    struct config_1 {
      unsigned char bios_segment: 3;
      unsigned char removable_disks_as_fixed: 1;
      unsigned char interrupt: 2;
    unsigned char dma_channel: 2;
    } config_1;
    struct config_2 {
      unsigned char ha_scsi_id: 3;
      unsigned char mapping_mode: 2;
      unsigned char bios_drive_number: 1;
      unsigned char tfr_port: 2;
    } config_2;

#if (ULTRASTOR_DEBUG & UD_DETECT)
    printk("US14F: detect: called\n");
#endif

    /* If a 24F has already been configured, don't look for a 14F.  */
    if (config.bios_segment)
	return FALSE;

#ifdef PORT_OVERRIDE
    if(check_region(PORT_OVERRIDE, 0xc)) {
      printk("Ultrastor I/O space already in use\n");
      return FALSE;
    };
    config.port_address = PORT_OVERRIDE;
#else
    for (i = 0; i < ARRAY_SIZE(ultrastor_ports_14f); i++) {
      if(check_region(ultrastor_ports_14f[i], 0x0c)) continue;
      config.port_address = ultrastor_ports_14f[i];
#endif

#if (ULTRASTOR_DEBUG & UD_DETECT)
	printk("US14F: detect: testing port address %03X\n", config.port_address);
#endif

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
中文字幕乱码久久午夜不卡 | 成人av在线资源网| 在线观看网站黄不卡| 日韩免费视频一区二区| 亚洲色图.com| 高清shemale亚洲人妖| 欧美一级二级三级蜜桃| 一区二区在线看| 成人av电影在线播放| 精品久久久久香蕉网| 午夜精品一区二区三区电影天堂 | 成人精品视频一区二区三区| 欧美一级在线免费| 午夜伦欧美伦电影理论片| 99re热这里只有精品免费视频| 欧美xxxxxxxx| 麻豆91小视频| 日韩欧美色电影| 免费高清在线视频一区·| 欧美色图在线观看| 亚洲图片欧美视频| 欧美在线一区二区三区| 国产精品盗摄一区二区三区| 国产91对白在线观看九色| 精品美女在线播放| 激情综合色综合久久| 日韩女优av电影| 亚洲成年人网站在线观看| 欧美日韩情趣电影| 首页亚洲欧美制服丝腿| 欧美精品vⅰdeose4hd| 丝袜诱惑制服诱惑色一区在线观看 | 亚洲欧美国产毛片在线| 91原创在线视频| 亚洲欧美区自拍先锋| 色综合久久久久综合体桃花网| 亚洲欧美在线视频观看| 99久久精品免费看国产免费软件| 国产精品免费视频一区| 色综合久久六月婷婷中文字幕| 一区二区三区国产精华| 欧美三级视频在线观看| 蜜桃精品视频在线| 久久久综合视频| 91天堂素人约啪| 亚洲国产精品一区二区久久恐怖片| 欧美调教femdomvk| 美女国产一区二区三区| 久久精品免费在线观看| 91免费视频网| 欧美aa在线视频| 国产欧美日韩不卡免费| 91网页版在线| 美女爽到高潮91| 精品va天堂亚洲国产| 风间由美性色一区二区三区| 一区二区三区自拍| 日韩精品一区二区三区视频播放| 粉嫩aⅴ一区二区三区四区| 亚洲国产毛片aaaaa无费看| 日韩视频在线永久播放| caoporn国产一区二区| 亚洲国产精品久久不卡毛片 | 风流少妇一区二区| 亚洲一区二区三区影院| 久久综合色之久久综合| 色综合天天综合| 久久精品国产精品亚洲精品| 中文字幕日韩欧美一区二区三区| 欧美人狂配大交3d怪物一区| 国产精品77777竹菊影视小说| 亚洲一区二区精品久久av| 久久蜜桃一区二区| 欧美日韩国产a| caoporm超碰国产精品| 麻豆成人综合网| 一区二区三区精品| 国产亚洲女人久久久久毛片| 欧美色大人视频| 99久久精品免费看国产| 日本欧美久久久久免费播放网| 国产精品你懂的在线欣赏| 日韩免费观看2025年上映的电影| 91视频在线看| 成人综合激情网| 偷窥少妇高潮呻吟av久久免费| 亚洲欧洲精品一区二区三区不卡| 精品久久国产老人久久综合| 欧美吻胸吃奶大尺度电影| 一级日本不卡的影视| 国产麻豆成人精品| 亚洲视频每日更新| 3751色影院一区二区三区| 91网站最新地址| 国产iv一区二区三区| 日本成人中文字幕在线视频| 亚洲国产毛片aaaaa无费看| 自拍偷拍欧美精品| 欧美高清一级片在线观看| 久久综合九色综合97婷婷| 日韩一区二区影院| 欧美精选午夜久久久乱码6080| 在线精品亚洲一区二区不卡| 91丨porny丨中文| 99精品久久99久久久久| 成人精品小蝌蚪| 成人app软件下载大全免费| 国产激情视频一区二区三区欧美| 久久成人久久鬼色| 久久99精品国产91久久来源| 麻豆成人av在线| 国产综合一区二区| 国产一区二区在线看| 精彩视频一区二区三区| 美女免费视频一区二区| 麻豆精品一区二区综合av| 蜜桃av一区二区| 精品一区二区三区在线观看| 美女一区二区三区| 国产麻豆一精品一av一免费| 国产精品99久久久| 成人av在线播放网址| 97精品国产露脸对白| 欧美专区日韩专区| 在线电影院国产精品| 日韩午夜激情av| 国产色婷婷亚洲99精品小说| 国产精品国产三级国产普通话三级| 国产精品国产成人国产三级| 夜夜嗨av一区二区三区| 亚洲chinese男男1069| 久久99在线观看| 国产jizzjizz一区二区| 色伊人久久综合中文字幕| 欧美色图第一页| 精品国产电影一区二区| 国产精品美女一区二区| 亚洲国产人成综合网站| 老色鬼精品视频在线观看播放| 成人午夜视频在线| 在线视频综合导航| 精品少妇一区二区三区在线播放| 国产日韩av一区二区| 亚洲一区二区影院| 久久爱另类一区二区小说| 成人av资源网站| 在线不卡一区二区| 欧美国产精品一区二区| 亚洲高清免费在线| 国产一区二区看久久| 欧美午夜在线观看| 久久欧美一区二区| 夜夜亚洲天天久久| 国产精品77777| 欧美日韩在线直播| 欧美激情一区二区三区在线| 亚洲综合丁香婷婷六月香| 久久99在线观看| 91蜜桃网址入口| 精品区一区二区| 亚洲香肠在线观看| 成人黄色在线视频| 欧美一区二区三区播放老司机| 国产精品另类一区| 老司机午夜精品| 欧美日韩欧美一区二区| 中文字幕一区二区视频| 麻豆专区一区二区三区四区五区| 色拍拍在线精品视频8848| 久久免费看少妇高潮| 日本午夜精品一区二区三区电影| av影院午夜一区| 久久人人爽人人爽| 日韩**一区毛片| 欧美怡红院视频| 亚洲欧美在线另类| 丁香婷婷综合网| 日韩你懂的电影在线观看| 亚洲成人久久影院| 色噜噜狠狠成人网p站| 中文字幕欧美激情| 国产一区二区三区不卡在线观看| 欧美日韩不卡一区二区| 亚洲综合色丁香婷婷六月图片| zzijzzij亚洲日本少妇熟睡| 2020国产精品自拍| 精品在线免费观看| 777奇米四色成人影色区| 亚洲一级片在线观看| 在线一区二区视频| 亚洲精品综合在线| 色婷婷久久99综合精品jk白丝| 国产精品久久久久久久久免费桃花 | 日韩欧美高清一区| 日本成人在线不卡视频| 91精品久久久久久久99蜜桃| 日韩主播视频在线| 欧美日本一区二区三区| 爽好多水快深点欧美视频| 91精品国产一区二区三区香蕉|