where do 8250 serial port initialize its mapbase and membase when booting?

wilbur.chan wilbur512 at gmail.com
Mon Jun 21 03:27:30 EST 2010


linux 2.6.21.7

where do serial 8250 port fill its membase and mapbase  fileds  in
system initializing ?



I found that , when calling do_initcalls--->  serial8250_init ---->
platform_driver_register--->bus_for_each_dev,  system found

an device of serial 8250, which has already fill the membase and mapbase fileds.

That is to say,  before serial8250_init ---->
platform_driver_register, system has create a serial device with
membase and mapbase initialized.

 do_initcalls--->  serial8250_init ----> platform_driver_register--->
dev = bus_for_each_dev


             --->  struct plat_serial8250_port *p = dev->platform_data;

                    /*  at this point , p->membase and p->mapbase are
all assigned with proper value by system */




I searched the whole source code with keyword 'membase' , and found
the following code :


serial8250_request_std_resource:

case UPIO_MEM:
	if (!up->port.mapbase)
		break;

	if (!request_mem_region(up->port.mapbase, size, "serial")) {
		ret = -EBUSY;
		break;
	}
  /*I guess membase is generated according to mapbase ,*
    so I add some debug print  here.
    However, I found membase and mapbase are already initialized
before these codes. */


                if (up->port.flags & UPF_IOREMAP) {
	                 up->port.membase = ioremap(up->port.mapbase, size);
	                 if (!up->port.membase) {
		          release_mem_region(up->port.mapbase, size);
		          ret = -ENOMEM;
	                 }
                 }


So I am really confused with serial 8250
initializing----------------where do kernel apply membase and mapbase
filed to  8250 port?

Thx


More information about the Linuxppc-dev mailing list