Skip to contentSkip to conversation

grub2 ChangeLog term/i386/pc/serial.c

DISCUSSION Vesa Jääskeläinen 3 participants 6 messages Nov 6, 2007 – Nov 9, 2007 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 11 lines · Robert Millan

CVSROOT: /sources/grub
Module name: grub2
Changes by: Robert Millan <robertmh> 07/11/06 21:23:59

Modified files:

	.              : ChangeLog 
	term/i386/pc   : serial.c 

Log message:
2007-11-06 Robert Millan <[email protected]>

Quoted 7 lines

* term/i386/pc/serial.c (serial_hw_put): Switch order of arguments in grub_outb() calls.
(serial_hw_init): Likewise.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/grub2/ChangeLog?cvsroot=grub&r1=1.437&r2=1.438
http://cvs.savannah.gnu.org/viewcvs/grub2/term/i386/pc/serial.c?cvsroot=grub&r1=1.4&r2=1.5

Why on earth those parameters are reversed anyway :) ?

On all systems that I can remember arguments for lots of things go like this:

func(destination, source)

examples are:
memcpy, strcpy

On most of the other systems outp is also outp(port, value) ("destination, source"). Eg. following the same convention.

#2 lore raw
Quoted 11 lines · Vesa Jääskeläinen
Quoted 9 lines

2007-11-06 Robert Millan <[email protected]>

* term/i386/pc/serial.c (serial_hw_put): Switch order of arguments in grub_outb() calls.
(serial_hw_init): Likewise.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/grub2/ChangeLog?cvsroot=grub&r1=1.437&r2=1.438
http://cvs.savannah.gnu.org/viewcvs/grub2/term/i386/pc/serial.c?cvsroot=grub&r1=1.4&r2=1.5

Why on earth those parameters are reversed anyway :) ?

My fault :-)

When I replaced inb() and outb() in that file, I assumed they would have the same semantics as grub_inb() and grub_outb().

Quoted 10 lines

On all systems that I can remember arguments for lots of things go like this:

func(destination, source)

examples are:
memcpy, strcpy

On most of the other systems outp is also outp(port, value) ("destination, source"). Eg. following the same convention.

grub_inb() and grub_outb() are based on the inb()/outb() implementation from glibc headers, so I kept the same arguments for consistency.

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)
#3 lore raw
Quoted 9 lines · Robert Millan
Quoted 3 lines · Vesa Jääskeläinen
Quoted 2 lines

* term/i386/pc/serial.c (serial_hw_put): Switch order of arguments in grub_outb() calls.

Why on earth those parameters are reversed anyway :) ?

My fault :-)

When I replaced inb() and outb() in that file, I assumed they would have the same semantics as grub_inb() and grub_outb().

Just to be clear, I would have understood your rational ordering better than current version ;)

Quoted 2 lines

grub_inb() and grub_outb() are based on the inb()/outb() implementation from glibc headers, so I kept the same arguments for consistency.

I see... Once again inconsistency introduced by Unix folks... as AT&T assembler wouldn't be enough, they then poisons C libs too... oh well... another thing to try to keep in mind...

#4 lore raw
Quoted 6 lines · Vesa Jääskeläinen
Quoted 2 lines

grub_inb() and grub_outb() are based on the inb()/outb() implementation from glibc headers, so I kept the same arguments for consistency.

I see... Once again inconsistency introduced by Unix folks... as AT&T assembler wouldn't be enough, they then poisons C libs too... oh well... another thing to try to keep in mind...

I always thought the Right Way to do this would be implement it in GCC, so that you can do things like:

  __some_magic__(PORT_ADDR) |= 0x80;

which is much more beatufil than either of:

  outb (PORT_ADDR, inb (PORT_ADDR) | 0x80);

  outb (inb (PORT_ADDR) | 0x80, PORT_ADDR);

don't you think?

(now if someone is bored and takes my suggestion to gcc-patches, that'd make my day...)

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)
#5 lore raw
Quoted 15 lines · Robert Millan
Quoted 6 lines · Vesa Jääskeläinen
Quoted 2 lines

grub_inb() and grub_outb() are based on the inb()/outb() implementation from glibc headers, so I kept the same arguments for consistency.

I see... Once again inconsistency introduced by Unix folks... as AT&T assembler wouldn't be enough, they then poisons C libs too... oh well... another thing to try to keep in mind...

I always thought the Right Way to do this would be implement it in GCC, so that you can do things like:

  __some_magic__(PORT_ADDR) |= 0x80;

which is much more beatufil than either of:

Quoted 8 lines
  outb (PORT_ADDR, inb (PORT_ADDR) | 0x80);

  outb (inb (PORT_ADDR) | 0x80, PORT_ADDR);

don't you think?

(now if someone is bored and takes my suggestion to gcc-patches, that'd make my day...)

That's possible in C++ using operator overloading AFAIK.

Did this commit fix serial support for LB?

--
Marco

#6 lore raw
Quoted 10 lines · Marco Gerards
Quoted 10 lines

I always thought the Right Way to do this would be implement it in GCC, so that you can do things like:

  __some_magic__(PORT_ADDR) |= 0x80;

which is much more beatufil than either of:

  outb (PORT_ADDR, inb (PORT_ADDR) | 0x80);
Quoted 8 lines
Quoted 6 lines
  outb (inb (PORT_ADDR) | 0x80, PORT_ADDR);

don't you think?

(now if someone is bored and takes my suggestion to gcc-patches, that'd make my day...)

That's possible in C++ using operator overloading AFAIK.

Ah, right. Maybe we could switch to building with g++ just to get this feature ;-)

Quoted 1 line

Did this commit fix serial support for LB?

No, it fixed a bug affecting all platforms (i.e. both of them ;-)).

For serial.mod to work on LB, we need the other patch (the machine.h one).

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)