GPS setup and serial port

I have notice that different to prior versions, the system automagically detects the gps and connects it to serial 3. i prefer to have more control over it, where can i see the service that assignes a port and makes the connection.

You can find the parameters relating to GPS setup here: https://ardupilot.org/rover/docs/parameters.html#gps-parameters

Also you might be able to control which serial ports are enabled for which protocols using the serial parameters here
https://ardupilot.org/rover/docs/parameters.html#serial-parameters

If you’re on Pixhawk4, this link explains the UART mapping to external plugs: