Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1L0iZ0-0006Fy-Fo for mharc-grub-devel@gnu.org; Thu, 13 Nov 2008 15:13:14 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L0iYy-0006EJ-OY for grub-devel@gnu.org; Thu, 13 Nov 2008 15:13:12 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L0iYy-0006Db-09 for grub-devel@gnu.org; Thu, 13 Nov 2008 15:13:12 -0500 Received: from [199.232.76.173] (port=41661 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L0iYx-0006DP-R2 for grub-devel@gnu.org; Thu, 13 Nov 2008 15:13:11 -0500 Received: from willie.n0ano.com ([64.66.241.76]:52119 helo=xolotl.n0ano.com) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1L0iYx-0002XZ-0g for grub-devel@gnu.org; Thu, 13 Nov 2008 15:13:11 -0500 Received: from xolotl.n0ano.com (xolotl.n0ano.com [127.0.0.1]) by xolotl.n0ano.com (8.13.4/8.13.4) with ESMTP id mADKD6Dt022933 for ; Thu, 13 Nov 2008 13:13:06 -0700 Received: (from n0ano@localhost) by xolotl.n0ano.com (8.13.4/8.13.4/Submit) id mADKD6K8022931 for grub-devel@gnu.org; Thu, 13 Nov 2008 13:13:06 -0700 From: n0ano@n0ano.com X-Authentication-Warning: xolotl.n0ano.com: n0ano set sender to n0ano@n0ano.com using -f Date: Thu, 13 Nov 2008 13:13:06 -0700 To: The development of GRUB 2 Message-ID: <20081113201306.GL17223@xolotl.n0ano.com> References: <20081107160725.GD17223@xolotl.n0ano.com> <49147245.6080105@nic.fi> <20081108112536.GA11583@thorin> <491584C4.5020407@nic.fi> <20081108124544.GA25958@thorin> <20081109015819.GA4022@xolotl.n0ano.com> <20081109215730.GA26330@thorin> <20081112185803.GI17223@xolotl.n0ano.com> <491C6C71.1090903@nic.fi> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <491C6C71.1090903@nic.fi> User-Agent: Mutt/1.4.2.1i X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) Subject: Re: [PATCH] PCI serial card support X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Nov 2008 20:13:12 -0000 On Thu, Nov 13, 2008 at 08:05:37PM +0200, Vesa J??skel?inen wrote: > > Why not hide the legacy comports if they are not there and we can auto > detect that? I went back and forth on this. I finally decided that COM1 to COM4 are so firmly a part of the PC design I should leave them (note that if GRUB_MACHINE_PCBIOS is not defined then these 4 I/O ports will be defined whether or not they are there and I'll have to list them.). If there's a strong preference I can drop them if the BIOS doesn't define an I/O port for them. > > That actually brings us to other issue. Should be have some kind of HW > dependant device path support that would be universal in grub?. Now if > user unplugs in example USB serial converter then the order will change > and can cause some problems. Maybe. Seems like a little bit of over engineering right now. > > > --- include/grub/pci_serial_ids.h (revision 0) > > +++ include/grub/pci_serial_ids.h (revision 0) > > @@ -0,0 +1,642 @@ > > +/* > > + * GRUB -- GRand Unified Bootloader > > + * Copyright (C) 2000,2001,2002,2003,2004,2005,2007 Free Software Foundation, Inc. > > This seems to be new file. Please change copyright years to start from 2008. > > Where did you get that device table?. Generated by yourself from pci > database? > > Anyway. I think those vendor and device ID's should be in global file as > they are "universal" to any PCI device. It is now. My understanding is that a data table is not copyrightable (no expressive content) but, just to make sure there is no issue, I've replaced this with a table of just the devices I know about. I'll create (a very small) generic PCI ID table, we can add on as time goes by. > > > --- term/i386/pc/serial.c (revision 1911) > > +++ term/i386/pc/serial.c (working copy) > > > +#include > > > > +void grub_serial_add(int type, unsigned int id, unsigned int base, unsigned int port); > > +#include > > + > > Please keep includes at same place. > > Why is this prototype even here?. And should it be static? Since the mapping table code calls this function the prototype needs to be defined before the include of `pci_serial_ids.h'. I'll move the prototype to `serial.h' and clean these two up. > > > +char *serial_types[] = { > > + "legacy", > > + " pci", > > + " usb" > > +}; > > static const > > And please leave output formatting to actual printing. sure. > > > + grub_printf("%c%2d: %s ", (p == serial_dev) ? '*' : ' ', > > + i, serial_types[p->type]); > > What is p->type is not within range of serial_types? Then we have a more serious problem since `p->type' is only set by the code to a value between 0 - 2. Given that this could only be wrong because of a code bug it seems silly to value check it. > > > +char parity[] = { > > static const > > > +static int > > +serial_pci_scan (int bus, int dev, int func, grub_pci_id_t pciid) > > > + vid = pciid & 0xffff; > > + did = pciid >> 16; > > + addr = grub_pci_make_address (bus, dev, func, 2); > > + w = grub_pci_read (addr); > > + class = (w >> 16) | ((w >> 8) & 0xff); > > + addr = grub_pci_make_address (bus, dev, func, 11); > > + w = grub_pci_read (addr); > > + ss_vid = w & 0xffff; > > + ss_did = w >> 16; > > This smells. Perhaps helper function or macro. > > As a generic note. If this is generic information that is available on > every PCI device. Why not change PCI to iterate with structure. > > Well... I didn't look too deep there this time. :) I was trying not to re-write the PCI code too much, it is way to hard coded right now but my goal was to get the serial support in first. I can certainly look into regularizing the PCI code a little on the way. Thanks for the comments, I'll get an updated patch out soon. -- Don Dugger "Censeo Toto nos in Kansa esse decisse." - D. Gale n0ano@n0ano.com Ph: 303/443-3786