Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 04 Oct 2012 10:20:52 -0700
From:      Carl Delsey <carl.r.delsey@intel.com>
To:        freebsd-hackers@freebsd.org
Subject:   No bus_space_read_8 on x86 ?
Message-ID:  <506DC574.9010300@intel.com>

next in thread | raw e-mail | index | archive | help
I noticed that the bus_space_*_8 functions are unimplemented for x86. 
Looking at the code, it seems this is intentional.

Is this done because on 32-bit systems we don't know, in the general 
case, whether to read the upper or lower 32-bits first?

If that's the reason, I was thinking we could provide two 
implementations for i386: bus_space_read_8_upper_first and 
bus_space_read_8_lower_first. For amd64 we would just have bus_space_read_8

Anybody who wants to use bus_space_read_8 in their file would do 
something like:
#define BUS_SPACE_8_BYTES     LOWER_FIRST
or
#define BUS_SPACE_8_BYTES     UPPER_FIRST
whichever is appropriate for their hardware.

This would go in their source file before including bus.h and we would 
take care of mapping to the correct implementation.

With the prevalence of 64-bit registers these days, if we don't provide 
an implementation, I expect many drivers will end up rolling their own.

If this seems like a good idea, I'll happily whip up a patch and submit it.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?506DC574.9010300>