@@ -3057,144 +3057,6 @@ int ata_cable_sata(struct ata_port *ap)
30573057}
30583058EXPORT_SYMBOL_GPL (ata_cable_sata );
30593059
3060- /**
3061- * ata_bus_probe - Reset and probe ATA bus
3062- * @ap: Bus to probe
3063- *
3064- * Master ATA bus probing function. Initiates a hardware-dependent
3065- * bus reset, then attempts to identify any devices found on
3066- * the bus.
3067- *
3068- * LOCKING:
3069- * PCI/etc. bus probe sem.
3070- *
3071- * RETURNS:
3072- * Zero on success, negative errno otherwise.
3073- */
3074-
3075- int ata_bus_probe (struct ata_port * ap )
3076- {
3077- unsigned int classes [ATA_MAX_DEVICES ];
3078- int tries [ATA_MAX_DEVICES ];
3079- int rc ;
3080- struct ata_device * dev ;
3081-
3082- ata_for_each_dev (dev , & ap -> link , ALL )
3083- tries [dev -> devno ] = ATA_PROBE_MAX_TRIES ;
3084-
3085- retry :
3086- ata_for_each_dev (dev , & ap -> link , ALL ) {
3087- /* If we issue an SRST then an ATA drive (not ATAPI)
3088- * may change configuration and be in PIO0 timing. If
3089- * we do a hard reset (or are coming from power on)
3090- * this is true for ATA or ATAPI. Until we've set a
3091- * suitable controller mode we should not touch the
3092- * bus as we may be talking too fast.
3093- */
3094- dev -> pio_mode = XFER_PIO_0 ;
3095- dev -> dma_mode = 0xff ;
3096-
3097- /* If the controller has a pio mode setup function
3098- * then use it to set the chipset to rights. Don't
3099- * touch the DMA setup as that will be dealt with when
3100- * configuring devices.
3101- */
3102- if (ap -> ops -> set_piomode )
3103- ap -> ops -> set_piomode (ap , dev );
3104- }
3105-
3106- /* reset and determine device classes */
3107- ap -> ops -> phy_reset (ap );
3108-
3109- ata_for_each_dev (dev , & ap -> link , ALL ) {
3110- if (dev -> class != ATA_DEV_UNKNOWN )
3111- classes [dev -> devno ] = dev -> class ;
3112- else
3113- classes [dev -> devno ] = ATA_DEV_NONE ;
3114-
3115- dev -> class = ATA_DEV_UNKNOWN ;
3116- }
3117-
3118- /* read IDENTIFY page and configure devices. We have to do the identify
3119- specific sequence bass-ackwards so that PDIAG- is released by
3120- the slave device */
3121-
3122- ata_for_each_dev (dev , & ap -> link , ALL_REVERSE ) {
3123- if (tries [dev -> devno ])
3124- dev -> class = classes [dev -> devno ];
3125-
3126- if (!ata_dev_enabled (dev ))
3127- continue ;
3128-
3129- rc = ata_dev_read_id (dev , & dev -> class , ATA_READID_POSTRESET ,
3130- dev -> id );
3131- if (rc )
3132- goto fail ;
3133- }
3134-
3135- /* Now ask for the cable type as PDIAG- should have been released */
3136- if (ap -> ops -> cable_detect )
3137- ap -> cbl = ap -> ops -> cable_detect (ap );
3138-
3139- /* We may have SATA bridge glue hiding here irrespective of
3140- * the reported cable types and sensed types. When SATA
3141- * drives indicate we have a bridge, we don't know which end
3142- * of the link the bridge is which is a problem.
3143- */
3144- ata_for_each_dev (dev , & ap -> link , ENABLED )
3145- if (ata_id_is_sata (dev -> id ))
3146- ap -> cbl = ATA_CBL_SATA ;
3147-
3148- /* After the identify sequence we can now set up the devices. We do
3149- this in the normal order so that the user doesn't get confused */
3150-
3151- ata_for_each_dev (dev , & ap -> link , ENABLED ) {
3152- ap -> link .eh_context .i .flags |= ATA_EHI_PRINTINFO ;
3153- rc = ata_dev_configure (dev );
3154- ap -> link .eh_context .i .flags &= ~ATA_EHI_PRINTINFO ;
3155- if (rc )
3156- goto fail ;
3157- }
3158-
3159- /* configure transfer mode */
3160- rc = ata_set_mode (& ap -> link , & dev );
3161- if (rc )
3162- goto fail ;
3163-
3164- ata_for_each_dev (dev , & ap -> link , ENABLED )
3165- return 0 ;
3166-
3167- return - ENODEV ;
3168-
3169- fail :
3170- tries [dev -> devno ]-- ;
3171-
3172- switch (rc ) {
3173- case - EINVAL :
3174- /* eeek, something went very wrong, give up */
3175- tries [dev -> devno ] = 0 ;
3176- break ;
3177-
3178- case - ENODEV :
3179- /* give it just one more chance */
3180- tries [dev -> devno ] = min (tries [dev -> devno ], 1 );
3181- fallthrough ;
3182- case - EIO :
3183- if (tries [dev -> devno ] == 1 ) {
3184- /* This is the last chance, better to slow
3185- * down than lose it.
3186- */
3187- sata_down_spd_limit (& ap -> link , 0 );
3188- ata_down_xfermask_limit (dev , ATA_DNXFER_PIO );
3189- }
3190- }
3191-
3192- if (!tries [dev -> devno ])
3193- ata_dev_disable (dev );
3194-
3195- goto retry ;
3196- }
3197-
31983060/**
31993061 * sata_print_link_status - Print SATA link status
32003062 * @link: SATA link to printk link status about
0 commit comments