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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? config.c

?? 硬盤驅(qū)動程序, 硬盤驅(qū)動程序,硬盤驅(qū)動程序
?? C
?? 第 1 頁 / 共 2 頁
字號:
///////////////////////////////////////////////////////////////////////////////
//
//  (C) Copyright 1995 - 1998 OSR Open Systems Resources, Inc.
//	All Rights Reserved
//      Based on a previous work by Microsoft Corporation
//      Copyright (c) 1991, 1992, 1993  Microsoft Corporation
//
//    This sofware is supplied for instructional purposes only.
//
//      OSR Open Systems Resources, Inc. (OSR) expressly disclaims any warranty
//      for this software.  THIS SOFTWARE IS PROVIDED  "AS IS" WITHOUT WARRANTY
//      OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION,
//      THE IMPLIED WARRANTIES OF MECHANTABILITY OR FITNESS FOR A PARTICULAR
//      PURPOSE.  THE ENTIRE RISK ARISING FROM THE USE OF THIS SOFTWARE REMAINS
//      WITH YOU.  OSR's entire liability and your exclusive remedy shall not
//      exceed the price paid for this material.  In no event shall OSR or its
//      suppliers be liable for any damages whatsoever (including, without
//      limitation, damages for loss of business profit, business interruption,
//      loss of business information, or any other pecuniary loss) arising out
//      of the use or inability to use this software, even if OSR has been
//      advised of the possibility of such damages.  Because some states/
//      jurisdictions do not allow the exclusion or limitation of liability for
//      consequential or incidental damages, the above limitation may not apply
//      to you.
//
//    This driver is the example Programmed I/O device driver that
//    accompanies the book Windows NT Device Driver Development, by
//    Peter Viscarola and W. Anthony Mason, (c) 1998 OSR Open Systems
//    Resources, Inc. and published by MacMillan Technical Publishing
//    ISBN 1578700582.  
//
//
//	MODULE:
//
//		$Workfile: config.c $
//
//	ABSTRACT:
//
//    This module handles the gathering of the configruation information 
//    for the IDE sample driver
//
//	AUTHOR:
//
//		Open Systems Resources, Inc.
// 
//	REVISION:   
//
//
///////////////////////////////////////////////////////////////////////////////

#include "ntddk.h"                      // main NT include
#include "ntdddisk.h"                   // disk driver IOCTL definitions
#include "hw.h"                         // the access macro/definitions
#include "ide.h"                        // general declarations/structures
#include "config.h"                     // configuration declarations

//
// device defaults
//

#define DEFAULT_INTERFACE_TYPE  Isa
#define DEFAULT_BUS_NUMBER      0
#define DEFAULT_IRQL            14
#define DEFAULT_BASE_ADDRESS    0x01f0;
#define DEFAULT_PORT_ADDRESS    0x03f6;

//
// forward delcarations of static routines
//

static VOID
UpdateWithBios(
PCONFIG_DATA ConfigData,
ULONG ParameterTableOffset
);

static BOOLEAN
ReconcileWithRegistry(
PDRIVER_OBJECT DriverObject,
PCONFIG_DATA ConfigData
);

static BOOLEAN
IssueIdentify(
PCONFIG_DATA ConfigData,
PUCHAR Buffer
);

//
// This is the structure of the information returned after an
// IDENTIFY command has been issued on the IDE drive
//

typedef struct _IDENTIFY_DATA {
    USHORT GeneralConfiguration;            // 00
    USHORT NumberOfCylinders;               // 01
    USHORT Reserved1;                       // 02
    USHORT NumberOfHeads;                   // 03
    USHORT UnformattedBytesPerTrack;        // 04
    USHORT UnformattedBytesPerSector;       // 05
    USHORT SectorsPerTrack;                 // 06
    USHORT VendorUnique1[3];                // 07
    USHORT SerialNumber[10];                // 10
    USHORT BufferType;                      // 20
    USHORT BufferSectorSize;                // 21
    USHORT NumberOfEccBytes;                // 22
    USHORT FirmwareRevision[4];             // 23
    USHORT ModelNumber[20];                 // 27
    UCHAR  MaximumBlockTransfer;            // 47 low byte
    UCHAR  VendorUnique2;                   // 47 high byte
    USHORT DoubleWordIo;                    // 48
    USHORT Capabilities;                    // 49
    USHORT Reserved2;                       // 50
    UCHAR  VendorUnique3;                   // 51 low byte
    UCHAR  PioCycleTimingMode;              // 51 high byte
    UCHAR  VendorUnique4;                   // 52 low byte
    UCHAR  DmaCycleTimingMode;              // 52 high byte
    USHORT TranslationFieldsValid;          // 53 (low bit)
    USHORT NumberOfCurrentCylinders;        // 54
    USHORT NumberOfCurrentHeads;            // 55
    USHORT CurrentSectorsPerTrack;          // 56
    ULONG  CurrentSectorCapacity;           // 57 & 58
    UCHAR  MultiSectorCount;                // 59 low
    UCHAR  MultiSectorSettingValid;         // 59 high (low bit)
    ULONG  TotalUserAddressableSectors;     // 60 & 61
    UCHAR  SingleDmaModesSupported;         // 62 low byte
    UCHAR  SingleDmaTransferActive;         // 62 high byte
    UCHAR  MultiDmaModesSupported;          // 63 low byte
    UCHAR  MultiDmaTransferActive;          // 63 high byte
    USHORT Reserved4[192];                  // 64
} 
IDENTIFY_DATA, *PIDENTIFY_DATA;


///////////////////////////////////////////////////////////////////////////////
//
//	IdeGetConfigData
//
//    This routine obtains the primary configuration information for the
//    device, including the bus and port addresses.  Note that many of
//    the values are assumed, as #defin'ed by the DEFAULT_ values, while
//    some are actually defined by checking into the ROM (some geometry).
//
//	INPUTS:
//
//    DriverObject      - driver object for this driver
//    RegistryPath      - this driver's service node in the registry
//    ConfigData        - allocated, zero'ed buffer that describes the
//                        controller and disk
//
//	OUTPUTS:
//	
//    ConfigData        - filled up with info
//
//	RETURNS:
//
//    STATUS_SUCCESS if we have a disk, otherwise STATUS_NO_SUCH_DEVICE
//
//      IRQL:
//
//    IRQL_PASSIVE_LEVEL
//
//	NOTES:
//
//    The steps followed are:
//
//      - call IoGetConfigurationInformation to get the primary AtDisk Address
//      - translate the ControllerBase and ControlPort addresses
//      - connect the interrupt
//      - make sure our controller is really there 
//      - claim the AtDisk primary address
//      - issue an IDENTIFY to get retrieve disk information from the contoller
//      - map the BIOS and get more configruation information
//      - check the configuration information with the registry
//
///////////////////////////////////////////////////////////////////////////////

NTSTATUS
IdeGetConfigData(IN PDRIVER_OBJECT DriverObject,
                 IN PUNICODE_STRING RegistryPath,
                 IN OUT PCONFIG_DATA ConfigData)
{
    PCONFIGURATION_INFORMATION configurationInformation;
    UCHAR               driveTypes, tmp;
    UCHAR               buffer[512];            // for IssueIdentify
    LARGE_INTEGER       tmpPtr;                 // for BIOS delving
    PUSHORT             paramVector;            // for BIOS delving
    PHYSICAL_ADDRESS    translatedAddress;      // for address translation
    ULONG               addressSpace;           // for address translation
    PHYSICAL_ADDRESS        phys_tmp;
    NTSTATUS            ntStatus;

    //
    // Get the current configuration manager information.
    //
    configurationInformation = IoGetConfigurationInformation();

    //
    // store the pointer to the hard disk count
    //
    ConfigData->HardDiskCount = &configurationInformation->DiskCount;

    //
    // We grab the primary AtDisk address at all costs. If we can't have it,
    // we just take our disk and go home... I mean, we refuse to load.
    //
    if (configurationInformation->AtDiskPrimaryAddressClaimed) {

#if DBG
        DbgPrint("IdeGetDiskConfig: Primary address already claimed!\n");
#endif


        return(STATUS_DEVICE_CONFIGURATION_ERROR);
    }



    //
    // Fill in some controller information.
    //
    ConfigData->InterfaceType = DEFAULT_INTERFACE_TYPE;
    ConfigData->BusNumber = DEFAULT_BUS_NUMBER;
    ConfigData->OriginalControllerIrql = DEFAULT_IRQL;

    phys_tmp.QuadPart = 0;

    //
    // store the default ControllerBase address and range
    //
    phys_tmp.LowPart = DEFAULT_BASE_ADDRESS;
    ConfigData->OriginalControllerBaseAddress = phys_tmp;
    ConfigData->RangeOfControllerBase = 8;

    //
    // store the default ControlPortAddress and range
    //
    phys_tmp.LowPart = DEFAULT_PORT_ADDRESS;
    ConfigData->OriginalControlPortAddress = phys_tmp;
    ConfigData->RangeOfControlPort = 1;

    //
    // set the interrupt vector to the same as the irql
    //
    ConfigData->OriginalControllerVector = ConfigData->OriginalControllerIrql;

    //
    // Translate the ControllerBase address
    //

    //
    // First, note that this is a port address
    //
    addressSpace = 0x01;

    //
    // Translate the Controller Base Address
    //
    if (!HalTranslateBusAddress(DEFAULT_INTERFACE_TYPE,
                            DEFAULT_BUS_NUMBER,
                            ConfigData->OriginalControllerBaseAddress,
                            &addressSpace,
                            &translatedAddress))  {

        //
        // We couldn't do the translation, so bail
        //
#if DBG
        DbgPrint("IdeGetDiskConfig: HalTranslateBusAddress failure for ControllerBase\n");
#endif

        return(STATUS_NO_SUCH_DEVICE);

    }

    //
    // The address was translated, so now check if the mapping 
    // of the addreess puts the address in memory space or I/O space
    //
    if (addressSpace == 0x0)  {

        //
        // We're in memory space, so we have to Map this address into
        // system space
        //
        ConfigData->ControllerBaseAddress = MmMapIoSpace(translatedAddress,
                                              ConfigData->RangeOfControllerBase,
                                              FALSE);

        //
        // if we didn't get an address, we have to quit
        //
        if (!ConfigData->ControllerBaseAddress) {

#if DBG
            DbgPrint("IdeGetDiskConfig: MmMapIoSpace failure for ControllerBase\n");
#endif
            return STATUS_NO_SUCH_DEVICE;

        }

        //
        // note that the ControllerBase is mapped
        //
        ConfigData->ControllerBaseMapped = TRUE;

    } else {

        //
        // The addresss is in I/O space, so we just need the low part
        // of the translated address
        //
        ConfigData->ControllerBaseMapped = FALSE;

        ConfigData->ControllerBaseAddress = (PVOID)translatedAddress.LowPart;
    }


    //
    // Next, Translate the ControlPort address
    //
    addressSpace = 0x01;

    //
    // Translate the address
    //
    if (!HalTranslateBusAddress( DEFAULT_INTERFACE_TYPE,
                                DEFAULT_BUS_NUMBER,
                                ConfigData->OriginalControlPortAddress,
                                &addressSpace,
                                &translatedAddress)) {
        //
        // We couldn't do the translation, so bail out
        //
#if DBG
        DbgPrint("IdeGetDiskConfig: HalTranslateBusAddress failure for ControlPort\n");
#endif

        //
        // If the controller's base address was mapped, we need to unmap it
        // before we leave.
        //
        if(ConfigData->ControllerBaseMapped) {

            MmUnmapIoSpace(ConfigData->ControllerBaseAddress,
                                     ConfigData->RangeOfControllerBase);
        }

        //
        // return error status
        //
        return(STATUS_NO_SUCH_DEVICE);

    }

    //
    // The address was translated, so now check if the mapping 
    // of the addreess puts the address in memory space or I/O space
    //
    if (addressSpace == 0x0) {

        //
        // We in memory space, so we have to Map this address into
        // system space
        //
        ConfigData->ControlPortAddress = MmMapIoSpace(translatedAddress,
                                        ConfigData->RangeOfControlPort,
                                        FALSE);

        //
        // if we didn't get an address, we have to quit
        //
        if (!ConfigData->ControlPortAddress) {

#if DBG
            DbgPrint("IdeGetDiskConfig: MmMapIoSpace failure for ControlPort\n");
#endif

            //
            // Unmap the controllerBase
            //

            if (ConfigData->ControllerBaseMapped) {
                MmUnmapIoSpace(ConfigData->ControllerBaseAddress,
                                        ConfigData->RangeOfControllerBase);
            }

            //
            // return failure status
            //
            return(STATUS_NO_SUCH_DEVICE);

        }

        //
        // note that the ControlPort is mapped
        //
        ConfigData->ControlPortMapped = TRUE;

    } else {

        //
        // The addresss is in I/O space, so we just need the
        // translated address
        //
        ConfigData->ControlPortMapped = FALSE;

        ConfigData->ControlPortAddress = (PVOID)translatedAddress.LowPart;
    }

    //
    // get the interrupt vector
    //
    ConfigData->ControllerVector = HalGetInterruptVector(ConfigData->InterfaceType,
                                            ConfigData->BusNumber,
                                            ConfigData->OriginalControllerIrql,
                                            ConfigData->OriginalControllerVector,
                                            &ConfigData->ControllerIrql,
                                            &ConfigData->ProcessorNumber);


    //
    // Check if the controller exists by writing 0xaa to the COUNT register and
    // attempting to read it back.  Crude, but effective.
    //
    WRITE_PORT_UCHAR(ConfigData->ControllerBaseAddress + SECTOR_COUNT_REGISTER, 0xaa);

    tmp = READ_PORT_UCHAR(ConfigData->ControllerBaseAddress + SECTOR_COUNT_REGISTER);

    //
    // Did we get 0xaa back from the count register?
    //
    if (tmp != 0xaa) {

        //
        // No, we didn't.  Hmmmmm... I don't know what we've got, but it's
        // either an IDE controller that's not there or something else.
        //
        // We're outa here in either case.
        //
#if DBG
        DbgPrint("IdeGetDiskConfig: Unable to verify controller existance\n");
#endif

        //
        // Unmap the ControllerBase
        //
        if (ConfigData->ControllerBaseMapped) {

            MmUnmapIoSpace(ConfigData->ControllerBaseAddress,
                                    ConfigData->RangeOfControllerBase);
        }

        //
        // Unmap the ControlPort
        //
        if (ConfigData->ControlPortMapped) {

            MmUnmapIoSpace(ConfigData->ControlPortAddress,
                                            ConfigData->RangeOfControlPort);
        }

        //
        // return failure status
        //
        return(STATUS_NO_SUCH_DEVICE);
    }

    //
    // The controller exists, so claim the AtDisk primary IO 
    // address range.
    //
    configurationInformation->AtDiskPrimaryAddressClaimed = TRUE;

    ConfigData->OkToUseThisController = TRUE;

    //
    // Check CMOS for drive types for the disk
    //
    WRITE_PORT_UCHAR(CFGMEM_QUERY_PORT, CFGMEM_FIRST_CONTROLLER_DRIVE_TYPES);

    KeStallExecutionProcessor(1L);

    driveTypes = READ_PORT_UCHAR(CFGMEM_DATA_PORT);

    ConfigData->Disk.DriveType = (UCHAR)
                                  (driveTypes & CFGMEM_DRIVES_FIRST_DRIVE_MASK);

    //
    // If there is no drive, then we have to quit.
    //
    if (!ConfigData->Disk.DriveType) {

#if DBG
        DbgPrint("IdeGetDiskConfig: Unable to read drive configuration\n");
#endif

        //
        // Unmap the ControllerBase
        //

        if (ConfigData->ControllerBaseMapped) {

            MmUnmapIoSpace(ConfigData->ControllerBaseAddress,
                                        ConfigData->RangeOfControllerBase);
        }

        //
        // Unmap the ControlPort
        //
        if (ConfigData->ControlPortMapped) {

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91麻豆蜜桃一区二区三区| 不卡在线视频中文字幕| 国产成人av福利| 91豆麻精品91久久久久久| 91麻豆精品国产91久久久久久久久| 中文字幕第一区第二区| 美洲天堂一区二卡三卡四卡视频| 成人h动漫精品| 久久美女艺术照精彩视频福利播放 | 在线亚洲一区观看| 欧美国产精品v| 国产一区二区导航在线播放| 精品视频免费看| 一区二区三区精品视频| av在线这里只有精品| 久久久青草青青国产亚洲免观| 亚洲电影第三页| 在线观看区一区二| 中文字幕av资源一区| 国产乱码一区二区三区| 26uuu亚洲综合色| 狂野欧美性猛交blacked| 在线观看www91| 亚洲成a人片在线不卡一二三区| 色哟哟精品一区| 亚洲人成网站精品片在线观看 | 91免费视频网| 国产精品情趣视频| 成人听书哪个软件好| 日本一区二区三区久久久久久久久不 | 色视频成人在线观看免| 国产精品视频看| 99久久99久久综合| 一区二区三区中文免费| 91九色02白丝porn| 亚洲丰满少妇videoshd| 欧美日产在线观看| 免费在线观看日韩欧美| 日韩欧美美女一区二区三区| 久久精品72免费观看| 久久一区二区三区四区| 成人免费视频国产在线观看| 中文字幕亚洲视频| 在线观看91精品国产入口| 亚洲国产成人av网| 欧美大肚乱孕交hd孕妇| 国产乱理伦片在线观看夜一区 | 精品国产凹凸成av人网站| 国产乱对白刺激视频不卡| 国产精品久久久久久久久免费桃花| 99久久久无码国产精品| 一区二区三区在线免费播放 | 日韩成人免费在线| 久久久久久久久99精品| 99视频在线精品| 亚洲福利国产精品| 精品国产3级a| 色综合欧美在线| 免费久久精品视频| 国产亚洲精品7777| 91成人免费在线视频| 麻豆91在线播放免费| 国产欧美精品日韩区二区麻豆天美| 91亚洲精品一区二区乱码| 日韩avvvv在线播放| 欧美激情一区二区三区四区 | 亚洲精品一线二线三线无人区| 国产精品自拍一区| 亚洲一卡二卡三卡四卡五卡| 日韩精品一区二| 日本欧美大码aⅴ在线播放| 中文字幕在线播放不卡一区| 国产欧美va欧美不卡在线| 久久精品在线观看| 国产欧美一区二区在线| 久久一日本道色综合| 久久婷婷综合激情| 久久久久久黄色| 国产亚洲精品久| 亚洲欧美中日韩| 一区二区三区在线视频观看 | 中文字幕av一区二区三区| 欧美精品一区二区在线播放| 精品国产sm最大网站| 久久久蜜桃精品| 中文欧美字幕免费| 亚洲日本一区二区三区| 亚洲精品福利视频网站| 亚洲成人中文在线| 毛片av一区二区| 国产精品一卡二| www.欧美.com| 欧美日韩亚洲不卡| 欧美电视剧在线观看完整版| 久久精品欧美一区二区三区不卡| 国产色婷婷亚洲99精品小说| 国产精品美日韩| 亚洲黄一区二区三区| 天天综合日日夜夜精品| 理论片日本一区| youjizz国产精品| 欧美日韩一区久久| 欧美精品一区视频| 日韩美女视频一区二区| 午夜精品福利在线| 国产成人av网站| 欧美日韩亚洲综合在线| 欧美不卡一二三| 亚洲乱码日产精品bd| 蜜乳av一区二区三区| 不卡一区二区中文字幕| 欧美日韩精品电影| 欧美经典一区二区三区| 一区二区三区精品在线| 久久aⅴ国产欧美74aaa| 91在线国产福利| 精品欧美黑人一区二区三区| 国产精品久久看| 久久精品国产秦先生| 色狠狠桃花综合| 国产午夜精品一区二区| 亚洲综合激情网| 丰满亚洲少妇av| 日韩一区二区精品| 成人免费视频在线观看| 久久国产精品免费| 一本大道av伊人久久综合| www日韩大片| 亚洲成人av资源| 9久草视频在线视频精品| 欧美变态凌虐bdsm| 一区二区三区免费看视频| 国产精品一区一区| 欧美一个色资源| 亚洲一区av在线| 91影院在线免费观看| 日韩欧美国产三级电影视频| 亚洲午夜电影网| 色999日韩国产欧美一区二区| 精品va天堂亚洲国产| 天天爽夜夜爽夜夜爽精品视频| voyeur盗摄精品| 国产亚洲美州欧州综合国| 琪琪一区二区三区| 欧美人体做爰大胆视频| 亚洲欧美乱综合| 成人午夜免费av| 久久色中文字幕| 激情综合色丁香一区二区| 欧美三级韩国三级日本一级| 亚洲视频一二三区| 99久久99久久久精品齐齐| 国产精品午夜春色av| 国产一区不卡视频| 久久午夜国产精品| 激情文学综合网| 久久无码av三级| 韩国毛片一区二区三区| 日韩无一区二区| 久久精品国产99国产| 欧美一区二区三级| 亚洲国产成人av网| 欧美日本一区二区| 美女在线视频一区| 欧美裸体bbwbbwbbw| 婷婷成人综合网| 67194成人在线观看| 日韩精品一区第一页| 欧美剧在线免费观看网站| 午夜精品久久久久久久久| 欧美日韩一级片网站| 日韩制服丝袜先锋影音| 欧美伦理影视网| 久久激情综合网| 久久久国产午夜精品| 国产成人精品亚洲777人妖| 国产日韩综合av| www.一区二区| 亚洲综合一二区| 91精品国产综合久久精品性色| 日韩不卡在线观看日韩不卡视频| 欧美一区二区播放| 国产呦精品一区二区三区网站| 精品成人一区二区| 成人午夜精品在线| 亚洲一区二区三区小说| 欧美精品精品一区| 国内精品伊人久久久久av一坑| 精品粉嫩aⅴ一区二区三区四区 | 91小视频免费观看| 一区二区三区毛片| 日韩美女天天操| 成人免费精品视频| 亚洲成人av一区二区| 日韩欧美激情在线| 成人午夜伦理影院| 丝袜诱惑制服诱惑色一区在线观看| 日韩欧美不卡在线观看视频| 成熟亚洲日本毛茸茸凸凹| 伊人一区二区三区|