If the selector lever will not move from P using the proper shift procedure, continue to hold down the brake pedal.

Take the vehicle to an Authorized Mazda Dealer to have the system checked.
Shift-Lock System
Manual Shift ModeCamshaft Position (CMP) Sensor Removal/Installation [Mzr 2.0, Mzr 2.5]
CAUTION:
When replacing the CMP sensor, make sure there is no foreign material on
it such as metal shavings. If it is installed with foreign material, the sensor
output signal will malfunction resulting from fluctuation in magnetic flux and
cause a deterioration in engine control.
...
Body Control Module (Bcm) Configuration
1. Connect the M-MDS to DLC-2.
2. After the vehicle is identified, select the following items from the initial
screen of the M-MDS.
When using the IDS (laptop PC)
Select “Module Programming”.
Select “Programmable Module Installation”.
Select ...
Engine SST [Mzr 2.0, Mzr 2.5]
1: Mazda SST number
2: Global SST number
Example
1:49 UN01 052
2:310–D005
Spring lock coupler tool (green)
1: 49 C017 5A0
2: –
Engine support set
1:49 B011 105
2:–
Adapter
...