From: "Jan Beulich" Subject: [PATCH 1/4] ns16550: store pointer to config parameters for PCI Date: Tue, 23 Feb 2016 04:28:18 -0700 Message-ID: <56CC506202000078000D52AD@prv-mh.provo.novell.com> References: <56CC4F0B02000078000D5290@prv-mh.provo.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__PartF2C56542.1__=" Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aYB8i-0002NN-Fh for xen-devel@lists.xenproject.org; Tue, 23 Feb 2016 11:28:24 +0000 In-Reply-To: <56CC4F0B02000078000D5290@prv-mh.provo.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: xen-devel Cc: Ian Campbell , Keir Fraser , Ian Jackson , Tim Deegan List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__PartF2C56542.1__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Subsequent changes will want to use this pointer. This makes the enable_ro structure member redundant, so it gets dropped at once. Signed-off-by: Jan Beulich --- a/xen/drivers/char/ns16550.c +++ b/xen/drivers/char/ns16550.c @@ -74,7 +74,7 @@ static struct ns16550 { u32 bar64; u16 cr; u8 bar_idx; - bool_t enable_ro; /* Make MMIO devices read only to Dom0 */ + const struct ns16550_config_param *param; /* Points into .init.*! */ #endif } ns16550_com[2] =3D { { 0 } }; =20 @@ -624,7 +624,7 @@ static void __init ns16550_init_postirq( #ifdef CONFIG_HAS_PCI if ( uart->bar || uart->ps_bdf_enable ) { - if ( !uart->enable_ro ) + if ( !uart->param ) pci_hide_device(uart->ps_bdf[0], PCI_DEVFN(uart->ps_bdf[1], uart->ps_bdf[2])); else @@ -900,7 +900,7 @@ pci_uart_config(struct ns16550 *uart, bo /* Check for params in uart_config lookup table */ for ( i =3D 0; i < ARRAY_SIZE(uart_config); i++) { - unsigned int p; + const struct ns16550_config_param *param; =20 if ( uart_config[i].vendor_id !=3D vendor ) continue; @@ -908,33 +908,34 @@ pci_uart_config(struct ns16550 *uart, bo if ( uart_config[i].dev_id !=3D device ) continue; =20 - p =3D uart_config[i].param; + param =3D uart_param + uart_config[i].param; + /* * Force length of mmio region to be at least * 8 bytes times (1 << reg_shift) */ - if ( size < (0x8 * (1 << uart_param[p].reg_shift))= ) + if ( size < (0x8 * (1 << param->reg_shift)) ) continue; =20 - if ( bar_idx >=3D uart_param[p].max_bars ) + if ( bar_idx >=3D param->max_bars ) continue; =20 - if ( uart_param[p].fifo_size ) - uart->fifo_size =3D uart_param[p].fifo_size; + uart->param =3D param; + + if ( param->fifo_size ) + uart->fifo_size =3D param->fifo_size; =20 - uart->reg_shift =3D uart_param[p].reg_shift; - uart->reg_width =3D uart_param[p].reg_width; - uart->lsr_mask =3D uart_param[p].lsr_mask; + uart->reg_shift =3D param->reg_shift; + uart->reg_width =3D param->reg_width; + uart->lsr_mask =3D param->lsr_mask; uart->io_base =3D ((u64)bar_64 << 32) | (bar & PCI_BASE_ADDRESS_MEM_MASK);= - uart->io_base +=3D uart_param[p].first_offset; - uart->io_base +=3D bar_idx * uart_param[p].uart_of= fset; - if ( uart_param[p].base_baud ) - uart->clock_hz =3D uart_param[p].base_baud * = 16; - size =3D max(8U << uart_param[p].reg_shift, - uart_param[p].uart_offset); - /* Set device and MMIO region read only to Dom0 = */ - uart->enable_ro =3D 1; + uart->io_base +=3D param->first_offset; + uart->io_base +=3D bar_idx * param->uart_offset; + if ( param->base_baud ) + uart->clock_hz =3D param->base_baud * 16; + size =3D max(8U << param->reg_shift, + param->uart_offset); break; } =20 @@ -1094,10 +1095,6 @@ static void ns16550_init_common(struct n { uart->clock_hz =3D UART_CLOCK_HZ; =20 -#ifdef CONFIG_HAS_PCI - uart->enable_ro =3D 0; -#endif - /* Default is no transmit FIFO. */ uart->fifo_size =3D 1; =20 --=__PartF2C56542.1__= Content-Type: text/plain; name="ns16550-replace-enable_ro.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="ns16550-replace-enable_ro.patch" ns16550: store pointer to config parameters for PCI=0A=0ASubsequent = changes will want to use this pointer.=0A=0AThis makes the enable_ro = structure member redundant, so it gets dropped=0Aat once.=0A=0ASigned-off-b= y: Jan Beulich =0A=0A--- a/xen/drivers/char/ns16550.c=0A= +++ b/xen/drivers/char/ns16550.c=0A@@ -74,7 +74,7 @@ static struct ns16550 = {=0A u32 bar64;=0A u16 cr;=0A u8 bar_idx;=0A- bool_t = enable_ro; /* Make MMIO devices read only to Dom0 */=0A+ const struct = ns16550_config_param *param; /* Points into .init.*! */=0A #endif=0A } = ns16550_com[2] =3D { { 0 } };=0A =0A@@ -624,7 +624,7 @@ static void __init = ns16550_init_postirq(=0A #ifdef CONFIG_HAS_PCI=0A if ( uart->bar || = uart->ps_bdf_enable )=0A {=0A- if ( !uart->enable_ro )=0A+ = if ( !uart->param )=0A pci_hide_device(uart->ps_bdf[0], = PCI_DEVFN(uart->ps_bdf[1],=0A uart->ps_bdf[2]))= ;=0A else=0A@@ -900,7 +900,7 @@ pci_uart_config(struct ns16550 = *uart, bo=0A /* Check for params in uart_config lookup = table */=0A for ( i =3D 0; i < ARRAY_SIZE(uart_config);= i++)=0A {=0A- unsigned int = p;=0A+ const struct ns16550_config_param *param;=0A = =0A if ( uart_config[i].vendor_id !=3D vendor )=0A = continue;=0A@@ -908,33 +908,34 @@ pci_uart_conf= ig(struct ns16550 *uart, bo=0A if ( uart_config[i].= dev_id !=3D device )=0A continue;=0A =0A- = p =3D uart_config[i].param;=0A+ = param =3D uart_param + uart_config[i].param;=0A+=0A = /*=0A * Force length of mmio region to be at = least=0A * 8 bytes times (1 << reg_shift)=0A = */=0A- if ( size < (0x8 * (1 << = uart_param[p].reg_shift)) )=0A+ if ( size < (0x8 * = (1 << param->reg_shift)) )=0A continue;=0A = =0A- if ( bar_idx >=3D uart_param[p].max_bars )=0A+ = if ( bar_idx >=3D param->max_bars )=0A = continue;=0A =0A- if ( uart_param[p].= fifo_size )=0A- uart->fifo_size =3D uart_param[p= ].fifo_size;=0A+ uart->param =3D param;=0A+=0A+ = if ( param->fifo_size )=0A+ = uart->fifo_size =3D param->fifo_size;=0A =0A- = uart->reg_shift =3D uart_param[p].reg_shift;=0A- = uart->reg_width =3D uart_param[p].reg_width;=0A- = uart->lsr_mask =3D uart_param[p].lsr_mask;=0A+ = uart->reg_shift =3D param->reg_shift;=0A+ uart->reg_= width =3D param->reg_width;=0A+ uart->lsr_mask =3D = param->lsr_mask;=0A uart->io_base =3D ((u64)bar_64 = << 32) |=0A (bar & PCI_BASE_ADDRESS= _MEM_MASK);=0A- uart->io_base +=3D uart_param[p].fir= st_offset;=0A- uart->io_base +=3D bar_idx * = uart_param[p].uart_offset;=0A- if ( uart_param[p].ba= se_baud )=0A- uart->clock_hz =3D uart_param[p].b= ase_baud * 16;=0A- size =3D max(8U << uart_param[p].= reg_shift,=0A- uart_param[p].uart_offset)= ;=0A- /* Set device and MMIO region read only to = Dom0 */=0A- uart->enable_ro =3D 1;=0A+ = uart->io_base +=3D param->first_offset;=0A+ = uart->io_base +=3D bar_idx * param->uart_offset;=0A+ = if ( param->base_baud )=0A+ uart->clock_hz = =3D param->base_baud * 16;=0A+ size =3D max(8U << = param->reg_shift,=0A+ param->uart_offset)= ;=0A break;=0A }=0A =0A@@ = -1094,10 +1095,6 @@ static void ns16550_init_common(struct n=0A {=0A = uart->clock_hz =3D UART_CLOCK_HZ;=0A =0A-#ifdef CONFIG_HAS_PCI=0A- = uart->enable_ro =3D 0;=0A-#endif=0A-=0A /* Default is no transmit = FIFO. */=0A uart->fifo_size =3D 1;=0A =0A --=__PartF2C56542.1__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --=__PartF2C56542.1__=--