Re: [PATCH RFC] pcmcia: load include_io, include_mem from /etc/modprobe.d/pcmcia.conf

2009-11-22 Thread Komuro

Hi,


Hmmm... we can't get rid of userspace in all cases, can't we?


Yes.it is difficult to get rid of it.

but, for example, Fedora rescue-mode does not run the pcmcia-socket-startup.
so I think it is necessary to allocate minimum io/mem resources
inside the kernel.

Best Regards
Komuro


___
Linux PCMCIA reimplementation list
http://lists.infradead.org/mailman/listinfo/linux-pcmcia


Re: Re: [PATCH RFC] pcmcia: load include_io, include_mem from /etc/modprobe.d/pcmcia.conf

2009-11-09 Thread Komuro
Hi,

 load include_io, include_mem from /etc/modprobe.d/pcmcia.conf
 instead of running pcmcia-socket-startup.
 (integration of pcmcia-socket-startup to the kernel)

Hmmm... we can't get rid of userspace in all cases, can't we?

 if /etc/modprobe.d/pcmcia.conf does not exist,
 rsrc_nonstatic allocates minimum io/mem resource.

Could you split this up into two different parts? One for the module
parameter, one for the default allocation. The latter one would need the ACK
of the x86 maintainer(s), for I'm not sure that it is safe to allocate this
area unconditionally. (Well, of course we do additional checks, but
anyways...)

I will prepare updated patch by next weekend.

Actually, allocated io/mem by rsrc_nostatic is no relationship with
other device(ISA, PCI).

So I think it does not need the ACK of the x86 maintainer.

Best Regards
Komuro


___
Linux PCMCIA reimplementation list
http://lists.infradead.org/mailman/listinfo/linux-pcmcia


Re: [PATCH RFC] pcmcia: load include_io, include_mem from /etc/modprobe.d/pcmcia.conf

2009-11-08 Thread Dominik Brodowski
Hey,

On Sun, Nov 08, 2009 at 11:19:24AM +0900, Komuro wrote:
 load include_io, include_mem from /etc/modprobe.d/pcmcia.conf
 instead of running pcmcia-socket-startup.
 (integration of pcmcia-socket-startup to the kernel)

Hmmm... we can't get rid of userspace in all cases, can't we?

 if /etc/modprobe.d/pcmcia.conf does not exist,
 rsrc_nonstatic allocates minimum io/mem resource.

Could you split this up into two different parts? One for the module
parameter, one for the default allocation. The latter one would need the ACK
of the x86 maintainer(s), for I'm not sure that it is safe to allocate this
area unconditionally. (Well, of course we do additional checks, but
anyways...)

 options rsrc_nonstatic 
 include_io_list=0x100,0x3af,0x3e0,0x4ff,0x800,0x820,0xc00,0xcf7,0xa00,0xaff
 options rsrc_nonstatic 
 include_mem_list=0xc,0xf,0xa000,0xa0ff,0x6000,0x60ff

Is there no way to specifiy a list of ranges? Seems not :(

 --- linux-2.6.32-rc5-git3/drivers/pcmcia/rsrc_nonstatic.c.orig
 2009-11-01 20:51:39.0 +0900
 +++ linux-2.6.32-rc5-git3/drivers/pcmcia/rsrc_nonstatic.c 2009-11-08 
 11:00:14.0 +0900
 @@ -47,6 +47,13 @@ INT_MODULE_PARM(probe_io,  1); /* IO por
  INT_MODULE_PARM(mem_limit,   0x1);
  #endif
  
 +static int include_io_list[16];
 +static unsigned int include_io_count = 0;
 +module_param_array(include_io_list, int, include_io_count, 0444);
 +static int include_mem_list[16];
 +static unsigned int include_mem_count = 0;
 +module_param_array(include_mem_list, int, include_mem_count, 0444);
 +

Would it be better to do the static default initialization here?

#ifdef X86
static int include_io_list[16] = [0x0100, 0x03af 
#else
static int include_io_list[16];
#endif

  /* for io_db and mem_db */
  struct resource_map {
   u_long  base, num;
 @@ -779,8 +786,49 @@ static int nonstatic_autoadd_resources(s
   struct resource *res;
   int i, done = 0;
  
 - if (!s-cb_dev || !s-cb_dev-bus)
 - return -ENODEV;
 + if (include_io_count) {
We don't need this check here.

 + for (i = 0; i  include_io_count; i=i+2) {
 + if (!adjust_io(s, ADD_MANAGED_RESOURCE, 
 + include_io_list[i], include_io_list[i+1])) {
 + done |= IORESOURCE_IO;
 + }
Unneeded brackets.

 + }
 + }
 +#if defined(CONFIG_X86)
 +   else {
 + /* allocate minimum io resource */
 + if (!adjust_io(s, ADD_MANAGED_RESOURCE, 0x100, 0x03af)) {
Either 0x0100, or 0x3af. You don't need brackets here.
 + done |= IORESOURCE_IO;
 + }
 + } 
 +#endif
 +
 + if (include_mem_count) {
Check not needed.

 + for (i = 0; i  include_mem_count; i=i+2) {
 + if (!adjust_memory(s, ADD_MANAGED_RESOURCE, 
 + include_mem_list[i], include_mem_list[i+1])) {
Brackets.

 + done |= IORESOURCE_MEM;
 + }
 + }
 + }
 +
 +#if defined(CONFIG_X86)
 +   else  {
 + /* allocate minimum memory resource */
 + if (!adjust_memory(s, ADD_MANAGED_RESOURCE, 
 + 0xa000, 0xa0ff)) {
Brackets.
 + done |= IORESOURCE_MEM;
 + }
 + } 
 +#endif
 +
 + if (!s-cb_dev || !s-cb_dev-bus) {
 + if (done == (IORESOURCE_MEM | IORESOURCE_IO)) {
 + s-resource_setup_done = 1;
 + return 0;
 + } else 
 + return -ENODEV;
 + }
  
  #if defined(CONFIG_X86)
   /* If this is the root bus, the risk of hitting
 @@ -789,8 +837,13 @@ static int nonstatic_autoadd_resources(s
* resources is too big. Therefore, don't do auto-adding
* of resources at the moment.
*/
 - if (s-cb_dev-bus-number == 0)
 - return -EINVAL;
 + if (s-cb_dev-bus-number == 0) {
 + if (done == (IORESOURCE_MEM | IORESOURCE_IO)) {
 + s-resource_setup_done = 1;
 + return 0;
 + } else 
 + return -EINVAL;
 + }
  #endif
  
   for (i=0; i  PCI_BUS_NUM_RESOURCES; i++) {


Best,
Dominik

___
Linux PCMCIA reimplementation list
http://lists.infradead.org/mailman/listinfo/linux-pcmcia