open-src/lib/libpciaccess/scanpci_64bit.patch
changeset 1177 e04e8553e2ce
equal deleted inserted replaced
1176:22a62d074ec1 1177:e04e8553e2ce
       
     1 diff -urp -x '*~' -x '*.orig' src/solx_devfs.c src/solx_devfs.c
       
     2 --- src/solx_devfs.c	Fri Jul 15 15:29:25 2011
       
     3 +++ src/solx_devfs.c	Mon Jul 25 18:57:29 2011
       
     4 @@ -865,14 +865,10 @@
       
     5  	}
       
     6  
       
     7  
       
     8 -	/*
       
     9 -	 * We split the shift count 32 into two 16 to
       
    10 -	 * avoid the complaining of the compiler
       
    11 -	 */
       
    12 -	dev->regions[ent].base_addr = reg->pci_phys_low +
       
    13 -	    ((reg->pci_phys_mid << 16) << 16);
       
    14 -	dev->regions[ent].size = reg->pci_size_low +
       
    15 -	    ((reg->pci_size_hi << 16) << 16);
       
    16 +	dev->regions[ent].base_addr = reg->pci_phys_low |
       
    17 +	    ((uint64_t)reg->pci_phys_mid << 32);
       
    18 +	dev->regions[ent].size = reg->pci_size_low |
       
    19 +	    ((uint64_t)reg->pci_size_hi << 32);
       
    20  
       
    21  	switch (reg->pci_phys_hi & PCI_REG_ADDR_M) {
       
    22  	    case PCI_ADDR_IO:
       
    23 
       
    24 diff -urp -x '*~' -x '*.orig' scanpci/scanpci.c scanpci/scanpci.c
       
    25 --- scanpci/scanpci.c	Thu Oct  7 14:14:44 2010
       
    26 +++ scanpci/scanpci.c	Mon Jul 25 17:16:07 2011
       
    27 @@ -132,11 +132,14 @@
       
    28  	pci_device_probe( dev );
       
    29  	for ( i = 0 ; i < 6 ; i++ ) {
       
    30  	    if ( dev->regions[i].base_addr != 0 ) {
       
    31 -		printf( "  BASE%u     0x%08x SIZE %d  %s",
       
    32 +		static const char *fmt8 = "  BASE%u     0x%08llx SIZE %d  %s";
       
    33 +		static const char *fmt16 = "  BASE%u     0x%016llx SIZE %d  %s";
       
    34 +		printf( dev->regions[i].is_64 ? fmt16 : fmt8,
       
    35  			i,
       
    36  			(intptr_t) dev->regions[i].base_addr,
       
    37  			(size_t) dev->regions[i].size,
       
    38 -			(dev->regions[i].is_IO) ? "I/O" : "MEM" );
       
    39 +			(dev->regions[i].is_IO) ? "I/O" : 
       
    40 +			((dev->regions[i].is_64) ? "MEM64" : "MEM") );
       
    41  
       
    42  		if ( ! dev->regions[i].is_IO ) {
       
    43  		    if ( dev->regions[i].is_prefetchable ) {