serial.c: round baudrates to valid ones

MSDN says: "The baud rate at which the communications device
operates. This member can be an actual baud rate value, or one of
the following indexes." But it is not specified what happens for
different values, so we round down to valid ones (or to the minimum
of 9600) by reusing the existing struct baudentry sp_baudtable[] and
the new function round_baud().

Do similarly on non-Windows where arbitrary values are not allowed

Corresponding to flashrom svn r1660.

Signed-off-by: Stefan Tauner <>
Acked-by: Stefan Tauner <>
1 file changed