[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] fix some bugs of WinPv driver WDM version
# HG changeset patch # User Wayne Gong <wayne.gong@xxxxxxxxxx> # Date 1215410619 -28800 # Node ID d5e48a07a2134cd6274392079b7c1bcad89417f4 # Parent ab5d87da78e3948530a22d77a94c15e8a747fe38 Merge bug fixer from WDF to WDM. diff -r ab5d87da78e3 -r d5e48a07a213 xenhide/xenhide.c --- a/xenhide/xenhide.c Mon Jul 07 09:39:15 2008 +0800 +++ b/xenhide/xenhide.c Mon Jul 07 14:03:39 2008 +0800 @@ -60,8 +60,8 @@ UNICODE_STRING RegValueName; HANDLE RegHandle; OBJECT_ATTRIBUTES RegObjectAttributes; - char Buf[200]; - ULONG BufLen = 200; + char Buf[300];// Sometimes bigger then 200 if system reboot from crash + ULONG BufLen = 300; PKEY_VALUE_PARTIAL_INFORMATION KeyPartialValue; int State = 0; size_t StartPos = 0; @@ -249,8 +249,9 @@ if (gplpv) { /* hide only specific devices */ - if (XenHide_IdSuffixMatches(PhysicalDeviceObject, L"VEN_8086&DEV_7010") - || XenHide_IdSuffixMatches(PhysicalDeviceObject, L"VEN_10EC&DEV_8139")) + if (XenHide_IdSuffixMatches(PhysicalDeviceObject, L"VEN_8086&DEV_7010") // Qemu IDE + || XenHide_IdSuffixMatches(PhysicalDeviceObject, L"VEN_10EC&DEV_8139") // Qemu Network + || XenHide_IdSuffixMatches(PhysicalDeviceObject, L"VEN_1000&DEV_0012"))// Qemu SCSI { hide_type = XENHIDE_TYPE_DEVICE; } diff -r ab5d87da78e3 -r d5e48a07a213 xenpci/gnttbl.c --- a/xenpci/gnttbl.c Mon Jul 07 09:39:15 2008 +0800 +++ b/xenpci/gnttbl.c Mon Jul 07 14:03:39 2008 +0800 @@ -149,28 +149,59 @@ return TRUE; } +#if defined(_X86_) +static unsigned int +GntTbl_QueryMaxFrames(PXENPCI_DEVICE_DATA xpdd) +{ + struct gnttab_query_size query; + int rc; + + query.dom = DOMID_SELF; + + rc = HYPERVISOR_grant_table_op(xpdd,GNTTABOP_query_size, &query, 1); + if ((rc < 0) || (query.status != GNTST_okay)) + { + KdPrint((__DRIVER_NAME " ***CANNOT QUERY MAX GRANT FRAME***\n")); + return 4; /* Legacy max supported number of frames */ + } + return query.max_nr_frames; +} +#endif + VOID GntTbl_Init(PXENPCI_DEVICE_DATA xpdd) { int i; - + int max_grant_frames = NR_GRANT_FRAMES; + int max_grant_entries = NR_GRANT_ENTRIES; //KdPrint((__DRIVER_NAME " --> GntTbl_Init\n")); KeInitializeSpinLock(&xpdd->grant_lock); - for (i = NR_RESERVED_ENTRIES; i < NR_GRANT_ENTRIES; i++) +#if defined(_X86_) + max_grant_frames = GntTbl_QueryMaxFrames(xpdd); + max_grant_entries = min(NR_GRANT_ENTRIES,(max_grant_frames * PAGE_SIZE / sizeof(grant_entry_t))); + KdPrint((__DRIVER_NAME " max_grant_entries : %d\n",max_grant_entries)); +#else + #if defined(_AMD64_) + KdPrint((__DRIVER_NAME " AMD64 cannot support HYPERVISOR_grant_table_op now\n")); + #endif +#endif + + xpdd->gnttab_list = ExAllocatePoolWithTag(NonPagedPool, sizeof(grant_ref_t) * max_grant_entries, XENPCI_POOL_TAG);// Where to free? + for (i = NR_RESERVED_ENTRIES; i < max_grant_entries; i++) GntTbl_PutRef(xpdd, i); xpdd->gnttab_table_physical = XenPci_AllocMMIO(xpdd, - PAGE_SIZE * NR_GRANT_FRAMES); + PAGE_SIZE * max_grant_frames); xpdd->gnttab_table = MmMapIoSpace(xpdd->gnttab_table_physical, - PAGE_SIZE * NR_GRANT_FRAMES, MmNonCached); + PAGE_SIZE * max_grant_frames, MmNonCached); if (!xpdd->gnttab_table) { KdPrint((__DRIVER_NAME " Error Mapping Grant Table Shared Memory\n")); return; } - GntTbl_Map(xpdd, 0, NR_GRANT_FRAMES - 1); + GntTbl_Map(xpdd, 0, max_grant_frames - 1); //KdPrint((__DRIVER_NAME " <-- GntTbl_Init table mapped at %p\n", gnttab_table)); } diff -r ab5d87da78e3 -r d5e48a07a213 xenpci/xenpci.h --- a/xenpci/xenpci.h Mon Jul 07 09:39:15 2008 +0800 +++ b/xenpci/xenpci.h Mon Jul 07 14:03:39 2008 +0800 @@ -57,7 +57,7 @@ #define XENPCI_POOL_TAG (ULONG) 'XenP' #define NR_RESERVED_ENTRIES 8 -#define NR_GRANT_FRAMES 4 +#define NR_GRANT_FRAMES 32 #define NR_GRANT_ENTRIES (NR_GRANT_FRAMES * PAGE_SIZE / sizeof(grant_entry_t)) #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) @@ -184,7 +184,7 @@ grant_entry_t *gnttab_table; PHYSICAL_ADDRESS gnttab_table_physical; - grant_ref_t gnttab_list[NR_GRANT_ENTRIES]; + grant_ref_t *gnttab_list; ev_action_t ev_actions[NR_EVENTS]; // unsigned long bound_ports[NR_EVENTS/(8*sizeof(unsigned long))]; diff -r ab5d87da78e3 -r d5e48a07a213 xenvbd/scsiport.c --- a/xenvbd/scsiport.c Mon Jul 07 09:39:15 2008 +0800 +++ b/xenvbd/scsiport.c Mon Jul 07 14:03:39 2008 +0800 @@ -170,6 +170,24 @@ { KdPrint((__DRIVER_NAME " device-type = %s (This probably won't work!)\n", value)); xvdd->device_type = XENVBD_DEVICETYPE_UNKNOWN; + } + } + else if (strcmp(setting, "mode") == 0) + { + if (strncmp(value, "r", 1) == 0) + { + KdPrint((__DRIVER_NAME " mode = r\n")); + xvdd->device_mode = XENVBD_DEVICEMODE_READ; + } + else if (strncmp(value, "w", 1) == 0) + { + KdPrint((__DRIVER_NAME " mode = w\n")); + xvdd->device_mode = XENVBD_DEVICEMODE_WRITE; + } + else + { + KdPrint((__DRIVER_NAME " mode = unknown\n")); + xvdd->device_mode = XENVBD_DEVICEMODE_UNKNOWN; } } break; @@ -525,6 +543,12 @@ parameter_header->DeviceSpecificParameter = 0; parameter_header->BlockDescriptorLength = 0; offset += sizeof(MODE_PARAMETER_HEADER); + + if (xvdd->device_mode == XENVBD_DEVICEMODE_READ) + { + KdPrint((__DRIVER_NAME " Mode sense to a read only disk.\n")); + parameter_header->DeviceSpecificParameter|=MODE_DSP_WRITE_PROTECT; + } if (!cdb->MODE_SENSE.Dbd) { diff -r ab5d87da78e3 -r d5e48a07a213 xenvbd/xenvbd.h --- a/xenvbd/xenvbd.h Mon Jul 07 09:39:15 2008 +0800 +++ b/xenvbd/xenvbd.h Mon Jul 07 14:03:39 2008 +0800 @@ -90,6 +90,12 @@ XENVBD_DEVICETYPE_CONTROLLER // Not yet used } XENVBD_DEVICETYPE; +typedef enum { + XENVBD_DEVICEMODE_UNKNOWN, + XENVBD_DEVICEMODE_READ, + XENVBD_DEVICEMODE_WRITE +} XENVBD_DEVICEMODE; + struct { blkif_shadow_t shadows[SHADOW_ENTRIES]; @@ -115,6 +121,7 @@ UCHAR last_additional_sense_code; blkif_response_t tmp_rep; XENVBD_DEVICETYPE device_type; + XENVBD_DEVICEMODE device_mode; DISK_GEOMETRY Geometry; ULONG bytes_per_sector; ULONGLONG total_sectors; diff -r ab5d87da78e3 -r d5e48a07a213 xenvbd/xenvbd.inx --- a/xenvbd/xenvbd.inx Mon Jul 07 09:39:15 2008 +0800 +++ b/xenvbd/xenvbd.inx Mon Jul 07 14:03:39 2008 +0800 @@ -62,6 +62,7 @@ HKR,"XenConfig\ring-ref", "type", %FLG_ADDREG_TYPE_DWORD%, %XEN_INIT_TYPE_RING% HKR,"XenConfig\event-channel", "type", %FLG_ADDREG_TYPE_DWORD%, %XEN_INIT_TYPE_EVENT_CHANNEL_IRQ% HKR,"XenConfig\device-type", "type", %FLG_ADDREG_TYPE_DWORD%, %XEN_INIT_TYPE_READ_STRING_FRONT% +HKR,"XenConfig\mode", "type", %FLG_ADDREG_TYPE_DWORD%, %XEN_INIT_TYPE_READ_STRING_BACK% HKR,"XenConfig\sectors", "type", %FLG_ADDREG_TYPE_DWORD%, %XEN_INIT_TYPE_READ_STRING_BACK% HKR,"XenConfig\sector-size", "type", %FLG_ADDREG_TYPE_DWORD%, %XEN_INIT_TYPE_READ_STRING_BACK% HKR,"XenConfig\vectors", "type", %FLG_ADDREG_TYPE_DWORD%, %XEN_INIT_TYPE_VECTORS% _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |