FB cleanups
I'd like someone to test these out for me -- they compile but I'm monitorless here.
* Turn gsc_read/write[bwl] calls into read/write[bwl]
* Remove unused functions memcpy_tohp, memcopy_fromhp from fbcon-sti.c
* Delete gsc_memset_io()
* Teach <video/fbcon.h> to use memset_io instead.
* Make <video/fbcon.h> use read/write[bwl] instead of direct accesses unless the architecture specifies otherwise.
Index: drivers/video/fbcon-sti.c
===================================================================
RCS file: /home/cvs/parisc/linux/drivers/video/fbcon-sti.c,v retrieving revision 1.5
fbcon-sti.c +6 -33
@@ -70,40 +70,14 @@ memcpy_fromhp_tohp(void *dest, void *src count +=3 ; count &= ~3 ;/* XXX */ -while (count) { - count --; -gsc_writel (~gsc_readl (s), d); +while (count--) { +writel (~readl (s), d); d +=32 *4 ; s +=32 *4 ; } }static void -memcpy_tohp (void *dest,void *src,int count) -{ -unsigned long d = (unsigned long ) dest; -u32 *s = (u32 *)src; - - count +=3 ; - count &= ~3 ;/* XXX */ - - d =ram2log (dest); - -while (count) { - count--; -gsc_writel (*s++, d); - d +=32 *4 ; - } -} - -static void -memcopy_fromhp (void *dest,void *src,int count) -{ -/* FIXME */ -printk ("uhm ...\n" ); -} - -static void memset_tohp (void *dest,u32 word,int count) {unsigned long d =ram2log (dest);
@@ -111,9 +85,8 @@ memset_tohp(void *dest, u32 word, int co count +=3 ; count &= ~3 ; -while (count) { - count--; -gsc_writel (word, d); +while (count--) { +writel (word, d); d +=32 ; } }
@@ -123,7 +96,7 @@ readb_hp(void *src) {unsigned long s =ram2log (src); -return ~gsc_readb (s); +return ~readb (s); } static void
@@ -137,7 +110,7 @@ writeb_hp(u8 b, void *dst)return ; } -gsc_writeb (b, d); +writeb (b, d); } static void
Index: include/asm-parisc/gsc.h
===================================================================
RCS file: /home/cvs/parisc/linux/include/asm-parisc/gsc.h,v retrieving revision 1.9
gsc.h +0 -8
@@ -32,14 +32,6 @@ extern void _gsc_writeq(u64,void *);#define gsc_writel (v,a) _gsc_writel((v),(void *)(a))#define gsc_writeq (v,a) _gsc_writeq((v),(void *)(a)) -static __inline__void *gsc_memset_io (void *s,int c,size_t n) -{ -while (n--) { -gsc_writeb (c,s++); - } -return NULL ; -} -struct gsc_dev {struct gsc_bus *bus;/* bus this device is on */ struct gsc_dev *next;/* chain of all devices */
Index: include/video/fbcon.h
===================================================================
RCS file: /home/cvs/parisc/linux/include/video/fbcon.h,v retrieving revision 1.6
fbcon.h +7 -17
@@ -206,16 +206,6 @@ extern int set_all_vcs(int fbidx, struct#define fb_writel sbus_writel#define fb_memset sbus_memset_io -#elif defined(__hppa__) - -#define fb_readb gsc_readb -#define fb_readw gsc_readw -#define fb_readl gsc_readl -#define fb_writeb gsc_writeb -#define fb_writew gsc_writew -#define fb_writel gsc_writel -#define fb_memset gsc_memset_io -#elif defined(__i386__) || defined(__alpha__)#define fb_readb __raw_readb
@@ -228,13 +218,13 @@ extern int set_all_vcs(int fbidx, struct#else -#define fb_readb (addr) (*(volatile u8 *) (addr)) -#define fb_readw (addr) (*(volatile u16 *) (addr)) -#define fb_readl (addr) (*(volatile u32 *) (addr)) -#define fb_writeb (b,addr) (*(volatile u8 *) (addr) = (b)) -#define fb_writew (b,addr) (*(volatile u16 *) (addr) = (b)) -#define fb_writel (b,addr) (*(volatile u32 *) (addr) = (b)) -#define fb_memset memset +#define fb_readb (addr) readb(addr) +#define fb_readw (addr) readw(addr) +#define fb_readl (addr) readl(addr) +#define fb_writeb (b,addr) writeb(b,addr) +#define fb_writew (b,addr) writew(b,addr) +#define fb_writel (b,addr) writel(b,addr) +#define fb_memset (addr, c, len) memset_io((unsigned long)addr, c, len)#endif
Signature · 1 line
Revolutions do not require corporate support.
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Matthew" == Matthew Wilcox <[email protected]> writes:
Matthew> I'd like someone to test these out for me -- they compile but Matthew> I'm monitorless here.
Matthew> * Turn gsc_read/write[bwl] calls into read/write[bwl] *
Question, does this STI device appear on PCI/ISA cards?
Jes
Quoted 8 lines · Jes Sorensen
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Matthew" == Matthew Wilcox <[email protected]> writes:
Matthew> I'd like someone to test these out for me -- they compile but Matthew> I'm monitorless here.
Matthew> * Turn gsc_read/write[bwl] calls into read/write[bwl] *
Question, does this STI device appear on PCI/ISA cards?
STI isn't a device, it's an interface. STI applies to GSC, EISA & PCI cards. The particular chip (Artist) the driver deals with currently is only on the GSC bus. But we don't need to have gsc_read/write functions; they will all go away eventually, I suspect.
Signature · 1 line
Revolutions do not require corporate support.
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Matthew" == Matthew Wilcox <[email protected]> writes:
Matthew> STI isn't a device, it's an interface. STI applies to GSC, Matthew> EISA & PCI cards. The particular chip (Artist) the driver Matthew> deals with currently is only on the GSC bus. But we don't Matthew> need to have gsc_read/write functions; they will all go away Matthew> eventually, I suspect.
Point is that readb/writeb are *only* defined for PCI and PCI look-alike devices, even for ISA you're supposed to use isa_readb/isa_writeb
Jes
Quoted 3 lines · Jes Sorensen
Point is that readb/writeb are *only* defined for PCI and PCI look-alike devices, even for ISA you're supposed to use isa_readb/isa_writeb
No, you're wrong. isa_* are due to go away in 2.5. After you've called ioremap(), you can call readb/writeb on the returned address. You might want to refer to Documentation/IO-mapping.txt and/or Documentation/DocBook/deviceiobook.* (only in Alan's tree right now).
Signature · 1 line
Revolutions do not require corporate support.
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Matthew" == Matthew Wilcox <[email protected]> writes:
Quoted 3 lines · Jes Sorensen
Quoted 3 lines
Point is that readb/writeb are *only* defined for PCI and PCI look-alike devices, even for ISA you're supposed to use isa_readb/isa_writeb
Matthew> No, you're wrong. isa_* are due to go away in 2.5. After Matthew> you've called ioremap(), you can call readb/writeb on the Matthew> returned address. You might want to refer to Matthew> Documentation/IO-mapping.txt and/or
Matthew> Documentation/DocBook/deviceiobook.* (only in Alan's tree Matthew> right now).
Then Linus changed his mind. You are still *only* supposed to use readb/writeb on PCI (and possible ISA) on PCI like devices.
Jes
Quoted 2 lines
Then Linus changed his mind. You are still *only* supposed to use readb/writeb on PCI (and possible ISA) on PCI like devices.
ISA is a PCI like device, its a wacky slow motion PCI bridge with no configuration space ;).
Quoted 2 lines · Jes Sorensen
Then Linus changed his mind. You are still *only* supposed to use readb/writeb on PCI (and possible ISA) on PCI like devices.
I've heard this before. But no-one ever came up with an example of what _was_ `PCI-like'. Since right now our writeb is #defined to gsc_writeb, that leads me to believe GSC is sufficiently PCI-like.
Signature · 1 line
Revolutions do not require corporate support.
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Alan" == Alan Cox <[email protected]> writes:
Then Linus changed his mind. You are still *only* supposed to use readb/writeb on PCI (and possible ISA) on PCI like devices.
Alan> ISA is a PCI like device, its a wacky slow motion PCI bridge Alan> with no configuration space ;).
True, but is GSC sufficiently similar? (note, I don't have intimate knowledge about GSC).
Jes
Quoted 2 lines · Jes Sorensen
Then Linus changed his mind. You are still *only* supposed to use readb/writeb on PCI (and possible ISA) on PCI like devices.
Jes,
AFAIK, STI devices will all be memory mapped devices. readb/writeb will do the right thing since GSC is "PCI-like" in this regard.
BTW, I'm not aware of any HP EISA graphics devices - only GSC devices with an EISA form-factor. So the answer is GSC and PCI device.
grant
Grant Grundler
parisc-linux {PCI|IOMMU|SMP} hacker
+1.408.447.7253
Quoted 5 lines · Alan Cox
Quoted 2 lines
Then Linus changed his mind. You are still *only* supposed to use readb/writeb on PCI (and possible ISA) on PCI like devices.
ISA is a PCI like device, its a wacky slow motion PCI bridge with no configuration space ;).
And no memory mapped I/O. Just I/O port space afaik.
grant
Quoted 4 lines
Quoted 2 lines
ISA is a PCI like device, its a wacky slow motion PCI bridge with no configuration space ;).
And no memory mapped I/O. Just I/O port space afaik.
ISA bus has MMIO, including busmastering.
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Matthew" == Matthew Wilcox <[email protected]> writes:
Quoted 2 lines · Jes Sorensen
Quoted 2 lines
Then Linus changed his mind. You are still *only* supposed to use readb/writeb on PCI (and possible ISA) on PCI like devices.
Matthew> I've heard this before. But no-one ever came up with an Matthew> example of what _was_ `PCI-like'. Since right now our writeb Matthew> is #defined to gsc_writeb, that leads me to believe GSC is Matthew> sufficiently PCI-like.
Well time to go study the bus behaviors and compare them then. How does gsc behave wrt cache coherency, read-around-write, write ordering etc etc.
Using writeb on a gsc is misleading everybody else who reads the code into believing that it's a PCI device.
Jes
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Grant" == Grant Grundler <[email protected]> writes:
Quoted 2 lines · Grant> Jes Sorensen wrote:
Quoted 2 lines
Then Linus changed his mind. You are still *only* supposed to use readb/writeb on PCI (and possible ISA) on PCI like devices.
Grant> Jes, AFAIK, STI devices will all be memory mapped devices. Grant> readb/writeb will do the right thing since GSC is "PCI-like" in Grant> this regard.
I still don't like it as it is misleading.
Jes
Quoted 1 line · Alan Cox
ISA bus has MMIO, including busmastering.
really? ok. I thought the 8237A (DMA chip) on pc's provided the DMA capability. I didn't think it wasn't inherent to the ISA bus. But it's been so long (late 80's) since I've seriously mucked with ISA devices.
ta,
grant
Grant Grundler
parisc-linux {PCI|IOMMU|SMP} hacker
+1.408.447.7253
Quoted 3 lines
Well time to go study the bus behaviors and compare them then. How does gsc behave wrt cache coherency, read-around-write, write ordering etc etc.
And ISA is noticable for the fact it doesnt behave quite like PCI. You use readb/readw/readl on ISA.
Quoted 2 lines
Using writeb on a gsc is misleading everybody else who reads the code into believing that it's a PCI device.
Rubbish.
Alan
Quoted 2 lines
really? ok. I thought the 8237A (DMA chip) on pc's provided the DMA capability. I didn't think it wasn't inherent to the ISA bus.
It provides some DMA capabilities. Cards can also drive DMA themselves, and for anything > 2Mhz basically have to.
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Alan" == Alan Cox <[email protected]> writes:
Well time to go study the bus behaviors and compare them then. How does gsc behave wrt cache coherency, read-around-write, write ordering etc etc.
Alan> And ISA is noticable for the fact it doesnt behave quite like Alan> PCI. You use readb/readw/readl on ISA.
Yes, except that ISA has stronger semantics than PCI.
Quoted 2 lines
Quoted 2 lines
Using writeb on a gsc is misleading everybody else who reads the code into believing that it's a PCI device.
Alan> Rubbish.
Unfortunately not, look at the fb code to see the chaos.
Jes
Quoted 3 lines · Jes Sorensen
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Alan" == Alan Cox <[email protected]> writes:
Yes, except that ISA has stronger semantics than PCI.
You need to issue a read after a write to be sure the write hit the device on ISA?
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
Using writeb on a gsc is misleading everybody else who reads the code into believing that it's a PCI device.
Alan> Rubbish.
Unfortunately not, look at the fb code to see the chaos.
huh? the fb code is ugly precisely because people aren't using readb/writeb to access device memory.
Signature · 1 line
Revolutions do not require corporate support.
Quoted 4 lines
Quoted 1 line
Yes, except that ISA has stronger semantics than PCI.
You need to issue a read after a write to be sure the write hit the device on ISA?
In some cases yes.