1. Disconnect the negative battery cable.
2. Remove the headliner.
3. Disconnect the connector.
4. Remove the screws, and then remove the sunroof motor.

Sunroof unit disassembly/assembly
Sunroof motor installationMazda 6 Service Manual: Manual Shift Mode
The manual shift mode gives you the feel of driving a manual transaxle vehicle
by allowing you to operate the selector lever manually. This allows you to control
engine rpm and torque to the drive wheels much like a manual transaxle when more
control is desired.
To change to manual shift mode ...
Mazda 6 Service Manual: Scheduled Maintenance (U.S.A., Canada, and Puerto Rico)
Follow Schedule 1 if the vehicle is operated mainly where none of the following
conditions (severe driving conditions) apply.
Repeated short-distance driving
Driving in dusty conditions
Driving with extended use of brakes
Driving in areas where salt or other corrosive materials are used
...