From: Ian Campbell Subject: Re: [PATCH RFC 3/8] ns16550: make usable on ARM Date: Tue, 10 Sep 2013 16:11:51 +0100 Message-ID: <1378825911.10928.21.camel@kazak.uk.xensource.com> References: <1378822681.10928.8.camel@kazak.uk.xensource.com> <1378822705-19310-3-git-send-email-ian.campbell@citrix.com> <522F504202000078000F2061@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1VJPbh-0003eR-19 for xen-devel@lists.xenproject.org; Tue, 10 Sep 2013 15:11:57 +0000 In-Reply-To: <522F504202000078000F2061@nat28.tlf.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich Cc: keir@xen.org, stefano.stabellini@eu.citrix.com, julien.grall@linaro.org, tim@xen.org, Josh Zhao , xen-devel List-Id: xen-devel@lists.xenproject.org On Tue, 2013-09-10 at 16:00 +0100, Jan Beulich wrote: > >>> On 10.09.13 at 16:18, Ian Campbell wrote: > > @@ -40,15 +45,22 @@ string_param("com2", opt_com2); > > > > static struct ns16550 { > > int baud, clock_hz, data_bits, parity, stop_bits, fifo_size, irq; > > - unsigned long io_base; /* I/O port or memory-mapped I/O address. */ > > + u64 io_base; /* I/O port or memory-mapped I/O address. */ > > + u64 io_size; > > Does the size really need to be 64 bits? No, I just wrote 64 for both by mistake. [...] > > + default: /* assume single byte */ > > Is that really a good idea? I'd recommend returning all 1s here, and > dropping writes below. OK. > > + case 1: > > + return readb(addr); > > + case 4: > > + return readl(addr); > > This won't work without changing the return type of the function. > Or is this just mandating the access width, without the upper 24 > bits carrying meaningful data? The latter, the registers are still 8 bytes, it's just the accesses. Maybe I should mask. > > +#ifdef HAS_PCI > > static void pci_serial_early_init(struct ns16550 *uart) > > { > > if ( !uart->ps_bdf_enable || uart->io_base >= 0x10000 ) > > @@ -178,6 +215,9 @@ static void pci_serial_early_init(struct ns16550 *uart) > > pci_conf_write16(0, uart->ps_bdf[0], uart->ps_bdf[1], uart->ps_bdf[2], > > PCI_COMMAND, PCI_COMMAND_IO); > > } > > +#else > > +static void pci_serial_early_init(struct ns16550 *uart) {} > > +#endif > > I'd prefer if #ifdef-s of this kind went inside the function body, thus > avoiding the duplication of the function "header". This particularly > reduces the churn on eventual future changes to the function type > (in particular people not building all architectures not noticing the > need to change more than one place). Me too normally, no idea why I did it this way! > > > @@ -278,21 +320,27 @@ static void __init ns16550_init_postirq(struct serial_port *port) > > bits = uart->data_bits + uart->stop_bits + !!uart->parity; > > uart->timeout_ms = max_t( > > unsigned int, 1, (bits * uart->fifo_size * 1000) / uart->baud); > > - > > if ( uart->irq > 0 ) > > Anything wrong with the blank line above? A victim of some debugging code I inserted then removed I think. I'll but it back. > > > +static const char const *ns16550_dt_compat[] __initdata = > > That ought to be __initconst now that committed that patch. Indeed yes, thanks. Ian.