]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Use uintmax_t (typedef'd to rman_res_t type) for rman ranges.
authorjhibbits <jhibbits@FreeBSD.org>
Fri, 18 Mar 2016 01:28:41 +0000 (01:28 +0000)
committerjhibbits <jhibbits@FreeBSD.org>
Fri, 18 Mar 2016 01:28:41 +0000 (01:28 +0000)
commit720f47c9edd51268b4c29ce82e0436209cd8aa23
tree79d2db0783ae236486e47ff49d1e85214325a9e0
parentaf520aec51ed6695cde23fdbf339ecb995ac52ab
Use uintmax_t (typedef'd to rman_res_t type) for rman ranges.

On some architectures, u_long isn't large enough for resource definitions.
Particularly, powerpc and arm allow 36-bit (or larger) physical addresses, but
type `long' is only 32-bit.  This extends rman's resources to uintmax_t.  With
this change, any resource can feasibly be placed anywhere in physical memory
(within the constraints of the driver).

Why uintmax_t and not something machine dependent, or uint64_t?  Though it's
possible for uintmax_t to grow, it's highly unlikely it will become 128-bit on
32-bit architectures.  64-bit architectures should have plenty of RAM to absorb
the increase on resource sizes if and when this occurs, and the number of
resources on memory-constrained systems should be sufficiently small as to not
pose a drastic overhead.  That being said, uintmax_t was chosen for source
clarity.  If it's specified as uint64_t, all printf()-like calls would either
need casts to uintmax_t, or be littered with PRI*64 macros.  Casts to uintmax_t
aren't horrible, but it would also bake into the API for
resource_list_print_type() either a hidden assumption that entries get cast to
uintmax_t for printing, or these calls would need the PRI*64 macros.  Since
source code is meant to be read more often than written, I chose the clearest
path of simply using uintmax_t.

Tested on a PowerPC p5020-based board, which places all device resources in
0xfxxxxxxxx, and has 8GB RAM.
Regression tested on qemu-system-i386
Regression tested on qemu-system-mips (malta profile)

Tested PAE and devinfo on virtualbox (live CD)

Special thanks to bz for his testing on ARM.

Reviewed By: bz, jhb (previous)
Relnotes: Yes
Sponsored by: Alex Perez/Inertial Computing
Differential Revision: https://reviews.freebsd.org/D4544
76 files changed:
UPDATING
sys/arm/xscale/ixp425/avila_ata.c
sys/arm/xscale/ixp425/ixp425.c
sys/arm/xscale/pxa/pxa_obio.c
sys/compat/ndis/kern_ndis.c
sys/dev/acpica/acpi.c
sys/dev/acpica/acpi_hpet.c
sys/dev/acpica/acpi_timer.c
sys/dev/advansys/adv_isa.c
sys/dev/atkbdc/atkbdc_subr.c
sys/dev/bxe/bxe.c
sys/dev/cardbus/cardbus_cis.c
sys/dev/ctau/if_ct.c
sys/dev/ed/if_ed_3c503.c
sys/dev/ed/if_ed_cbus.c
sys/dev/fdt/simplebus.c
sys/dev/iir/iir_pci.c
sys/dev/mca/mca_bus.c
sys/dev/mxge/if_mxge.c
sys/dev/ofw/ofwbus.c
sys/dev/pccard/pccard.c
sys/dev/pccard/pccard_cis.c
sys/dev/pccbb/pccbb.c
sys/dev/pccbb/pccbb_pci.c
sys/dev/pci/pci.c
sys/dev/pci/pci_pci.c
sys/dev/pci/pci_subr.c
sys/dev/ppc/ppc.c
sys/dev/proto/proto_bus_isa.c
sys/dev/sound/isa/ad1816.c
sys/dev/sound/isa/ess.c
sys/dev/sound/isa/mss.c
sys/dev/sound/isa/sb16.c
sys/dev/sound/isa/sb8.c
sys/dev/sound/pci/als4000.c
sys/dev/sound/pci/atiixp.c
sys/dev/sound/pci/aureal.c
sys/dev/sound/pci/cmi.c
sys/dev/sound/pci/cs4281.c
sys/dev/sound/pci/csapcm.c
sys/dev/sound/pci/ds1.c
sys/dev/sound/pci/emu10k1.c
sys/dev/sound/pci/emu10kx.c
sys/dev/sound/pci/envy24.c
sys/dev/sound/pci/envy24ht.c
sys/dev/sound/pci/es137x.c
sys/dev/sound/pci/fm801.c
sys/dev/sound/pci/hdspe-pcm.c
sys/dev/sound/pci/ich.c
sys/dev/sound/pci/maestro.c
sys/dev/sound/pci/maestro3.c
sys/dev/sound/pci/neomagic.c
sys/dev/sound/pci/solo.c
sys/dev/sound/pci/t4dwave.c
sys/dev/sound/pci/via8233.c
sys/dev/sound/pci/via82c686.c
sys/dev/sound/pci/vibes.c
sys/dev/wl/if_wl.c
sys/dev/xe/if_xe.c
sys/dev/xe/if_xe_pccard.c
sys/kern/subr_rman.c
sys/mips/atheros/apb.c
sys/mips/mips/nexus.c
sys/mips/nlm/xlp_pci.c
sys/mips/nlm/xlp_simplebus.c
sys/mips/rmi/iodi.c
sys/mips/rmi/xlr_pci.c
sys/powerpc/mpc85xx/lbc.c
sys/powerpc/ofw/ofw_pci.c
sys/powerpc/powermac/uninorth.c
sys/powerpc/powerpc/nexus.c
sys/sparc64/pci/apb.c
sys/sys/_types.h
sys/sys/param.h
sys/x86/x86/io_apic.c
usr.sbin/devinfo/devinfo.c