Re: [PATCH] Provide better abstraction for the serial drivers to xmit buf and tty



Currently the uart_info structure is allocated on an open, so it's not
available until that point in time. The trouble is that console_init() is
called before memory is set up, so you can't allocate the uart_info
until it's too late for the console or a debugger that wants to work
early, though it's ok for IPMI.

A debugger can provide a pre-existing uart_info and buffer. The
initialisation is only done if the uart_state->info pointer is NULL.

The uart_info struct is not very big, maybe it would be best to pull that
into uart_port? But the circ buffer might still be a problem, since it
would need to be dynamically allocated and it might need to be
checked instead.

How about this (untested idea in the finest Linux tradition)

Add

uart_console_prepare(struct uart_port *port, struct uart_info
*info, void *buffer)
{
port->info = info;
info->xmit.buf = buffer;
... etc ...
info->flags |= UPF_BOOTALLOCATED;
}


in uart_shutdown() check UPF_BOOTALLOCATED and don't free xmit.buf if so.

ditto in uart_remove_one_port for info itself


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



Relevant Pages

  • Cache coherency issues using AllocateCommonBuffer(..)
    ... I am seeing a cache coherency issue with memory allocated through ... The application I am running is in a dual host enviornment, ... from its shared memory buffer, is stale, i.e. cached data. ... drivet I allocate with the following call: ...
    (microsoft.public.development.device.drivers)
  • RE: x86, ptrace: support for branch trace store(BTS)
    ... as long as the buffer could be ... to request that an unlimited amount of memory be allocated in the ... task to block until the debugger had an opportunity to siphoon out the ... send a signal when the buffer gets full instead of having the kernel ...
    (Linux-Kernel)
  • Re: 1G DMA buffer under XP - how?
    ... system memory, and what is address 0 to the controller could be something ... so only the HAL's DMA routines can allocate ... common buffer correctly in all situations. ... My card is happy with any physical address> below 4G, and I can tell this call to only allocate below the given> HighestAcceptableAddress. ...
    (microsoft.public.development.device.drivers)
  • Re: 32-bit dma allocations on 64-bit platforms
    ... relies on swiotlb for em64t systems. ... needs (more on our memory usage shortly). ... the swiotlb code throwing a kernel panic when it can't allocate ... ~64k for X's push buffer and ~1M per opengl client for their push ...
    (Linux-Kernel)
  • Re: to free() or not to free() in lex/yacc
    ... I am working on a school project where we use lex/yacc to write a compiler ... memory allocation for strings. ... The advantage is that you only allocate ... You allocate names in this buffer. ...
    (comp.lang.c)